Linear AlgebraMatrix Algebra1 of 9
Matrix Algebra · 1

What Is a Matrix?

In data science, a matrix is a table of numbers, while in physics and graphics it is an operator that transforms space. How can the same box of numbers be both at once?

Data Tables and Operators
movies\htmlClass{lc-mute}{\text{movies}}
users\htmlClass{lc-mute}{\text{users}}
55
33
11
44
22
55
44
11
44
11
55
33
[3−12041]\begin{bmatrix} 3 & -1 & 2 \\ 0 & 4 & 1 \end{bmatrix}
Text solution
Put each recipe into a columnWriting each drink's ingredients as a column builds a table AA whose columns are complete recipes and whose rows track a single ingredient across the menu.
A=[4113],x=[32]\displaystyle A = \begin{bmatrix} \colone{4} & \coltwo{1} \\ \colone{1} & \coltwo{3} \end{bmatrix}, \qquad x = \begin{bmatrix} \colone{3} \\ \coltwo{2} \end{bmatrix}
Combine the columns by the order weightsMultiplying AA by the customer order xx scales the Smoothie column by 3\colone{3} and the Shake column by 2\coltwo{2}, then adds the two recipes together.
Ax=3[41]+2[13]=[123]+[26]=[149]\displaystyle \begin{aligned} \output{Ax} &= \colone{3\begin{bmatrix} 4 \\ 1 \end{bmatrix}} + \coltwo{2\begin{bmatrix} 1 \\ 3 \end{bmatrix}} \\ &= \colone{\begin{bmatrix} 12 \\ 3 \end{bmatrix}} + \coltwo{\begin{bmatrix} 2 \\ 6 \end{bmatrix}} \\ &= \output{\begin{bmatrix} 14 \\ 9 \end{bmatrix}} \end{aligned}
Or dot each ingredient row with the orderTaking each row of AA and multiplying matching entries with xx totals one ingredient at a time across both drinks.
Ax=[(4×3)+(1×2)(1×3)+(3×2)]=[12+23+6]=[149]\displaystyle \begin{aligned} \output{Ax} &= \begin{bmatrix} (\colone{4} \times \colone{3}) + (\coltwo{1} \times \coltwo{2}) \\ (\colone{1} \times \colone{3}) + (\coltwo{3} \times \coltwo{2}) \end{bmatrix} \\ &= \begin{bmatrix} \colone{12} + \coltwo{2} \\ \colone{3} + \coltwo{6} \end{bmatrix} \\ &= \output{\begin{bmatrix} 14 \\ 9 \end{bmatrix}} \end{aligned}

So the order x=[32]x = \begin{bmatrix} \colone{3} \\ \coltwo{2} \end{bmatrix} requires 14\output{14} berries and 9\output{9} scoops of protein powder.

1

Size, Entries, and Input-Output Shapes

Our first table had 22 rows and 22 columns, so the input and output had the same length. When a table has a different number of rows and columns, we need a way to name its size, point to individual numbers inside it, and tell what size vector it can take in and send out.

Size, Entries, and Input-Output Shapes
A=A =
Smoothie\htmlClass{lc-green}{\text{Smoothie}}
Shake\htmlClass{lc-pink}{\text{Shake}}
Berries\text{Berries}
4\htmlClass{lc-green}{4}
1\htmlClass{lc-pink}{1}
Powder\text{Powder}
1\htmlClass{lc-green}{1}
3\htmlClass{lc-pink}{3}
Bananas\text{Bananas}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}

We always count down the rows first and across the columns second, both for the size of the whole matrix and for the position of a single entry:

Size: m⏟rows×n⏟columns,Entry: Ai⏟row, j⏟column\displaystyle \begin{gathered} \text{Size: } \underbrace{m}_{\text{rows}} \times \underbrace{n}_{\text{columns}}, \\[4pt] \text{Entry: } A_{\underbrace{i}_{\scriptstyle\text{row}},\,\underbrace{j}_{\scriptstyle\text{column}}} \end{gathered}

Watch out: on an (x,y)(x, y) graph you go across first and up second, but in a matrix A3,1A_{3,1} means down to row 33, then across to column 11.

