Wolfram Alpha:

```Rotation can be represented by a unit vector and an
angle of revolution about that vector.

When a sequence of rotations is applied in three
dimensions and the resultant total rotation is
calculated it follows laws which may not be intuitive.

The order of rotations is important. If a sequence
of rotations is performed, changing the order will
produce different results.  Therefore, rotations form
a non-Abelian (non-commutative) group.  Representations
of 3D rotations in this way are very messy so it is
better to think of rotations in terms of QUATERNIONS
or matrices where we can combine rotations into a
single rotation.

Quaternions
----------

H = a + bi + cj + dk where i2 = j2 = k2 = -ijk) are
effectively the equivalent of the complex plane in 3D.
The following rules are used when multiplying 2 or
more quaternions together:

1 |  i |  j |  k
----------------------
1 | 1 |  i |  j |  k
----------------------
i | i | -1 |  k | -j
----------------------
j | j | -k | -1 |  i
----------------------
k | k |  j | -i | -1
----------------------

The formula for 3D rotations is:

Pout = q * Pin * q*

where,

Pout and Pin are points in 3D space represented by
the i, j and k parts of a quaternion (real part = 0).
q* is the complex conjugate. q is a quaternion which
represents the rotation.  In terms of the angle and
axis of the rotation, q is:

q = cos(α/2) + i(xsin(α/2)) + j(ysin(α/2)) + k(αsin(a/2))

where,

α = rotation angle
x,y,z = rotation axis

Combining Rotations
------------------

A rotation of q1 followed by a rotation of q2 is
equivalent to a single rotation of q2*q1.  Note
the reversal of order, that is, we put the first
rotation on the right hand side of the multiplication.

The order worked out above assumes that each rotation,
q1 and then q2 is done in the absolute frame of
reference so we get q2*q1.  When working in the
frame of reference of a moving object the order
is not reversed so the combined rotation is q1*q2.

Summarizing:

absolute frame of  	frame of reference
reference               of rotating object
-----------------       ------------------
q2*q1                       q1*q2

Once we have expressed the rotational quantity
as a quaternion, it is easy to work with it.

Combining rotations and translations implies that
the above formulas contain both multiplication

This means that we cannot necessarily derive a
single quaternion that can represent a combination
of the above transforms.  This is because a quaternion
contains 4 scalar values so there is no way it can
represent say the 6 degrees of freedom of a solid
object.

If we want a single algebraic entity which can
represent any combination of the above transforms
then we would need to consider other algebras:

- Use matrices
- Use dual quaternions.
- Use projective or conformal projections.
- Use quaternions for the rotation part and
handle the translation part separately
(see affine translations).

```