Composite Transformations

I. Composite Transformations: Doing One Transformation After Another

Imagine first doing a rotation and then doing a shear — that is a composition of transformations: one transformation following another.

vector v ──(first) T₁──► T₁(v) ──(then) T₂──► T₂(T₁(v))

The key question: is the composition of two linear transformations still a linear transformation?

Yes it is. Because a linear transformation preserves straight lines and preserves parallel, equally spaced structure, doing it twice preserves them as well — so the composition is still a linear transformation, and it can be represented by a single matrix. That matrix is the product of the two matrices.

II. The Order of Matrix Multiplication: Right to Left

Let the matrix of the transformation T1T_1 be M1M_1, and the matrix of T2T_2 be M2M_2. Applying M1M_1 first and then M2M_2, the composition is written:

M2M1M_2 M_1

Note: the matrix that acts first is written on the right! M2M1M_2 M_1 means “first M1M_1, then M2M_2”.

M₂M₁·v = M₂(M₁·v)
 └┬─┘ └┬┘
 first M₁  then M₂

Geometric intuition: the function notation f(g(x))f(g(x)) evaluates gg first and then ff. Matrix multiplication works the same way — the rightmost matrix acts first.

III. The Formula for Matrix Multiplication

Let M1=(abcd)M_1 = \begin{pmatrix} a & b \\ c & d \end{pmatrix} and M2=(efgh)M_2 = \begin{pmatrix} e & f \\ g & h \end{pmatrix}. Then the composition M2M1M_2 M_1 is:

M2M1=(efgh)(abcd)=(ea+fceb+fdga+hcgb+hd)M_2 M_1 = \begin{pmatrix} e & f \\ g & h \end{pmatrix}\begin{pmatrix} a & b \\ c & d \end{pmatrix} = \begin{pmatrix} ea + fc & eb + fd \\ ga + hc & gb + hd \end{pmatrix}

How to remember it:

  • the ii-th row and jj-th column of the product = the ii-th row of M2M_2 times the jj-th column of M1M_1 (multiply component by component and add)
  • Geometric check: column 1 of the product = the position of the image (a,c)(a,c) of ı^\hat{\imath} under M1M_1, after being transformed by M2M_2, that is M2⋅(a,c)TM_2 \cdot (a,c)^T
Example: M₁ = the 90° rotation [[0,-1],[1,0]], M₂ = the shear [[1,1],[0,1]]
Rotate first, then shear:
M₂M₁ = [[1,1],[0,1]]·[[0,-1],[1,0]]
     = [[1·0+1·1, 1·(-1)+1·0], [0·0+1·1, 0·(-1)+1·0]]
     = [[1, -1],[1, 0]]

IV. Interactive Demo: A Then B Versus B Then A

How to operate and what to observe:

  • switch between “rotate then shear” and “shear then rotate”
  • compare the final grid in the two orders — they are completely different!
  • confirm: the matrix that acts first is written on the right of the product

V. The Significance of Matrix Multiplication

ViewMeaning
Algebraicthe merging of two consecutive matrix multiplications
Geometrica composition of transformations (right first, then left)
Practicalmerging several transformations into one, to improve computational efficiency

Its significance in computer graphics: an object may first be scaled, then rotated, then translated (in practice an affine transformation in homogeneous coordinates). You can pre-multiply these matrices into a single matrix and then perform just one matrix multiplication per vertex — this is one of the principles behind GPU rendering.

Summary

Symbols Used in This Article

SymbolTypePronunciation/ExplanationMeaning in This Article
T1,T2T_1, T_2Mathematical symbolT one, T twoThe two linear transformations, applied in turn
M1,M2M_1, M_2Mathematical symbolM one, M twoThe matrices corresponding to T1T_1 and T2T_2
M2M1M_2 M_1Mathematical symbolM two times M oneThe matrix of the composite transformation, with the first-acting M1M_1 written on the right
M1M2≠M2M1M_1 M_2 \neq M_2 M_1Mathematical symbolnot equalMatrix multiplication is not commutative in general
(ea+fceb+fdga+hcgb+hd)\begin{pmatrix} ea+fc & eb+fd \\ ga+hc & gb+hd \end{pmatrix}Mathematical symbolmatrix productThe product matrix obtained by multiplying row by column
f(g(x))f(g(x))Mathematical symbolf of g of xThe notation for function composition, paralleling the “right to left” rule of matrix multiplication

Found an issue with this content?

Tell us what could be improved.