← Back to linear algebra 1

Introduction to Matrices

An m×nm \times n matrix is a rectangular array of numbers with mm rows and nn columns:

A=[a11a12a1na21a22a2nam1am2amn]A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}

Notation:

Matrix-Vector Multiplication

Definition (Matrix-Vector Multiplication):
If AA is an m×nm \times n matrix with columns a1,a2,,an\vec{a}_1, \vec{a}_2, \ldots, \vec{a}_n and x=(x1,x2,,xn)\vec{x} = (x_1, x_2,\ldots, x_n) is a vector in Rn\mathbb{R}^n, then:

Ax=[a1a2an][x1x2xn]=x1a1+x2a2++xnanA\vec{x} = \begin{bmatrix} \vec{a}_1 & \vec{a}_2 & \cdots & \vec{a}_n \end{bmatrix}\begin{bmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{bmatrix} = x_1\vec{a}_1 + x_2\vec{a}_2 + \cdots + x_n\vec{a}_n

The product AxA\vec{x} is a linear combination of the columns of AA with weights from x\vec{x}, and the resulting vector lies in Rm\mathbb{R}^m.

Let A=[123456]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{bmatrix} and x=[23]\vec{x} = \begin{bmatrix} 2 \\ 3 \end{bmatrix}.

Compute AxA\vec{x}:

Ax=2[135]+3[246]=[2610]+[61218]=[81828]A\vec{x} = 2\begin{bmatrix} 1 \\ 3 \\ 5 \end{bmatrix} + 3\begin{bmatrix} 2 \\ 4 \\ 6 \end{bmatrix} = \begin{bmatrix} 2 \\ 6 \\ 10 \end{bmatrix} + \begin{bmatrix} 6 \\ 12 \\ 18 \end{bmatrix} = \begin{bmatrix} 8 \\ 18 \\ 28 \end{bmatrix}

There's an equivalent way to compute AxA\vec{x} by taking dot products of rows with x\vec{x}:

Ax=[123456][23]=[1(2)+2(3)3(2)+4(3)5(2)+6(3)]=[81828]A\vec{x} = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{bmatrix}\begin{bmatrix} 2 \\ 3 \end{bmatrix} = \begin{bmatrix} 1(2) + 2(3) \\ 3(2) + 4(3) \\ 5(2) + 6(3) \end{bmatrix} = \begin{bmatrix} 8 \\ 18 \\ 28 \end{bmatrix}

Both methods give the same result. The column perspective (linear combination) is more conceptually important for linear algebra, while the row perspective is sometimes more convenient for computation.

Let I=[100010001]I = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} and x=[abc]\vec{x} = \begin{bmatrix} a \\ b \\ c \end{bmatrix}.

Ix=a[100]+b[010]+c[001]=[abc]=xI\vec{x} = a\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} + b\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} + c\begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} = \begin{bmatrix} a \\ b \\ c \end{bmatrix} = \vec{x}

The identity matrix leaves any vector unchanged: Ix=xI\vec{x} = \vec{x}.


Properties of Matrix-Vector Multiplication

Theorem (Linearity of Matrix-Vector Multiplication):
Matrix-vector multiplication satisfies the following two fundamental linearity properties:

  1. A(u+v)=Au+AvA(\vec{u} + \vec{v}) = A\vec{u} + A\vec{v}
  2. A(cu)=c(Au)A(c\vec{u}) = c(A\vec{u})

Let A=[a1a2an]A = \begin{bmatrix} \vec{a}_1 & \vec{a}_2 & \cdots & \vec{a}_n \end{bmatrix}, u=[u1un]\vec{u} = \begin{bmatrix} u_1 \\ \vdots \\ u_n \end{bmatrix}, and v=[v1vn]\vec{v} = \begin{bmatrix} v_1 \\ \vdots \\ v_n \end{bmatrix}.

Then u+v=[u1+v1un+vn]\vec{u} + \vec{v} = \begin{bmatrix} u_1 + v_1 \\ \vdots \\ u_n + v_n \end{bmatrix} and cu=[cu1cun]c\vec{u} = \begin{bmatrix} cu_1 \\ \vdots \\ cu_n \end{bmatrix}, so:

A(u+v)=(u1+v1)a1++(un+vn)an=(u1a1++unan)+(v1a1++vnan)=Au+AvA(cu)=(cu1)a1++(cun)an=c(u1a1)++c(unan)=c(u1a1++unan)=c(Au)\begin{align*} A(\vec{u} + \vec{v}) &= (u_1 + v_1)\vec{a}_1 + \cdots + (u_n + v_n)\vec{a}_n \\ &= (u_1\vec{a}_1 + \cdots + u_n\vec{a}_n) + (v_1\vec{a}_1 + \cdots + v_n\vec{a}_n) \\ &= A\vec{u} + A\vec{v} \\ A(c\vec{u}) &= (cu_1)\vec{a}_1 + \cdots + (cu_n)\vec{a}_n \\ &= c(u_1\vec{a}_1) + \cdots + c(u_n\vec{a}_n) \\ &= c(u_1\vec{a}_1 + \cdots + u_n\vec{a}_n) \\ &= c(A\vec{u}) \end{align*}

The two properties combine into a single statement:

Corollary:
For any matrix AA, vectors u,v\vec{u}, \vec{v}, and scalars c,dc, d:

A(cu+dv)=cAu+dAvA(c\vec{u} + d\vec{v}) = cA\vec{u} + dA\vec{v}

More generally, for any linear combination, we have:

A(c1v1+c2v2++ckvk)=c1Av1+c2Av2++ckAvkA(c_1\vec{v}_1 + c_2\vec{v}_2 + \cdots + c_k\vec{v}_k) = c_1A\vec{v}_1 + c_2A\vec{v}_2 + \cdots + c_kA\vec{v}_k