Tutorials › Linear Algebra › Matrix Products Represent Compositions

Matrix Representations of Linear Maps · Tutorial 441 of 1000

Matrix Products Represent Compositions

Learn why the matrix for a composition is formed by multiplying the matrix of the first map on the right by the matrix of the second map on the left.

Intermediate 10 min read

What You'll Learn

  • State the basis and finite-dimensionality conditions for the composition formula.
  • Prove that the representation matrix of \(S\circ T\) is \([S][T]\).
  • Explain why the intermediate basis must match and why the multiplication order matters.
  • Interpret each column of the product as the image of a domain basis vector.
  • Verify composition matrices with square and rectangular worked examples.

Why Composition Reverses the Written Order

When a vector passes through two linear maps, it encounters the first map and then the second. If \(T\) acts first and \(S\) acts afterward, the resulting map is \(S\circ T\), defined by \((S\circ T)(\mathbf{v})=S(T(\mathbf{v}))\). The corresponding matrix product has the same order of action: the matrix for \(T\) is on the right, and the matrix for \(S\) is on the left. The order can feel reversed until we track what each matrix does to the coordinates at every stage.

Throughout the tutorial, the spaces are finite-dimensional vector spaces over \(\mathbb{F}\), where \(\mathbb{F}\) is \(\mathbb{R}\) or \(\mathbb{C}\). A basis is an ordered list, so the order of its vectors determines the order of coordinates. For a linear map \(T:V\to W\), the notation \([T]_{\mathcal{C}\leftarrow\mathcal{B}}\) means the matrix of \(T\) using the basis \(\mathcal{B}\) for its domain \(V\) and the basis \(\mathcal{C}\) for its codomain \(W\). Its defining coordinate property is

$$ [T(\mathbf{v})]_{\mathcal{C}} = [T]_{\mathcal{C}\leftarrow\mathcal{B}}[\mathbf{v}]_{\mathcal{B}}. $$

In particular, the matrix acts on the coordinate vector of the input, not directly on the abstract vector without reference to a basis. To apply two maps successively, the output coordinates from the first matrix must be coordinates in the basis used for the domain of the second map. This matching requirement is central to the composition formula.

Theorem (Matrix of a composition): Let \(V,W,U\) be finite-dimensional vector spaces over \(\mathbb{F}\), with ordered bases \(\mathcal{B}\) for \(V\), \(\mathcal{C}\) for \(W\), and \(\mathcal{D}\) for \(U\). If \(T:V\to W\) and \(S:W\to U\) are linear, then $$ [S\circ T]_{\mathcal{D}\leftarrow\mathcal{B}} = [S]_{\mathcal{D}\leftarrow\mathcal{C}} [T]_{\mathcal{C}\leftarrow\mathcal{B}}. $$ The basis \(\mathcal{C}\) is the same in the codomain coordinates of \(T\) and the domain coordinates of \(S\).

