Part II — Linear Algebra & Matrix Decompositions · Chapter 2

Matrices as linear transformations

Hook

A function takes a number to a number. What does a function from arrows to arrows look like?

Intuition
v = (3.0, 2.0) → Mv = (-2.0, 3.0)

Drag vv anywhere. MvMv always stays exactly 90°90° ahead of it — the matrix isn't picking a new direction each time, it's applying the same fixed rule to whatever you hand it.

Formalize

A 2×22\times2 matrix is that fixed rule —

M=(abcd),Mv=(avx+bvycvx+dvy)M = \begin{pmatrix} a & b \\ c & d \end{pmatrix}, \qquad Mv = \begin{pmatrix} a\,v_x + b\,v_y \\ c\,v_x + d\,v_y \end{pmatrix}
  • MM — the 2×22\times2 matrix representing the transformation.
  • a,b,c,da, b, c, d — the four entries of MM that determine what kind of transformation it performs.
  • vv — the input vector being transformed, with components vx,vyv_x, v_y.
  • MvMv — the output vector after applying the transformation.
  1. Each output is a weighted mix

    Each output component is a weighted mix of vv's own components.

  2. The entries decide the transformation

    Change a,b,c,da,b,c,d and you change what kind of transformation it is — a stretch, a rotation, a shear, or a projection that collapses a whole dimension away.

Play
M = [[0, -1], [1, 0]] → Mv = (-2.0, 3.0)

Switch matrices and drag vv around each time. The same arrow gets rotated, stretched, sheared, or flattened onto an axis depending only on which numbers are sitting in MM.

Worked example

With M=(2000.5)M = \begin{pmatrix} 2 & 0 \\ 0 & 0.5 \end{pmatrix} (the "Scale" preset) and v=(3,4)v=(3,4):

  1. Multiply the matrix by the vector
    Mv=(2(3)+0(4)0(3)+0.5(4))=(62)Mv = \begin{pmatrix} 2(3) + 0(4) \\ 0(3) + 0.5(4) \end{pmatrix} = \begin{pmatrix} 6 \\ 2 \end{pmatrix}
  2. Read what each component did

    The xx-component doubled, the yy-component halved — exactly what a diagonal matrix does: scale each axis independently. Push that idea further — set the second diagonal entry to exactly 00, as in the "Project" preset — and the yy-component vanishes entirely: every vector collapses onto the xx-axis. Projection is just a transformation with nothing left in one direction.

Checkpoint

Drag v until Mv lands on (4, 3), using the 90° rotation matrix.

Mv = (-2.0, 3.0)
Drag v to try it
Summary
Mv=(avx+bvycvx+dvy)Mv = \begin{pmatrix} a\,v_x + b\,v_y \\ c\,v_x + d\,v_y \end{pmatrix}

A matrix is a fixed rule for turning any vector into another one. The same four numbers, applied consistently, are all it takes to rotate, stretch, shear, or project every arrow in the plane.