Introduction #
... quaternions appear to exude an air of nineteenth century decay, as a rather unsuccessful species in the struggle-for-life of mathematical ideas. Mathematicians, admittedly, still keep a warm place in their hearts for the remarkable algebraic properties of quaternions but, alas, such enthusiasm means little to the harder-headed physical scientist.
— Simon L. Altmann, Rotations, Quaternions, and Double Groups
This article is a work in progress. I'll and refine it a few times over the next week. But until then I don't guarantee correctness.
Early in physics, we learn to model the motion of point particles. We do this by assigning Euclidean coordinates , and finding differential equations for their evolution. However, in everyday life we rarely encounter point particles. Instead we are surrounded by rigid bodies. While these have a centre of mass that behaves like a point particle, they can also do things like twist and spin. To model these, we need coordinates that can describe all of their degrees of freedom.
In this article we will derive the Euler-Lagrange equations for a rigid body in terms of the quarternions. Euler's equations were re-written in quaternion form in [CR04]. Here we will use [LM18] to generalise this to Lagrangian mechanics on the quaternions.
All images were created by me in Blender. You can use them for your own purposes, but please reference this article. And if you want higher-resolution images feel free to email me.
Euler angles, and their failures #
As before, we will have centre of mass coordinates . On top of these, we need some more coordinates to describe the orientation of the body. One way of doing this is to use Euler angles. These are three angles representing a series of rotations, that transform the body from its initial orientation to its current one: [B08]

In the image above, are three angles which transform the coordinate axies into axies representing the current orientation of the body.
I won't go into it here, but we can find differential equations for all of the coordinates , which allow us to solve for how the rigid body evolves in time. These are quite complicated. But even worse, they are singular. If we try and numerically simulate them, there are particular values for the Euler angles where if they are ever reached, the simulation will blow up. This is because, while should describe a three-dimensional parameter space, there are particular configurations where it collapses to two dimensions. In this situation the coordinates can no longer describe the full range of motion of the object, and the numerics do not survive.

In fact, there is an even more fundamental reason for why they Euler angles, which comes from geometry. The orientation of a rigid body has a naturally spherical geometry. When we write down three angles , we are using Euclidean flat space to parameterise this curved geometry. Such a thing is an act of violence against the coordinate system, and will always result in a singularity somewhere.
If we want to avoid singularities, we need to find a way to parameterise rigid bodies using a space whose geometry is also curved. We'll see that that the unit quaternions are up to the task.
Crash course in quaternions #
With complex numbers, we add a number with the rule . With the quaternions, we add three numbers . These also square to zero:
Moreover, their products with each other are
These anti-commute with each other:
These rules are all you need to know to do computations with the quaternions.
The conjugate of a quaternion is defined similarly to the complex numbers. If
then
The norm of the quaternion is then
If is a unit quaternion, then
We'll now give a few identities without proof.
Mutliplication rule #
[eqQuaternionMultiplication]:
To see this just expand everything out.
Cross product #
If are pure quaternions, then
[eqCrossProduct]:
This follows from [eqQuaternionMultiplication]
Rotations #
Secondly, suppose is a unit vector. Then the quaternion
represents a rotation about the axis by an angle . What this means is that if is a pure quaternion, and
then is a pure quaternion corresponding to the rotated . For proof see section 5 of [CR04].
Inner product #
The inner product on the quaternions is defined as
Suppose , . Then
And
Quaternion description of a rigid body #
We will represent the orientation of the rigid body with a unit quaternion:
Note that we have a one-to-one correspondence between orientations and unit quaternions.
As well as the position, we need the velocity. This is a tangent vector at . Let be a curve on the sphere, then
Then differentiating both sides, and labelling as the velocity, gives
[eqTangentCondition]:
Any quaternion satisfying this equation is a tangent vector at , representing some angular velocity relative to the configuration .
Let's try and interpret physically, following section 8.2 of [CR04]. Suppose
Then
and
where are the derivatives of with respect to time. The scalar part of is
where the last line follows since is a unit quaternion with constant norm. Thus , and its conjugate , are pure quaternions. Let's define this pure quaternion as
Note that the factor of is added for convenience based on what will come later. Then
Position in the lab frame relates to the body frame as
Then
where the last line follows since is a pure quaternion. From [eqCrossProduct] we find
Thus is the angular velocity of the rigid body.
Thus the velocity relates to position as
[eqQuaternionEOM]:
Euler-Lagrange equations #
Suppose we write down a Lagrangian in terms of the quaternion position and angular velocity . What are the Euler-Lagrange equations, that give us the equations of motion? This will require us to develop variational calculus on the quaternions. We will do this by applying the Lie group formalism in section 8.6 of [LM18].
Infinitesimal variations #
Suppose is a path, and let be a variation of this. We need a way of parameterising this in terms of a Euclidean variation. Looking at [eqQuaternionEOM] we can write
where is an arbitrary pure quaternion such that . The corresponding tangent vector is
The angular velocity is then
where we have used since is a pure quaternion.
This gives us
Now let us calculate the effect of an infinitesimal variation, when is very small. The variation in orientation is
which gives
[eqDeltaq]:
The variation in angular momentum is
Thus we find
[eqDeltaomega]:
With these, we can parameterise an arbitrary variation using a pure quaternion . This lets us turn the problem into one of unconstrained optimisation, since is an arbitrary three-dimensional vector.
Variation in the action #
Now suppose we have a Lagrangian
We want to find the trajectory which minimises the action
Let us consider an arbitrary variation
Then
Into this we substitute [eqDeltaq] and [eqDeltaomega]. The first term is
The second term is
Since this gives us the Euler-Lagrange equation for the quaternions:
Examples #
Free body #
Let's now use this to derive Euler's equations for a free rigid body. The Lagrangian in Euclidean space is just the kinetic energy
where is the moment of inertial and is the angular velocity vector. We need to re-write this in terms of quaternions.
Let be the pure quaternion corresponding to . Define to be the matrix
where is the inertial tensor. Then we have
Writing it out in components gives
so the left-hand side of Euler's equations is
The right-hand side is
Thus we get
Conclusion #
I'm grateful to Ivan Toftul for introducing me to [CR04] and helping me to understand it.
References #
[CR04] E A Coutsias, & L Romero (2004) The quaternions with an application to rigid body dynamics UNM Digital Repository
[LM18] T Lee, M Leok, & N H McClamroch (2018) Global formulations of Lagrangian and Hamiltonian dynamics on manifolds Springer International Publishing