Proof. First, \(S\circ T\) is linear: for \(\mathbf{v},\mathbf{w}\in V\) and scalars \(a,b\in\mathbb{F}\), linearity of \(T\) and \(S\) gives \((S\circ T)(a\mathbf{v}+b\mathbf{w})=S(aT(\mathbf{v})+bT(\mathbf{w}))=aS(T(\mathbf{v}))+bS(T(\mathbf{w}))\). Write \(\mathbf{A}=[T]_{\mathcal{C}\leftarrow\mathcal{B}}\) and \(\mathbf{B}=[S]_{\mathcal{D}\leftarrow\mathcal{C}}\). Let \(\dim V=n\), \(\dim W=q\), and \(\dim U=m\), so \(\mathbf{A}\) has \(q\) rows and \(n\) columns, and \(\mathbf{B}\) has \(m\) rows and \(q\) columns. For any \(\mathbf{v}\in V\), put \(\mathbf{x}=[\mathbf{v}]_{\mathcal{B}}\). By the defining coordinate property of the representation matrices, \([T(\mathbf{v})]_{\mathcal{C}}=\mathbf{A}\mathbf{x}\), and then \([S(T(\mathbf{v}))]_{\mathcal{D}}=\mathbf{B}(\mathbf{A}\mathbf{x})\). To identify this with the product matrix acting on \(\mathbf{x}\), its \(i\)th coordinate is $$ \sum_{k=1}^{q} b_{ik}\left(\sum_{j=1}^{n}a_{kj}x_j\right) = \sum_{j=1}^{n}\left(\sum_{k=1}^{q}b_{ik}a_{kj}\right)x_j. $$ The inner sum is the \((i,j)\) entry of \(\mathbf{B}\mathbf{A}\), by the definition of matrix multiplication. Thus \([S(T(\mathbf{v}))]_{\mathcal{D}}=(\mathbf{B}\mathbf{A})[\mathbf{v}]_{\mathcal{B}}\) for every \(\mathbf{v}\in V\). Since a vector is uniquely determined by its coordinates in \(\mathcal{D}\), this is exactly the representation matrix of \(S\circ T\), proving the formula. \(\square\)

The matrix dimensions also record the path through the spaces: \(\mathbf{A}\) sends \(n\) coordinates in \(\mathcal{B}\) to \(q\) coordinates in \(\mathcal{C}\), and \(\mathbf{B}\) sends those \(q\) coordinates to \(m\) coordinates in \(\mathcal{D}\). The product \(\mathbf{B}\mathbf{A}\) is therefore an \(m\times n\) matrix, as required for a map from \(V\) to \(U\). If the intermediate bases do not match, the displayed product is not the representation formula: the entries of the first output coordinate vector would be interpreted using a different basis by the second matrix.

What the Product Columns Represent

Corollary: With the bases and maps in the theorem, the \(j\)th column of \([S]_{\mathcal{D}\leftarrow\mathcal{C}}[T]_{\mathcal{C}\leftarrow\mathcal{B}}\) is \([S(T(\mathbf{b}_j))]_{\mathcal{D}}\), where \(\mathbf{b}_j\) is the \(j\)th vector of \(\mathcal{B}\).

Proof. The \(j\)th column of the representation matrix of any linear map from \(V\) is the coordinate vector of the image of \(\mathbf{b}_j\) in the codomain basis. Apply that fact to \(S\circ T\): its \(j\)th column is \([(S\circ T)(\mathbf{b}_j)]_{\mathcal{D}}=[S(T(\mathbf{b}_j))]_{\mathcal{D}}\). The theorem identifies its representation matrix with the stated product, so the \(j\)th column of the product has exactly this meaning. \(\square\)

This column interpretation gives a concrete way to understand matrix multiplication. Each column of \([T]_{\mathcal{C}\leftarrow\mathcal{B}}\) records the \(\mathcal{C}\)-coordinates of one image \(T(\mathbf{b}_j)\). Multiplication on the left by \([S]_{\mathcal{D}\leftarrow\mathcal{C}}\) takes each of those coordinate vectors and converts it into the \(\mathcal{D}\)-coordinates of its image under \(S\). The result is a column of the matrix for the whole composition.

Worked Compositions in Coordinates

Worked Example: Two Maps on \(\mathbb{R}^2\)

Use the standard basis in each copy of \(\mathbb{R}^2\). Define \(T:\mathbb{R}^2\to\mathbb{R}^2\) by \(T(x,y)=(x+2y,3x+y)\), and \(S:\mathbb{R}^2\to\mathbb{R}^2\) by \(S(u,v)=(2u-v,u+v)\). Find the matrix for \(S\circ T\) and verify it by applying the maps.

The standard-coordinate matrices are

$$ [T]=\begin{bmatrix}1&2\\3&1\end{bmatrix}, \qquad [S]=\begin{bmatrix}2&-1\\1&1\end{bmatrix}. $$

