Rotation Matrix

Category: Linear Algebra   Level: 301

R(θ) = [[cos θ, -sin θ], [sin θ, cos θ]]

To rotate the plane by an angle, track where e₁ and e₂ go on the unit circle. Those two landing points are the columns of the rotation matrix.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Start with the unit circle

The basis vectors e₁ and e₂ both sit on the circle of radius 1. Rotate everything by θ = 30° counterclockwise.

θ = 30°

Step 1: Start with the unit circle

Step 2: Rotate e₁

The tip of e₁ slides 30° along the circle. Its new x is cos θ and its new y is sin θ, the legs of the dashed triangle.

R e1 = (cos θ, sin θ) = (0.866, 0.5)

Step 2: Rotate e₁

Step 3: Rotate e₂

The tip of e₂ slides 30° too, which moves it left. Its new x is −sin θ and its new y is cos θ.

R e2 = (-sin θ, cos θ) = (-0.5, 0.866)

Step 3: Rotate e₂

Step 4: Write the landing points as columns

The first column is where e₁ lands and the second column is where e₂ lands. That is the whole rotation matrix.

R(30°) = [[0.866, -0.5], [0.5, 0.866]]

Step 4: Write the landing points as columns

Step 5: Rotate a shape

Every point turns by 30° about the origin. The yellow square keeps its size and its right angles, so the determinant is 1. A rotation never squashes anything.

det R = cos2 θ + sin2 θ = 1

Step 5: Rotate a shape

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render rotation-matrix --out /tmp/rotation-matrix

Source: svgmath/diagrams/linear_maps.py