Quaternions and Spatial Rotations

Extend complex-number ideas to quaternion products, inverses, and rotations in three dimensions.

Learning goals

  • Compute quaternion products in the correct order.
  • Connect pure quaternion multiplication with dot and cross products.
  • Use a unit quaternion to rotate a vector and prove length preservation.

Four real coordinates

Complex multiplication describes rotations in a plane, but a spatial rotation also needs an axis. Quaternions provide an algebra that can encode this additional information. We will learn the multiplication rules first, then explain how unit quaternions act on spatial vectors.

Quaternion

\[q=a+b\mathbf i+c\mathbf j+d\mathbf k,\quad a,b,c,d\in\mathbb R\]\[\mathbf i^2=\mathbf j^2=\mathbf k^2=\mathbf i\mathbf j\mathbf k=-1\]

The scalar part is a; the remaining three coordinates form the vector part. A pure quaternion has zero scalar part. The algebra is associative and distributive but multiplication is not commutative.

ProductResultReversed product
\(\mathbf i\mathbf j\)\(\mathbf k\)\(\mathbf j\mathbf i=-\mathbf k\)
\(\mathbf j\mathbf k\)\(\mathbf i\)\(\mathbf k\mathbf j=-\mathbf i\)
\(\mathbf k\mathbf i\)\(\mathbf j\)\(\mathbf i\mathbf k=-\mathbf j\)

Order changes an answer

Compute \((1+\mathbf i)(1+\mathbf j)\) and the reversed product.

Show worked solution
\[1+\mathbf i+\mathbf j+\mathbf k,\qquad1+\mathbf i+\mathbf j-\mathbf k\]

Distribute without interchanging factors. Only the product of the two imaginary units changes sign.

Conjugate, norm, and inverse

Three operations with distinct jobs

Quaternion conjugation keeps the scalar part and reverses the vector part.

Norm and multiplicative inverse

The norm is the square root of the sum of the squares of the four real coefficients; it is a real nonnegative number. The multiplicative inverse undoes multiplication by a nonzero quaternion.

Conjugation and inversion coincide for unit quaternions, but not for arbitrary nonzero ones.

Before using quaternions to move vectors, we need to know how to undo a nonzero quaternion. Conjugation reverses the imaginary part, and multiplying by the conjugate produces a real squared norm. That is the key simplification behind the inverse formula; it does not mean we may reorder arbitrary quaternion products.

\[q^*=a-b\mathbf i-c\mathbf j-d\mathbf k,\quad |q|=\sqrt{a^2+b^2+c^2+d^2}\]\[qq^*=q^*q=|q|^2,\qquad q^{-1}=q^*/|q|^2\quad(q\ne0)\]

Compute an inverse

Find the inverse of \(q=1+2\mathbf i-\mathbf j+2\mathbf k\).

Show worked solution
\[|q|^2=1+4+1+4=10,\quad q^{-1}=\frac{1-2\mathbf i+\mathbf j-2\mathbf k}{10}\]

Multiplying in either order gives the real scalar ten divided by ten.

Norm is multiplicative

Assume \((pq)^*=q^*p^*\). Prove \(|pq|=|p||q|\).

Show worked solution
\[|pq|^2=pq(pq)^*=pqq^*p^*=|q|^2pp^*=|p|^2|q|^2\]

The squared norms are real scalars and commute with all quaternions. Take nonnegative square roots.

Conjugating a product reverses its order. Forgetting that reversal breaks the norm proof.

Dot and cross products in one multiplication

Quaternion multiplication may initially look like a new set of rules to memorize. For pure quaternions, familiar vector operations explain those rules: the scalar part comes from a dot product, while the vector part comes from a cross product. This also explains why order matters.

Identify a pure quaternion with its vector of three coefficients. Expanding with the multiplication table gives:

\[uv=-u\cdot v+u\times v\]

Compute geometrically

Let \(u=\mathbf i+2\mathbf j\) and \(v=3\mathbf i+\mathbf k\). Find \(uv\).

Show worked solution
\[u\cdot v=3,\quad u\times v=(2,-1,-6)\]\[uv=-3+2\mathbf i-\mathbf j-6\mathbf k\]

Pure unit squares

Prove that any pure unit quaternion squares to negative one.

Show worked solution

Set \(v=u\). The cross product with itself is zero and its squared length is one. Thus \(u^2=-u\cdot u=-1\).

Polar form and the half-angle

Complex numbers described rotations in a plane. A unit quaternion adds the information needed to choose an axis in space. Pay particular attention to the angle: the quaternion uses half the physical rotation angle because the vector is multiplied on both sides.

\[q=|q|(\cos\theta+u\sin\theta),\qquad |u|=1,\quad u\text{ pure}\]

For a nonreal quaternion, normalize its vector part to choose the axis u. For a real quaternion the axis is not uniquely determined. Zero admits such a representation but carries no meaningful angle or axis.

Rotate a vector

