Educerie

Educerie · AP · Precalculus

Unit 4 Functions Involving Parameters, Vectors, and Matrices · 4.13 Matrices as Functions

This unit is not on the AP exam. The exam covers Units 1 to 3 only; Unit 4 is taught here for the course and for what comes after it.

Big ideas: The columns of a matrix are the images of the two unit vectors; rotations, stretches and reflections as matrices; composition as a product and undoing as an inverse.

Where it is examined: Not on the AP Precalculus exam. The College Board lists Unit 4 as an additional topic available to schools. If your school teaches it, the work is building a matrix from what a transformation does, composing two transformations, and reading the effect of a matrix on area.

The question this unit answers: How does high-resolution computer imaging turn, stretch and move a whole picture at once?


AP Precalculus 4.13

Matrices as Functions

How does high-resolution computer imaging turn, stretch and move a whole picture at once?

What you will learn

  • Understand that a 2 by 2 matrix is a function on the plane fixed by where i and j go
  • Know the rotation matrix and that |det A| is the area scale factor
  • Know that composition is a matrix product with the first transformation on the right, and that an inverse needs a nonzero determinant

You must be able to

  1. Build a matrix from the images of the unit vectors
  2. Rotate a vector with the rotation matrix
  3. Find the area of an image using the determinant
  4. Compose two transformations in the right order and check with i
  5. Find the inverse of a transformation and check it on a vector
  6. Show that the order of two transformations matters

1A matrix from a rule

The linear transformation that sends ⟨x,y⟩\langle x, y\rangle to ⟨a11x+a12y, a21x+a22y⟩\langle a_{11}x + a_{12}y,\ a_{21}x + a_{22}y\rangle goes with the matrix

A=[a11a12a21a22]A = \begin{bmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{bmatrix}

This is Topic 4.12. The subscripts say the row and column: a21a_{21} is in row 2, column 1.

2The unit vectors tell you everything

Every vector is a combination of i⃗\vec{i} and j⃗\vec{j}: ⟨x,y⟩=xi⃗+yj⃗\langle x, y\rangle = x\vec{i} + y\vec{j}. A linear transformation respects that, so

L(⟨x,y⟩)=x L(i⃗)+y L(j⃗)L(\langle x, y\rangle) = x\,L(\vec{i}) + y\,L(\vec{j})

Now look at what the matrix does to the unit vectors:

A[10]=[a11a21]A\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} a_{11} \\ a_{21} \end{bmatrix}A[01]=[a12a22]A\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} a_{12} \\ a_{22} \end{bmatrix}

The first column of AA is where i⃗\vec{i} goes. The second column is where j⃗\vec{j} goes.

So you can build a matrix without the rule, if you know where the unit vectors land.

Worked example 1. A linear transformation sends i⃗\vec{i} to ⟨3,−1⟩\langle 3, -1\rangle and j⃗\vec{j} to ⟨2,5⟩\langle 2, 5\rangle. Find its matrix, and where ⟨4,1⟩\langle 4, 1\rangle goes.

The images are the columns:

A=[32−15]A = \begin{bmatrix} 3 & 2 \\ -1 & 5 \end{bmatrix}A[41]=[12+2−4+5]=[141]A\begin{bmatrix} 4 \\ 1 \end{bmatrix} = \begin{bmatrix} 12 + 2 \\ -4 + 5 \end{bmatrix} = \begin{bmatrix} 14 \\ 1 \end{bmatrix}

Check with the rule L(⟨x,y⟩)=xL(i⃗)+yL(j⃗)L(\langle x, y\rangle) = xL(\vec{i}) + yL(\vec{j}): 4⟨3,−1⟩+1⟨2,5⟩=⟨14,1⟩4\langle 3, -1\rangle + 1\langle 2, 5\rangle = \langle 14, 1\rangle. It agrees.

3Rotations

Rotate the plane by an angle θ\theta counterclockwise about the origin.

  • i⃗=⟨1,0⟩\vec{i} = \langle 1, 0\rangle goes to ⟨cos⁡θ,sin⁡θ⟩\langle\cos\theta, \sin\theta\rangle, the point on the unit circle at angle θ\theta.
  • j⃗\vec{j} is a quarter turn ahead of i⃗\vec{i}, so it goes to the point at angle θ+π2\theta + \dfrac{\pi}{2}, which is ⟨−sin⁡θ,cos⁡θ⟩\langle -\sin\theta, \cos\theta\rangle.

Those are the columns:

Rθ=[cos⁡θ−sin⁡θsin⁡θcos⁡θ]R_\theta = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}

This matrix rotates every vector by θ\theta counterclockwise about the origin.

Worked example 2. Rotate ⟨3,2⟩\langle 3, 2\rangle by 90∘90^\circ. Then rotate ⟨4,0⟩\langle 4, 0\rangle by 60∘60^\circ.

For 90∘90^\circ, cos⁡=0\cos = 0 and sin⁡=1\sin = 1: R=[0−110]R = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}.

[0−110][32]=[−23]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 3 \\ 2 \end{bmatrix} = \begin{bmatrix} -2 \\ 3 \end{bmatrix}

For 60∘60^\circ, cos⁡=12\cos = \dfrac{1}{2} and sin⁡=32\sin = \dfrac{\sqrt{3}}{2}:

[12−323212][40]=[223]\begin{bmatrix} \tfrac{1}{2} & -\tfrac{\sqrt{3}}{2} \\ \tfrac{\sqrt{3}}{2} & \tfrac{1}{2} \end{bmatrix}\begin{bmatrix} 4 \\ 0 \end{bmatrix} = \begin{bmatrix} 2 \\ 2\sqrt{3} \end{bmatrix}

