\(
\newcommand{\BE}{\begin{equation}}
\newcommand{\EE}{\end{equation}}
\newcommand{\BA}{\begin{eqnarray}}
\newcommand{\EA}{\end{eqnarray}}
\newcommand\CC{\mathbb{C}}
\newcommand\FF{\mathbb{F}}
\newcommand\NN{\mathbb{N}}
\newcommand\QQ{\mathbb{Q}}
\newcommand\RR{\mathbb{R}}
\newcommand\ZZ{\mathbb{Z}}
\newcommand{\va}{\hat{\mathbf{a}}}
\newcommand{\vb}{\hat{\mathbf{b}}}
\newcommand{\vn}{\hat{\mathbf{n}}}
\newcommand{\vt}{\hat{\mathbf{t}}}
\newcommand{\bx}{\mathbf{x}}
\newcommand{\bv}{\mathbf{v}}
\newcommand{\bg}{\mathbf{g}}
\newcommand{\bn}{\mathbf{n}}
\newcommand{\by}{\mathbf{y}}
\)

Rotation Matrix / Direction Cosine Matrix (DCM)

Introduction

The rotation matrix formalism is the first rotation formalism we discuss in our multi-page article on rotation formalisms in three dimensions. It carries out rotations of vectors with the fundamental tools of linear algebra, i.e. by means of multiplication with an orthonormal matrix which represents a rotation. The entries of the rotation matrix are directly the rotation parameters of this formalism. The rotation matrix is sometimes also referred to as the Direction Cosine Matrix (DCM), as we will explain towards the end of this page.

Linear Algebra Preliminaries

Before we get started with the rotation matrix formalism, let us review very briefly some basics of linear algebra, primarily to define our notation (for more explanations, see our linear algebra primer).

Let \(\mathbf{v}\) be a vector, the element of a vector space \(V\), which in our particular case we can identify with the three dimensional Euclidean space. If vectors \(\{\mathbf{a}_i\}\), \(i=1,2,3\), form a basis \(\mathcal{A}\) of \(V\) and vectors \(\{\mathbf{b}_i\}\), \(i=1,2,3\), form a different basis \(\mathcal{B}\) of \(V\), then this vector \(\mathbf{v}\) can be expressed as a linear combination of basis vectors with respect to either of these two bases as
\begin{eqnarray}
\mathbf{v} &=& {}^{\mathcal{A}}v_1\mathbf{a}_1+{}^{\mathcal{A}}v_2\mathbf{a}_2+{}^{\mathcal{A}}v_3\mathbf{a}_3\\
&=& {}^{\mathcal{B}}v_1\mathbf{b}_1+{}^{\mathcal{B}}v_2\mathbf{b}_2+{}^{\mathcal{B}}v_3\mathbf{b}_3
\end{eqnarray}

The coordinate matrices defined by
\begin{eqnarray}
\mathbf{v}_{\mathcal{A}} &=&
\left.\begin{pmatrix}
{}^{\mathcal{A}}v_1\\
{}^{\mathcal{A}}v_2\\
{}^{\mathcal{A}}v_3
\end{pmatrix}\right._{\mathcal{A}}\\
\mathbf{v}_{\mathcal{B}} &=&
\left.\begin{pmatrix}
{}^{\mathcal{B}}v_1\\
{}^{\mathcal{B}}v_2\\
{}^{\mathcal{B}}v_3
\end{pmatrix}\right._{\mathcal{B}}
\end{eqnarray}
are 3-tuples of numbers which contain the coefficients of vector \(\mathbf{v}\) with respect to the corresponding bases. It is thus important to write explicitly, with respect to which basis the 3-tuple was taken. The same vector \(\mathbf{v}\) can have entirely different 3-tuples (coordinate matrices) \(\mathbf{v}_{\mathcal{A}}\) and \(\mathbf{v}_{\mathcal{B}}\) with respect to different bases \(\mathcal{A}\) and \(\mathcal{B}\), respectively.

We can then define basis transformation matrices \(R_B^A\) and \(R_A^B\) by the equations
\begin{eqnarray}
\mathbf{v}_{\mathcal{A}} &=& R_A^B \mathbf{v}_{\mathcal{B}}\\
\mathbf{v}_{\mathcal{B}} &=& R_B^A \mathbf{v}_{\mathcal{A}}
\end{eqnarray}
which transform the coordinate matrix of a fixed vector \(\mathbf{v}\) with respect to one basis to another basis. In the above, \(R_A^B=(R_B^A)^{-1}\). The above is true in general, whether the basis transformation is a rotation or a more general linear map, which map stretch vectors and change their angles with respect to each other.