\[r=\cos(\phi/2)+u\sin(\phi/2),\qquad v'=rvr^*\]

The rotation angle is phi around the oriented unit axis u. The quaternion uses half that angle.

A quarter-turn about the vertical axis

Rotate \(v=\mathbf i\) by \(\pi/2\) around \(\mathbf k\).

Show worked solution
\[r=(1+\mathbf k)/\sqrt2\]\[r\mathbf i r^*=\frac{(\mathbf i+\mathbf j)(1-\mathbf k)}2=\mathbf j\]

The positive horizontal coordinate axis rotates to the other horizontal coordinate axis.

Why quaternion conjugation is a rotation

We now have a candidate rotation formula. Let us ask what must be proved before calling it a rotation: vectors should remain vectors, lengths should be preserved, and the axis should stay fixed. Following these properties explains the formula beyond a numerical example. It also clarifies why replacing a unit quaternion by its negative produces the same rotation.

Purity and length

For unit \(r\) and pure \(v\), prove \(rvr^*\) is pure and has the same norm.

Show worked solution
\[(rvr^*)^*=rv^*r^*=-rvr^*\]

A quaternion is pure exactly when its conjugate is its negative. Multiplicativity of norm then gives:

\[|rvr^*|=|r||v||r^*|=|v|\]

Axis and angle

Explain how this length-preserving map has the stated axis and angle.

Show worked solution

Decompose \(v=v_\parallel+v_\perp\) relative to \(u\). The parallel part commutes with \(r\) and is fixed. For the perpendicular part, \(uv_\perp=-v_\perp u\). Expanding the two factors of the unit quaternion gives:

\[rv_\perp r^*=v_\perp\cos\phi+(u\times v_\perp)\sin\phi\]

The two vectors on the right are perpendicular with equal lengths in the plane perpendicular to the axis, so this is precisely a planar rotation through phi.

Two rotations: keep the application order

For a unit quaternion q, write \(R_q(v)=qvq^*\). Applying q first and p second gives \(R_p(R_q(v))=p(qvq^*)p^*=(pq)v(pq)^*\) because \((pq)^*=q^*p^*\). Thus the combined quaternion is pq, with the first-applied factor on the right. This is the same composition convention used for functions; multiplying in the opposite order describes a different experiment.

Turn a camera mount around two axes

A direction vector starts at (0,1,0). Compare a positive quarter-turn about the fixed x-axis followed by one about the fixed z-axis with the reverse order. Use the right-hand convention.

Show worked solution

In the first order, the x-turn sends \((0,1,0)\) to \((0,0,1)\), which the z-turn leaves fixed. In reverse order, the z-turn sends it to \((-1,0,0)\), which the x-turn leaves fixed. The final directions differ, proving these rotations do not commute. The axes here are fixed world axes; axes that move with the object would require a different description.

For a nonunit nonzero q, \(qvq^*\) scales length by \(|q|^2\). To obtain the corresponding pure rotation, normalize q or use \(qvq^{-1}\). Replacing an inverse by a conjugate is justified only for unit quaternions.

Move the rotation axis

So far the axis has passed through the origin. The same move-rotate-move-back idea used for complex transformations handles an offset axis. Translate relative to a point on the axis, rotate the displacement, and then restore the original position.

\[v'=b+r(v-b)r^*\]

For an axis through the point b, translate b to the origin, rotate, then translate back. This is the same conjugation idea used for complex rotations about a point.

Practice: an offset axis

Rotate \((2,0,0)\) a quarter-turn about the vertical line through \((1,0,0)\).

Show worked solution

Subtract the axis point to get \((1,0,0)\). The rotation gives \((0,1,0)\). Adding the axis point back gives \((1,1,0)\).

Two quaternions, one rotation

Prove \(r\) and \(-r\) describe the same rotation.

Show worked solution
\[(-r)v(-r)^*=(-r)v(-r^*)=rvr^*\]

Both minus signs cancel. This explains why a spatial rotation has two unit-quaternion representatives.

References and further study

Primary source for this extension: the supplied course notes, 2.5. Quaternions and R³ — Modern Geometry I-D, pp. 1–4. The conjugation approach connects to the transformation viewpoint in Michael Henle, Modern Geometries: Non-Euclidean, Projective, and Discrete, 2nd edition, Prentice Hall, 2001.

Continue exploring

Synthesis and proof challenges

Quaternion formulas encode both the amount and order of rotation. These challenges connect the algebra to spatial motion and show why the unit-norm hypothesis matters.

Reasoning · What if the quaternion is not unit?

Let r be a nonzero quaternion and v a pure quaternion. Compare \(rvr^*\) with \(rvr^{-1}\). Which always preserves the length of v?

Hint

Write r as its positive norm times a unit quaternion.

Show worked solution

Write \(r=su\), with s=|r|>0 and |u|=1. Then \(rvr^*=s^2uvu^*\), so its norm is \(s^2|v|\): it is a rotation followed by scaling unless s=1 (or v=0). But \(r^{-1}=u^*/s\), so \(rvr^{-1}=uvu^*\) always preserves length. Replacing inverse by conjugate is justified for unit quaternions, not for arbitrary nonzero ones.

Advanced / Honors · Rotation order is observable

Apply a positive quarter-turn about the x-axis and then one about the y-axis to the vector (0,0,1). Reverse the order and compare. Relate the two orders to products of their unit quaternions.

Hint

Use the right-hand rule for each coordinate-axis rotation. In a composition, the quaternion for the second rotation multiplies on the left.

Show worked solution

The x quarter-turn sends (0,0,1) to (0,-1,0), which the y rotation fixes. Reversing the order, the y rotation first sends (0,0,1) to (1,0,0), which the x rotation fixes. The final vectors differ. With \(r_x=(1+\mathbf i)/\sqrt2\) and \(r_y=(1+\mathbf j)/\sqrt2\), the products are \(r_yr_x=(1+\mathbf i+\mathbf j-\mathbf k)/2\) and \(r_xr_y=(1+\mathbf i+\mathbf j+\mathbf k)/2\). These are neither equal nor negatives, consistent with distinct rotations.

HM Math Studio

Opening your learning space…