Matrices as movements of space
Why this matters
So far a matrix has been a table, and multiplying by it a calculation. There's a second way to see it that makes much of linear algebra click: a matrix is a movement. Multiply every point of the plane by the same 2 × 2 matrix and the whole plane stretches, flips, slants or turns, with straight lines staying straight and the origin staying put. Read this way, a matrix's columns tell you at a glance what it does, two movements in a row are one matrix product, and a layer of a neural network is a movement of all its data at once, chosen during training so that the next step finds the data easier to sort.
- See a 2 × 2 matrix as a movement of the plane: a stretch, flip, shear or rotation
- Read a matrix's columns as where the two unit arrows land, and write a rotation with cos θ and sin θ
- Apply a matrix to many points at once, and chain two movements by multiplying their matrices
- See a layer as a movement of the data that can make two groups easier to split, and move a batch of points with PyTorch's points @ M.T
The math: what a matrix does to the plane
Purpose. See what a matrix does, not just what it holds.
Multiply every point (x, y) by a 2 × 2 matrix and the whole plane moves. Four basic movements:
- Stretch: [[2, 0], [0, 1]] doubles every x and keeps y, pulling the plane sideways.
- Flip: [[1, 0], [0, −1]] keeps x and negates y, a mirror in the x-axis: (2, 3) goes to (2, −3).
- Shear: [[1, 1], [0, 1]] adds y to x, slanting squares into parallelograms: (1, 2) goes to (3, 2).
- Rotation: [[0, −1], [1, 0]] turns everything a quarter turn counterclockwise: (3, 1) goes to (−1, 3).
The origin never moves, since anything times (0, 0) is (0, 0), and straight lines stay straight.