Composing Transformations

Do one transformation, then another. Applying B and then A to a vector means computing A(B\vec{x}) — and there is a single matrix that does both in one step. It is exactly the matrix product:

A(B\vec{x}) = (AB)\vec{x}.

So that strange "row dot column" rule was never arbitrary — it's engineered precisely so that the product matrix performs the two motions back to back. Note the order: the matrix applied first sits on the right, nearest the vector.

Order changes everything

Here R is a rotation and S a horizontal stretch. Flip the toggle to compose them both ways. "Rotate then stretch" (SR) lands the grid somewhere quite different from "stretch then rotate" (RS) — the very reason matrix multiplication isn't commutative.

Chains of motion

Any sequence of linear moves — rotate, scale, shear, reflect, in any order — collapses into one matrix, their product. This is why graphics engines multiply a stack of matrices into a single one before drawing, and why a deep neural network is, layer by layer, a chain of matrix products with a little nonlinearity sprinkled between. One matrix, many motions.