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, 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 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 constants 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 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 prove first that the product v2=qv0qβˆ— lies in the same plane as v0 and v1, we do so by proving first 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 base 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 therm 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 which rotates the pure quaternion p1 to p2 and also let q2 be a quaternion which 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