Text solution
Match the input length to the columnsBecause our 3×23 \times 2 recipe matrix AA has 22 columns, the input order xx must have 22 entries to weight them. A 33-entry vector like [325]\begin{bmatrix} \colone{3} \\ \coltwo{2} \\ \missed{5} \end{bmatrix} leaves the 5\missed{5} with no third column to scale, so AxAx is not defined.
A=[411322],x=[32]\displaystyle A = \begin{bmatrix} \colone{4} & \coltwo{1} \\ \colone{1} & \coltwo{3} \\ \colone{2} & \coltwo{2} \end{bmatrix}, \qquad x = \begin{bmatrix} \colone{3} \\ \coltwo{2} \end{bmatrix}
Add the scaled columns to get the outputScaling and adding the two 33-entry columns produces a 33-entry output vector, one entry for each ingredient row.
Ax=3[412]+2[132]=[1236]+[264]=[14910]\displaystyle \begin{aligned} \output{Ax} &= \colone{3\begin{bmatrix} 4 \\ 1 \\ 2 \end{bmatrix}} + \coltwo{2\begin{bmatrix} 1 \\ 3 \\ 2 \end{bmatrix}} \\ &= \colone{\begin{bmatrix} 12 \\ 3 \\ 6 \end{bmatrix}} + \coltwo{\begin{bmatrix} 2 \\ 6 \\ 4 \end{bmatrix}} \\ &= \output{\begin{bmatrix} 14 \\ 9 \\ 10 \end{bmatrix}} \end{aligned}

So the 22-item drink order comes out as a 33-item ingredient list: 14\output{14} berries, 9\output{9} scoops of powder, and 10\output{10} bananas.

2

Scaling and Adding Matrices

Now that we know how one matrix acts on a vector, what happens when we update a whole table at once, like doubling every recipe or adding a table of seasonal extras?

Scaling and Adding Matrices
A=A =
Smoothie\htmlClass{lc-green}{\text{Smoothie}}
Shake\htmlClass{lc-pink}{\text{Shake}}
Berries\text{Berries}
4\htmlClass{lc-green}{4}
1\htmlClass{lc-pink}{1}
Powder\text{Powder}
1\htmlClass{lc-green}{1}
3\htmlClass{lc-pink}{3}
Bananas\text{Bananas}
2\htmlClass{lc-green}{2}
2\htmlClass{lc-pink}{2}
cA=?A+B=?\begin{aligned} cA &= {?} \\ A + B &= {?} \end{aligned}
Text solution
Scale every entry by ccDoubling the menu multiplies every entry in the 3×23 \times 2 matrix AA by 22.
2A=2[411322]=[822644]\displaystyle \begin{aligned} 2A &= 2\begin{bmatrix} \colone{4} & \coltwo{1} \\ \colone{1} & \coltwo{3} \\ \colone{2} & \coltwo{2} \end{bmatrix} \\ &= \begin{bmatrix} \colone{8} & \coltwo{2} \\ \colone{2} & \coltwo{6} \\ \colone{4} & \coltwo{4} \end{bmatrix} \end{aligned}
Add matching entries of same-size matricesBecause the base table AA and the Summer Boost table BB are both 3×23 \times 2, we add the entries sitting in the exact same row and column. If their sizes did not match, A+BA + B would not be defined.
A+B=[411322]+[120010]=[4+11+21+03+02+12+0]=[531332]\displaystyle \begin{aligned} A + B &= \begin{bmatrix} \colone{4} & \coltwo{1} \\ \colone{1} & \coltwo{3} \\ \colone{2} & \coltwo{2} \end{bmatrix} + \begin{bmatrix} \colone{1} & \coltwo{2} \\ \colone{0} & \coltwo{0} \\ \colone{1} & \coltwo{0} \end{bmatrix} \\ &= \begin{bmatrix} 4+1 & 1+2 \\ 1+0 & 3+0 \\ 2+1 & 2+0 \end{bmatrix} \\ &= \begin{bmatrix} \colone{5} & \coltwo{3} \\ \colone{1} & \coltwo{3} \\ \colone{3} & \coltwo{2} \end{bmatrix} \end{aligned}
Combine the outputs directlyMultiplying a scaled or added matrix by xx gives the exact same result as scaling or adding the separate outputs Ax\output{Ax} and Bx\output{Bx}.
(cA)x=c(Ax),(A+B)x=Ax+Bx\displaystyle \begin{aligned} (cA)x &= c(\output{Ax}), \\ (A + B)x &= \output{Ax} + \output{Bx} \end{aligned}
3

