Linear Algebra · 18 min

A Matrix Is a Transformation

Two arrows are enough to record any linear move on 2D space. Drag them, and you've written every 2×2 matrix that exists.

0 / 0

Drag the two arrows. Everything is here.

Two draggable arrows. The faint grid behind them is 2D space, transformed live. The filled shape is the unit square (the unit-corner box at the origin) under the same transformation.

A · drag the two column-arrows to define the matrix

-3-2-1123-2-112
[
1.00 0.00 0.00 1.00
]
det
1.00
rank
2

Quests, in order:

  1. Press I. Nothing moves. The arrows sit at [1,0][1, 0] and [0,1][0, 1]. This is “do nothing.”
  2. Press rot 90°. The whole space turns ninety degrees. Notice both arrows turned together.
  3. Press shear. The grid tilts. One arrow stayed put; the other slid sideways.
  4. Press collapse. The unit square flattens to a line. Space lost a dimension.
  5. Drag column 1 across the origin. The shape’s fill flips: orientation reversed.

You just wrote down five matrices without seeing a single number. That’s the point of the lesson.

What you just discovered.

Every transformation you ran is fully described by two arrows: wherever the two columns ended up.

That pair of arrows is the matrix. The first column tells you where the arrow [1,0][1, 0] landed (we’ll call it ı^\hat{\imath}, “i-hat”). The second column tells you where [0,1][0, 1] landed (ȷ^\hat{\jmath}, “j-hat”).

A  =  [  where ı^ went    where ȷ^ went  ].A \;=\; \bigl[\; \text{where }\hat{\imath}\text{ went} \;\big|\; \text{where }\hat{\jmath}\text{ went} \;\bigr].

That’s the entire object. A matrix isn’t a 4-number grid you memorize formulas about. It’s a record of where two arrows landed, and every other fact about it is downstream of those two arrows.

Read off a matrix.

Suppose a transformation sends ı^[2,0]\hat{\imath} \mapsto [2, 0] and ȷ^[1,3]\hat{\jmath} \mapsto [1, 3].

Write it as a 2×2 matrix. What’s the entry at row 2, column 2?

Linearity, after the fact.

Two things you might have noticed while playing, both of which turn out to be the definition of what makes a transformation “linear.”

The origin always stays put. No preset moves the corner of the unit square that sits at (0,0)(0, 0). You can’t translate space with a linear transformation; only the directions of the arrows change.

Grid lines stay straight, evenly spaced. Rotate, shear, scale, collapse: the grid’s spacing may change, but the lines themselves stay lines. Nothing bends.

Both rules together are the formal definition: a transformation TT is linear if, for all vectors u,v\mathbf{u}, \mathbf{v} and scalars cc:

T(u+v)=T(u)+T(v),T(cv)=cT(v).T(\mathbf{u} + \mathbf{v}) = T(\mathbf{u}) + T(\mathbf{v}), \qquad T(c\, \mathbf{v}) = c\, T(\mathbf{v}).

You were obeying both axioms with your fingers the whole time. The axioms are the bookkeeping; the widget is the thing.

(Aside: the function f(x)=mx+bf(x) = mx + b from precalc is not linear in this sense when b0b \ne 0; it shifts the origin. It’s affine, meaning linear plus a translation. Mathematicians are picky about this; ML people use “linear layer” to mean “affine layer” all the time, and we just live with it.)

Multiplying by a vector: the column picture.

You know the matrix is two columns. Now: what does AxA\mathbf{x} actually mean?

If x=[x1,x2]\mathbf{x} = [x_1, x_2], then x\mathbf{x} is ”x1x_1 steps along ı^\hat{\imath}, then x2x_2 steps along ȷ^\hat{\jmath}.” After the transformation, ı^\hat{\imath} and ȷ^\hat{\jmath} have moved; they’re now the columns of AA. Linearity means the recipe survives: take the same x1x_1 steps along the new ı^\hat{\imath}, then x2x_2 steps along the new ȷ^\hat{\jmath}.

