Composing Transformations

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.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Start with the same square twice

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]]

Step 1: Start with the same square twice

Step 2: Top row: shear

The shear keeps e₁ fixed and slides e₂ over to (1, 1). The square leans right.

S e1 = (1, 0), S e2 = (1, 1)

Step 2: Top row: shear

Step 3: Top row: then rotate

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]]

Step 3: Top row: then rotate

Step 4: Bottom row: rotate

Now rotate the square first. It turns into the second quadrant and stays a square.

R e1 = (0, 1), R e2 = (-1, 0)

Step 4: Bottom row: rotate

Step 5: Bottom row: then shear

Shear the turned square. The combined map is S times R.

S R = [[1, -1], [1, 0]]

Step 5: Bottom row: then shear

Step 6: Compare the results

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

Step 6: Compare the results

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render transformation-composition --out /tmp/transformation-composition

Source: svgmath/diagrams/linear_maps.py