Matrices & Systems

Study Sheet

Matrices & Systems

Arithmetic with grids of numbers

Matrix Multiplication

Tip
Row times column

The (i,j)(i, j) entry of ABAB is row ii of AA dotted with column jj of BB. Sizes must chain: an m×nm\times n matrix times an n×pn\times p matrix is m×pm\times p — the inner sizes agree, the outer sizes survive. Order matters: AB≠BAAB \ne BA in general, the biggest habit change from ordinary algebra.

Why rows meet columns: column jj of ABAB is AA applied to column jj of BB, and AA applied to a vector produces, in slot ii, row ii of AA dotted with that vector. So the rule is not a convention; it is what "apply BB, then AA" forces. The size rule is the same fact: AA can only act on vectors with as many entries as AA has columns. A 2×32\times3 times a 3×43\times4 is 2×42\times4, while a 3×43\times4 times a 2×32\times3 is not defined at all.

Concept
A matrix is a machine for systems
xya₁a₁a₁a₂b
Column picture: three copies of column 1 and one of column 2 land exactly on b = (7, 2).

The system 2x+y=72x + y = 7, x−y=2x - y = 2 is the single equation Ax=bA\mathbf x = \mathbf b with A=(211−1)A = \begin{pmatrix}2&1\\1&-1\end{pmatrix} and b=(7,2)\mathbf b = (7, 2). Solving the system, inverting AA, and asking whether b\mathbf b is a combination of the columns of AA are one question in three dialects.

Read AxA\mathbf x column by column: A(xy)=x(21)+y(1−1)A\begin{pmatrix}x\\y\end{pmatrix} = x\begin{pmatrix}2\\1\end{pmatrix} + y\begin{pmatrix}1\\-1\end{pmatrix}. Solving the system means finding the weights that combine the columns into b\mathbf b; here 3(2,1)+1(1,−1)=(7,2)3(2,1) + 1(1,-1) = (7,2), so (x,y)=(3,1)(x, y) = (3, 1). Had the two columns pointed along the same line, their combinations would fill only that line, most b\mathbf b would be out of reach, and AA would have no inverse — the three dialects fail together.

Example
Linear dependence

(1,2,3)(1,2,3) and (2,4,t)(2,4,t) are dependent exactly when one is a multiple of the other; the first two coordinates force the multiplier to be 22, so t=6t = 6 — dependence is a rigid, all-coordinates condition.

Test the reasoning on a near miss: (1,2,3)(1,2,3) and (2,4,7)(2,4,7) agree on the multiplier 22 in the first two coordinates and disagree in the third (2⋅3=6≠72\cdot3 = 6 \ne 7), so they are independent. A single mismatched coordinate is enough; two vectors are dependent only when one multiplier works in every coordinate at once.

Side note
Significance: matrices are how computers see everything

An image is a matrix of pixels; a social network is an adjacency matrix; a dataset is a rows-by-features matrix; a 3D scene is transformed by 4×44\times4 matrices sixty times a second. Matrix multiplication being composition is why graphics pipelines can collapse a chain of transformations into one matrix and apply it to millions of points.

Try it
Try it: predict before you multiply

Let A=(0−110)A = \begin{pmatrix}0&-1\\1&0\end{pmatrix}, the rotation by 90∘90^\circ counterclockwise. Predict A2A^2 from the geometry, then confirm it by multiplying.

Show the answer

Prediction: two quarter-turns make a half-turn, which sends every vector v\mathbf v to −v-\mathbf v; so A2A^2 should be −I-I. Computation, row times column: entry (1,1)(1,1) is 0⋅0+(−1)⋅1=−10\cdot0 + (-1)\cdot1 = -1; entry (1,2)(1,2) is 0⋅(−1)+(−1)⋅0=00\cdot(-1) + (-1)\cdot0 = 0; entry (2,1)(2,1) is 1⋅0+0⋅1=01\cdot0 + 0\cdot1 = 0; entry (2,2)(2,2) is 1⋅(−1)+0⋅0=−11\cdot(-1) + 0\cdot0 = -1. So A2=(−100−1)=−IA^2 = \begin{pmatrix}-1&0\\0&-1\end{pmatrix} = -I, as predicted. One step further: A4=(A2)2=(−I)2=IA^4 = (A^2)^2 = (-I)^2 = I — four quarter-turns bring every vector home. Thinking in maps first turns matrix arithmetic into geometry you can check at a glance.

