Loading editor...

12. Rotations

The transpose turns the rows of into columns and vice versa. It obeys , and it lets us switch fluidly between the column view and the row view of a matrix-vector product. In this chapter that duality pays off: a rotation matrix is precisely one whose transpose is its inverse.

We saw a glimpse of this fact in the very first chapter, where we expressed the rotated coordinates of a point as a weighted sum of its input coordinates. That weighted sum is a matrix. Now let's explore the rotation matrix in detail.


12.1 Rotation in two dimensions

12.1.1 The hard way

We can describe a point in polar coordinates as , where is its distance from the origin and is the angle it makes with the x-axis. (See polar coordinates if this is unfamiliar.)

We would like to rotate by an angle . The rotated point simply gains that angle: . Expanding with the angle-sum identities:

Collecting the and terms, this is exactly a matrix acting on the original point:

Geometrically the matrix is doing nothing more than angle addition: it keeps the radius and adds to the angle.

Here sits at angle on a circle of radius , and sits at angle at the very same radius. and glides along the circle while never changes.

So the matrix on the left is the one that rotates any input vector by the angle . There is a much cleaner way to arrive at the same matrix, without any trigonometric grinding.


12.1.2 The easy way

This method comes from a single observation: multiplying a matrix by a basis vector picks out a column of .

So once we know where the input should land, we know the first column of the matrix; and once we know where should land, we know the second column. For a rotation by these landing spots are obvious from a picture: just rotate each basis vector by and read off its tip.

Draw and the two input basis vectors and in grey. Their rotated images are the columns of the rotation matrix. Reveal , which sits at , and , at .

The two colored arrows are literally the columns of

shown as a live readout on the canvas. and watch both columns glide around the circle while staying perpendicular, then , where the columns snap back to the plain identity matrix. No angle-sum identities required: the picture is the derivation.


12.2 Rotation in higher dimensions

What does rotation look like in higher dimensions? In three dimensions it already gets complicated, and in four or more we can say very little visually. But two facts hold for a rotation in any number of dimensions:

  • The angle between two vectors does not change after rotation.
  • The norm (length) of a vector does not change after rotation.

Everything else about rotation matrices follows from these two facts.

12.2.1 The columns of a rotation matrix are perpendicular

Consider an rotation matrix . Pick the two basis vectors and . They are perpendicular, so .

Since rotation preserves angles, the rotated vectors are still perpendicular: . But is just the first column of and is the second column (by the same basis-vector trick as before). Therefore

The same argument applied to any pair of basis vectors shows that every pair of columns of is perpendicular.

The two columns of are drawn here: in blue and in pink, with the angle between them marked live. and the mark holds at exactly the entire way. The right angle between the columns is preserved because rotation preserves angles.


12.2.2 The columns of a rotation matrix have unit norm

Since rotation preserves length, and each basis vector has length :

So every column of a rotation matrix is a unit vector.


12.3 A beautiful property:

We can fold the two facts above into a single statement about the columns of :

Now recall that the entries of are exactly the dot products of the columns of (the rows of are the columns of ). So:

Every diagonal entry is and every off-diagonal entry is . So .


12.4 The transpose of a rotation matrix is its inverse

We just showed that . But the defining property of the inverse is . Comparing the two gives

The transpose of a rotation matrix is its inverse. This makes perfect geometric sense: the inverse of "rotate by " is "rotate by ", and you can check that flipping the sign of in is the same as transposing it.

Start with a vector in white. : swings to in gold, and the mark shows the angle it turned through. Now : the gold arrow swings straight back onto and the swept angle closes to zero. Undoing with recovers the original vector, which is exactly what means.

Because as well, the exact same reasoning about columns applies to the rows:

Just like the columns, the rows of a rotation matrix are mutually perpendicular unit vectors.

In the next chapter we will study normal vectors, meaning vectors perpendicular to a given surface or line, where this perpendicularity machinery and the dot product come together again.


← 11. Matrix transpose · 13. Normal vectors →