How to find the matrix of a composition of linear transformations

A composition applies one transformation and then uses its output as the input to another. Matrix multiplication lets us combine those two steps. Let’s keep track of which map acts first and then check the result on a vector.

Write a matrix for each transformation

Use S(x1,x2)=(3x1,x1-x2) and T(x1,x2)=(2x1+4x2,-x2). Their matrices are

A=[301-1]
B=[240-1]

Apply the first map on the right

For T(S(x)), the vector first becomes Ax and then becomes B(Ax). Grouping gives (BA)x, so multiply B by A.

BA=[10-4-11]

Check the combined matrix on a vector

With x=(3,4), the first map gives S(x)=(9,-1). Applying the second gives T(9,-1)=(14,1). The combined matrix gives the same output.

10(3)-4(4)=14-3+4=1

The intermediate output space of the first map must match the input space of the second for the composition to be defined.