# Quaternion evolution

In this note I will repeat some stuff that I was already explaining in the past, but we will also find some important new stuff.
The time evolution differential equation for the attitude matrix is

(1) where is the angular velocity vector in the body frame, and maps any vector into skew-symmetric matrix as follows:

(2) It has the property that for any vector we have

(3) Equation (1) follows immediately from the definition of the angular velocity. The angular velocity in the laboratory frame is defined by

(4) But maps coordinates of vectors in the body frame into their coordinates in the laboratory frame. Thus and therefore

(5) But from Eq. (3) we have therefore and so Eq. (1) follows.
While description of rotations in terms of orthogonal matrices in principle suffices in classical mechanics, sometimes it is convenient to use the group of quaternions of unit norm, the group isomorphic to the group used in quantum mechanical description of half-integer spin particles. Quaternions have some advantages in numerical procedures (as for instance in 3D computer games), but they are also convenient for graphical representation of the intrinsic geometry of the rotation group. And this is what interests us, when we plot trajectories representing history of a spinning rigid body.

Quaternions of unit norm, representing rotations, form a 3-dimensional sphere in 4-dimensional Euclidean space, and we are projecting stereographically this sphere onto our familiar three-dimensional space, where we orient ourselves in a usual way known from everyday experience.
The question therefore arises: how the equation describing the time evolution looks like when represented in the quaternion setting?
To derive it we have to return to the fundamental relation between quaternions and rotations of vectors in space.
For every vector with components denote by the pure imaginary quaternion defined as:

(6) Then to unit quaternion that is such that there corresponds rotation matrix such that for all the following identity holds

(7) The second interesting property of the hat map is that for all we have

(8) where is the commutator. The property follows directly form the definitions and from the quaternion multiplication rules. Every pure imaginary quaternion is of the form for some Derivation:
As shown on plaque by the Royal Canal at Broome Bridge in Dublin, the essence of the quaternions is contained in the four equations

(9) From these, multiplying from the left and/or from the right by or or we derive

(10) From the definition of the hat map we have

(11) Therefore  When we expand the parenthesis and use the multiplication rules in Eqs. (9),(10), we find that the terms with squares cancel out, while the terms with products like etc. can be organized as follows The coefficients in the parentheses on the right are now exactly the components of the cross product Thus Suppose now that is a trajectory in the space of unit quaternions, while is the corresponding trajectory in the rotation group. Thus we have

(12) for all and all We now differentiate both sides with respect to On the left we use the standard product rule for differentiation, but we pay attention so as to preserve the order, because multiplication of quaternions is non commutative. On the right we enter with the differentiation under the “hat”, because it is a linear operation. We obtain:

(13) Assume now that is a solution of Eq. (1), so that We have

(14) We now use Eq. (12) on the right to obtain

(15) In order to get rid of we differentiate the defining equation of unit quaternions to obtain

(16) or

(17) Putting this into Eq. (15) and multiplying both sides on the right by we obtain

(18) Multiplying from the left by :

(19) From Eq. (16) it follows that the quaternion is pure imaginary: Therefore there exists vector such that

(20) Eq. (19) can now be written as

(21) where on the right we have used Eq. (3). Applying Eq. (8) to the left we end with

(22) Since the above holds for any we deduce that

(23) Using (20) we finally obtain:

Evolution equation for quaternions

(24) Note: It may be that the final formula can be derived in a shorter way, but I do not know how. It is this last formula that I was using when verifying that the algorithm provided in Meeting with remarkable circles gives indeed a solution of the evolution equation.

## 13 thoughts on “Quaternion evolution”

1. arkajad says:

Thanks. In the meantime I have corrected all of these by myself, except the angular momentum/velocity mistake.

2. arkajad says:

Do not abuse it!

3. Bjab says:

OK

4. Ronan says:

So as far as I can understand q(t)=q2(t)q1(t) from earlier post.
I am intrepretering lower case here to be quaternion form and upper case would be Matrix form i.e Q(t)=Q2(t).Q1(t)
So the final eqn(21) gives 4 choices for d(psi)/dt to solve.( I can’t get latex working properly).
I picked one. Gives 1 solution. What initial conditions need to be picked. Solution has one constant to solve for?
I can try posting the work sheet with a dropbox link you wish.

5. Ronan says:

Hi, Can you show how this arises? I don’t see where it comes from.
The second interesting property of the hat map is that for all we have where is the commutator.

1. arkajad says:

1. Ronan says:

Thank you. I didn’t know the definition of the hat function.

6. Ronan says:

Is this correct? 1. arkajad says:

What are you taking for Q0 (later denoted Q1)?

2. arkajad says:

I am getting in the arguments. Which is the same as But I am getting plus signs, not minus signs.
If you can’t find a mistake in your derivation, let me know, and I will prepare a Maple sheet with my derivation.

1. Ronan says:

Oh! I had used negative values of A1 and A3. Comes out the same as yours now.
The solution I get for psi(t)= setting psi(0)=0 doesnt get me close your expression for psi(t)
What initial condition should I use?

1. arkajad says:

To fix the constant, so that psi(0)=0, integrate the function of s over s, with s=0..t.

Then simplify the difference between my expression and your expression. You will get:

(1/2)*t-I*Pi*sqrt(3)+sqrt(3)*ln(tanh((1/12)*t*sqrt(3))-1)-sqrt(3)*ln(tanh((1/12)*t*sqrt(3))+1)

Using the definition of tanh in terms of exponential, you can then can show by hand that this is zero.

Try it. If you can’t let me know, and I will show you how.

Maple, with its simplification algorithms, is not smart enough to simplify it to zero.