Ax  =  x1a1+x2a2A\mathbf{x} \;=\; x_1\, \mathbf{a}_1 \,+\, x_2\, \mathbf{a}_2

where a1,a2\mathbf{a}_1, \mathbf{a}_2 are the columns. Matrix-vector multiplication is a weighted sum of the columns. That’s the whole geometric meaning. Read AxA\mathbf{x} as “blend the columns of AA in proportions given by x\mathbf{x}.”

Blend two columns.

For A=[2103]A = \begin{bmatrix}2 & 1 \\ 0 & 3\end{bmatrix} and x=[4,1]\mathbf{x} = [4, -1]:

Blend 44 of column 1 with 1-1 of column 2. What’s the first component of the result?

The row picture: a faster way to compute the same thing.

Same answer, different bookkeeping. If you only want the ii-th output component, you can dot the ii-th row of AA with x\mathbf{x}:

(Ax)i  =  jAijxj.(A\mathbf{x})_i \;=\; \sum_j A_{ij}\, x_j.

This is the formula every textbook leads with. It’s faster to compute by hand and it gives the same answer. But it hides the geometry behind arithmetic; you wouldn’t have learned anything new about matrices from staring at it.

The move: column picture for thinking, row picture for computing. When you’re trying to understand what a matrix does, blend the columns. When you’re trying to compute the answer, dot the rows.

Name the matrices you already built.

Reopen the widget if you want. Each preset has a name and a formula. You don’t memorize these; you draw the transformation, read off the columns, write them down.

  • Identity (II): ı^\hat{\imath} stays at [1,0][1, 0], ȷ^\hat{\jmath} stays at [0,1][0, 1]. Matrix: [1001]\begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}.
  • Scale by ss: both arrows triple in length. Matrix: [s00s]\begin{bmatrix}s & 0 \\ 0 & s\end{bmatrix}.
  • Rotation by θ\theta: ı^\hat{\imath} moves to [cosθ,sinθ][\cos\theta, \sin\theta]. Matrix: [cosθsinθsinθcosθ]\begin{bmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta\end{bmatrix}.
  • Horizontal shear: ı^\hat{\imath} stays put; ȷ^\hat{\jmath} slides to [k,1][k, 1]. Matrix: [1k01]\begin{bmatrix}1 & k \\ 0 & 1\end{bmatrix}.
  • Reflection across the xx-axis: ȷ^\hat{\jmath} flips down to [0,1][0, -1]. Matrix: [1001]\begin{bmatrix}1 & 0 \\ 0 & -1\end{bmatrix}.

Try this in the widget: drag the columns to make a 90°90° counterclockwise rotation by hand. ı^\hat{\imath} goes to [0,1][0, 1]. ȷ^\hat{\jmath} goes to [1,0][-1, 0]. That’s it. That’s the whole matrix.

Rotation by inspection.

Without computing anything: the matrix that rotates every vector 90°90° counterclockwise.

What’s the entry at row 1, column 2?

Collapse: what it looks like to lose a dimension.

Reopen the widget and press collapse again. The two columns end up parallel; the unit square is squashed flat into a line. Whatever was 2D before is now 1D.

When the columns of a matrix span only a line (or a point), the matrix has rank less than 2. Specifically:

  • Both columns linearly independent → rank 2, full rank, the transformation reaches every direction.
  • Columns parallel (one is a scalar multiple of the other) → rank 1, the transformation flattens 2D space to a line.
  • Both columns are the zero arrow → rank 0, everything goes to the origin.

Rank measures how much space the transformation can reach. Losing rank is the geometric event behind every “this matrix is singular” / “this system has no unique solution” warning you’ll meet for the rest of linear algebra.

Drag the two columns until they’re nearly aligned. Watch the det readout drop toward zero. Determinant is rank’s continuous cousin; we’ll meet it formally next lesson, but you’ve already seen it move.

Lesson complete

Nice tinkering.