Unit 1, lesson 4

Matrices, Linear Maps, and Determinants

How a matrix acts as a linear map, how products compose maps and solve systems, and how the determinant measures area or volume scaling and orientation.

  • Theory part 7
  • Practice part 8
  • Linear Maps, Lines, and Planes

Stretch a photo, shear it, or turn it a quarter turn. Straight lines stay straight, the origin stays put, and evenly spaced grid lines stay evenly spaced. Every motion like that is captured by a small grid of numbers, a matrix, and one number computed from it tells you how much areas grow and whether the picture got flipped. These ideas return later in the course, where a derivative becomes a matrix and the determinant becomes the Jacobian.

Key terms

Matrix notation

Definition An m×nm \times n matrix AA is a rectangular array of real numbers with mm rows and nn columns. The entry in row ii and column jj is written aija_{ij}. A vector in Rn\mathbb{R}^n is written as a column, an n×1n \times 1 matrix. If the columns of AA are the vectors a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n in Rm\mathbb{R}^m, we write

A=[a1a2⋯an].A = \begin{bmatrix} \mathbf{a}_1 & \mathbf{a}_2 & \cdots & \mathbf{a}_n \end{bmatrix}.

Two matrices are equal when they have the same size and equal entries in every position. The n×nn \times n identity matrix InI_n has 11 on the diagonal and 00 elsewhere. The transpose ATA^{T} of an m×nm \times n matrix is the n×mn \times m matrix with entries (AT)ij=aji(A^{T})_{ij} = a_{ji}, so the rows of AA become the columns of ATA^{T}.

In plain words A matrix is a table of numbers. Rows come first, columns second, both in the size and in the index.

Example The matrix

A=[2103]A = \begin{bmatrix} 2 & 1 \\ 0 & 3 \end{bmatrix}

is 2×22 \times 2, with a12=1a_{12} = 1 and a21=0a_{21} = 0. Its columns are ⟨2,0⟩\langle 2, 0 \rangle and ⟨1,3⟩\langle 1, 3 \rangle.

Matrix-vector multiplication and linear maps

Definition Let AA be an m×nm \times n matrix with columns a1,…,an\mathbf{a}_1, \dots, \mathbf{a}_n and let x=⟨x1,…,xn⟩\mathbf{x} = \langle x_1, \dots, x_n \rangle. The product AxA\mathbf{x} is the vector in Rm\mathbb{R}^m

Ax=x1a1+x2a2+⋯+xnan.A\mathbf{x} = x_1 \mathbf{a}_1 + x_2 \mathbf{a}_2 + \cdots + x_n \mathbf{a}_n.

Equivalently, its iith entry is ai1x1+⋯+ainxna_{i1} x_1 + \cdots + a_{in} x_n, the dot product of row ii with x\mathbf{x}. The product is defined only when x\mathbf{x} has as many entries as AA has columns. A map TT from Rn\mathbb{R}^n to Rm\mathbb{R}^m is linear if T(u+v)=T(u)+T(v)T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v}) and T(cu)=cT(u)T(c\mathbf{u}) = cT(\mathbf{u}) for all vectors u,v\mathbf{u}, \mathbf{v} and scalars cc. Every map x↦Ax\mathbf{x} \mapsto A\mathbf{x} is linear, and every linear map TT equals x↦Ax\mathbf{x} \mapsto A\mathbf{x} for exactly one matrix, its standard matrix, whose jjth column is T(ej)T(\mathbf{e}_j).

In plain words The columns of a matrix say where the basis vectors land. Every other vector lands at the same combination of those columns, so the whole grid moves along with them.

Example With AA from above and x=⟨1,2⟩\mathbf{x} = \langle 1, 2 \rangle,

Ax=1[20]+2[13]=[46].A\mathbf{x} = 1\begin{bmatrix} 2 \\ 0 \end{bmatrix} + 2\begin{bmatrix} 1 \\ 3 \end{bmatrix} = \begin{bmatrix} 4 \\ 6 \end{bmatrix}.