Since \(T\) acts first, multiply \([S][T]\):

$$ [S][T] = \begin{bmatrix}2&-1\\1&1\end{bmatrix} \begin{bmatrix}1&2\\3&1\end{bmatrix} = \begin{bmatrix} 2(1)+(-1)(3)&2(2)+(-1)(1)\\ 1(1)+1(3)&1(2)+1(1) \end{bmatrix} = \begin{bmatrix}-1&3\\4&3\end{bmatrix}. $$

Direct composition gives \(T(x,y)=(x+2y,3x+y)\), followed by \(S(T(x,y))=(2(x+2y)-(3x+y),(x+2y)+(3x+y))=(-x+3y,4x+3y)\). The matrix found above sends \((x,y)^{\top}\) to \((-x+3y,4x+3y)^{\top}\), as required.

Check: Take \((x,y)=(2,-1)\). Then \(T(2,-1)=(2-2,6-1)=(0,5)\), and \(S(0,5)=(-5,5)\). The product matrix gives \(\begin{bmatrix}-1&3\\4&3\end{bmatrix}\begin{bmatrix}2\\-1\end{bmatrix} =\begin{bmatrix}-2-3\\8-3\end{bmatrix} =\begin{bmatrix}-5\\5\end{bmatrix}\), the same output.

Worked Example: A Nonstandard Intermediate Basis

Let \(V=U=\mathbb{R}[x]_{\leq 1}\), the space of polynomials of degree at most \(1\), with basis \(\mathcal{B}=\mathcal{D}=(1,x)\). Let \(W=\mathbb{R}^2\) have basis \(\mathcal{C}=(\mathbf{c}_1,\mathbf{c}_2)\), where \(\mathbf{c}_1=(1,1)^{\top}\) and \(\mathbf{c}_2=(1,-1)^{\top}\). Define \(T\) and \(S\) by the representation matrices $$ [T]_{\mathcal{C}\leftarrow\mathcal{B}} =\begin{bmatrix}1&2\\0&1\end{bmatrix}, \qquad [S]_{\mathcal{D}\leftarrow\mathcal{C}} =\begin{bmatrix}2&1\\1&-1\end{bmatrix}. $$

The columns specify the basis images: \(T(1)=\mathbf{c}_1\), \(T(x)=2\mathbf{c}_1+\mathbf{c}_2\), \(S(\mathbf{c}_1)=2+x\), and \(S(\mathbf{c}_2)=1-x\). The intermediate basis is \(\mathcal{C}\) for both maps, so the product is valid:

$$ [S\circ T]_{\mathcal{D}\leftarrow\mathcal{B}} = \begin{bmatrix}2&1\\1&-1\end{bmatrix} \begin{bmatrix}1&2\\0&1\end{bmatrix} = \begin{bmatrix} 2(1)+1(0)&2(2)+1(1)\\ 1(1)+(-1)(0)&1(2)+(-1)(1) \end{bmatrix} = \begin{bmatrix}2&5\\1&1\end{bmatrix}. $$

Check the result on \(p(x)=3+2x\), whose \(\mathcal{B}\)-coordinate vector is \((3,2)^{\top}\). First, \(T(p)=3\mathbf{c}_1+2(2\mathbf{c}_1+\mathbf{c}_2)=7\mathbf{c}_1+2\mathbf{c}_2=(9,5)^{\top}\). Applying \(S\) using those \(\mathcal{C}\)-coordinates gives \(S(T(p))=7(2+x)+2(1-x)=16+5x\). The product matrix gives \(\begin{bmatrix}2&5\\1&1\end{bmatrix}\begin{bmatrix}3\\2\end{bmatrix}=\begin{bmatrix}6+10\\3+2\end{bmatrix}=\begin{bmatrix}16\\5\end{bmatrix}\), the \(\mathcal{D}\)-coordinates of \(16+5x\).

Worked Example: A Rectangular Composition

