A quaternion is an extension of complex numbers used to represent rotations and 3D orientation.

Definition

A quaternion has the form

where and the imaginary units satisfy

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 and the vector part is

So

in shorthand.

Conjugate, Norm, and Inverse

The conjugate of

is

The norm is

and

If , then the inverse is

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 around a unit axis , use the unit quaternion

A vector is written as the pure quaternion

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