How Matrices Move Space

Up to now, our vectors have been lists of drinks and ingredients. What happens when the input vector x=[32]\point{x} = \point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} is a point on a 2D grid?

How Matrices Move Space
AxAx
x=[32]\htmlClass{lc-blue}{x = \begin{bmatrix} 3 \\ 2 \end{bmatrix}}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}
3\htmlClass{lc-mute}{3}
4\htmlClass{lc-mute}{4}
5\htmlClass{lc-mute}{5}
6\htmlClass{lc-mute}{6}
7\htmlClass{lc-mute}{7}
8\htmlClass{lc-mute}{8}
9\htmlClass{lc-mute}{9}
1\htmlClass{lc-mute}{1}
2\htmlClass{lc-mute}{2}
3\htmlClass{lc-mute}{3}
I=[1001]I = \begin{bmatrix} \htmlClass{lc-green}{1} & \htmlClass{lc-pink}{0} \\ \htmlClass{lc-green}{0} & \htmlClass{lc-pink}{1} \end{bmatrix}
[10]\htmlClass{lc-green}{\begin{bmatrix} 1 \\ 0 \end{bmatrix}}
[01]\htmlClass{lc-pink}{\begin{bmatrix} 0 \\ 1 \end{bmatrix}}
[32]\htmlClass{lc-blue}{\begin{bmatrix} 3 \\ 2 \end{bmatrix}}
[32]=3[10]+2[01]\htmlClass{lc-blue}{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} = \htmlClass{lc-green}{3\begin{bmatrix} 1 \\ 0 \end{bmatrix}} + \htmlClass{lc-pink}{2\begin{bmatrix} 0 \\ 1 \end{bmatrix}}
A=[2101]A = \begin{bmatrix} \htmlClass{lc-green}{2} & \htmlClass{lc-pink}{1} \\ \htmlClass{lc-green}{0} & \htmlClass{lc-pink}{1} \end{bmatrix}
[20]\htmlClass{lc-green}{\begin{bmatrix} 2 \\ 0 \end{bmatrix}}
[11]\htmlClass{lc-pink}{\begin{bmatrix} 1 \\ 1 \end{bmatrix}}
[82]\htmlClass{lc-blue}{\begin{bmatrix} 8 \\ 2 \end{bmatrix}}
[82]=3[20]+2[11]\htmlClass{lc-blue}{\begin{bmatrix} 8 \\ 2 \end{bmatrix}} = \htmlClass{lc-green}{3\begin{bmatrix} 2 \\ 0 \end{bmatrix}} + \htmlClass{lc-pink}{2\begin{bmatrix} 1 \\ 1 \end{bmatrix}}
Text solution
Break the point into standard grid stepsOn a standard grid, the point [32]\point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} is 3\colone{3} steps of [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} (right) plus 2\coltwo{2} steps of [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} (up), which are the columns of the identity matrix I=[1001]I = \begin{bmatrix} \colone{1} & \coltwo{0} \\ \colone{0} & \coltwo{1} \end{bmatrix}.
I[32]=3[10]+2[01]=[32]\displaystyle \begin{aligned} I\point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} &= \colone{3\begin{bmatrix} 1 \\ 0 \end{bmatrix}} + \coltwo{2\begin{bmatrix} 0 \\ 1 \end{bmatrix}} \\ &= \point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} \end{aligned}
Put the new landing spots into the columnsStretching the right step [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} to [20]\colone{\begin{bmatrix} 2 \\ 0 \end{bmatrix}} and tilting the up step [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} to [11]\coltwo{\begin{bmatrix} 1 \\ 1 \end{bmatrix}} gives the columns of AA.
A=[2101]\displaystyle A = \begin{bmatrix} \colone{2} & \coltwo{1} \\ \colone{0} & \coltwo{1} \end{bmatrix}
Use the point's coordinates to weight the new columnsMultiplying AA by [32]\point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} takes 3\colone{3} of Column 1 plus 2\coltwo{2} of Column 2 on the new grid.
A[32]=3[20]+2[11]=[60]+[22]=[82]\displaystyle \begin{aligned} A\point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} &= \colone{3\begin{bmatrix} 2 \\ 0 \end{bmatrix}} + \coltwo{2\begin{bmatrix} 1 \\ 1 \end{bmatrix}} \\ &= \colone{\begin{bmatrix} 6 \\ 0 \end{bmatrix}} + \coltwo{\begin{bmatrix} 2 \\ 2 \end{bmatrix}} \\ &= \point{\begin{bmatrix} 8 \\ 2 \end{bmatrix}} \end{aligned}

