Understanding Composition Through Matrices
Have you ever used a map app to turn by turn travel from one place to another, then another place after that? students, in linear algebra, a matrix can do something similar with points, vectors, and data 🔢. This lesson explains how matrices represent transformations and how doing one transformation after another is called composition. By the end, you should be able to explain what matrix composition means, connect it to matrix multiplication, and use it to model real situations like rotations, reflections, and scaling.
What Composition Means in Linear Algebra
In everyday language, composition means combining actions in order. If you first stretch a rubber band and then rotate it, the final result depends on both actions and on the order you use them. In linear algebra, a transformation is a rule that takes a vector and produces a new vector. When we apply one transformation and then another, we are composing them.
Suppose $T$ and $S$ are transformations. Their composition is written as $T \circ S$. This means “apply $S$ first, then apply $T$.” The order matters because $T \circ S$ is generally not the same as $S \circ T$. That is one of the most important ideas in this topic.
For example, imagine a drawing of a shape on graph paper. If you rotate the shape and then stretch it, the result may look very different from stretching first and then rotating. The same happens with vectors. Composition tells us how multiple changes combine into a single overall change.
Matrices help us study composition because each linear transformation can be represented by a matrix. If one transformation is represented by $A$ and another by $B$, then applying $B$ first and then $A$ is represented by the matrix product $AB$. So matrix multiplication is not just arithmetic with tables of numbers—it is the algebraic way to describe combining transformations.
Matrices as Transformation Machines
A matrix can be thought of as a machine that takes an input vector and produces an output vector. For a vector $\mathbf{x}$, the output is $A\mathbf{x}$, where $A$ is a matrix. If $A$ is a $2 \times 2$ matrix, it transforms vectors in the plane. If it is a $3 \times 3$ matrix, it transforms vectors in three-dimensional space.
Here is a simple example. Let
$$
A = $\begin{bmatrix}2$ & 0 \ 0 & $1\end{bmatrix}$.
$$
This matrix doubles the $x$-coordinate and leaves the $y$-coordinate unchanged. So the vector $\begin{bmatrix}3 \\ 4\end{bmatrix}$ becomes
$$
A$\begin{bmatrix}3$ \ $4\end{bmatrix}$ = $\begin{bmatrix}6$ \ $4\end{bmatrix}$.
$$
Now let
$$
B = $\begin{bmatrix}0$ & -1 \ 1 & $0\end{bmatrix}$.
$$
This matrix rotates vectors $90^\circ$ counterclockwise around the origin. So if we apply $B$ to $\begin{bmatrix}3 \\ 4\end{bmatrix}$, we get
$$
B$\begin{bmatrix}3$ \ $4\end{bmatrix}$ = $\begin{bmatrix}$-4 \ $3\end{bmatrix}$.
$$
Each matrix describes a clear action. Composition asks what happens when we do both actions one after the other.
Composition and Matrix Multiplication
The key connection is this: if $S(\mathbf{x}) = B\mathbf{x}$ and $T(\mathbf{x}) = A\mathbf{x}$, then the composition $T \circ S$ is given by
$$
(T $\circ$ S)($\mathbf{x}$) = A(B$\mathbf{x}$) = (AB)$\mathbf{x}$.
$$
This equation shows why the product $AB$ represents doing $B$ first and then $A$.
It is important to read matrix multiplication carefully. The matrix closest to the vector acts first. So in $AB\mathbf{x}$, the matrix $B$ is applied before $A$. This is opposite the order in which the matrices are written. Many students find this surprising at first, so always remember: right to left.
Let’s use the matrices above. If we first rotate by $90^\circ$ and then stretch horizontally, the composition is represented by
$$
AB = $\begin{bmatrix}2$ & 0 \ 0 & $1\end{bmatrix}$$\begin{bmatrix}0$ & -1 \ 1 & $0\end{bmatrix}$.
$$
Multiplying gives
$$
AB = $\begin{bmatrix}0$ & -2 \ 1 & $0\end{bmatrix}$.
$$
Now test it on the vector $\begin{bmatrix}3 \\ 4\end{bmatrix}$:
$$
AB$\begin{bmatrix}3$ \ $4\end{bmatrix}$ = $\begin{bmatrix}$-8 \ $3\end{bmatrix}$.
$$
Check the same result by doing it in two steps. First rotate:
$$
B$\begin{bmatrix}3$ \ $4\end{bmatrix}$ = $\begin{bmatrix}$-4 \ $3\end{bmatrix}$.
$$
Then stretch horizontally:
$$
A$\begin{bmatrix}$-4 \ $3\end{bmatrix}$ = $\begin{bmatrix}$-8 \ $3\end{bmatrix}$.
$$
The answers match, which confirms that matrix multiplication captures composition correctly.
Why Order Matters
One of the most important features of composition is that it is not usually commutative. That means in general
$$
$AB \neq BA.$
$$
This happens because the first transformation can change the coordinate system or shape in a way that affects the second transformation.
Let’s compare two orders with the same matrices. We already found
$$
AB = $\begin{bmatrix}0$ & -2 \ 1 & $0\end{bmatrix}$.
$$
Now compute the reverse order:
$$
BA = $\begin{bmatrix}0$ & -1 \ 1 & $0\end{bmatrix}$$\begin{bmatrix}2$ & 0 \ 0 & $1\end{bmatrix}$ = $\begin{bmatrix}0$ & -1 \ 2 & $0\end{bmatrix}$.
$$
These matrices are different, so the transformations are different.
Why does this happen? Imagine scaling a shape and then rotating it. The scaling happens in the original directions of the axes. But if you rotate first and then scale, the stretch acts on a rotated shape. The final positions of points will not match. This is why order matters so much in matrix algebra.
A real-world example is image editing. If you resize a photo and then rotate it, the result can differ from rotating first and then resizing. In more advanced settings, such as robotics or computer graphics, the order of transformations affects how an object moves in space. Matrix composition gives a precise way to track those changes.
Interpreting Composition Geometrically
Composition is not just symbol pushing. It has a visual meaning. Each matrix changes the geometry of the plane or space. When matrices are composed, the shape undergoes one transformation and then another.
For example, suppose a transformation first reflects across the $x$-axis and then shifts the result by a linear transformation. In pure linear algebra, translations are not represented by ordinary matrices unless we use special coordinates, so in this lesson we focus on linear transformations such as rotations, reflections, shears, and scalings. These are all transformations that can be represented by matrices.
A shear matrix might look like
$$
C = $\begin{bmatrix}1$ & 3 \ 0 & $1\end{bmatrix}$.
$$
This pushes points sideways depending on their $y$-value. If we compose $C$ with a rotation matrix $B$, the shape first rotates and then shears, or vice versa depending on the order. Even without drawing every point, you can predict the result by tracking what each matrix does.
This geometric view is useful because it helps you understand the meaning behind the product, not just the calculation. Each column of a matrix also tells a story: it shows where the basis vectors go. If you know where $\mathbf{e}_1 = \begin{bmatrix}1 \\ 0\end{bmatrix}$ and $\mathbf{e}_2 = \begin{bmatrix}0 \\ 1\end{bmatrix}$ go under a transformation, you can understand the whole transformation. Composition then means applying one set of column effects after another.
A Step-by-Step Strategy for Problems
When you are asked to find a composition through matrices, students, use this procedure:
- Identify each transformation and its matrix.
- Decide the order of application.
- Multiply the matrices in the correct order, remembering that the first transformation goes on the right.
- Simplify the product.
- Check your answer by testing a vector if needed.
Here is a sample problem. Let $S$ be a reflection across the $x$-axis, represented by
$$
S = $\begin{bmatrix}1$ & 0 \ 0 & -$1\end{bmatrix}$,
$$
and let $R$ be a $90^\circ$ counterclockwise rotation, represented by
$$
R = $\begin{bmatrix}0$ & -1 \ 1 & $0\end{bmatrix}$.
$$
Find the matrix for “reflect first, then rotate.”
Because reflection happens first, then rotation, the composition is $R S$:
$$
RS = $\begin{bmatrix}0$ & -1 \ 1 & $0\end{bmatrix}$$\begin{bmatrix}1$ & 0 \ 0 & -$1\end{bmatrix}$ = $\begin{bmatrix}0$ & 1 \ 1 & $0\end{bmatrix}$.
$$
So the composed transformation is represented by
$$
$\begin{bmatrix}0$ & 1 \ 1 & $0\end{bmatrix}$.
$$
You can check it with a vector such as $\begin{bmatrix}2 \\ 5\end{bmatrix}$. First reflect to get $\begin{bmatrix}2 \\ -5\end{bmatrix}$, then rotate to get $\begin{bmatrix}5 \\ 2\end{bmatrix}$. The product matrix gives the same result.
Why This Matters in Matrix Algebra
Composition through matrices is a central part of matrix algebra because it shows how matrices work together, not just separately. Many bigger ideas depend on this, including systems of equations, invertible matrices, change of basis, and transformations in computer graphics and engineering.
If a matrix has an inverse $A^{-1}$, then composing a transformation with its inverse gives the identity transformation:
$$
A^{-1}A = I \quad \text{and} \quad AA^{-1} = I.
$$
That means applying one transformation and then undoing it brings every vector back to where it started. This is another form of composition, and it helps explain why inverses are so useful.
Understanding composition also helps you read and build complex transformation chains. A large process can often be broken into smaller steps. Instead of analyzing the whole system at once, you can study each matrix separately, then combine them through multiplication. This makes matrix algebra powerful and organized.
Conclusion
Composition through matrices means combining linear transformations in a specific order, with matrix multiplication representing that combination. students, the main idea to remember is that the matrix on the right acts first, and the matrix on the left acts second. Because order matters, $AB$ and $BA$ are often different. By linking transformations like rotations, reflections, scalings, and shears to matrix products, you can describe complicated geometric changes in a precise and efficient way. This topic is a foundation for many areas of linear algebra and for real-world applications in science, technology, and design 📐.
Study Notes
- Composition means applying one transformation after another.
- If $S$ happens first and $T$ happens second, the composition is $T \circ S$.
- For matrices, $T \circ S$ is represented by $AB$ when $S(\mathbf{x}) = B\mathbf{x}$ and $T(\mathbf{x}) = A\mathbf{x}$.
- The matrix closest to the vector acts first.
- In general, $AB \neq BA$, so order matters.
- Matrix multiplication is the algebraic way to combine linear transformations.
- Common transformations include rotations, reflections, scalings, and shears.
- Composition is essential for understanding inverse matrices, change of basis, and applied linear algebra.