The Row Picture and the Column Picture

Tip
Rows give lines, columns give combinations

For a 2×22\times2 system, the row picture draws each equation as a line, and the solution is the point where the lines cross. The column picture reads Ax=x1a1+x2a2A\mathbf x = x_1\mathbf a_1 + x_2\mathbf a_2 as a combination of the columns a1,a2\mathbf a_1, \mathbf a_2, and the solution is the pair of weights that lands on b\mathbf b. Same numbers, two geometries.

The two pictures are the two ways of computing AxA\mathbf x. Entry by entry, slot ii of AxA\mathbf x is row ii dotted with x\mathbf x, so setting it equal to bib_i gives one equation — one line. All at once, AxA\mathbf x is the columns weighted by the entries of x\mathbf x. The row picture tells you where the answer is; the column picture tells you whether an answer can exist: Ax=bA\mathbf x = \mathbf b is solvable exactly when b\mathbf b lies in the span of the columns.

Example
Worked: one system, both pictures
xy−11234−2−1123(2, 1)x + 2y = 43x − y = 5
Row picture: the lines x + 2y = 4 and 3x − y = 5 cross at the solution (2, 1).

Solve x+2y=4x + 2y = 4, 3x−y=53x - y = 5. Row picture first: the lines are y=2−12xy = 2 - \tfrac12x and y=3x−5y = 3x - 5. They meet where the heights agree, 2−12x=3x−52 - \tfrac12x = 3x - 5, so 72x=7\tfrac72x = 7: x=2x = 2 and y=1y = 1.

Column picture: the columns are a1=(1,3)\mathbf a_1 = (1, 3) and a2=(2,−1)\mathbf a_2 = (2, -1), and the solution claims 2a1+1a2=b2\mathbf a_1 + 1\mathbf a_2 = \mathbf b. Check: 2(1,3)+(2,−1)=(4,5)2(1,3) + (2,-1) = (4, 5) ✓. The row picture located the point (2,1)(2, 1); the column picture reads the same numbers as a recipe — two of the first column, one of the second. Because the columns are not parallel (the determinant 1⋅(−1)−2⋅3=−71\cdot(-1) - 2\cdot3 = -7 is not 00), every b\mathbf b in the plane has exactly one such recipe.

Example
Worked: a product computed by columns

Compute AxA\mathbf x for A=(12013−1)A = \begin{pmatrix}1&2\\0&1\\3&-1\end{pmatrix} and x=(2,−1)\mathbf x = (2, -1). By columns, the entries of x\mathbf x are the weights:

Ax=2(103)−1(21−1).A\mathbf x = 2\begin{pmatrix}1\\0\\3\end{pmatrix} - 1\begin{pmatrix}2\\1\\-1\end{pmatrix}.

Combine slot by slot:

Ax=(2−20−16+1)=(0−17).A\mathbf x = \begin{pmatrix}2 - 2\\0 - 1\\6 + 1\end{pmatrix} = \begin{pmatrix}0\\-1\\7\end{pmatrix}.

Check by rows: row 1 gives 1⋅2+2⋅(−1)=01\cdot2 + 2\cdot(-1) = 0, row 2 gives 0⋅2+1⋅(−1)=−10\cdot2 + 1\cdot(-1) = -1, row 3 gives 3⋅2+(−1)(−1)=73\cdot2 + (-1)(-1) = 7 ✓. The shapes carry information too: a 3×23\times2 matrix takes vectors with 22 entries to vectors with 33, so its outputs — combinations of just two columns — fill at most a plane inside R3\mathbb R^3. Most right-hand sides in R3\mathbb R^3 are out of its reach.

Example
Worked: is b in reach?
xyza₁a₂bb′
The columns span the plane z = x + y: b lies in it, b′ sits one unit above.

