A matrix as a function
A matrix is a rectangle of numbers. A 2×2 matrix A = [[a, b], [c, d]] can act as a function: give it a vector ⟨x, y⟩ and it gives back
A⟨x, y⟩ = ⟨ax + by, cx + dy⟩
Each output part is a row of the matrix "times" the input (multiply matching numbers, then add). Such a function is called a linear transformation: it keeps the origin fixed, keeps straight lines straight, and keeps evenly spaced grid lines evenly spaced.
Columns, common transformations and composition
Put in i = ⟨1, 0⟩: you get ⟨a, c⟩, the first column. Put in j = ⟨0, 1⟩: you get ⟨b, d⟩, the second column. So to build a matrix, ask "where should i go?" and "where should j go?" and write those as columns.
- Stretch by k in x: [[k, 0], [0, 1]]
- Reflect in the x-axis: [[1, 0], [0, −1]]; in the line y = x: [[0, 1], [1, 0]]
- Rotate by θ anticlockwise: [[cos θ, −sin θ], [sin θ, cos θ]]
- Shear: [[1, k], [0, 1]] slides points sideways by k times their height
Composition: doing B first, then A, is the single matrix AB (the one done first goes on the right). Order matters: usually AB ≠ BA.
Determinant and inverse
The determinant det A = ad − bc. The unit square (area 1) becomes a parallelogram with area |ad − bc|. A negative determinant means the shape was also flipped over.
If det A ≠ 0, A has an inverse A⁻¹ that undoes it:
A⁻¹ = (1 ÷ (ad − bc)) × [[d, −b], [−c, a]]
Swap a and d, change the signs of b and c, then divide by the determinant. If det A = 0, the plane is squashed onto a line (or a point), information is lost, and no inverse exists.
Matrices modelling contexts
A transition matrix describes how things move between states in one time step. Example: each year 90% of people in City A stay and 10% move to City B; 70% of City B stays and 30% moves to A. With shares written as a row ⟨A, B⟩:
next = ⟨A, B⟩ × [[0.9, 0.1], [0.3, 0.7]] = ⟨0.9A + 0.3B, 0.1A + 0.7B⟩
Starting at ⟨0.5, 0.5⟩: year 1 gives ⟨0.6, 0.4⟩, year 2 gives ⟨0.66, 0.34⟩, and the shares slowly settle at ⟨0.75, 0.25⟩, a steady state that the matrix leaves unchanged. To go back one year, multiply by the inverse.
Try it: In 3D step 5 press "Next year" again and again, and predict the next bar heights before you press.
Key formulas and definitions
- [[a, b], [c, d]]⟨x, y⟩ = ⟨ax + by, cx + dy⟩
- Column 1 = image of ⟨1, 0⟩; column 2 = image of ⟨0, 1⟩
- Rotation by θ: [[cos θ, −sin θ], [sin θ, cos θ]]
- det A = ad − bc = area scale factor
- A⁻¹ = (1/(ad − bc)) [[d, −b], [−c, a]]
- B then A = AB (order matters)
Worked examples
1. A = [[3, −1], [2, 4]]. Find A⟨2, 1⟩.
Top: 3·2 + (−1)·1 = 5. Bottom: 2·2 + 4·1 = 8. Answer ⟨5, 8⟩.
2. Write the matrix that sends i to ⟨2, 1⟩ and j to ⟨−1, 3⟩.
The columns are the images: [[2, −1], [1, 3]].
3. Find the matrix that rotates by 90° anticlockwise and use it on ⟨3, 1⟩.
cos 90° = 0, sin 90° = 1, so [[0, −1], [1, 0]]. ⟨3, 1⟩ → ⟨0·3 − 1·1, 1·3 + 0·1⟩ = ⟨−1, 3⟩.
4. A triangle has area 6. It is transformed by [[2, 1], [1, 3]]. Find the new area.
det = 2·3 − 1·1 = 5. New area = 5 × 6 = 30.
5. Find the inverse of A = [[4, 7], [2, 6]].
det = 24 − 14 = 10. A⁻¹ = (1/10)[[6, −7], [−2, 4]] = [[0.6, −0.7], [−0.2, 0.4]].
6. With the city matrix [[0.9, 0.1], [0.3, 0.7]] and start shares ⟨0.6, 0.4⟩, find next year's shares.
A: 0.6·0.9 + 0.4·0.3 = 0.54 + 0.12 = 0.66. B: 0.6·0.1 + 0.4·0.7 = 0.06 + 0.28 = 0.34. Next year ⟨0.66, 0.34⟩.
Common mistakes
- Reading the rows as the images of i and j. The images are the COLUMNS.
- Writing composition in the wrong order: "B then A" is AB, not BA.
- In the inverse, swapping b and c instead of a and d. Swap the main diagonal (a, d); only change the signs of b and c.
- Forgetting that det = 0 means no inverse, or forgetting to take |det| for area when the determinant is negative.