Quaternions and Rotations

In "Best solution to an overdetermined system," TMJ 6(3): 20, a least squares method was used to compute numerically the quaternion [Graphics:inoutgr1.gif] that corresponds to the rotation matrix

[Graphics:inoutgr3.gif][Graphics:inoutgr2.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr4.gif]

through the equivalence of [Graphics:inoutgr5.gif] to the general (quaternion) rotation matrix:

[Graphics:inoutgr3.gif][Graphics:inoutgr6.gif]

P. Chesson (chessonp@aol.com) pointed out the quaternions can be determined directly. Since [Graphics:inoutgr7.gif] is a rotation matrix, its determinant

[Graphics:inoutgr3.gif][Graphics:inoutgr8.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr9.gif]

must be 1. This condition and the equation [Graphics:inoutgr10.gif] determines a Gršbner basis for the quaternion variables.

[Graphics:inoutgr3.gif][Graphics:inoutgr11.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr12.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr13.gif]

We can now use [Graphics:inoutgr14.gif] to simplify any combination of quaternions. For the monomials

[Graphics:inoutgr3.gif][Graphics:inoutgr15.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr16.gif]

the reduced polynomials are

[Graphics:inoutgr3.gif][Graphics:inoutgr17.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr18.gif]

and, since

[Graphics:inoutgr3.gif][Graphics:inoutgr19.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr20.gif]

the (arbitrary) quaternion is

[Graphics:inoutgr3.gif][Graphics:inoutgr21.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr22.gif]

For example, the numerical rotation matrix

[Graphics:inoutgr3.gif][Graphics:inoutgr23.gif]

with elements

[Graphics:inoutgr3.gif][Graphics:inoutgr24.gif]

corresponds to the quaternion

[Graphics:inoutgr3.gif][Graphics:inoutgr25.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr26.gif]

The positive square root for [Graphics:inoutgr27.gif]ensures [Graphics:inoutgr28.gif] represents a proper rotation. The equivalence of [Graphics:inoutgr29.gif] and [Graphics:inoutgr30.gif] is easily tested.

[Graphics:inoutgr3.gif][Graphics:inoutgr31.gif]
[Graphics:inoutgr3.gif][Graphics:inoutgr32.gif]