Category: Linear Algebra Level: 301
(R S) x = R(S x), and R S ≠ S R
Doing one map after another multiplies their matrices, with the first map on the right. Shear then rotate lands somewhere different from rotate then shear, so order matters.
Both rows begin with the unit square, e₁ in green and e₂ in red. S is a shear that pushes the top to the right. R turns the plane a quarter turn.
S = [[1, 1], [0, 1]], R = [[0, -1], [1, 0]]
The shear keeps e₁ fixed and slides e₂ over to (1, 1). The square leans right.
S e1 = (1, 0), S e2 = (1, 1)
Turn the leaning shape a quarter turn. The combined map is R times S, with the first map written on the right.
R S = [[0, -1], [1, 1]]
Now rotate the square first. It turns into the second quadrant and stays a square.
R e1 = (0, 1), R e2 = (-1, 0)
Shear the turned square. The combined map is S times R.
S R = [[1, -1], [1, 0]]
The two final shapes point different ways, and the two matrices differ. Matrix multiplication is not commutative, much like socks and shoes.
R S ≠ S R
cd svg-generator python3 -m svgmath render transformation-composition --out /tmp/transformation-composition
Source: svgmath/diagrams/linear_maps.py