The row rule agrees, since 2⋅1+1⋅2=42 \cdot 1 + 1 \cdot 2 = 4 and 0⋅1+3⋅2=60 \cdot 1 + 3 \cdot 2 = 6. As a second example, the counterclockwise quarter turn sends e1\mathbf{e}_1 to e2\mathbf{e}_2 and e2\mathbf{e}_2 to −e1-\mathbf{e}_1, so its standard matrix has columns ⟨0,1⟩\langle 0, 1 \rangle and ⟨−1,0⟩\langle -1, 0 \rangle.

Composition and the matrix product

Definition Let AA be m×nm \times n and BB be n×pn \times p, with columns b1,…,bp\mathbf{b}_1, \dots, \mathbf{b}_p. The product ABAB is the m×pm \times p matrix with columns Ab1,…,AbpA\mathbf{b}_1, \dots, A\mathbf{b}_p, so its entries are

(AB)ij=∑k=1naikbkj.(AB)_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj}.

It is defined only when the number of columns of AA equals the number of rows of BB. With this definition (AB)x=A(Bx)(AB)\mathbf{x} = A(B\mathbf{x}) for every x\mathbf{x} in Rp\mathbb{R}^p, so ABAB is the matrix of the composition that applies BB first and then AA. The product is associative, (AB)C=A(BC)(AB)C = A(BC), but in general AB≠BAAB \ne BA.

In plain words Multiplying matrices is doing one map after another, and the order is read from right to left.

Example Let RR be the quarter turn and SS stretch the xx direction by 22,

R=[0−110],S=[2001].R = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}, \qquad S = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}.

Then

SR=[0−210],RS=[0−120].\begin{gathered} SR = \begin{bmatrix} 0 & -2 \\ 1 & 0 \end{bmatrix}, \\[0.4em] RS = \begin{bmatrix} 0 & -1 \\ 2 & 0 \end{bmatrix}. \end{gathered}

Follow e1\mathbf{e}_1 to see why they differ. Turning first sends it to e2\mathbf{e}_2, which the stretch leaves alone, giving ⟨0,1⟩\langle 0, 1 \rangle. Stretching first gives 2e12\mathbf{e}_1, which the turn sends to ⟨0,2⟩\langle 0, 2 \rangle. These are the first columns of SRSR and RSRS.

Linear systems

Definition A system of mm linear equations in nn unknowns,

ai1x1+⋯+ainxn=bi,i=1,…,m,\begin{gathered} a_{i1} x_1 + \cdots + a_{in} x_n = b_i, \\ i = 1, \dots, m, \end{gathered}

is the single matrix equation Ax=bA\mathbf{x} = \mathbf{b}, where A=[aij]A = [a_{ij}] is the coefficient matrix. The system has a solution exactly when b\mathbf{b} is a linear combination of the columns of AA. Its solution set is empty, a single point, or infinite. If xp\mathbf{x}_p is one solution, the solutions are exactly the vectors xp+h\mathbf{x}_p + \mathbf{h} with Ah=0A\mathbf{h} = \mathbf{0}.

In plain words Solving a system asks which input the map sends to a given output. There may be no such input, exactly one, or a whole line or plane of them.

Example The system 2x+y=52x + y = 5, x−y=1x - y = 1 reads

[211−1][xy]=[51].\begin{bmatrix} 2 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 5 \\ 1 \end{bmatrix}.

Adding the equations gives 3x=63x = 6, so x=2x = 2 and then y=1y = 1. Check by multiplying, since 2⋅2+1=52 \cdot 2 + 1 = 5 and 2−1=12 - 1 = 1.

Invertible matrices

