# Can quaternions be used to represent rotation rate?

A quaternion is a useful tool for representing a rotation, or change in attitude.

If a quaternion $q$ represents a rotation, and $v$ a vector, then $v'=qvq^*$ rotates the vector, where the multiply is distributive rather than element-wise. (I know this is obvious to most of the audience, but I'm trying to set the tone for the level of detail needed in the answer...)

If I want to rotate twice as far, I can multiply $q$ by itself to get $h=qq$, and then I can find $v'=hvh^*$.

What if what I have is a rotation rate, and I want to find the vector after rotating at a certain rate for a certain amount of time? Is there a convenient way to use quaternion math when I have a 3D rotation rate in radians per second?

First: note we are dealing only with the unit quaternions as a representation of attitude. The full quaternions don't really have a role here. I should also note up front that the quaternion itself has a rate ($$\dot{q}$$), but like the Euler angle rates the quaternion rate is not the actual angular velocity, which is a 3-vector. They are nonetheless (as with the Euler angles) related.

Since the unit quaternions are isomorphic to $$SU_2$$ and $$SU_2$$ double covers $$SO_3$$ with kernel $$\pm 1$$, we can essentially say that each attitude matrix (aka direction cosine matrix, aka element of $$SO_3$$ with a matrix represntation) can be associated with two quaternions which differ by only a minus sign and each quaternion can be associated with a unique attitude matrix. Thus, without loss of generality, I may write $$A = A(q) = A(-q).$$ You are asking about what happens when the attitude matrix is a function of time, e.g. $$A = A(t)$$. Let's take some arbitrary vector function $$r(t)$$ and look at it rotated, e.g. $$b(t) = A(t)r(t).$$ By the product rule, $$\frac{db}{dt} = \frac{dA}{dt}r + A\frac{dr}{dt}.$$ Since for any finite rotation rate only an infinitesimal rotation can occur in an infinitesimal amount of time, the matrix derivative is actually $$\frac{dA}{dt} = \frac{d}{dt}\begin{bmatrix} 1 & -q_3(t) & q_2(t)\\ q_3(t) & 1 & -q_1(t)\\ -q_2(t) & q_1(t) & 1\\ \end{bmatrix} = \Omega\times,$$ forming the cross product matrix where $$\Omega$$ is the angular velocity and the $$q_i$$ are the quaternion components, assuming we call the coefficient of 1 $$q_0$$. You should now recognize the product rule above as the formula for computing the derivative in a rotating reference frame.

Now do the same calculation for $$b(t) = q(t)r(t)q^*(t)$$ and find the same result! Why? Suppose we send $$\mathbb{R}^3\rightarrow\mathbb{R}^3$$ by computing $$qiq^*$$, $$qjq^*$$, and $$qkq^*$$. This is easily found to be $$A(q)$$--indeed, this is how the parameterization of $$SO_3$$ using the unit quaternions is typically derived. Thus all we have done is computed the "rotational derivative" using two different (but equivalent) formalisms for the rotation.

Anyway, from here it's not hard to show that

$$\frac{dq}{dt} = \frac{1}{2}\begin{bmatrix} 0 & -\Omega_x &-\Omega_y & -\Omega_z\\ \Omega_x & 0 & \Omega_z & -\Omega_y\\ \Omega_y & -\Omega_z & 0 & \Omega_x\\ \Omega_z & \Omega_y & -\Omega_x & 0\\ \end{bmatrix}q = [\Omega]q.$$

If your angular velocity is constant the solution is simply $$q(t) = e^{[\Omega](t-t_0)}q(t_0),$$

but generally this is a time-dependent system in which the angular velocity on the body is itself obtained by solving the Euler equations $$I\dot{\Omega} +\Omega\times I\Omega = \sum_iM_i,$$ where $$I$$ is the inertia tensor and $$M_i$$ are the moments (torques) on the rigid body. If, for instance, you have ever wondered how NASA keeps their spacecraft pointed in the right direction, it is by figuring out which quaternion corresponds to the orientation they want and firing small rockets on the side (typically monopropellant Hydrazine), spinning reaction/momentum wheels, etc. to get the right torques in the Euler equations to ultimately produce the right quaternion with the system above. The whole thing is done closed-loop using feedback control.

• Thanks! I appreciate the detailed explanation. Just to double check a few things-- does the $\times$ represent anything in the $dA/dt$ equation? Also, should the constant angular velocity solution be $q(t)=e^{[\Omega](t-t_0)}q(t_0)$? Commented Jun 7, 2016 at 6:41
• $\Omega\times$ is the cross product matrix with $\Omega$ as the entries, yeah, it should be $q(t_0)$ instead of $q(0)$, that's a typo.
– JMJ
Commented Jun 7, 2016 at 13:22

I don't have enough reputation to comment on @JMJ's answer, but believe that the 3rd row, 4th column element of $$[\Omega]$$ should be positive $$\Omega_x$$ without the negative sign.