Quaternion Mathematics

Quaternions are entities of the form w+xi+yj+zk where
sq(i) = sq(j) = sq(k) = ijk = -1
ij = k, jk = i, ki = j
ji = -k, kj = -i, ik = -j

The values of i, j, k are distinct, and neither quaternions themselves nor their components can be thought of as being complex numbers.

A quaternion is usually represented as a vector, [w, x, y, z]. They are added by adding the separate components, and are multiplied by expanding out and then simplifying by using the above relationships.

A quat of julia sets:

Note that quaternions are not numbers [Actually, they are numbers--in much the same way that the complex number system is a two-dimensional version of the real number system, the quaternion number system is a four-dimensional version of the real number system. Since multiplication isn't commutative, but every non-zero quaternion has a multiplicative inverse, this forms an algebraic system called a "division ring". Because real and complex number multiplications are both commutative and have inverses, these are called "fields".], and only some of the usual rules of arithmetic apply. In particular, the commutative law does not apply. Given two quaternions a and b it is not in general true that ab = ba. When simplifying expressions, the rules given above are used instead. You will find they don't imply simpler rules or any contradictions - you can't prove that k = 0, for example.

Quaternions are a Ring, and form a natural extension of the idea of complex numbers. Compared to complex numbers, they are of little interest, but do have applications in physics and computer graphics. In particular, quaternions are very useful in simulating flight, as they efficiently avoid 3 difficulties with the apparently simpler Euler angles of heading, pitch and roll: Zero divide when maneuvering vertically, gimbal lock and interpolation between 2 angles.

Ok, but what do those relationships represent, metaphorically speaking?

Suppose you have a unit vector V = xi + yj + zk which represents a rotation axis, and you have an angle theta which indicates how far you are rotating around that axis. Then you can represent this rotation as a unit quaternion:
V*sin(theta/2) + cos(theta/2)

If you carry out one rotation, represented by quaternion Q1, followed by another rotation represented by quaternion Q2, then the resulting rotation will be equal to a quaternion Q3 = Q1 * Q2.

When representing orientations, it is also possible to use Euler angles, which is analogous to saying "my head is at the center of a sphere, and I am looking out through latitude X degrees, longitude Y degrees, and 'up' in my view is Z degrees from 'north' on this sphere." But there is a singularity if you look through the north or south poles. What is your longitude there, and which way is your "up"?

Quaternions do not have any singularities.

The more usual way of representing orientations is, I think, in terms of vectors, which don't have singularities either. Rotations are usually represented by matrices, but when you work with arbitrary axes that gets to be horribly complicated terrifyingly quickly. That's where the advantage of quaternions comes in.

"Quaternions came from Hamilton ... and have been an inmixed evil to those who have touched them in any way. Vector is a useless survival ... and has never been of the slightest use to any creature."
-- Lord Kelvin

See also CliffordAlgebra and in particular the book GeometricAlgebraForComputerScience, which explains the generalisation of the rotation transformations discussed above. -- JohnFletcher

EditText of this page (last edited August 27, 2011) or FindPage with title or text search