The length is the same: 4+12=4\sqrt{4 + 12} = 4. A rotation does not change lengths.

4Other transformations

The same method gives any other.

  • Reflection in the x-axis. i⃗\vec{i} stays, and j⃗\vec{j} goes to ⟨0,−1⟩\langle 0, -1\rangle. The matrix is [100−1]\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}.
  • Stretch. Scale xx by 22 and yy by 55: [2005]\begin{bmatrix} 2 & 0 \\ 0 & 5 \end{bmatrix}.
  • Dilation by kk. [k00k]\begin{bmatrix} k & 0 \\ 0 & k \end{bmatrix}.

5The determinant as a scale factor for area

Figure 1 shows what the matrix A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix} does to the unit square. Read it in this order:

  • The grey square has corners (0,0)(0,0), (1,0)(1,0), (1,1)(1,1), (0,1)(0,1). Its area is 11.
  • i⃗\vec{i} goes to ⟨2,1⟩\langle 2, 1\rangle (the first column), and j⃗\vec{j} goes to ⟨1,2⟩\langle 1, 2\rangle (the second).
  • The amber parallelogram is the image of the square. Its corners are (0,0)(0,0), (2,1)(2,1), (3,3)(3,3) and (1,2)(1,2).
Figure 1. The matrix with columns <2, 1> and <1, 2> sends the unit square (grey) to a parallelogram (amber) of area 3 1 2 3 4 1 2 3 0 y x area 3 i → (2, 1) j → (1, 2) 1
Figure 1 · The matrix with columns ⟨2, 1⟩ and ⟨1, 2⟩ sends the unit square (grey) to a parallelogram (amber) of area 3

The parallelogram has area 33, and det⁡A=2(2)−1(1)=3\det A = 2(2) - 1(1) = 3.

The absolute value of the determinant of a 2×22 \times 2 transformation matrix is the factor by which areas of regions are multiplied.

It holds for any region, not just the unit square.

Example: the triangle with corners (0,0)(0,0), (4,0)(4,0), (0,3)(0,3) has area 66. Under [2005]\begin{bmatrix} 2 & 0 \\ 0 & 5 \end{bmatrix}, whose determinant is 1010, the image has corners (0,0)(0,0), (8,0)(8,0), (0,15)(0,15) and area 6060. That is 6×106 \times 10.

A rotation has determinant cos⁡2θ+sin⁡2θ=1\cos^2\theta + \sin^2\theta = 1, so it keeps areas, as it keeps lengths. A matrix with determinant 00 squashes everything onto a line, so every region gets area zero.

6Composition: one transformation after another

Apply L1L_1 first and then L2L_2. Each is linear, and the combined function, L2(L1(v⃗))L_2(L_1(\vec{v})), is also a linear transformation.

If L1L_1 has matrix A1A_1 and L2L_2 has matrix A2A_2, then

L2(L1(v⃗))=A2(A1v⃗)=(A2A1)v⃗L_2(L_1(\vec{v})) = A_2(A_1\vec{v}) = (A_2A_1)\vec{v}

The matrix of the composition is the product of the two matrices, with the second transformation on the left.

The matrix on the left acts last. The order is the same as for composition of functions: L2∘L1L_2 \circ L_1 means L1L_1 first.

Worked example 3. Rotate by 90∘90^\circ counterclockwise, then reflect in the x-axis. Find the single matrix.

A1=[0−110]A_1 = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}A2=[100−1]A_2 = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}A2A1=[100−1][0−110]=[0−1−10]A_2A_1 = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}

Check with the unit vectors. i⃗\vec{i} rotates to ⟨0,1⟩\langle 0, 1\rangle and reflects to ⟨0,−1⟩\langle 0, -1\rangle, the first column. j⃗\vec{j} rotates to ⟨−1,0⟩\langle -1, 0\rangle and stays there, the second column.

Now do them in the other order: reflect first, then rotate.

A1A2=[0−110][100−1]=[0110]A_1A_2 = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}

It is a different matrix. The order of transformations matters, as the order of matrix multiplication does.

7The inverse of a transformation

Two linear transformations are inverses if doing one and then the other takes every vector back to itself.

If L(v⃗)=Av⃗L(\vec{v}) = A\vec{v}, then the inverse transformation is

L−1(v⃗)=A−1v⃗L^{-1}(\vec{v}) = A^{-1}\vec{v}

where A−1A^{-1} is the inverse matrix, found in Topic 4.11.

It exists exactly when det⁡A≠0\det A \ne 0.

Worked example 4. Find the inverse of the rotation by 90∘90^\circ.

A=[0−110]A = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}det⁡A=0−(−1)(1)=1\det A = 0 - (-1)(1) = 1A−1=11[01−10]A^{-1} = \frac{1}{1}\begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}

This is the rotation by −90∘-90^\circ, because cos⁡(−90∘)=0\cos(-90^\circ) = 0 and sin⁡(−90∘)=−1\sin(-90^\circ) = -1. It turns back.

Worked example 5. For A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}, the determinant is 33, so A−1=13[2−1−12]A^{-1} = \dfrac{1}{3}\begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix}.

The vector ⟨1,2⟩\langle 1, 2\rangle goes to A⟨1,2⟩=⟨4,5⟩A\langle 1, 2\rangle = \langle 4, 5\rangle. Apply the inverse: 13⟨8−5, −4+10⟩=⟨1,2⟩\dfrac{1}{3}\langle 8 - 5,\ -4 + 10\rangle = \langle 1, 2\rangle. It is back where it began.