Let \(T:\mathbb{R}^2\to\mathbb{R}^3\) be \(T(x,y)=(x+y,2x-y,3y)\), and let \(S:\mathbb{R}^3\to\mathbb{R}^2\) be \(S(a,b,c)=(a+b-c,2a+c)\). Use standard bases throughout.

The matrices have sizes \(3\times2\) and \(2\times3\), respectively, so the matrix for \(S\circ T\) is the \(2\times3\) matrix for \(S\) multiplied by the \(3\times2\) matrix for \(T\):

$$ [S][T] = \begin{bmatrix}1&1&-1\\2&0&1\end{bmatrix} \begin{bmatrix}1&1\\2&-1\\0&3\end{bmatrix} = \begin{bmatrix} 1+2+0&1-1-3\\ 2+0+0&2+0+3 \end{bmatrix} = \begin{bmatrix}3&-3\\2&5\end{bmatrix}. $$

Directly, \(S(T(x,y))=S(x+y,2x-y,3y)=((x+y)+(2x-y)-3y,2(x+y)+3y)=(3x-3y,2x+5y)\), which agrees with the product. For a numerical check, \((x,y)=(2,-1)\) gives \(T(2,-1)=(1,5,-3)\) and \(S(1,5,-3)=(1+5-(-3),2-3)=(9,-1)\). The product gives \(\begin{bmatrix}3&-3\\2&5\end{bmatrix}\begin{bmatrix}2\\-1\end{bmatrix}=\begin{bmatrix}6+3\\4-5\end{bmatrix}=\begin{bmatrix}9\\-1\end{bmatrix}\).

Order and Basis Pitfalls

Reversing the matrices is not a harmless change. In the rectangular example, writing \([T][S]\) would attempt to multiply a \(3\times2\) matrix by a \(2\times3\) matrix. That product exists, but it is \(3\times3\), so it cannot represent a map from the \(2\)-dimensional domain of \(T\) to the \(2\)-dimensional codomain of \(S\). The correct order is \(\begin{bmatrix}1&1&-1\\2&0&1\end{bmatrix} \begin{bmatrix}1&1\\2&-1\\0&3\end{bmatrix}\), which is \(2\times2\). The map acts first by \(T\), then by \(S\); the rightmost matrix therefore acts first on the input coordinates.

Matching dimensions alone is not enough. The number of columns of \([S]\) and rows of \([T]\) may agree while their intermediate bases differ. For example, the entries of a coordinate vector in basis \(\mathcal{C}\) describe a potentially different vector from the same entries in another basis \(\mathcal{C}'\). Thus the shared intermediate basis is part of the theorem's hypothesis, not merely a convenient way to make the product dimensions fit.

The composition rule is useful whenever a transformation is built from successive stages. It lets us compute the final coordinate output with one matrix product, while the column interpretation explains exactly which images that product encodes. Before multiplying, identify the first map, the second map, each domain and codomain basis, and the intermediate basis that must agree.

Check Your Understanding

For each question, identify the spaces and bases involved before deciding which matrices can be multiplied.

  1. If \(T:V\to W\) has matrix size \(4\times2\) and \(S:W\to U\) has matrix size \(3\times4\), what is the size and order of the matrix for \(S\circ T\)?
  2. Suppose \([T]_{\mathcal{C}\leftarrow\mathcal{B}}=\begin{bmatrix}1&0\\2&1\end{bmatrix}\) and \([S]_{\mathcal{D}\leftarrow\mathcal{C}}=\begin{bmatrix}3&1\\0&2\end{bmatrix}\). Compute the matrix for \(S\circ T\).
  3. In the preceding question, what does the second column of the product represent in terms of the second basis vector of \(\mathcal{B}\)?
  4. Explain why matrices with compatible numerical sizes may still fail to represent a composition if their intermediate bases do not match.
  5. For \(T\) acting first and \(S\) acting second, explain in words why the product is \([S][T]\), not \([T][S]\).

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon