# Composition of rotations

← Back: Rotations using quaternions |
Overview: Quaternions |
Next: Realization of transformations → |

Usually rotations are regarded around the three coordinate axes , and and formulas are known to define the corresponding principal rotation matrices , and .

As explained in the previous article Rotations using quaternions, a rotation around an axis defined by a unit vector about the angle can be described by a quaternion as follows:

describes a rotation around the -axis by the angle . The -axis is defined by the unit vector . So if this rotation should be presented as a quaternion, has to equal . Accordingly the three principal rotations can be described by the following quaternions:

Assume two rotations are composed as

If two rotations are applied on a vector , one rotation is executed first and then the second rotation is applied on the intermediate result of the first rotation. Using rotation matrices this looks as follows:

The corresponding quaternions and for the two rotations can be computed as explained above and in Rotations using quaternions. So the first quaternion rotation leads to and is defined as

The second rotation is then applied to using the second quaternion :

Since multiplication of quaternions is associative, the order in which the multiplications are solved is not important and does not influence the result. So each the two outer quaternions can be multiplied first:

Following the rule for the conjugate of a product of quaternions this leads to

Thus the rotation composed by the two rotations and is equivalent to a quaternion equal to the product of the two corresponding quaternions and :