Maths WorkshopMaths problems with full solutions
Exercise 136Linear algebra › Linear mapsL1Added 3 Nov 2026

Composition and matrix product

#composition#matrix product#representation

Statement

Let f:Rn→Rmf:\mathbb{R}^n\to\mathbb{R}^m and g:Rm→Rpg:\mathbb{R}^m\to\mathbb{R}^p be linear maps with matrices AA (of size m×nm\times n) and BB (of size p×mp\times m) in the canonical bases. Show that the matrix of g∘fg\circ f in the canonical bases is BABA.

Hint

The matrix of a linear map is the unique matrix MM with φ(x)=Mx\varphi(x)=Mx for all xx; compute g(f(x))g(f(x)) with the matrix product.

Show solutionHide solution

Solution

Uniqueness of the matrix. If Mx=M′xMx=M'x for all xx, then taking x=ejx=e_j (canonical basis vector) shows that the jj-th columns of MM and M′M' coincide. So a linear map has exactly one matrix in the canonical bases.

Matrix action. For x∈Rnx\in\mathbb{R}^n, f(x)=Ax∈Rmf(x)=Ax\in\mathbb{R}^m and g(y)=By∈Rpg(y)=By\in\mathbb{R}^p. By associativity of the matrix product,
(g∘f)(x)=g(f(x))=B(Ax)=(BA)x.(g\circ f)(x)=g(f(x))=B(Ax)=(BA)x.
Thus BABA (of size p×np\times n) satisfies the defining property of the matrix of g∘fg\circ f.

Conclusion. Composition of linear maps corresponds to multiplication of matrices, in the same order: Mat⁡(g∘f)=Mat⁡(g)Mat⁡(f)\operatorname{Mat}(g\circ f)=\operatorname{Mat}(g)\operatorname{Mat}(f).