Quaternions and Their Modern Applications: Jason Lim
Quaternions and Their Modern Applications: Jason Lim
Quaternion Algebra
First, some notation: quaternions will be denoted by a lower case letter, such as q or p. Ordinary
vectors in three dimensions will be denoted by bold-face letters, for example, i, j, and k, represent the
orthonormal basis in R3 . We can write quaternions as the sum of a scalar and vector component,
q=q 0+ q
Where
q=i q1 + j q2 +k q 3
And q 0 is some scalar. We say that two quaternions are equal if and only if all of their respective
components are equal. Quaternions can be summed together using ordinary algebraic properties:
q+ p=( q 0 + p 0 ) +i ( q1 + p1 ) + j ( q 2+ p 2 )+ k ( q 3+ p 3 )
q+ (−q )=0
Where 0 can be represented by a quaternion with all components equal to 0. Scalar multiplication
applies as it would to ordinary vectors:
c q= c q 0 +i c q 1+ j c q 2+ k c q 3
Quaternion multiplication is a bit more involved; it must be defined so that Hamilton’s equation (Eq. 1)
and the ‘special’ products that the equation implies are satisfied, that is:
i j=k =− ji
j k =i=−k j
k i= j=−i k
These products, not to be confused with ordinary dot or cross products, will be defined through the
following as quaternion products. Following the above equations, combined with the ordinary
definitions of dot and cross products for vectors, it can be shown through some algebra that:
p q= ( p 0 +i p1 + j p2 +k p 3 ) ( q0 +i q1 + j q 2+ k q3 )
¿ p0 q0 − p ∙ q+ p 0 q+q 0 p+ p×q Eq. 2
Eq. 2 will be the equation used to define the product of two quaternions. The multiplicative inverse of a
quaternion is then that quaternion with scalar component 1 and vector component 0,
q=1+0 .
q* =q 0− q= q0−i q1 − j q2 −k q3
N ( q ) =( q ) =√ q* q ; N 2 ( q )=q* q=q q*
Unit quaternions are those with a norm of 1. The inverse of a quaternion is given by
*
−1 q
q = 2
N (q )
If q is a unit quaternion, then obviously the inverse is equal to the complex conjugate.
Geometric Interpretation
We know that rotations in three dimensions can be represented by a 3x3 orthogonal matrix with
a determinant of ±1. A key point in understanding how quaternions can be applied as rotation operators
is recognizing that ordinary vectors in R3 can be written as quaternions with a scalar component of 0. In
fact, we will consider any vector i Thus, every vector in R3 can be mapped one to one with the set of
quaternions of the form v =0+ v . This set is called pure quaternions. Then in order to have a useful
definition of a quaternion rotation operation, it should be closed for the set of pure quaternions. For
convenience, we can denote the set of all quaternions in R4, Q, and the set of pure quaternions Q0.
Equation 2 shows that the product of any arbitrary quaternion in Q with a vector in R3 is not necessarily
in Q0. However, we can form a product using two arbitrary quaternions, say q and r, in Q, on a vector
(or pure quaternion) v. We can show that the product qvr will have a scalar component of 0 as long as
r=−q , or, equivalently, q=r * . Then we can define two triple-product quaternion operators,
w 1=q v q *
*
w 2=q v q
Where w 1 and w 2 can be considered the images of the vector v under the two operations.
We would like to be able to associate an angle with quaternions and quaternion operations so
that we may apply them to rotations. For any unit quaternion, we know
q 20+ ( q ) 2=1
We also know
2 2
sin θ+cos θ=1
We place the restriction −π <θ< π on the angle θ in order to define it uniquely. It is useful to define
a unit vector in the direction of the vector component of a quaternion q, such that
q q
u= =
(q ) sin θ
Then we can write a unit quaternion as
q=cos θ+u sin θ Eq. 3
w=q v q
* Eq. 4
will not change the length of w. This operation with a unit quaternion now starts to resemble a rotation
operation. It is worth noting that since sine is an odd function, the complex conjugate of a quaternion
can be found by simply replacing θ with –θ .
By examining the effect of the quaternion operator on the basis vector i, we can interpret the
geometric meaning of the operation. This will not be shown here, but it can be verified with equation 2
that the quaternion operation in equation 4, where q is given by
Thus it appears that the operation has rotated the vector i counter-clockwise through an angle 2θ , about
the axis k. Note that from a different perspective, we could say the coordinate-frame was rotated
clockwise through an angle of −2θ . Remembering that the complex conjugate of a quaternion is found
by substituting a negative angle, we note that the same rotation viewed from the two different
perspectives of point rotation and frame rotation are formed by simply switching the order of the
quaternion/complex-conjugate product in equation 4.
These results can be generalized as follows:
The quaternion operation q vq * will be defined as a point rotation, while the operation q* v q will be
defined as frame rotation, where q is a unit quaternion and v is the vector corresponding to the pure
quaternion v =0+ v . These operations can be geometrically interpreted as rotations in three
dimensions, of either the vector or frame, through an angle 2θ about the axis given by the vector
component of the quaternion q, q. In the following discussion, we will use the symbol Lq (v ) to denote
the point rotation operation and L* ( v ) to denote the frame rotation. It is useful to come up with a
q
general formula for such an operation:
Lq ( v )= w= ( q0 + q ) ( 0+ v ) ( q0− q )
¿ ( q 20− ( q ) 2 ) v +2 ( q ∙ v ) q + 2 q 0 ( q ×v ) Eq. 5
( )( )( )
2 2
w1 2q 0−1+2 q 1 2( q 1 q 2−q 0 q 3 ) 2( q1 q3 + q0 q2 ) v1
Lq ( v )= w 2 = 2( q1 q2 +q 0 q3 ) 2 q20−1+2 q22 2( q2 q3 −q0 q 1 ) v2
2 2
w3 2( q1 q3− q0 q2 ) 2 ( q 2 q 3 +q 0 q 1 ) 2 q0−1+2 q 3 v3
Applications of Quaternions
Using quaternions as rotation operators rather than matrices has advantages in many subject
fields. For example,