Definition A square n×nn \times n matrix AA is invertible if there is an n×nn \times n matrix BB with AB=BA=InAB = BA = I_n. Such a BB is unique and is written A−1A^{-1}. For a square matrix the following are equivalent. The matrix AA is invertible. The equation Ax=bA\mathbf{x} = \mathbf{b} has exactly one solution for every b\mathbf{b}, namely x=A−1b\mathbf{x} = A^{-1}\mathbf{b}. Only x=0\mathbf{x} = \mathbf{0} solves Ax=0A\mathbf{x} = \mathbf{0}. The columns are linearly independent. The determinant is not zero. For a 2×22 \times 2 matrix with ad−bc≠0ad - bc \ne 0,

[abcd]−1=1ad−bc[d−b−ca].\begin{bmatrix} a & b \\ c & d \end{bmatrix}^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}.

If AA and BB are invertible of the same size, then (AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}.

In plain words An invertible map can be undone. Nothing gets squashed, so every output comes from exactly one input.

Example For the coefficient matrix AA of the system above, ad−bc=−2−1=−3ad - bc = -2 - 1 = -3, so

A−1=13[111−2],A−1[51]=[21],\begin{gathered} A^{-1} = \frac{1}{3}\begin{bmatrix} 1 & 1 \\ 1 & -2 \end{bmatrix}, \\[0.4em] A^{-1}\begin{bmatrix} 5 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 1 \end{bmatrix}, \end{gathered}

the same solution as before. By contrast, the matrix with rows ⟨1,2⟩\langle 1, 2 \rangle and ⟨2,4⟩\langle 2, 4 \rangle has ad−bc=0ad - bc = 0. Its columns are parallel, it squashes the plane onto a line, and it has no inverse.

Determinant

Definition The determinant of a 2×22 \times 2 matrix is ad−bcad - bc, as above. For a 3×33 \times 3 matrix A=[aij]A = [a_{ij}], expansion along the first row gives

det⁡A=a11(a22a33−a23a32)−a12(a21a33−a23a31)+a13(a21a32−a22a31).\begin{aligned} \det A &= a_{11}(a_{22}a_{33} - a_{23}a_{32}) \\[0.4em] &\quad - a_{12}(a_{21}a_{33} - a_{23}a_{31}) \\[0.4em] &\quad + a_{13}(a_{21}a_{32} - a_{22}a_{31}). \end{aligned}

For a larger square matrix the determinant is defined the same way, by expanding along the first row into smaller determinants with alternating signs. For square matrices AA and BB of the same size, det⁡(AB)=det⁡Adet⁡B\det(AB) = \det A \det B and det⁡AT=det⁡A\det A^{T} = \det A. Swapping two rows changes the sign, multiplying one row by a number kk multiplies the determinant by kk, adding a multiple of one row to another changes nothing, and AA is invertible exactly when det⁡A≠0\det A \ne 0. Because det⁡AT=det⁡A\det A^{T} = \det A, the same rules hold for columns. For vectors u,v,w\mathbf{u}, \mathbf{v}, \mathbf{w} in R3\mathbb{R}^3, the matrix with rows u,v,w\mathbf{u}, \mathbf{v}, \mathbf{w} has determinant u⋅(v×w)\mathbf{u} \cdot (\mathbf{v} \times \mathbf{w}), the scalar triple product.

In plain words The determinant is one number that tells you whether the matrix squashes space flat, and the next two sections say what its size and sign mean.

Example Expanding along the first row,

∣120013201∣=1(1)−2(−6)+0=13.\begin{aligned} \begin{vmatrix} 1 & 2 & 0 \\ 0 & 1 & 3 \\ 2 & 0 & 1 \end{vmatrix} &= 1(1) - 2(-6) + 0 \\[0.4em] &= 13. \end{aligned}

Area and volume scaling

Definition Let AA be a 2×22 \times 2 matrix. For every bounded region RR in the plane that has an area, for example one bounded by finitely many smooth curves, the image A(R)A(R) has area

area⁡(A(R))=∣det⁡A∣area⁡(R).\operatorname{area}(A(R)) = \lvert \det A \rvert \operatorname{area}(R).

For a 3×33 \times 3 matrix the same holds with volume in place of area. In particular the unit square goes to the parallelogram spanned by the columns, with area ∣det⁡A∣\lvert \det A \rvert, and the unit cube goes to the parallelepiped spanned by the columns, with volume ∣det⁡A∣\lvert \det A \rvert. When det⁡A=0\det A = 0 the image is flattened and has area or volume 00.

In plain words A linear map stretches every area by the same factor, and the absolute value of the determinant is that factor.

Example The matrix with rows ⟨2,1⟩\langle 2, 1 \rangle and ⟨0,3⟩\langle 0, 3 \rangle has determinant 66. It sends the unit square to the parallelogram with corners (0,0)(0, 0), (2,0)(2, 0), (1,3)(1, 3) and (3,3)(3, 3), whose area is base 22 times height 33, which is 66. It sends the unit disk, of area π\pi, to an ellipse of area 6π6\pi.

Orientation

Definition An ordered basis (v1,v2)(\mathbf{v}_1, \mathbf{v}_2) of R2\mathbb{R}^2 is positively oriented if the matrix with columns v1,v2\mathbf{v}_1, \mathbf{v}_2 has positive determinant, and negatively oriented if the determinant is negative. An ordered basis (v1,v2,v3)(\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3) of R3\mathbb{R}^3 is positively oriented, or right-handed, when

det⁡[v1v2v3]=v1⋅(v2×v3)>0.\begin{aligned} &\det \begin{bmatrix} \mathbf{v}_1 & \mathbf{v}_2 & \mathbf{v}_3 \end{bmatrix} \\[0.4em] &\quad = \mathbf{v}_1 \cdot (\mathbf{v}_2 \times \mathbf{v}_3) > 0. \end{aligned}

The standard bases are positively oriented, since det⁡I=1\det I = 1. An invertible linear map preserves orientation when det⁡A>0\det A > 0 and reverses it when det⁡A<0\det A < 0.

In plain words The sign of the determinant says whether the map keeps your right hand a right hand or turns it into a mirror image.

Example The reflection matrix with rows ⟨1,0⟩\langle 1, 0 \rangle and ⟨0,−1⟩\langle 0, -1 \rangle has determinant −1-1. Before the map, turning from e1\mathbf{e}_1 to e2\mathbf{e}_2 is counterclockwise. After it, turning from e1\mathbf{e}_1 to −e2-\mathbf{e}_2 is clockwise. In space the ordered triple (j,i,k)(\mathbf{j}, \mathbf{i}, \mathbf{k}) gives j⋅(i×k)=j⋅(−j)=−1\mathbf{j} \cdot (\mathbf{i} \times \mathbf{k}) = \mathbf{j} \cdot (-\mathbf{j}) = -1, so it is left-handed, matching j×i=−k\mathbf{j} \times \mathbf{i} = -\mathbf{k}.

Basis changes

Definition A basis of Rn\mathbb{R}^n is a list of nn vectors b1,…,bn\mathbf{b}_1, \dots, \mathbf{b}_n for which the matrix P=[b1 ⋯ bn]P = [\mathbf{b}_1 \ \cdots \ \mathbf{b}_n] is invertible. Every x\mathbf{x} in Rn\mathbb{R}^n then has unique coordinates c=[x]B\mathbf{c} = [\mathbf{x}]_{\mathcal{B}} with x=c1b1+⋯+cnbn\mathbf{x} = c_1\mathbf{b}_1 + \cdots + c_n\mathbf{b}_n, that is

x=Pc,c=P−1x.\mathbf{x} = P\mathbf{c}, \qquad \mathbf{c} = P^{-1}\mathbf{x}.

