Quaternions define a 4 dimensional algebra which is particularly useful for dealing with rotations in 3d. They are often used when you might want to produce a smooth rotation by interpolating between two orientations. Common applications are 3d graphics animation (e.g. games or CGI) and robotic kinematics.
Quaternions can be thought of as being similar to complex numbers but with 3 imaginary components instead of just one. These components are labelled , , and are all square roots of -1.
Quaternions were discovered by William Hamilton in 1843. His moment of inspiration is encapsulated by the following equation (which he famously etched onto Brougham Bridge in Dublin):
The quaternion number system is a superset of the complex numbers.
Operations
A quaterion can be represented by four numbers as follows:
Suppose we have two quaternions:
The sum of two quaternions is calculated as follows:
The following table describes the relationships between under multiplication:
As can be seen from this table, multiplication is non-commutative (in contrast with complex numbers).
Unit quaternions
The norm (or magnitude) of a quaterion is given by:
A quaternion with unit norm is a versor. In robotics, a unit quaternion may be described as an attitude quaternion.
Conjugate
The conjugate of quaternion is written as:
The product is always a real number and has the value:
If is a unit quaternion, its inverse is .