Quaternions as Rotations

Let p be a 3D point represented as a quaternion using its homogeneous coordinates, p=[w,v], and let q be any non-zero quaternion. Then:

Theorem: The product qpqβˆ’1 takes p=[w,v] to pβ€²=[w,vβ€²].

Before proving this theorem, let’s make the following observation. We can express q as a multiplication of a scalar quaternion s and a unit quaternion Uq, so q=sUq. Then qpqβˆ’1=sUqp(sUq)βˆ’1=sUqpUqβˆ’1sβˆ’1. Because the scalar multiplication is commutative, UqpUqβˆ’1ssβˆ’1=UqpUqβˆ’1, so the product doesn’t change irrespective of whether q is a unit quaternion or not. Finally, notice that Uqβˆ’1=Uqβˆ—, so we can write the action as qpqβˆ—. Note that from now on, q is assumed to be a unit quaternion without loss of generality.

Next, let’s prove that the scalar part of qpqβˆ— is the same as the scalar of p (we can use the formula to find the scalar component of a quaternion):

2S(qpqβˆ—)=qpqβˆ—+(qpqβˆ—)βˆ—=qpqβˆ—+qpβˆ—qβˆ—=q(p+pβˆ—)qβˆ—=q2S(p)qβˆ—=2qS(p)qβˆ—=2[sq,vq][sp,0][sq,βˆ’vq]=2[spsq,spvq][sq,βˆ’vq]=2[spsq2βˆ’sp(vqβ‹…βˆ’vq),βˆ’spsqvq+spsqvq+spvqΓ—vq]=2[spsq2+sp|v|2,0]=2[spsq2+sp(1βˆ’sq2),0]because of the definition of a unit quaternion=2[sp,0]=2S(p)

Therefore, the scalar part of p remains constant in the operation, i.e., if p=[w,v], then pβ€²=qpqβˆ—=[w,vβ€²]. And because multiplication preserves norms, then |p|=|pβ€²| and also |v|=|vβ€²|. β—Ό

Theorem: If |q|=1, then q=[cos⁑θ,v^sin⁑θ] acts to rotate around the unit axis v^ by 2θ.

Let:

v0=[0,v0]|v0|=|v0|=1v1=[0,v1]|v1|=|v1|=1

Be two pure quaternions (which can be represented in 3D space), and an arbitrary quaternion q which has the form:

(1)q=v1v0βˆ—=[0,v1][0,βˆ’v0](2)=[v0β‹…v1,v0Γ—v1]

Let ΞΈ be the angle between v0 and v1. Then v0β‹…v1=cos⁑θ. Also, let v0Γ—v1=sin⁑θv^. Then (1) becomes:

(3)q=[cos⁑θ,sin⁑θv^]

Let’s first prove that the product v2=qv0qβˆ— lies in the same plane as v0 and v1. We do so by first proving that the product v2v1βˆ— has the same components (dot and cross products) as v1v0βˆ—:

v2v1βˆ—=(qv0qβˆ—)v1βˆ—=(qv0(v1v0βˆ—)βˆ—)v1βˆ—=(qv0v0v1βˆ—)v1βˆ—=q(v0v0)(v1βˆ—v1βˆ—)=q(βˆ’1)(βˆ’1)since they're unit quaternions they square to βˆ’1=v1v0βˆ—

Then, if v2v1βˆ—=v1v0βˆ—, that means that v2=qv0qβˆ— lies in the same plane as v0 and v1. Also, v2 forms an angle of ΞΈ with v1. Furthermore, v1Γ—v2=v^sin⁑θ. Finally, if the angle between v0 and v1 is ΞΈ, then the angle between v0 and v2 is 2ΞΈ, which confirms what’s seen on the image above.

Furthermore, the same can be said of q acting on v1. Let v3=qv1qβˆ—. Then:

v3v2βˆ—=(qv1qβˆ—)(qv0qβˆ—)βˆ—=(q(qv0)qβˆ—)(qv0qβˆ—)βˆ—by finding v1 from (1)=q(qv0qβˆ—)(qv0qβˆ—)βˆ—=q=v1v0βˆ—

Now, any vector p can be represented in terms of the basis v0, v1, and v^, e.g., p=s1v0+s1v1+s2v^. We’ve seen what q does to v0 and v1, so let’s see what it does to v^.

Before computing qv^qβˆ—, see that:

qv^=[cos⁑θ,sin⁑θv^][0,v^]=[…,β€¦βˆ’sin⁑θ(v^Γ—v^)]=[…,β€¦βˆ’0]

So qv^ is a commutative operation because the cross product is the only term that makes the quaternion operation non-commutable, and in qv^, that term is zero. Therefore, qv^qβˆ—=v^qqβˆ—=v^, which means that q does not modify v^.

Thus, the action of q on any vector p is a rotation around v^ by 2ΞΈ. β—Ό

Quaternion Rotation Facts

Let q1 be a quaternion that rotates the pure quaternion p1 to p2, and also let q2 be a quaternion that rotates the vector p2 to p3. Then p3 will have the form:

p3=q2p2q2βˆ—=q2(q1p1q1βˆ—)q2βˆ—=(q2q1)p1(q1βˆ—q2βˆ—)=(q2q1)p1(q2q1)βˆ—

Therefore, the combination of rotation q1 followed by q2 is given by q=q2q1.

When the rotations q1,q2,…,qn are applied to the pure quaternion p, the result is equal to qpqβˆ—, where q=qnqnβˆ’1…q2q1.