01 / 21

Composition of
Transformations

Learn how combining linear transformations works through matrix multiplication, and discover why order matters when composing maps.

Linear Algebra

What Is a Linear Transformation?

A linear transformation is a function \( T: \mathbb{R}^n \to \mathbb{R}^m \) that preserves two key operations: vector addition and scalar multiplication.

Every linear transformation from \(\mathbb{R}^n\) to \(\mathbb{R}^m\) can be represented by an \(m \times n\) matrix. The transformation \(T(\mathbf{x}) = A\mathbf{x}\) maps input vectors by matrix multiplication.

Seeing a Transformation in Action

Original
\(e_1\)
\(e_2\)
T Transformed
\(T(e_1)\)
\(T(e_2)\)

What Is Composition?

When you apply one transformation and then another, you are composing them. If \(S\) and \(T\) are linear transformations, the composition \(S \circ T\) means: first apply \(T\), then apply \(S\).

x T(x) S(T(x)) y
\((S \circ T)(x) = S(T(x))\)

Core Theorem: Matrix Product

This is the deep reason matrix multiplication exists: it was invented precisely to represent composition of linear maps. The product \(AB\) encodes "first apply \(B\), then apply \(A\)."

Why \(AB\) Equals Composition

1
Start with input \(\mathbf{x}\). Apply \(T\) first: compute \(B\mathbf{x}\) to get a new vector.
2
Apply \(S\) to the result. Compute \(A(B\mathbf{x})\). By associativity, this equals \((AB)\mathbf{x}\).
3
Conclude: The single matrix \(AB\) performs both transformations in one step. No information is lost.

Order Matters: \(AB \neq BA\)

Unlike scalar multiplication, matrix multiplication is not commutative. Composing transformations in a different order generally gives a different result.

Rotate, then Shear
\(AB\)
Shear, then Rotate
\(BA\)
≠

Properties of Composition

✓ Associative
\((AB)C = A(BC)\): grouping does not matter.
✕ Not Commutative
\(AB \neq BA\) in general: order matters.
✓ Distributive
\(A(B+C) = AB + AC\): distributes over addition.

How to Compute a Composition

1
Identify the matrices. Write \(A\) for the outer (second) transformation and \(B\) for the inner (first) transformation.
2
Check dimensions. If \(A\) is \(m \times n\) and \(B\) is \(n \times p\), the product \(AB\) will be \(m \times p\).
3
Multiply. Entry \((AB)_{ij}\) = row \(i\) of \(A\) dotted with column \(j\) of \(B\): \(\sum_k a_{ik}\,b_{kj}\).
4
Verify. Test on a known vector: compute \(A(B\mathbf{x})\) and \((AB)\mathbf{x}\) separately. They must agree.

Example 1: Simple Composition

Let \( A = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix} \) (shear) and \( B = \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} \) (scale). Find the matrix of \( S \circ T \) where \( T(\mathbf{x}) = B\mathbf{x} \) and \( S(\mathbf{x}) = A\mathbf{x} \).

Example 2: Rotation then Reflection

Let \( R_{90} = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \) (90° rotation) and \( M = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \) (reflect over \(x\)-axis). Find \( M \circ R_{90} \).

Now try the reverse order: \( R_{90} \circ M \).

\(MR_{90} \neq R_{90}M\): one reflects across \(y = -x\), the other across \(y = x\). Order matters!

Example 3: Composing in \(\mathbb{R}^3\)

Let \( A = \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \) and \( B = \begin{bmatrix} 1 & 0 & 0 \\ 3 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix} \). Find \(AB\).

Geometric Chain of Transformations

Original Scale Scaled Rotate Rotated Reflect Final

Each transformation is a matrix. The entire chain can be collapsed into a single matrix \(C = M_3 \cdot M_2 \cdot M_1\). This single matrix maps any vector from the original space directly to the final result.

Determinants and Area Scaling

The determinant tells you how a transformation scales area (in 2D) or volume (in 3D). For a composition:

\(\det > 0\)
Orientation is preserved: the transformation does not "flip" the plane.
\(\det < 0\)
Orientation is reversed: a reflection is involved somewhere.

Common Mistakes

✕ Wrong Order
Writing \(BA\) when you mean "first \(B\), then \(A\)." The correct product is \(AB\): the left matrix acts second.
✕ Assuming Commutativity
Assuming \(AB = BA\). This is almost never true. Always verify or state that the order is intentional.
✕ Dimension Mismatch
Trying to multiply \(A_{m \times n}\) by \(B_{p \times q}\) when \(n \neq p\). The inner dimensions must match.

Summary Table

Property Scalar Functions Linear Transformations
Notation \(f \circ g\) \(S \circ T\) or \(AB\)
Meaning \(f(g(x))\) \(A(B\mathbf{x})\)
Associative? Yes Yes
Commutative? Generally no Generally no
Identity \(f(x) = x\) \(I\) (identity matrix)
Inverse \(f^{-1}\) \(A^{-1}\) (if exists)

Question 1 of 5

If \( T(\mathbf{x}) = B\mathbf{x} \) and \( S(\mathbf{x}) = A\mathbf{x} \), which matrix represents \( S \circ T \)?

Question 2 of 5

Let \( A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \) and \( B = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} \). What is \(AB\)?

Question 3 of 5

Which property does matrix multiplication not satisfy in general?

Question 4 of 5

If \(\det(A) = 3\) and \(\det(B) = -2\), what is \(\det(AB)\)?

Question 5 of 5

If \(A\) is \(3 \times 2\) and \(B\) is \(2 \times 4\), what are the dimensions of \(AB\)?