If a linear map has standard matrix AA, then in B\mathcal{B} coordinates it has matrix P−1APP^{-1}AP, meaning [Ax]B=P−1AP [x]B[A\mathbf{x}]_{\mathcal{B}} = P^{-1}AP\,[\mathbf{x}]_{\mathcal{B}}. To convert from B\mathcal{B} coordinates to coordinates in a second basis C\mathcal{C} with matrix QQ, first return to standard coordinates and then solve, so [x]C=Q−1P [x]B[\mathbf{x}]_{\mathcal{C}} = Q^{-1}P\,[\mathbf{x}]_{\mathcal{B}}.

In plain words A new basis is a new grid. The coordinates of a point in that grid come from solving one linear system, and a well chosen grid can make a map look much simpler.

Example Take b1=⟨1,1⟩\mathbf{b}_1 = \langle 1, 1 \rangle, b2=⟨1,−1⟩\mathbf{b}_2 = \langle 1, -1 \rangle and x=⟨5,1⟩\mathbf{x} = \langle 5, 1 \rangle. Solving c1+c2=5c_1 + c_2 = 5 and c1−c2=1c_1 - c_2 = 1 gives c1=3c_1 = 3 and c2=2c_2 = 2, and indeed 3⟨1,1⟩+2⟨1,−1⟩=⟨5,1⟩3\langle 1, 1 \rangle + 2\langle 1, -1 \rangle = \langle 5, 1 \rangle. The map with rows ⟨2,1⟩\langle 2, 1 \rangle and ⟨1,2⟩\langle 1, 2 \rangle sends b1\mathbf{b}_1 to ⟨3,3⟩=3b1\langle 3, 3 \rangle = 3\mathbf{b}_1 and b2\mathbf{b}_2 to ⟨1,−1⟩=b2\langle 1, -1 \rangle = \mathbf{b}_2, so

P−1AP=[3001].P^{-1}AP = \begin{bmatrix} 3 & 0 \\ 0 & 1 \end{bmatrix}.

In the new grid the map simply stretches by 33 along b1\mathbf{b}_1 and fixes b2\mathbf{b}_2.

Check yourself

  1. Compute ABAB and BABA for the matrices with rows ⟨1,2⟩,⟨0,1⟩\langle 1, 2 \rangle, \langle 0, 1 \rangle for AA and ⟨1,0⟩,⟨3,1⟩\langle 1, 0 \rangle, \langle 3, 1 \rangle for BB.
Show the answer

Row times column gives

AB=[7231],BA=[1237].AB = \begin{bmatrix} 7 & 2 \\ 3 & 1 \end{bmatrix}, \quad BA = \begin{bmatrix} 1 & 2 \\ 3 & 7 \end{bmatrix}.

They differ, so the order of the maps matters. Both have determinant 11, as det⁡(AB)=det⁡Adet⁡B=1\det(AB) = \det A \det B = 1 predicts.

  1. The matrix with rows ⟨1,3⟩\langle 1, 3 \rangle and ⟨2,1⟩\langle 2, 1 \rangle is applied to the triangle with corners (0,0)(0, 0), (1,0)(1, 0) and (0,2)(0, 2). What is the area of the image, and is orientation preserved?
Show the answer

The determinant is 1−6=−51 - 6 = -5. The triangle has area 11, so the image has area ∣−5∣⋅1=5\lvert -5 \rvert \cdot 1 = 5. The sign is negative, so the map reverses orientation.

  1. Find the coordinates of ⟨4,3⟩\langle 4, 3 \rangle in the basis b1=⟨2,1⟩\mathbf{b}_1 = \langle 2, 1 \rangle, b2=⟨1,1⟩\mathbf{b}_2 = \langle 1, 1 \rangle.
Show the answer

Solve 2c1+c2=42c_1 + c_2 = 4 and c1+c2=3c_1 + c_2 = 3. Subtracting gives c1=1c_1 = 1, then c2=2c_2 = 2. Check that 1⟨2,1⟩+2⟨1,1⟩=⟨4,3⟩1\langle 2, 1 \rangle + 2\langle 1, 1 \rangle = \langle 4, 3 \rangle.

How this lesson connects

It also uses Vector components, linear combinations, basic algebra and simultaneous equations.