# Rotations with Quaternions and their exponential.

1. Oct 18, 2011

### tomelwood

1. The problem statement, all variables and given/known data
Hello,
I'm trying to get my head around the various properties of quaternions that all seem very similar, but I can't quite understand the underlying differences between them. I would like to know the differences between unit quaternions, purely imaginary quaternions, rotating a quaternion (does computing rotations using quaternions require them to be of unit magnitude?), and the exponential of a quaternion.

2. Relevant equations
One definition I have found is that "The exponential of a quaternion q = [a; v] is exp(q) =
exp(a)[cos(m);Lsin(m)], where m is a scalar and L a vector such that mL=v"
(taken from http://warwickmaths.org/files/Quaternions%20And%20Their%20Importance%2065.pdf [Broken] , page 6)
But another one says that the exponential of a purely imaginary q is "cos |q| + (q/|q|)sin|q|" Is this the same definition, but for the less general case of q having no scalar part?
If so, how are the two connected?

With regard to rotations, I know that we can think of the unit quaternion q = [a; v] , where v = tA, A being a unit vector (as q being a unit quaternion doesn't mean that v is a unit vector, correct?), as being represented as q = cos(θ/2) + A sin(θ/2) , where θ is the angle of rotation and A is the axis of rotation.

How does this relate to the exponential formula, as they look very similar indeed. What is the relation between |q| and θ?

3. The attempt at a solution

If someone can help me understanding these nuances with quaternions, I would be very grateful. I have already proven that the above representation of a rotation is true, but I would like to know the connection between that and the exponential.

Although, is it the case that the modulus of the quaternion is simply the angle of rotation? I think that is the connection between the two exponential cases. But how does that come about?

Many thanks.

Last edited by a moderator: May 5, 2017
2. Oct 18, 2011

### D H

Staff Emeritus
Let me offer my assistance in this endeavor!

Now that is a mighty ad hoc definition. A much better definition is

$$\exp(q) = \sum_{n=0}^{\infty} \frac {q^n}{n!}$$

This is the same definition of the exponential function that is used for the reals, then extended to the complex numbers, and now to the quaternions. This series definition of the exponential function is arguably the most important function in all of mathematics; Rudin says exactly that. Why diverge from this extremely important definition?

There is one hidden problem here: Given that multiplication in the quaternions is not commutative, does writing qn make sense? It turns out that this does make sense precisely because qn×q = q×qn. Even though quaternions is not commutative in general, the product of a quaternion and that quaternion raised to some integer power is commutative. (You might want to try to prove this conjecture.) In fact, any non-zero quaternion raised to some real power and that same quaternion raised to some other real power commute multiplicatively.

As far as that author's definition of the quaternion exponential: It is wrong. There is too much leeway in his "where m is a scalar and L a vector such that mL=v". His definition is not unique (the definition I gave is unique). He should have said "where m=||v|| and L=v/m".

Let's go back to the definition I gave. I'll write this pure imaginary quaternion q as [0;v]=[0;vu], where v is a non-zero 3-vector, v is the magnitude of that vector, and u=v/v is a unit 3-vector. The series starts with q0, which is defined to be [1;0] in the context of this series. (The same goes for exp(x) and exp(z), for real x and complex z.) The next element is q1. A quaternion raised to the first power is of course the quaternion in question. So here q1=[0;vu]. Multiplying to obtain successive powers, q2 is [-v2;0], q3 is [0;-v3u], and so on.

In general, q2n=[(-1)nv2n;0] and q2n+1=[0;(-1)nv2n+1u], so

$$\exp(q) = \left[ \sum_{n=0}^{\infty}\frac{(-1)^nv^{2n}}{(2n)!}\;;\; \sum_{n=0}^{\infty}\frac{(-1)^nv^{2n+1}}{(2n+1)!} \right] = \left[\sin v; \cos v\,\hat{\mathbf u}\right]$$

Before talking about rotations in three space and how quaternions can be used to describe them, I'm going to be a bit pedantic and differentiate between rotation and transformation and then between left and right quaternions.

On rotation versus transformation: Imagine you have a white sheet of paper with one black dot somewhere on the paper. You need a coordinate system of some sort to describe the location of that dot. Imagine you have a couple of sheets of transparent plastic each with a grid marked on it. Putting one of those transparencies atop the white sheet of paper gives you such a coordinate system. If you put the second transparency atop the other so that the axes and grids line up, you will have another coordinate system that is identical to the first one. Now physically rotate the second transparency. Note that the dot has not rotated; the dot is where it was. It is the coordinate system that has been rotated. The dot's coordinates will of course change due to this rotation of the coordinate system. You can describe this physical rotation of the transparency in terms of a rotation matrix R. How about the transformation of the coordinates of the dot? The coordinates of some point as represented in two different coordinate systems are related by a transformation matrix T. Here, the rotation matrix R and transformation matrix T inverses of one another. Rotation is the conjugate of transformation.

On left version right quaternions: I'm going to skip ahead a bit and note that q[0;v]q-1 is a pure imaginary quaternion. So is q-1[0;v]q. The only difference between the two forms is whether original quaternion (rather than its inverse) is on the left or the right of the pure imaginary quaternion [0;v]. The form q[0;v]q-1 is a "left" form (the original quaternion is on the left) while q-1[0;v]q is a "right" form (the original quaternion is on the right).

The reason for these pedantic distinctions is that silly arguments arise over it. One person will be using right rotation quaternions and another left transformation quaternions. When they exchange data the will find that their data don't agree. If the two don't know that multiple representation schemes exist, a "You're doing it wrong!" "No, you're doing it wrong" argument will ensue. Who's wrong? Both are; they are wrong for arguing. (BTW, the author of the paper you cited is using left rotation quaternions.)

Finally, on rotation/transformation with unit quaternions: Let's look at the form q[0;v]q-1. Pre-multiplying by some non-zero real a and post-multiplying by 1/a doesn't change the result. This means that there's no reason to use quaternions in general. Unit quaternions will work just fine. The reason for using unit quaternions is that the multiplicative inverse of a unit quaternion is just the conjugate of that quaternion.

Without derivation,
• The left rotation quaternion $q=[\cos\frac{\theta}2;\sin\frac{\theta}2\hat u]$ rotates a vector v about the u-hat axis by an angle θ via $q\;[0;\vec v]\;q^{\ast}$.
• The corresponding right rotation quaternion is $q=[\cos\frac{\theta}2;-\sin\frac{\theta}2\hat u]$ with the rotation represented via $q^{\ast}\;[0;\vec v]\;q$.
• The left transformation quaternion $q=[\cos\frac{\theta}2;-\sin\frac{\theta}2\hat u]$ transforms the coordinates of a vector v as expressed in some frame to another frame whose axes are rotated about the u-hat axis by an angle of θ relative to the original frame via $q\;[0;\vec v]\;q^{\ast}$.
• The corresponding right transformation quaternion is $q=[\cos\frac{\theta}2;\sin\frac{\theta}2\hat u]$ with the transformation represented via $q^{\ast}\;[0;\vec v]\;q$.

Note that the quaternion exponential does not arise in any of the above. The quaternion exponential becomes very important when you need to compute the time derivative of a time-varying quaternion.

Last edited by a moderator: May 5, 2017