Is b=(1,2,3)\mathbf b = (1, 2, 3) a combination of a1=(1,0,1)\mathbf a_1 = (1, 0, 1) and a2=(0,1,1)\mathbf a_2 = (0, 1, 1)? What about b′=(1,2,4)\mathbf b' = (1, 2, 4)? Write the general combination: c1a1+c2a2=(c1, c2, c1+c2)c_1\mathbf a_1 + c_2\mathbf a_2 = (c_1,\ c_2,\ c_1 + c_2). The first two coordinates force the weights.

For b=(1,2,3)\mathbf b = (1, 2, 3): the first two coordinates force c1=1c_1 = 1, c2=2c_2 = 2, and the third must then be c1+c2=3c_1 + c_2 = 3 — it is, so b=a1+2a2\mathbf b = \mathbf a_1 + 2\mathbf a_2 and the system Ax=bA\mathbf x = \mathbf b has the solution x=(1,2)\mathbf x = (1, 2). For b′=(1,2,4)\mathbf b' = (1, 2, 4) the same weights are forced, but the third coordinate comes out 3≠43 \ne 4: no solution. Geometrically, every combination satisfies z=x+yz = x + y, so the columns span that plane; b\mathbf b lies in it and b′\mathbf b' sits one unit above it.

Side note
Where it goes wrong: running down the columns

A common slip multiplies (1234)(56)\begin{pmatrix}1&2\\3&4\end{pmatrix}\begin{pmatrix}5\\6\end{pmatrix} by pairing x\mathbf x with the columns: (1⋅5+3⋅6, 2⋅5+4⋅6)=(23,34)(1\cdot5 + 3\cdot6,\ 2\cdot5 + 4\cdot6) = (23, 34). That is ATxA^{\mathsf T}\mathbf x, not AxA\mathbf x. Rows meet the vector: (1⋅5+2⋅6, 3⋅5+4⋅6)=(17,39)(1\cdot5 + 2\cdot6,\ 3\cdot5 + 4\cdot6) = (17, 39). The column picture catches the error at once: AxA\mathbf x must equal 5(1,3)+6(2,4)=(17,39)5(1, 3) + 6(2, 4) = (17, 39).

Try it
Try it: build the right-hand side

The system Ax=bA\mathbf x = \mathbf b with A=(1421)A = \begin{pmatrix}1&4\\2&1\end{pmatrix} has the solution x=(3,−2)\mathbf x = (3, -2). What is b\mathbf b? Find it with the column picture, then check with rows.

Show the answer

By columns, the solution's entries are the weights: b=3(12)−2(41)=(3−86−2)=(−54)\mathbf b = 3\begin{pmatrix}1\\2\end{pmatrix} - 2\begin{pmatrix}4\\1\end{pmatrix} = \begin{pmatrix}3 - 8\\6 - 2\end{pmatrix} = \begin{pmatrix}-5\\4\end{pmatrix}. By rows: 1⋅3+4⋅(−2)=−51\cdot3 + 4\cdot(-2) = -5 and 2⋅3+1⋅(−2)=42\cdot3 + 1\cdot(-2) = 4 ✓. Since the columns (1,2)(1, 2) and (4,1)(4, 1) are not parallel (1⋅1−4⋅2=−7≠01\cdot1 - 4\cdot2 = -7 \ne 0), (3,−2)(3, -2) is the only pair of weights that reaches (−5,4)(-5, 4).

Inverses and Transposes

Tip
Undo, and reverse the order

The inverse A−1A^{-1} undoes AA: A−1A=AA−1=IA^{-1}A = AA^{-1} = I, where II has ones on the diagonal and zeros elsewhere. Only a square matrix can have one. Products invert in reverse order, (AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}, and transposes reverse the same way, (AB)T=BTAT(AB)^{\mathsf T} = B^{\mathsf T}A^{\mathsf T}. To find A−1A^{-1}, row reduce [ A∣I ][\,A \mid I\,] until the left half is II; the right half is then A−1A^{-1}.

The reversal is the socks-and-shoes rule: socks go on first, so they come off last. ABAB applies BB first, so undoing it must undo AA first: (B−1A−1)(AB)=B−1(A−1A)B=B−1B=I(B^{-1}A^{-1})(AB) = B^{-1}(A^{-1}A)B = B^{-1}B = I. The Gauss–Jordan recipe works because each row operation is multiplication on the left by a simple invertible matrix. The operations that turn AA into II therefore multiply to A−1A^{-1}, and applying the same operations to II writes that product down.

