A quaternion is an extension of complex numbers used to represent rotations and 3D orientation.
Definition
A quaternion has the form
where
The multiplication rules are
and reversing the order changes the sign:
This means quaternion multiplication is not commutative.
Scalar and Vector Parts
We can write
where the scalar part is
So
in shorthand.
Conjugate, Norm, and Inverse
The conjugate of
is
The norm is
and
If
Unit Quaternion
A unit quaternion satisfies
Unit quaternions are especially important because they represent rotations in 3D.
Quaternion Multiplication
If
then
This combines the dot product and cross product into one algebraic rule.
Rotations in 3D
To rotate by angle
A vector
The rotated vector is obtained by
Why Quaternions Are Useful
- They avoid gimbal lock that can happen with Euler angles
- They are more compact than rotation matrices
- They are numerically stable for interpolation
- They are widely used in computer graphics, robotics, and physics