So AA moves the point [32]\point{\begin{bmatrix} 3 \\ 2 \end{bmatrix}} to [82]\point{\begin{bmatrix} 8 \\ 2 \end{bmatrix}}, and moves the entire 2D grid along with its two columns.

Every point [x1x2]\point{\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}} stays attached to the grid as x1\colone{x_1} times Column 1 plus x2\coltwo{x_2} times Column 2. So once you know where [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} and [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} land, you can stretch, tilt, rotate, reflect, or flatten the whole plane.

The two columns of a matrix are simply where the right step and the up step land, and those two arrows carry every point on the grid to its new spot.

Key concepts

Whenever you read or build an m×nm \times n matrix AA, you are looking at both a table of numbers and a machine that transforms vectors:

Rows by columns (m×nm \times n and Ai,jA_{i,j})

Count down to the row ii first and across to the column jj second. In the 3×23 \times 2 matrix A=[411322]A = \begin{bmatrix} 4 & 1 \\ 1 & 3 \\ 2 & 2 \end{bmatrix}, A3,1=2A_{3,1} = 2.

When AxAx is defined and its shape

The input xx weights the columns of AA, so AxAx is only defined when xx has nn entries (matching the nn columns), and the output Ax\output{Ax} always has mm entries (matching the mm rows).

Scaling and adding matrices

You can scale any matrix entry by entry (cAcA), and you can add two matrices entry by entry (A+BA + B) only when they have the exact same m×nm \times n size. If you already have the outputs Ax\output{Ax} and Bx\output{Bx}, skip building the full matrix and combine the outputs directly:

(cA)x=c(Ax),(A+B)x=Ax+Bx\displaystyle \begin{aligned} (cA)x &= c(\output{Ax}), \\ (A + B)x &= \output{Ax} + \output{Bx} \end{aligned}

Columns are where the grid steps land

In geometry, the columns of AA are the landing spots of the standard axis steps, like [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} and [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} in 2D, or [100]\colone{\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}}, [010]\coltwo{\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}}, and [001]\colthree{\begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}} in 3D. Rotating the plane by 90∘90^\circ moves [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} to [01]\colone{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} and [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} to [−10]\coltwo{\begin{bmatrix} -1 \\ 0 \end{bmatrix}}, giving [0−110]\begin{bmatrix} \colone{0} & \coltwo{-1} \\ \colone{1} & \coltwo{0} \end{bmatrix}; flattening onto the X-axis moves [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} to [00]\coltwo{\begin{bmatrix} 0 \\ 0 \end{bmatrix}}, giving [1000]\begin{bmatrix} \colone{1} & \coltwo{0} \\ \colone{0} & \coltwo{0} \end{bmatrix}.

4

Practice

1

A bakery tracks 3 ingredients (rows: flour, butter, sugar) across 4 pastries (columns) in the matrix

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

What is the size of AA, what are the entries A2,3A_{2,3} and A3,2A_{3,2}, and what does Column 3 represent?

For both matrix size and entry subscripts, do we count down the rows first or across the columns first?

