ion The direction cosine matrix is one of the ways to mathematically represent attitude. It is a special 3×3 matrix that when multiplied by a vector in one reference frame transforms that vector to a second rotated reference frame. For this rotation matrix \(\mathbf{R}\) to be a valid rotation transformation then it must be orthogonal, such that:

\[ \det{(\mathbf{R})} = 1 \] \[ \mathbf{R}^{-1} = \mathbf{R}^T \]

So that the transformed vector stays the same length and that the inverse mapping is simply the opposite operation so that the inverse matrix is just the transpose of the matrix.

This allows a rotation transformation matrix to be defined that encodes the attitude \(\mathbf{\Phi}\) information, so following the attitude convention, it gives:

\[ \mathbf{R}^b_w = f(\mathbf{\Phi}) \]

Where \(\mathbf{R}^b_w\) transforms a column vector in the reference or world coordinate frame \(\mathcal{F}^w\) to the body or rotated coordinate frame \(\mathcal{F}^w\) when pre-multiplied by the rotation matrix. So let \(\mathbf{R}^b_a\) be a rotation matrix that maps a vector from \(\mathcal{F}^a\) to \(\mathcal{F}^b\), such that:

\[ \vec{v}^b = \mathbf{R}^b_a \vec{v}^a \]

## Direct Cosine Matrix (DCM)

The rotation transformation matrix can be described as an operation that projects the reference frame axes onto the rotated frame axes, so that it forms a mapping of how much each axis is transferred to all the other axes. This is called a *Direct Cosine Matrix* (DCM) because each element of the matrix is the cosine of the unsigned angle between the frame axes.

\[ \mathbf{R}^b_a = \left[\begin{array}{ccc} \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{array}\right] \]

where \(\theta_{x^a,x^b}\) is the unsigned angle between the \(x^a\) axis and the \(x^b\) axis. This process effectively rotates the reference frame via the projection, it does * not* rotate the vector, rather it views the same vector from a different frame.

## Single Axis Transformations

The single axis frame rotation transformations are given by:

\[ \mathbf{R}_x(\theta) = \left[\begin{array}{ccc} 1 & 0 & 0 \\ 0 & \cos(\theta) & \sin(\theta) \\ 0 & -\sin(\theta) & \cos(\theta) \end{array}\right] \]

\[ \mathbf{R}_y(\theta) = \left[\begin{array}{ccc} \cos(\theta) & 0 & -\sin(\theta) \\ 0 & 1 & 0 \\ \sin(\theta) & 0 & \cos(\theta) \end{array}\right] \]

\[ \mathbf{R}_z(\theta) = \left[\begin{array}{ccc} \cos(\theta) & \sin(\theta) & 0 \\ -\sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1 \end{array}\right] \]

It should be noted again that 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 based on if it is the frame rotates (passive) or if the vector itself rotates (active). When the frame rotates, it is considered a passive rotation since the vector does not change, rather it is the frame of reference that rotates. This is the standard used in this page, as it is most closely aligned with engineering concepts.

Rotations have no absolute quantities, they are always relative to a reference. Therefore an active rotation can be just considered as a passive rotation, but in the opposite direction. So an 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 \(\mathcal{F}^a\) to \(\mathcal{F}^c\) via the intermediate frame \(\mathcal{F}^b\):

\[\vec{x}^c = \mathbf{R}^c_b \vec{x}^b \\ \vec{x}^b = \mathbf{R}^b_a \vec{x}^a \\ \vec{x}^c = \mathbf{R}^c_b\left(\mathbf{R}^b_a \vec{x}^a\right) \\ \vec{x}^c = \mathbf{R}^c_a \vec{x}^a \]

So the composite rotation matrix \(\mathbf{R}^c_a\) is formed by chaining the rotations together \(\mathbf{R}^c_a = \mathbf{R}^c_b\mathbf{R}^b_a\) by multiplying the subsequent rotations on the left.

## Intrinsic vs Extrinsic Rotations

When multiple rotations are chained together by sequential operations, there are two different ways of viewing the operation, there are intrinsic or extrinsic rotation sequences.

In the * intrinsic* definition, each sequential operation is applied to the

*intermediate*frame from the previous rotation. Consider the example:

\[ \left(x,y,z \right) \rightarrow \mathbf{R}_z \rightarrow \left(x’,y’,z \right) \rightarrow \mathbf{R}_{y’} \rightarrow \left(x’’,y’,z’’\right) \]

The first rotation \( \mathbf{R}_{z} \) rotates the \( (x,y,z) \)-axes around the \(z\)-axis, so that the \( z \)-axis stays the same and the \( (x,y) \)-axes shift. The next rotation \( \mathbf{R}_{y’} \) is about the *new* \(y’\)-axis, so the \( (x’,z) \)-axes now shift. This is the convention used so far in this page.

In the * extrinsic* definition, each sequential operation is applied to the

**original**non-rotated frame. Consider the example:

\[\left(x,y,z\right) \rightarrow\mathbf{R}_z\rightarrow \left(x’,y’,z \right) \rightarrow\mathbf{R}_y\rightarrow \left(x’’,y’’,z’’ \right) \]

The first rotation \( \mathbf{R}_{z} \) rotates the \( (x,y,z) \)-axes around the \(z\)-axis, while the next rotation \(\mathbf{R}_{y}\) is about the *original* \(y\)-axis, causing all the \((x,y,z)\)-axes to change.

To convert the chained

intrinsicrotation sequence \(\mathbf{R} = \mathbf{R}_i\mathbf{R}_j\mathbf{R}_k\) into anextrinsicrotation sequence, the rotation sequence can be reversed \(\mathbf{R’} = \mathbf{R}_k\mathbf{R}_j\mathbf{R}_i\). The opposite is also true, to convert anextrinsicrotation sequence into anintrinsicrotation sequence, reverse the sequence order of the rotations.