Example
Worked: certifying an inverse

Show that B=(3−1−52)B = \begin{pmatrix}3&-1\\-5&2\end{pmatrix} is the inverse of A=(2153)A = \begin{pmatrix}2&1\\5&3\end{pmatrix}, then use it to solve 2x+y=42x + y = 4, 5x+3y=115x + 3y = 11. For square matrices one product suffices: if AB=IAB = I, then BA=IBA = I as well.

Row times column: entry (1,1)(1,1) is 2⋅3+1⋅(−5)=12\cdot3 + 1\cdot(-5) = 1; entry (1,2)(1,2) is 2⋅(−1)+1⋅2=02\cdot(-1) + 1\cdot2 = 0; entry (2,1)(2,1) is 5⋅3+3⋅(−5)=05\cdot3 + 3\cdot(-5) = 0; entry (2,2)(2,2) is 5⋅(−1)+3⋅2=15\cdot(-1) + 3\cdot2 = 1. So AB=IAB = I ✓. The system is Ax=(4,11)A\mathbf x = (4, 11); multiplying both sides on the left by A−1=BA^{-1} = B isolates x\mathbf x: x=B(411)=(12−11−20+22)=(12)\mathbf x = B\begin{pmatrix}4\\11\end{pmatrix} = \begin{pmatrix}12 - 11\\-20 + 22\end{pmatrix} = \begin{pmatrix}1\\2\end{pmatrix}. Check in the original equations: 2+2=42 + 2 = 4 and 5+6=115 + 6 = 11 ✓.

Example
Worked: an inverse by Gauss–Jordan

Invert A=(1237)A = \begin{pmatrix}1&2\\3&7\end{pmatrix}. Set up [12103701]\left[\begin{array}{cc|cc}1&2&1&0\\3&7&0&1\end{array}\right] and clear below the first pivot with R2←R2−3R1R_2 \gets R_2 - 3R_1: [121001−31]\left[\begin{array}{cc|cc}1&2&1&0\\0&1&-3&1\end{array}\right].

The second pivot is already 11, so clear above it: R1←R1−2R2R_1 \gets R_1 - 2R_2 gives [107−201−31]\left[\begin{array}{cc|cc}1&0&7&-2\\0&1&-3&1\end{array}\right]. The left half is II, so the right half is the inverse: A−1=(7−2−31)A^{-1} = \begin{pmatrix}7&-2\\-3&1\end{pmatrix}. Check:

(1237)(7−2−31)=(7−6−2+221−21−6+7)=I ✓\begin{pmatrix}1&2\\3&7\end{pmatrix}\begin{pmatrix}7&-2\\-3&1\end{pmatrix} = \begin{pmatrix}7 - 6 & -2 + 2\\21 - 21 & -6 + 7\end{pmatrix} = I\ \checkmark

The same march works at any size. Had a row of zeros appeared in the left half, there would be no pivot to scale to 11, and AA would have no inverse.

Example
Worked: undoing a product in the right order
BAsquarestretchthen shear
The unit square after B, then after A: to undo, unshear first, then unstretch.

Let B=(2001)B = \begin{pmatrix}2&0\\0&1\end{pmatrix} (stretch xx by 22) and A=(1101)A = \begin{pmatrix}1&1\\0&1\end{pmatrix} (shear), so AB=(2101)AB = \begin{pmatrix}2&1\\0&1\end{pmatrix} stretches, then shears. Undo each piece by geometry: B−1=(12001)B^{-1} = \begin{pmatrix}\tfrac12&0\\0&1\end{pmatrix} halves xx, and A−1=(1−101)A^{-1} = \begin{pmatrix}1&-1\\0&1\end{pmatrix} shears back.

The shear happened last, so it must be undone first:

(AB)−1=B−1A−1=(12001)(1−101)=(12−1201).(AB)^{-1} = B^{-1}A^{-1} = \begin{pmatrix}\tfrac12&0\\0&1\end{pmatrix}\begin{pmatrix}1&-1\\0&1\end{pmatrix} = \begin{pmatrix}\tfrac12&-\tfrac12\\0&1\end{pmatrix}.

