Module 6 · Lesson 6.1

Matrix Multiplication as Composition of Transformations

Discover how matrix multiplication represents applying two or more space transformations in sequence, and why order matters when composing linear operations.

Intuition

In traditional algebra courses, matrix multiplication is often introduced as a tedious recipe of multiplying rows by columns. But geometrically, multiplying matrices has a clean, physical meaning: composing linear transformations.

Imagine applying a spatial transformation $B$ to a grid—such as stretching it horizontally. Next, imagine applying a second transformation $A$—such as rotating the space by $90^\circ$. Instead of applying these two transformations one after another to every point in space, we can compute a single combined matrix $C = AB$ that accomplishes both actions in one step.

Core concept

Matrix multiplication reads from right to left: in the expression $(AB)\vec{v}$, transformation $B$ acts on vector $\vec{v}$ first, and transformation $A$ acts on the result second.

  • Step 1 (First action $B$): Maps initial vector $\vec{v}$ to intermediate position $B\vec{v}$.
  • Step 2 (Second action $A$): Maps intermediate position $B\vec{v}$ to final position $A(B\vec{v})$.
  • Composite Matrix $C = AB$: A single matrix that transforms $\vec{v}$ directly to $A(B\vec{v})$.
  • Non-Commutativity ($AB \neq BA$): Changing the order of transformations usually changes the final result.
Initial Vector $\vec{v}$$\begin{pmatrix} 1 \\ 1 \end{pmatrix}$
Transform $B$ (Scale X by 2)$\begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix}$
Intermediate $B\vec{v}$$\begin{pmatrix} 2 \\ 1 \end{pmatrix}$
Transform $A$ (Rotate $90^\circ$)$\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$
Composite $C = AB$$\begin{pmatrix} 0 & -1 \\ 2 & 0 \end{pmatrix}$
Final $C\vec{v} = A(B\vec{v})$$\begin{pmatrix} -1 \\ 2 \end{pmatrix}$

Interactive Lab

Select transformations $B$ (first action) and $A$ (second action). Drag the progress slider or click Animate to see how space transforms step-by-step, or click "Compare AB vs BA" to visually experience why order matters.

Matrix $B$ (First) [ 2, 0 | 0, 1 ]
Matrix $A$ (Second) [ 0, -1 | 1, 0 ]
Product $C = AB$ [ 0, -1 | 2, 0 ]
Reversed $BA$ [ 0, -2 | 1, 0 ]

Key Idea

$$ (A B) \vec{v} = A (B \vec{v}) $$ $$ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} e & f \\ g & h \end{pmatrix} = \begin{pmatrix} ae + bg & af + bh \\ ce + dg & cf + dh \end{pmatrix} $$

The mechanics of matrix multiplication—multiplying rows of the first matrix by columns of the second—calculate where the transformed basis vectors end up after two consecutive spatial moves.

$B$The initial linear transformation matrix applied first to space
$A$The second linear transformation matrix applied to the result of $B$
$AB$The combined matrix performing both transformations in sequence
$\vec{v}$The initial input column vector in original space coordinates
$B\vec{v}$The intermediate position vector after applying transformation $B$
$(AB)\vec{v}$The final position vector after applying $B$ followed by $A$

Think Further

  1. In nested notation $A(B\vec{v})$, why is matrix multiplication evaluated from right to left rather than left to right?
  2. Is matrix multiplication commutative? That is, does $AB = BA$ for all $2 \times 2$ matrices? Give a geometric explanation.
  3. In 3D animation, object models undergo scaling, rotation, and camera placement. How does matrix composition optimize performance when rendering thousands of mesh vertices per frame?
Show suggested answers
  1. In standard mathematical function notation $f(g(x))$, the inner function $g(x)$ acts first on input $x$, and the outer function $f$ acts second on that result. Writing matrix composition as $A B \vec{v}$ follows this exact nested functional structure.
  2. No, matrix multiplication is generally non-commutative ($AB \neq BA$). For example, stretching horizontally ($B$) then rotating $90^\circ$ ($A$) moves the stretched axis to the vertical orientation. But rotating $90^\circ$ first ($A$) and then stretching horizontally ($B$) stretches what was originally the vertical axis, producing a totally different outcome.
  3. Rather than executing three separate matrix-vector multiplications for every single vertex in a complex 3D model, graphics engines multiply the transformation matrices together once ($M = M_{\text{proj}} M_{\text{view}} M_{\text{model}}$). Applying this single composite matrix $M$ to each vertex cuts calculation overhead dramatically.