The first of the above two equations describes a vector fixed in space whose coordinate matrix is being taken from the \(\mathcal{B}\) basis to the \(\mathcal{A}\) basis. And the second equation describes the coordinate matrix being taken from the (\mathcal{A}\) basis to the \(\mathcal{B}\) basis. We shall call this interpretation of a fixed vector under basis transformation a “B-style” transformation, as opposed to an “A-style” transformation, where we consider only one basis and interpret the linear map as moving a vector \(\mathbf{v}\) with respect to the same basis, as opposed to a basis transformation for a fixed vector \(\mathbf{v}\). (The two interpretations are related, in fact they are inverses of each other.) Let us look at “A-style” transformations next.

 

For the sake of imagination and ease of visualization, let us assume that basis \(\mathcal{A}\) is an inertial axis system fixed in space, which we take as a reference to which all other attitudes are measured. And let us imagine basis $\mathcal{B}$ to be the body axis system fixed with the aircraft and moves in space as the aircraft does (but it could be also a different moving axis system such as the wind frame or the velocity frame).

Interpreting the Rotation Matrix

Rather than a basis transformation on a fixed vector, we could also just work with one basis, say basis \(\mathcal{A}\) and witness the actual rotation of vector \(\mathbf{v}\) with respect to that basis (let us at this point start thinking of the linear map as a rotation, because that is what we will be eventually using). Let the linear map \(\varphi:V\rightarrow V\) be a rotation endomorphism of vector space \(V\) that moves a vector \(\mathbf{v}\) to become a different vector \(\mathbf{w}\). Let \(A\) be the matrix of \(\varphi\) with respect to basis \(\mathcal{A}\), i.e.
\begin{eqnarray}
\mathbf{w}&=&\varphi(\mathbf{v})\\
\mathbf{w}_A &=& A \mathbf{v}_A
\end{eqnarray}
\(\varphi\) can be time dependent. Then \(\mathbf{v}_{\mathcal{A}}\) is time independent but \(\mathbf{w}_{\mathcal{A}}\) depends on time.

Now let us define a second basis \(\mathcal{B}\) with basis vectors defined by \(\mathbf{b}_i=\varphi(\mathbf{a}_i)\), \(i=1,2,3\) (defining a linear operation on basis vectors defines the whole linear map, see our linear algebra primer). We can think of linear map \(\varphi\) describing the rotational motion of the aircraft and basis \(\mathcal{B}\) being the body axis system, while basis \(\mathcal{A}\) is the inertial axis system. The vector \(\mathcal{v}\) is fixed in the world frame, and vector \(\mathcal{w}\) is fixed in the body frame, moving with the aircraft. Correspondingly, the coordinate matrices \(\mathbf{v}_A\) and \(\mathbf{w}_B\) are time independent, and we can make the identification \(\mathbf{w}_B=\mathbf{v}_A\).

Using our previous notation, we still have basis transformation matrices \(R_A^B\) and \(R_B^A\) transforming the coordinate matrices of vectors from one basis to another. We see that \(A=R_B^A\), i.e. \(A\) is the basis transformation matrix, which takes the coordinate matrix of a fixed vector from the body frame \(\mathcal{B}\) to the inertial frame \(\mathcal{A}\). Let us use the notation \(B:=R_A^B=A^{-1}\) for the matrix which takes the coordinate matrix of a fixed vector in space from the inertial frame \(\mathcal{A}\) to the body frame \(\mathcal{B}\).