Check:

(12−1201)(2101)=(112−1201)=I ✓\begin{pmatrix}\tfrac12&-\tfrac12\\0&1\end{pmatrix}\begin{pmatrix}2&1\\0&1\end{pmatrix} = \begin{pmatrix}1&\tfrac12 - \tfrac12\\0&1\end{pmatrix} = I\ \checkmark

The other order, A−1B−1=(12−101)A^{-1}B^{-1} = \begin{pmatrix}\tfrac12&-1\\0&1\end{pmatrix}, fails: ABAB sends e2\mathbf e_2 to (1,1)(1, 1), and A−1B−1A^{-1}B^{-1} sends (1,1)(1,1) to (−12,1)(-\tfrac12, 1) instead of back to e2\mathbf e_2.

Side note
Where it goes wrong: inverting term by term

(A+B)−1(A + B)^{-1} is not A−1+B−1A^{-1} + B^{-1}. Take A=B=IA = B = I: (I+I)−1=(2I)−1=12I(I + I)^{-1} = (2I)^{-1} = \tfrac12 I, while I−1+I−1=2II^{-1} + I^{-1} = 2I — off by a factor of 44. And (AB)−1=A−1B−1(AB)^{-1} = A^{-1}B^{-1} fails whenever AA and BB do not commute, as the stretch-and-shear example showed. The inverse of a product is the product of the inverses in reverse order; for a sum there is no rule at all.

Try it
Try it: a 3×3 inverse

Invert U=(110011001)U = \begin{pmatrix}1&1&0\\0&1&1\\0&0&1\end{pmatrix} by Gauss–Jordan, and check your answer.

Show the answer

Start from [ U∣I ][\,U \mid I\,]. UU is already upper triangular with every pivot equal to 11, so only upward clearing is needed, working from the last pivot up. R2←R2−R3R_2 \gets R_2 - R_3 removes the 11 above the third pivot: row 2 becomes (0,1,0∣0,1,−1)(0, 1, 0 \mid 0, 1, -1). Then R1←R1−R2R_1 \gets R_1 - R_2 removes the 11 above the second pivot: row 1 becomes (1,0,0∣1,−1,1)(1, 0, 0 \mid 1, -1, 1). Row 3 stays (0,0,1∣0,0,1)(0, 0, 1 \mid 0, 0, 1). So U−1=(1−1101−1001)U^{-1} = \begin{pmatrix}1&-1&1\\0&1&-1\\0&0&1\end{pmatrix}. Check row 1 of UU−1UU^{-1}: (1,1,0)(1, 1, 0) against the three columns gives (1+0, −1+1, 1−1)=(1,0,0)(1 + 0,\ -1 + 1,\ 1 - 1) = (1, 0, 0) ✓, and rows 2 and 3 work the same way. The alternating signs have a reason: undoing "add the next coordinate" means subtracting it, then adding back what that subtraction took away.

Proofs & Why It Matters

Tip
Proof: matrix multiplication is composition

Let TAT_A and TBT_B be the maps x↦Ax\mathbf x \mapsto A\mathbf x and x↦Bx\mathbf x \mapsto B\mathbf x. Column jj of ABAB is A(Bej)A(B\mathbf e_j) — feed the jjth basis vector through BB, then through AA.

But a linear map is determined by where it sends basis vectors, so the matrix whose columns are A(Bej)A(B\mathbf e_j) Is the matrix of TA∘TBT_A\circ T_B. The row-times-column rule is just this computed entry by entry — and composition of maps is famously order-sensitive, which is why AB≠BAAB \ne BA. ■\blacksquare

Tip
Proof: row operations preserve solutions

Each operation is reversible: swapping rows swaps back; scaling by c≠0c \ne 0 undoes by 1c\tfrac1c; adding cc(row ii) to row jj undoes by subtracting. A solution of the old system satisfies every new equation (each new row is a combination of old rows), and reversibility gives the converse. So the solution set never changes on the way to echelon form. ■\blacksquare

Going Deeper: Explanations & Worked Problems

Concept
What a matrix does: track the basis vectors
xAe₁ = (2, 0)Ae₂ = (1, 3)area 6
The dashed unit square and its image: the parallelogram on (2, 0) and (1, 3), area 6.

