Skip to content

Rotation Matrices

Definition

A rotation matrix is a special 3×33 \times 3 matrix that, when pre-multiplied by a vector in one reference frame, transforms that vector into the same vector expressed in a second rotated reference frame. For a matrix R\mathbf{R} to be a valid rotation transformation it must be orthogonal:

det(R)=1R1=R \det(\mathbf{R}) = 1 \qquad \mathbf{R}^{-1} = \mathbf{R}^\top

The first condition ensures the transformed vector stays the same length. The second means the inverse transformation is simply the transpose — reversing the rotation costs nothing extra.

Let Rab\mathbf{R}^{ab} denote a rotation matrix that maps a vector from frame Fa\mathcal{F}^a to frame Fb\mathcal{F}^b:

vb=Rabva \mathbf{v}^b = \mathbf{R}^{ab} \, \mathbf{v}^a

Following the attitude convention Φ1:FwFb\Phi_1: \mathcal{F}^w \rightarrow \mathcal{F}^b, the attitude is encoded as Rwb=f(Φ)\mathbf{R}^{wb} = f(\Phi).

Direct Cosine Matrix

The rotation matrix can be understood as an operation that projects the reference frame axes onto the rotated frame axes — a mapping of how much each axis is transferred to all other axes. This is called a Direct Cosine Matrix (DCM) because each element is the cosine of the unsigned angle between the corresponding frame axes:

Rab=[cosθxa,xbcosθya,xbcosθza,xbcosθxa,ybcosθya,ybcosθza,ybcosθxa,zbcosθya,zbcosθza,zb] \mathbf{R}^{ab} = \begin{bmatrix} \cos\theta_{x_a, x_b} & \cos\theta_{y_a, x_b} & \cos\theta_{z_a, x_b} \\ \cos\theta_{x_a, y_b} & \cos\theta_{y_a, y_b} & \cos\theta_{z_a, y_b} \\ \cos\theta_{x_a, z_b} & \cos\theta_{y_a, z_b} & \cos\theta_{z_a, z_b} \end{bmatrix}

where θxa,xb\theta_{x_a, x_b} is the unsigned angle between the xax^a axis and the xbx^b axis. This process effectively rotates the reference frame via the projection — it does not rotate the vector itself. Rather, it re-expresses the same vector as seen from a different frame.

Single Axis Transformations

The elementary single-axis frame rotation transformations are:

Rx(θ)=[1000cosθsinθ0sinθcosθ] \mathbf{R}_x(\theta) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos\theta & \sin\theta \\ 0 & -\sin\theta & \cos\theta \end{bmatrix} Ry(θ)=[cosθ0sinθ010sinθ0cosθ] \mathbf{R}_y(\theta) = \begin{bmatrix} \cos\theta & 0 & -\sin\theta \\ 0 & 1 & 0 \\ \sin\theta & 0 & \cos\theta \end{bmatrix} Rz(θ)=[cosθsinθ0sinθcosθ0001] \mathbf{R}_z(\theta) = \begin{bmatrix} \cos\theta & \sin\theta & 0 \\ -\sin\theta & \cos\theta & 0 \\ 0 & 0 & 1 \end{bmatrix}

These transformations rotate the reference frame — they do not rotate the vector itself.

Active or Passive Rotations

A rotation can be considered active or passive depending on what moves:

  • Passive rotation — the vector stays fixed, the frame rotates. The vector does not change; it is the frame of reference that rotates. This is the convention used throughout this site, as it is most closely aligned with engineering concepts.
  • Active rotation — the frame stays fixed, the vector rotates.

Rotations have no absolute quantities — they are always relative to a reference. Therefore an active rotation can be considered as a passive rotation in the opposite direction. A passive rotation by θ\theta is the same as an active rotation by θ-\theta.

Chaining Multiple Rotations

Multiple rotations can be chained together by multiplying the rotation matrices in order (right to left). Consider the rotation from Fa\mathcal{F}^a to Fc\mathcal{F}^c via the intermediate frame Fb\mathcal{F}^b:

xc=Rbcxbxb=Rabxa \mathbf{x}^c = \mathbf{R}^{bc} \, \mathbf{x}^b \qquad \mathbf{x}^b = \mathbf{R}^{ab} \, \mathbf{x}^a

Substituting:

xc=Rbc(Rabxa)=Racxa \mathbf{x}^c = \mathbf{R}^{bc} \left( \mathbf{R}^{ab} \, \mathbf{x}^a \right) = \mathbf{R}^{ac} \, \mathbf{x}^a

So the composite rotation matrix is formed by multiplying subsequent rotations on the left:

Rac=RbcRab \mathbf{R}^{ac} = \mathbf{R}^{bc} \, \mathbf{R}^{ab}

Note that matrix multiplication is not commutative — the order of rotations matters.

Intrinsic vs Extrinsic Rotations

When multiple rotations are chained by sequential operations, there are two ways to interpret the sequence:

Intrinsic — each successive rotation is applied to the intermediate frame from the previous rotation. The rotation axes themselves move with each step. For example:

(x,y,z)Rz(x,y,z)Ry(x,y,z) (x, y, z) \xrightarrow{\mathbf{R}_z} (x', y', z) \xrightarrow{\mathbf{R}_{y'}} (x'', y', z'')

The second rotation Ry\mathbf{R}_{y'} is about the new yy'-axis. This is the convention used throughout this series.

Extrinsic — each successive rotation is applied to the original non-rotated fixed frame. For example:

(x,y,z)Rz(x,y,z)Ry(x,y,z) (x, y, z) \xrightarrow{\mathbf{R}_z} (x', y', z) \xrightarrow{\mathbf{R}_y} (x'', y'', z'')

The second rotation Ry\mathbf{R}_y is about the original yy-axis.

To convert a chained intrinsic rotation sequence R=RiRjRk\mathbf{R} = \mathbf{R}_i \mathbf{R}_j \mathbf{R}_k into an equivalent extrinsic sequence, reverse the order: R=RkRjRi\mathbf{R}' = \mathbf{R}_k \mathbf{R}_j \mathbf{R}_i. The opposite is also true.