Rotation matrices: everything you wanted to know

Rotation matrices: everything you wanted to know

In robotics, vision and graphics, rotation matrix is one of the most popular mathematical representations of the rotational motion. It is simple but sometimes may cause confusions. In this post, I will construct a rotation matrix from stratch and talk about its key properties. For brevity, all vectors are column vectors and all coordinate frames are right-handed unless otherwise stated.

Constructing a rotation matrix

Consider the cone-shaped object shown in the cover figure. The rotational motion of the object is characterized by the relative orientation between a reference coordinate frame (in RGB colors) and a local coordinate frame “attached” to the object (in black).

Let $r_1,r_2,r_3\in\mathbb{R}^3$ be the coordinates of the principal axes of the object frame relative to the reference frame. We define a $3\times 3$ matrix by stacking the coordinate vectors next to each other:

\begin{equation} R=\begin{bmatrix} r_1 & r_2 & r_3 \end{bmatrix} \end{equation}

$R$ is called a rotation matrix. Every rotational motion of the object can be represented using such a matrix, that is to say that it is surjective (onto).

Properties of rotation matrices

Property 1: Rotation matrices are orthogonal

As shown in the example above, the columns of $R$ are mutually orthonormal, which means that $R$ is an orthogonal matrix by definition:
$$
RR^T=R^TR=I
$$

Property 2: Rotation matrices have determinant +1

From the orthogonality, it follows that
$$
\det(RR^T)=\det(R)^2 = 1,
$$
and thus
$$
\det(R) = \pm 1.
$$

Recall from linear algebra that the determinant of $R$ is equal to the scalar triple product of its columns (or rows):
$$
\det(R) = \det([r_1\ r_2\ r_3]) = r_1^T(r_2\times r_3).
$$
Since the object frame is right-handed, we have that $r_2\times r_3=r_1$, followed by
$$
\det(R) = r_1^T r_1 = 1.
$$

The case of determinant -1

The case $\det(R)=-1$ corresponds to the case where $r_2\times r_3=-r_1$. This is illustrated in the cover figure, by the dashed axis $-r_1$. In this case, cross products, or the right-handness are not preserved by the tranformation $R$.

In summary, $3\times 3$ orthogonal matrices with determinant 1 correspond to 3D rotations, those with determinant -1 correspond to 3D rotations with a refection.

To go further

The set of all $3\times 3$ rotation matrices satisfying the two properties is denoted by the symbol $SO(3)$. The notation $SO$ abbreviates special orthogonal, in which the word special refers to the fact that $\det(R) = +1$ rather than $±1$.

A more formal definition of $SO(3)$ is as follows:
$$
SO(3)=\left\{ R\in\mathbb{R}^{3\times 3} | RR^T=I,\ \det(R)=1 \right\}.
$$
It is easy to show that the set $SO(3)$ is a group under the operation of matrix multiplication, satisfying the group axioms (closure, identity element, inverse element, and associativity). I will talk more about rotation and $SO(3)$ in upcoming posts.

Comments