Everything about AxA\mathbf x is visible in two special inputs. Feed in e1=(1,0)\mathbf e_1 = (1,0): out comes the first column of AA. Feed in e2=(0,1)\mathbf e_2 = (0,1): the second column.

Any other input is a combination x=x1e1+x2e2\mathbf x = x_1\mathbf e_1 + x_2\mathbf e_2, and linearity forces Ax=x1(col1)+x2(col2)A\mathbf x = x_1(\text{col}_1) + x_2(\text{col}_2) — matrix-times-vector is a weighted sum of columns. Example: A=(2103)A = \begin{pmatrix}2&1\\0&3\end{pmatrix} sends the unit square spanned by e1,e2\mathbf e_1, \mathbf e_2 to the parallelogram spanned by (2,0)(2,0) and (1,3)(1,3): the plane is stretched, sheared, and every area is multiplied by ∣det⁡A∣=6|\det A| = 6. This picture explains the multiplication rule too: the columns of ABAB are AA applied to the columns of BB — do BB first, then AA — which is why ABAB and BABA genuinely differ: shear-then-rotate is not rotate-then-shear.

Example
Worked: a full 2×2 product, entry by entry

Compute ABAB for A=(1234)A = \begin{pmatrix}1&2\\3&4\end{pmatrix}, B=(0152)B = \begin{pmatrix}0&1\\5&2\end{pmatrix}. Entry (1,1)(1,1): row 11 of AA dot column 11 of BB: 1⋅0+2⋅5=101\cdot0 + 2\cdot5 = 10. Entry (1,2)(1,2): row 11 dot column 22: 1⋅1+2⋅2=51\cdot1 + 2\cdot2 = 5. Entry (2,1)(2,1): row 22 dot column 11: 3⋅0+4⋅5=203\cdot0 + 4\cdot5 = 20.

Entry (2,2)(2,2): 3⋅1+4⋅2=113\cdot1 + 4\cdot2 = 11. So AB=(1052011)AB = \begin{pmatrix}10&5\\20&11\end{pmatrix}. Now the other order: BA=(0⋅1+1⋅30⋅2+1⋅45⋅1+2⋅35⋅2+2⋅4)=(341118)BA = \begin{pmatrix}0\cdot1+1\cdot3 & 0\cdot2+1\cdot4\\ 5\cdot1+2\cdot3 & 5\cdot2+2\cdot4\end{pmatrix} = \begin{pmatrix}3&4\\11&18\end{pmatrix} — completely different, as composition order predicts. One determinant check seals both: det⁡A⋅det⁡B=(−2)(−5)=10\det A\cdot\det B = (-2)(-5) = 10, and det⁡(AB)=10⋅11−5⋅20=10\det(AB) = 10\cdot11 - 5\cdot20 = 10 ✓.

Example
Worked: solving a system as a matrix question

Solve 2x+y=72x + y = 7, x−y=2x - y = 2 three compatible ways.

Way 1 — elimination: add the equations to kill yy: 3x=93x = 9, so x=3x = 3, then y=7−6=1y = 7 - 6 = 1.

Way 2 — inverse matrix: A=(211−1)A = \begin{pmatrix}2&1\\1&-1\end{pmatrix} has det⁡A=−2−1=−3\det A = -2 - 1 = -3, so A−1=1−3(−1−1−12)A^{-1} = \tfrac{1}{-3}\begin{pmatrix}-1&-1\\-1&2\end{pmatrix}, and x=A−1(72)=1−3(−9−3)=(31)\mathbf x = A^{-1}\begin{pmatrix}7\\2\end{pmatrix} = \tfrac{1}{-3}\begin{pmatrix}-9\\-3\end{pmatrix} = \begin{pmatrix}3\\1\end{pmatrix}.

Way 3 — column picture: find weights making x(21)+y(1−1)=(72)x\begin{pmatrix}2\\1\end{pmatrix} + y\begin{pmatrix}1\\-1\end{pmatrix} = \begin{pmatrix}7\\2\end{pmatrix}; the weights 33 and 11 work. Three languages, one answer (3,1)(3, 1) — and fluency means moving between them at will.