Speaking always as going from the inertial basis \(\mathcal{A}\) to body axis system basis \(\mathcal{B}\) let us call what matrix \(A\) accomplishes an “A-style rotation”, i.e. the active movement of a vector with respect to basis \(\mathcal{A}\) (even though it could also be interpreted as a basis transformation of the coordinate matrix of a fixed vector from basis \(\mathcal{B}\) to \(\mathcal{A}\)). And let us call the basis transformation of the coordinate matrix of a fixed vector \(\mathbf{v}\) from basis \(\mathcal{A}\) to \(\mathcal{B}\) a “\(B\)-style rotation” and denote it by \(B\). (If you want \(A\) from \(B\), just compute \(A=B^{-1}=B^T\) (the last equality is true because rotation matrices are orthonormal).

We shall henceforth use \(B\) as defined above as our primary rotation matrix. We will provide “translations” for all other rotation formalism with respect to \(B\) in both directions.

Differential Kinematic Equation for Rotation Matrix Formalism

In order to describe the real motion of an aircraft (not the imagined motion describing its attitude with respect to a reference axis system), we will be interested in the time derivative (with respect to the inertial frame \(\mathbf{A}\)) of all rotational parameters of a rotation formalism. The rotation parameters of the rotation matrix formalism are the entries of the rotation matrix \(B\). We shall therefore be interested in the time derivative of \(B\) with respect to the inertial frame. Without derivation, we state that

\begin{equation}
\frac{dB}{dt} = -[\tilde{\boldsymbol{\omega}}_B] B
\end{equation}

Here \([\tilde{\boldsymbol{\omega}}]\) is the cross-product equivalent matrix of vector \(\boldsymbol{\omega}=(\omega_1, \omega_2, \omega_3)\):
\begin{equation}
[\tilde{\boldsymbol{\omega}}] =
\begin{pmatrix}
0 & -\omega_3 & \omega_2 \\
\omega_3 & 0 & -\omega_1 \\
-\omega_2 & \omega_1 & 0
\end{pmatrix}
\end{equation}
which is a matrix that, when applied to another vector, results in the same result as evaluating the cross product \(\boldsymbol{\omega}\times\) (with some other vector). And \(\boldsymbol{\omega}_B=(p,q,r)\) here is the angular velocity vector expressed with respect to the body frame \(\mathcal{B}\).

The above are common ingredients for the differential equation of motion: we will see that in order to obtain the time derivatives of the parameters of a rotation formalism, we must know the angular velocity vector \(\boldsymbol{\omega}_{\mathcal{B}}=(p,q,r)\) and the current attitude of the aircraft. If we know these two ingredients, this equation can be used to compute attitude \(A\) at the next time step during numerical integration, as one computes the whole time history of the attitude of the aircraft. (The angular velocity information comes from the rotational dynamic equation of motion, while the attitude information comes from the previous time step and initially from a starting attitude.) 

From a mathematical perspective, the differential kinematic equation is a differential equation in the parameters of the rotation formalism, containing the parameters and their first time derivatives, and the \({\boldsymbol\omega_{\{mathcal{B}}\) are time dependent coefficients of the equation (their time dependence being given by another equation).

We can also obtain a similar equation for matrix \(A\):
\begin{equation}
\frac{dA}{dt} = [\tilde{\boldsymbol{\omega}}_A] A
\end{equation}
This time, the angular velocity vector shall be expressed with respect to the inertial frame \(\mathcal{A}\). The angular velocity vector obeys the usual transformation law for vectors under basis transformation, i.e. \(\boldsymbol{\omega}_{\mathcal{A}}= R_B^A \boldsymbol{\omega}_{\mathcal{B}}= A \boldsymbol{\omega}_{\mathcal{B}}\).

The above relation can be inverted. For instance, the angular velocity vector \(\boldsymbol{\omega}_{\mathcal{A}}=(\omega_1, \omega_2, \omega_3)\) of the aircraft (expressed with respect to basis \(\mathbf{A}\)) can be obtained from \(A(t)\) by the following expression:

\begin{equation}
[\tilde{\boldsymbol{\omega}}_A] = \frac{d A}{dt} A^T
\end{equation}

In fact, one can find the following four relations for the first time derivatives of the rotation matrix describing the motion of a rotating object (the derivative always being taken with respect to the inertial axis system \(\mathcal{A}\) and denoted by a dot over the letter here):
\begin{eqnarray}
\dot R_B^A &=& [\tilde{\boldsymbol{\omega}}_{\mathcal{A}}] R_B^A \\
\dot R_B^A &=& R_B^A [\tilde{\boldsymbol{\omega}}_{\mathcal{B}}] \\
\dot R_A^B &=& -R_A^B [\tilde{\boldsymbol{\omega}}_{\mathcal{A}}] \\
\dot R_A^B &=& -[\tilde{\boldsymbol{\omega}}_{\mathcal{B}}] R_{A}^B
\end{eqnarray}
with the one highlighted by us above being the last one. The proof of these relations and further details can be looked up, for instance, in the brief tutorial by Shiyu Zhao. However, to convey the idea, we shall sketch the proof of the first one of these relations here.

Proof: Let us work with only one basis here, \(\mathcal{A}\), and let us remember that in our more recent notation \(A := R_B^A\). Let \(\mathbf{v}(t_0)\) be an arbitrary fixed vector, e.g. (but not necessarily) the value of a vector \(\mathbf{v}(t)\) at some fixed time \(t_0\). For any vector \(\mathbf{v}(t)=A(t)\mathbf{v}(t_0)\) we have \(\dot{\mathbf{v}}=\boldsymbol{\omega}\times\mathbf{v} = [\tilde{\boldsymbol{\omega}}]\mathbf{v}\). On the other hand, we also have
\begin{equation}
\dot{\mathbf{v}}=\frac{dA}{dt}\mathbf{v}(t_0)=\frac{dA}{dt}\overbrace{A^{-1}\mathbf{v}}^{\mathbf{v}(t_0)=}=\frac{dA}{dt}A^{T}\mathbf{v},
\end{equation}
where in the last step we have used that \(A\) is an orthonormal matrix describing a rotation, and therefore \(A^{-1}=A^T\). Equating the two expressions for \(\dot{\mathbf{v}}\) (and removing \(\mathbf{v}\) at the end) yields the result \([\tilde{\boldsymbol{\omega}}_{\mathcal{A}}] = \frac{d A}{dt} A^T\).

Remember that in this proof we have not introduced a second basis, \(\mathcal{B}\), and therefore, if a basis is to be used for the quantities, it has to be the inertial frame basis \(\mathcal{A}\), which is why \(\boldsymbol{\omega}_{\mathcal{A}}\) appears in the final expression (and not \(\boldsymbol{\omega}_{\mathcal{B}}\)). The other three relations can be obtained by further manipulation of this first result.

Comments

Direction Cosine Matrix (DCM)

The rotation matrix \(B\) is often also called the Direction Cosine Matrix (DCM). We have seen in our linear algebra primer that the columns of the transformation matrix correspond to the coefficient matrices of the old basis vectors expressed with respect to the new basis. With that in mind, it is easy to see that the \(ij\)-th element of the DCM is the projection of the \(j\)-th basis vector of the old basis onto the \(i\)-th new basis vector. If both vectors have unit length, this entry then corresponds to the cosine of the angle between the two basis vectors, hence the name “directional cosine matrix” (sometimes also called “direction cosine matrix”).

Advantages of the Rotation Matrix Formalism

The rotation matrix formalism has several advantages. It is a computational tool from linear algebra, which can be applied directly to the coordinate matrices (3-tuples of numbers) of vectors by means of matrix multiplication to express a vector in one basis with respect to another (i.e. a vector in the inertial frame can be expressed in the body frame).

Two consecutive rotations can simply be performed by two consecutive matrix multiplications by their corresponding rotation matrices. This is a great asset and in general not true for most other attitude parametrizations, which do not allow you simply to multiply or add the parameters easily to concatenate two rotations and turn it into one combined one). The algebraic property that matrices in general do not commute under multiplication reflects the fact that the order of consecutive rotations in three-dimensional space matters.

The rotation matrix formalism has no coordinate singularities and thus works for any attitude without restrictions. And finally, the rotation matrix can also serve as the “universal translator” between all the other rotation formalisms: if we want to go from one rotation formalism to another, we first construct the rotation matrix from the first formalism (if we do not already have it) and then reconstruct the values of the parameters of the second formalism from this rotation matrix. While direct translation formulas exist between some rotation formalism, between others they do not, and this method of going through the rotation matrix always works. In particular for the latter reason, we will present for any other rotation formalism we discuss its relation to the rotation matrix in both directions. This is also why we discussed the rotation matrix formalism first.

Disadvantages of the Rotation Matrix Formalism

The rotation matrix formalism also has some disadvantages, which makes other rotation formalisms attractive alternatives. First of all, it is very unintuitive for humans: from looking at a rotation matrix, it is hard to visualize the corresponding rotation for a human being. It is not just a matter of getting used to viewing rotation matrices; even with practice it would be very difficult to have a conversation about aircraft attitude by referring to the nine parameters of the rotation matrix. This is in part because certain similar rotations can have vastly different combinations of rotation matrix parameter values (entries of the rotation matrix). The latter makes the rotation matrix also more challenging for interpolation and parameter estimation (it would be good if neighboring rotations all had similar parameter values).

Of the nine parameters of the rotation matrix, only three are independent. During repeated numerical computation, such as a numerical integration, care must be taken that the six constraints determining the other six parameters continue to be satisfied, and the nine parameters do not degrade the rotation matrix to a linear transformation, which does not correspond to a rotation anymore (though it would still be a valid linear transformation in the sense of linear algebra). At that point, it would not just become an inaccurate attitude representation, the rotation matrix would cease to have the interpretation of an aircraft attitude altogether due to accumulating numerical error.