Euler angles are bad

Many engineering disciplines require an understanding of various conventions used to describe rotations. There are many perfectly good, unambiguous ways to describe a rotation. Some of them (among others):

All of the above are perfectly adequate formalisms, each with their own drawbacks and advantages (singularities, compactness, etc). With all of these perfectly good options it’s unfortunate that most of the engineering world has decided to instead use Euler angles, a convention which suffers from singularities, complexity, and (worst of all) ambiguity.

The maxima worksheet used to derive the math below can be found here.


The most straight-forward way to describe a rotation convention is to say it’s a mapping between a set of parameters and a rotation matrix. A rotation matrix simply rotates a vector by a fixed angle around a fixed axis.

Euler angles describe a rotation about a single axis at a time. For example, a 3-2-1 rotation (often used in aerospace) describe a rotation which is first about the Z axis (this is called yaw), then about the Y axis (this is called pitch), and finally about the X axis (this is called roll). A set of Euler angles themselves must be accompanied by knowledge of the order in which they are to be applied. The same Euler angles applied in 3-2-1 order describe a different rotation than those applied in another order. This ambiguity can create confusion and misapplication of rotations between systems without taking careful care.

Let’s write out what a full 3-2-1 Euler sequence looks like.

The matrix below describes a rotation about the X axis by \(\phi\):

\[R_x = \begin{pmatrix}1 & 0 & 0\\ 0 & \cos{(\phi)} & \sin{(\phi)}\\ 0 & -\sin{(\phi)} & \cos{(\phi)}\end{pmatrix}\]

The matrix below describes a rotation about the Y axis by \(\theta\):

\[R_y = \begin{pmatrix}\cos{(\theta)} & 0 & -\sin{(\theta)}\\ 0 & 1 & 0\\ \sin{(\theta)} & 0 & \cos{(\theta)}\end{pmatrix}\]

The matrix below describes a rotation about the Z axis by \(\psi\):

\[R_z = \begin{pmatrix}\cos{(\psi)} & \sin{(\psi)} & 0\\ -\sin{(\psi)} & \cos{(\psi)} & 0\\ 0 & 0 & 1\end{pmatrix}\]

Applying them in 3-2-1 order means multiplying these matrices as \(R = R_x R_y R_z\):

\[R = \begin{pmatrix}\cos{(\psi)}\, \cos{(\theta)} & \sin{(\psi)}\, \cos{(\theta)} & -\sin{(\theta)}\\ \sin{(\phi)}\, \cos{(\psi)}\, \sin{(\theta)}-\cos{(\phi)}\, \sin{(\psi)} & \sin{(\phi)}\, \sin{(\psi)}\, \sin{(\theta)}+\cos{(\phi)}\, \cos{(\psi)} & \sin{(\phi)}\, \cos{(\theta)}\\ \cos{(\phi)}\, \cos{(\psi)}\, \sin{(\theta)}+\sin{(\phi)}\, \sin{(\psi)} & \cos{(\phi)}\, \sin{(\psi)}\, \sin{(\theta)}-\sin{(\phi)}\, \cos{(\psi)} & \cos{(\phi)}\, \cos{(\theta)}\end{pmatrix}\]

The matrix above is composed entirely of \(sin\) and \(cos\) of the Euler rotations themselves. As \(sin\) and \(cos\) are well defined over all angles it is apparent that any set of Euler angles can be used to build a rotation matrix, but what about the reverse?

Looking at \(R\) we can calculate the 3-2-1 Euler angles of a rotation matrix as follows:

\[\phi = atan( \frac{R_{23}}{R_{33}})\] \[\theta = -asin(R_{13})\] \[\psi = atan( \frac{R_{12}}{R_{11}} )\]

By inspection we notice a couple of things

  1. For pitch angles (\(\theta\)) of 90 degrees \(R_{23}\) and \(R_{33}\) will be zero. This means \(\phi\) will not be well defined.

  2. The exact same is true for yaw angle (\(\psi\))

This is somewhat intuitive. Imagine an airplane pitched up to 90 degrees, what is the difference between roll and yaw angle? There is no difference as the original Z axis and new X axis are coincident.


Describing dynamics in terms of Euler angles is also difficult. The relationship between a rotation matrix and a body angular rates is as follows:

\[\dot{R} = -\omega_X R\]

Where \(\omega_X\) describes a skew symmetric matrix built from the three body angular rates (\(p\), \(q\), \(r\)).

Applied to the 3-2-1 Euler angles we get:

\[\omega_X = \begin{pmatrix}0 & \sin{(\phi)}\, \left( \frac{d}{d t} \theta\right) -\cos{(\phi)}\, \left( \frac{d}{d t} \psi\right) \, \cos{(\theta)} & \cos{(\phi)}\, \left( \frac{d}{d t} \theta\right) +\sin{(\phi)}\, \left( \frac{d}{d t} \psi\right) \, \cos{(\theta)}\\ \cos{(\phi)}\, \left( \frac{d}{d t} \psi\right) \, \cos{(\theta)}-\sin{(\phi)}\, \left( \frac{d}{d t} \theta\right) & 0 & \left( \frac{d}{d t} \psi\right) \, \sin{(\theta)}-\frac{d}{d t} \phi\\ -\cos{(\phi)}\, \left( \frac{d}{d t} \theta\right) -\sin{(\phi)}\, \left( \frac{d}{d t} \psi\right) \, \cos{(\theta)} & \frac{d}{d t} \phi-\left( \frac{d}{d t} \psi\right) \, \sin{(\theta)} & 0\end{pmatrix}\]

Solving for the time derivatives of the Euler angles we get:

\[\begin{align} \dot{\phi} &= \frac{\left( \cos{(\phi)} r+\sin{(\phi)} q\right) \, \sin{(\theta)}+p\, \cos{(\theta)}}{\cos{(\theta)}} \\ \dot{\theta} &= \cos{(\phi)} q-\sin{(\phi)} r \\ \dot{\psi} &= \frac{\cos{(\phi)} r+\sin{(\phi)} q}{\cos{(\theta)}} \end{align}\]

This relationship is non-intuitive and will be different for each type of Euler sequence.

Please don’t use this garbage convention

In summary, Euler angles are ambiguous, complicated, unintuitive, and rely on meta-information to be interpreted. For the sanity of engineers everywhere, if you’re in a position to architect a system involving rotations please do not base it upon Euler angles.

Written by David Friedman on 25 November 2017