Doing one plane map after another gives a new map. This is where matrix multiplication comes from, and it explains why the order of a product matters.
If $T(\mathbf{x}) = A\mathbf{x}$ and $S(\mathbf{x}) = B\mathbf{x}$, the composition $S \circ T$ means "first $T$, then $S$": $(S \circ T)(\mathbf{x}) = S(T(\mathbf{x}))$.
Key idea
Why it works
Worked example: Rotate, then reflect
- Rotation: $A = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}$. Reflection: $B = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}$.
- First $A$, then $B$: $BA$ $= \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}$ $= \begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}$.
- Check with $\mathbf{e}_1$: rotating gives $(0, 1)$; reflecting that gives $(0, -1)$, which is column 1 of $BA$. ✓
- The result is the reflection across $y = -x$.
Answer: $\begin{bmatrix} 0 & -1 \\ -1 & 0 \end{bmatrix}$
Worked example: The other order
- $AB$ $= \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}$ $= \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$: the reflection across $y = x$.
- A different map, so $AB \neq BA$. The pictures below show both.
Answer: $\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$
Worked example: Angle addition from matrices
- $$R_\beta R_\alpha = \begin{bmatrix} \cos\beta & -\sin\beta \\ \sin\beta & \cos\beta \end{bmatrix}\begin{bmatrix} \cos\alpha & -\sin\alpha \\ \sin\alpha & \cos\alpha \end{bmatrix}$$
- The top-left entry is $\cos\beta\cos\alpha - \sin\beta\sin\alpha$, and the bottom-left is $\sin\beta\cos\alpha + \cos\beta\sin\alpha$.
- Geometrically the product is $R_{\alpha + \beta}$, whose first column is $(\cos(\alpha + \beta), \sin(\alpha + \beta))$. Matching entries gives the angle addition formulas.
Answer: $\cos(\alpha + \beta) = \cos\alpha\cos\beta - \sin\alpha\sin\beta$
Common mistake
The same rule works for longer chains and for maps between different spaces. "First $A$, then $B$, then $C$" is $CBA$. If $T: \mathbb{R}^n \to \mathbb{R}^m$ and $S: \mathbb{R}^m \to \mathbb{R}^p$, then $A$ is $m \times n$, $B$ is $p \times m$, and $BA$ is $p \times n$: the sizes match exactly because the output space of $T$ is the input space of $S$. To undo a chain, undo the last step first: $(BA)^{-1} = A^{-1}B^{-1}$.