Count the 33 horizontal rows first and the 44 vertical columns second:
Size of A\displaystyle \text{Size of } A =3×4\displaystyle = 3 \times 4
For A2,3A_{2,3}, go down to row 22 and across to column 33; for A3,2A_{3,2}, go down to row 33 and across to column 22 (don't read across first like (x,y)(x, y) coordinates, which swaps them to A2,3=1A_{2,3} = 1 and A3,2=0A_{3,2} = 0 and writes the size backwards as 4×34 \times 3):
A2,3\displaystyle A_{2,3} =0,A3,2\displaystyle = 0, \qquad A_{3,2} =1\displaystyle = 1
Column 3 is [302]\begin{bmatrix} 3 \\ 0 \\ 2 \end{bmatrix}, which represents the complete recipe for the third pastry: 33 units of flour, 00 butter, and 22 sugar.
2

Using the same 3×43 \times 4 matrix

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

explain why AxAx is not defined for x=[213]x = \begin{bmatrix} 2 \\ 1 \\ 3 \end{bmatrix}, and compute AyAy for the order y=[2013]y = \begin{bmatrix} 2 \\ 0 \\ 1 \\ 3 \end{bmatrix}.

Does each entry of the input vector weight a row of AA or a column of AA?

Because AA has 44 columns, its input vector must have 44 entries, one weight for each column, so AxAx is not defined for the 33-entry vector x=[213]x = \begin{bmatrix} 2 \\ 1 \\ 3 \end{bmatrix} (don't match the input length to the 33 rows).
For the 44-entry order y=[2013]y = \begin{bmatrix} 2 \\ 0 \\ 1 \\ 3 \end{bmatrix}, scale each of the 44 columns by its matching entry in yy (watch out for the 00 in the second entry: adding Column 2 unscaled instead of multiplying it by 00 gives [14136]\begin{bmatrix} 14 \\ 13 \\ 6 \end{bmatrix}):
Ay=2[210]+0[121]+1[302]+3[231]=[420]+[000]+[302]+[693]=[13115]\displaystyle \begin{aligned} \output{Ay} &= 2\begin{bmatrix} 2 \\ 1 \\ 0 \end{bmatrix} + 0\begin{bmatrix} 1 \\ 2 \\ 1 \end{bmatrix} + 1\begin{bmatrix} 3 \\ 0 \\ 2 \end{bmatrix} + 3\begin{bmatrix} 2 \\ 3 \\ 1 \end{bmatrix} \\ &= \begin{bmatrix} 4 \\ 2 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 0 \\ 0 \end{bmatrix} + \begin{bmatrix} 3 \\ 0 \\ 2 \end{bmatrix} + \begin{bmatrix} 6 \\ 9 \\ 3 \end{bmatrix} \\ &= \output{\begin{bmatrix} 13 \\ 11 \\ 5 \end{bmatrix}} \end{aligned}
3

Let AA and BB be 3×23 \times 2 matrices and CC be a 2×32 \times 3 matrix. For x=[32]x = \begin{bmatrix} 3 \\ 2 \end{bmatrix}, suppose Ax=[14910]Ax = \begin{bmatrix} 14 \\ 9 \\ 10 \end{bmatrix} and Bx=[503]Bx = \begin{bmatrix} 5 \\ 0 \\ 3 \end{bmatrix}, where the top row of AA is [41]\begin{bmatrix} 4 & 1 \end{bmatrix} and the top row of BB is [11]\begin{bmatrix} 1 & 1 \end{bmatrix}. Find the top row of 2A+B2A + B, compute (2A+B)x(2A + B)x, and explain why (A+C)x(A + C)x is not defined.

You only know the top rows of AA and BB. How can you find (2A+B)x(2A + B)x directly from the outputs AxAx and BxBx?

To find the top row of 2A+B2A + B, double both entries in the top row of AA and add the top row of BB:
2[41]+[11]=[82]+[11]=[93]\displaystyle \begin{aligned} 2\begin{bmatrix} \colone{4} & \coltwo{1} \end{bmatrix} + \begin{bmatrix} \colone{1} & \coltwo{1} \end{bmatrix} &= \begin{bmatrix} \colone{8} & \coltwo{2} \end{bmatrix} + \begin{bmatrix} \colone{1} & \coltwo{1} \end{bmatrix} \\ &= \begin{bmatrix} \colone{9} & \coltwo{3} \end{bmatrix} \end{aligned}
To find (2A+B)x(2A + B)x, scale Ax\output{Ax} by 22 and add Bx\output{Bx} directly (be careful to double only Ax\output{Ax}, not Bx\output{Bx}: doubling both gives 2(Ax+Bx)=[381826]2(Ax + Bx) = \begin{bmatrix} 38 \\ 18 \\ 26 \end{bmatrix}):
(2A+B)x=2(Ax)+Bx=2[14910]+[503]=[281820]+[503]=[331823]\displaystyle \begin{aligned} (2A + B)x &= 2(\output{Ax}) + \output{Bx} \\ &= 2\output{\begin{bmatrix} 14 \\ 9 \\ 10 \end{bmatrix}} + \output{\begin{bmatrix} 5 \\ 0 \\ 3 \end{bmatrix}} \\ &= \begin{bmatrix} 28 \\ 18 \\ 20 \end{bmatrix} + \begin{bmatrix} 5 \\ 0 \\ 3 \end{bmatrix} \\ &= \output{\begin{bmatrix} 33 \\ 18 \\ 23 \end{bmatrix}} \end{aligned}
Finally, (A+C)x(A + C)x is not defined because AA (3×23 \times 2) and CC (2×32 \times 3) do not have the exact same size, so A+CA + C cannot be added.
4

A 2×22 \times 2 matrix AA moves the standard right step [10]\begin{bmatrix} 1 \\ 0 \end{bmatrix} to [3−1]\begin{bmatrix} 3 \\ -1 \end{bmatrix} and the standard up step [01]\begin{bmatrix} 0 \\ 1 \end{bmatrix} to [12]\begin{bmatrix} 1 \\ 2 \end{bmatrix}. Write the matrix AA and find where it moves the point x=[23]x = \begin{bmatrix} 2 \\ 3 \end{bmatrix}.

Do the landing spots of [10]\begin{bmatrix} 1 \\ 0 \end{bmatrix} and [01]\begin{bmatrix} 0 \\ 1 \end{bmatrix} form the rows of AA or the columns of AA?

Write the landing spots [3−1]\colone{\begin{bmatrix} 3 \\ -1 \end{bmatrix}} and [12]\coltwo{\begin{bmatrix} 1 \\ 2 \end{bmatrix}} as the columns of AA (don't write them as rows, which gives [3−112]\begin{bmatrix} 3 & -1 \\ 1 & 2 \end{bmatrix} and sends [23]\begin{bmatrix} 2 \\ 3 \end{bmatrix} to [38]\begin{bmatrix} 3 \\ 8 \end{bmatrix}):
A=[31−12]\displaystyle A = \begin{bmatrix} \colone{3} & \coltwo{1} \\ \colone{-1} & \coltwo{2} \end{bmatrix}
Now weight the two columns by the coordinates of x=[23]\point{x} = \point{\begin{bmatrix} 2 \\ 3 \end{bmatrix}}:
Ax=2[3−1]+3[12]=[6−2]+[36]=[94]\displaystyle \begin{aligned} A\point{x} &= \colone{2\begin{bmatrix} 3 \\ -1 \end{bmatrix}} + \coltwo{3\begin{bmatrix} 1 \\ 2 \end{bmatrix}} \\ &= \colone{\begin{bmatrix} 6 \\ -2 \end{bmatrix}} + \coltwo{\begin{bmatrix} 3 \\ 6 \end{bmatrix}} \\ &= \point{\begin{bmatrix} 9 \\ 4 \end{bmatrix}} \end{aligned}
5

Write the 2×22 \times 2 matrix RR that reflects the 2D plane across the Y-axis and the matrix PP that flattens the plane onto the Y-axis. How does the combined matrix I+RI + R transform any point [x1x2]\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}, where II is the 2×22 \times 2 identity matrix?

When you reflect across the Y-axis or flatten onto the Y-axis, where does the horizontal step [10]\begin{bmatrix} 1 \\ 0 \end{bmatrix} land, and where does the vertical step [01]\begin{bmatrix} 0 \\ 1 \end{bmatrix} land?

Reflecting across the Y-axis flips the horizontal step [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} to [−10]\colone{\begin{bmatrix} -1 \\ 0 \end{bmatrix}} and leaves the vertical step [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} on the Y-axis at [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} (don't flip the vertical step to [0−1]\begin{bmatrix} 0 \\ -1 \end{bmatrix}, which reflects across the X-axis instead and makes I+RI + R flatten onto the X-axis at [2x10]\begin{bmatrix} 2x_1 \\ 0 \end{bmatrix}). Flattening onto the Y-axis sends [10]\colone{\begin{bmatrix} 1 \\ 0 \end{bmatrix}} to [00]\colone{\begin{bmatrix} 0 \\ 0 \end{bmatrix}} and keeps [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}} at [01]\coltwo{\begin{bmatrix} 0 \\ 1 \end{bmatrix}}:
R=[−1001],P=[0001]\displaystyle R = \begin{bmatrix} \colone{-1} & \coltwo{0} \\ \colone{0} & \coltwo{1} \end{bmatrix}, \qquad P = \begin{bmatrix} \colone{0} & \coltwo{0} \\ \colone{0} & \coltwo{1} \end{bmatrix}
Adding II and RR entry by entry gives 2P2P:
I+R=[1001]+[−1001]=[0002]=2P\displaystyle \begin{aligned} I + R &= \begin{bmatrix} \colone{1} & \coltwo{0} \\ \colone{0} & \coltwo{1} \end{bmatrix} + \begin{bmatrix} \colone{-1} & \coltwo{0} \\ \colone{0} & \coltwo{1} \end{bmatrix} \\ &= \begin{bmatrix} \colone{0} & \coltwo{0} \\ \colone{0} & \coltwo{2} \end{bmatrix} \\ &= 2P \end{aligned}
This flattens every point [x1x2]\point{\begin{bmatrix} x_1 \\ x_2 \end{bmatrix}} onto the Y-axis and doubles its vertical coordinate to [02x2]\point{\begin{bmatrix} 0 \\ 2x_2 \end{bmatrix}}.
6

A video game projects 3D points [xyz]\begin{bmatrix} x \\ y \\ z \end{bmatrix} onto a 2D screen using a matrix MM. If the 3D axis steps [100]\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix}, [010]\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix}, and [001]\begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} land at [2−1]\begin{bmatrix} 2 \\ -1 \end{bmatrix}, [30]\begin{bmatrix} 3 \\ 0 \end{bmatrix}, and [04]\begin{bmatrix} 0 \\ 4 \end{bmatrix} on the screen, what is the size of MM, what is MM, and where on the 2D screen does the 3D point [2−13]\begin{bmatrix} 2 \\ -1 \\ 3 \end{bmatrix} land?

