Contents

Rotation Quaternions

A quaternion is a 4-tuple with which is possible to obtain a concise and efficient representation of a rotation. The set of quaternions together with the two operations of addition and multiplication form a non-commutative ring.

Quaternions

Definition

A quaternion $q$ is defined as the sum of a scalar $q_0$ and a vector $\boldsymbol{q} = (q_1,q_2,q_3)$ in the standard orthonormal basis for $\mathbb{R}^3$ $i = (1, 0, 0), \ j = (0, 1, 0), \ k = (0, 0, 1)$. $$ q = q_0 + \boldsymbol{q} = q_0 + q_1\boldsymbol{i} + q_2\boldsymbol{j} + q_3\boldsymbol{k} $$

Addiction and Multiplication

The addition of two quaternions is just the addition component-wise

$$q = q_0 + q_1\boldsymbol{i} + q_2\boldsymbol{j} + q_3\boldsymbol{k}$$ $$p = p_0 + p_1\boldsymbol{i} + p_2\boldsymbol{j} + p_3\boldsymbol{k}$$ $$p + q = (p_0 + q_0) + (p_1 + q_1)\boldsymbol{i} + (p_2 + q_2)\boldsymbol{j} + (p_3 + q_3)\boldsymbol{k}$$

Moreover, each quaternion has a negative $-q$ that is just the quaternion with components

$$-q_i, \ i = 0,1,2,3$$

On the other hand the multiplication of two quaternions is a little bit more involved. The short form of such product is the following one where $p$ and $q$ are the vector parts of the quaternions.

$$pq = p_0q_0 - p\cdot q + p_0q + q_0p + p \times q$$

The set of quaternions is closed under multiplication and addition, and multiplication is distributive over addition. The identity quaternion has real part 1 and vector part (0, 0, 0).

Multiplication Example

Suppose we have the two quaternions

$$p = 3 + i - 2j + k$$ $$q = 2 - i + 2j + 3k$$

We can compute their inner product and cross product as below:

$$p \cdot q = - 1 - 4 + 3 = -2$$ $$p \times q = \begin{bmatrix} i & j & k \\ 1 & -2 & 1 \\ -1 & 2 & 3 \end{bmatrix} = -8i - 4j$$

The quaternion product is then

$$pq = (6 + 2) + 3(-i+2j+3k) + 2(i-2j+k) -8i - 4j$$ $$pq = 8 - 9i -2j + 11k$$

Complex Conjugate, Norm and Inverse

The complex conjugate $q^*$ of a quaternion $q$ is defined as the quaternion where the vector part is negated $q^* = q_0 - q = q_0 - q_1i - q_2j - q_3k$. We have the following properties:

  • $(q^)^ = q_0 - (-q) = q$
  • $q + q^* = 2q_0$
  • $q^q = qq^$
  • $(pq)^* = q^p^$

The norm of a quaternion $q$ is the scalar $|q| = \sqrt{q^*q}$. A quaternion is called unit quaternion if its norm is 1. The norm of the product of two quaternions $p$ and $q$ is the product of the individual norms $|pq|^2 = |p|^2|q|^2$. The inverse of a quaternion $q$ is defined as $$q^{-1} = \frac{q^}{|q|^2} \quad q^{-1}q = qq^{-1} = 1$$ In the case of a unit quaternion we have $q^{-1} = q^$.

Rotation Quaternions

Unit Quaternions are a really interesting tool to encode rotations: if we consider a unit quaternion $q = q_0 + \boldsymbol{q}$ we have that $|q|^2 = |q_0^2| + |\boldsymbol{q}^2| = 1$ thus it must exists an angle $\theta$ such that

$$\cos^2\theta = q_0^2 \quad \sin^2\theta = |q|^2$$

Indeed, it exists and it is an unique angle $\theta \in [0, \pi]$ . We can thus rewrite the quaternion in terms of such angle $\theta$ and a unit vector $\boldsymbol{u} = \frac{\boldsymbol{q}}{|\boldsymbol{q}|}$ $$ q = \cos\theta + \boldsymbol{u}\sin\theta $$ We can observe that any vector $v \in \mathbb{R}^3$ can be regarded as a quaternion with real part equal to zero $$v = 0 + v_1i + v_2j + v_3k $$ The following theorems hold for unit quaternions.

Theorem 1

For any unit quaternion $q = q_0 + \boldsymbol{q} = \cos\frac{\theta}{2} + \boldsymbol{u}\sin\frac{\theta}{2}$ and for any vector $v \in \mathbb{R}^3$ the action of the operator $$L_q(v) = \boldsymbol{qvq}^*$$ on $v$ is equivalent to a rotation of the vector through an angle $\theta$ about $u$ as the axis of rotation.

Theorem 2

For any quaternion $q = q_0 + \boldsymbol{q} = \cos\frac{\theta}{2} + \boldsymbol{u}\sin\frac{\theta}{2}$ and for any vector $v \in \mathbb{R}^3$ the action of the operator $$L_{q^} = q^v(q^)^ = q^*vq$$ is a rotation of the coordinate frame about the axis $u$ through an angle $\theta$ while $v$ is not rotated. Or equivalently the vector $v$ rotates through an angle $-\theta$ about $u$ with respect to the coordinate frame.

Operator Sequences

Let $p$ and $q$ be two unit quaternions, so is the product $qp$. If we have a vector $u$ and we want to apply first the rotation $v = L_p(u)$ and then the rotation $w = L_q(v)$ then the composition of such rotations is defined as $$ L_{qp}(u) = (L_q \circ L_p)(u) = (qp)u(qp)^* $$