Three imaginary units
A quaternion consists of one real part and three imaginary parts: Each imaginary unit squares to : These rules give the pairwise products , and , along with , and . Reversing the order changes the sign. Quaternion multiplication does not commute, just as rotations about different axes do not commute. Complex multiplication cannot represent this behavior, but quaternion multiplication can. Following Lynch and Park, this section places the real part first and writes . The real part is the scalar part, and is the vector part. If , the quaternion is pure. Pure quaternions represent ordinary 3-D vectors.A unit axis behaves like i
Let the unit vector specify the rotation axis. Write it as the pure quaternion When you square it, the mixed terms cancel in pairs because . The remaining terms give A unit axis squares to , as does. You can extend the planar formula to any axis. A rotation by about the axis has the unit quaternion (Lynch and Park eq. B.9). The sum of the squared components is , hence the term unit quaternion. The rotation formula below explains the half angle.Rotating a vector
To rotate the vector , first represent it by the pure quaternion . Then multiply it on both sides: The conjugate reverses the sign of the vector part, much as complex conjugation reverses the sign of . For a unit quaternion, the conjugate is also the inverse, . Multiplication by on the left and its conjugate on the right doubles the angle held in . The quaternion must therefore store . Consider a quarter turn. Rotate by about the axis. In this case, , and direct multiplication gives The calculation maps to , a quarter turn about .The double cover
Replace by . In the product , the two minus signs cancel. Thus and produce the same rotation. Every rotation corresponds to these two unit quaternions. Unit quaternions satisfy . These points form the 3-sphere , a sphere in four dimensions. They also form a group under quaternion multiplication. Since and represent one rotation, covers SO(3) twice. You obtain SO(3) from by identifying every pair of opposite points. Solà et al. therefore call a double cover of SO(3). Both groups have the same tangent space, so angular velocities, small rotations and uncertainties have the same form in either group. The double cover affects numerical work. When a filter or controller compares two quaternions, it should treat and as equal. Interpolation between orientations should follow the shorter path. This may require changing the sign of one quaternion first.Using quaternions
Composition. If you apply first and second, the combined rotation is . For and , the components of are (Lynch and Park eq. B.15). This quaternion product corresponds to the matrix product . To a rotation matrix. The unit quaternion produces the matrix (Lynch and Park eq. B.12). Each entry is quadratic in , so replacing by leaves unchanged. Cost. Composing two rotation matrices requires 27 multiplications and 18 additions. Composing two quaternions requires 16 multiplications and 12 additions. You can correct small numerical errors by rescaling to length 1. A rotation matrix that has drifted must be re-orthogonalized. Compared with other representations.Storage order. Different systems use different component orders. Lynch and Park place the scalar first, , as this section does. Newton and Warp and ROS 2 use , with the vector part first and scalar last. Check both conventions before passing a quaternion between systems.
References
- Kevin M. Lynch, F. (2017). Modern Robotics.
- Solà, J., Deray, J., Atchuthan, D. (2018). A micro Lie theory for state estimation in robotics. arXiv [cs.RO].
Found an error on this page? Report an issue.