The input has 33 coordinates and the output has 22 coordinates. How many columns and how many rows must MM have?

Each 2D landing spot is a 22-entry column and there are 33 of them (one for each 3D axis step), so MM has 22 rows and 33 columns (don't write the size as 3×23 \times 2 by putting input size before output size):
Size of M=2×3,M=[230−104]\displaystyle \text{Size of } M = 2 \times 3, \qquad M = \begin{bmatrix} \colone{2} & \coltwo{3} & \colthree{0} \\ \colone{-1} & \coltwo{0} & \colthree{4} \end{bmatrix}
Now weight the 33 columns by the coordinates of [2−13]\point{\begin{bmatrix} 2 \\ -1 \\ 3 \end{bmatrix}} (watch the negative sign on y=−1\coltwo{y} = \coltwo{-1}: adding the second column instead of subtracting it gives [710]\begin{bmatrix} 7 \\ 10 \end{bmatrix}):
M[2−13]=2[2−1]−1[30]+3[04]=[4−2]−[30]+[012]=[110]\displaystyle \begin{aligned} M\point{\begin{bmatrix} 2 \\ -1 \\ 3 \end{bmatrix}} &= \colone{2\begin{bmatrix} 2 \\ -1 \end{bmatrix}} - \coltwo{1\begin{bmatrix} 3 \\ 0 \end{bmatrix}} + \colthree{3\begin{bmatrix} 0 \\ 4 \end{bmatrix}} \\ &= \colone{\begin{bmatrix} 4 \\ -2 \end{bmatrix}} - \coltwo{\begin{bmatrix} 3 \\ 0 \end{bmatrix}} + \colthree{\begin{bmatrix} 0 \\ 12 \end{bmatrix}} \\ &= \point{\begin{bmatrix} 1 \\ 10 \end{bmatrix}} \end{aligned}