Algebra

A multiplication that remembers the order

Four characters — i² = j² = k² = ijk = −1 — define a multiplication in which ab and ba are different numbers. Everything follows from them, including the fact that a rotation of a solid body has two names, and that two full turns are needed to get one of them home.

Worth reading first: Multiplying is turning · Eight ways to leave a square alone.

Multiplying is turning showed the complex numbers doing a job no pair of real numbers can: multiplication by a complex number rotates the plane, so a two-dimensional geometric operation is an arithmetic one. The obvious next question is whether the same trick works in three dimensions, and the obvious answer is no — there is no three-dimensional number system in which every non-zero element can be divided by.

The quaternion multiplication table, from i² = j² = k² = ijk = −1. A four-by-four multiplication table of the quaternion units, with the row giving the left factor, every entry computed from Hamilton's rule, and the pair that differs between the two orders marked.
Fig. 1 The four units multiplied every way round, with the row giving the left factor. Every entry is computed from Hamilton’s one line, and the highlighted pair shows the smallest place where the order matters: i times j is k, and j times i is minus k.

What works is four dimensions, and the price is that the multiplication stops being commutative. Hamilton found this in 1843 after fifteen years of trying to make three dimensions work, and the whole system is contained in four characters:

i2=j2=k2=ijk=1.i^2 = j^2 = k^2 = ijk = -1.

Everything in the table above is derived from that. Multiply ijk=1ijk = -1 on the right by k1k^{-1}, which is k-k, and ij=kij = k falls out; do the corresponding thing on the other side and ji=kji = -k. The table is a consequence, not a definition, and the figure computes it rather than reproducing it.

The order is part of the answer

Twenty-four of the sixty-four ordered pairs of units give different answers in the two orders. That is a fact about the arithmetic, and it becomes a fact about the world as soon as the quaternions are put to work.

A turn about i and one about j, in both orders. A cube in its starting position and the two positions reached by applying the same two quarter turns in the two possible orders, which are not the same position.
Fig. 2 A quarter turn about one axis and a quarter turn about another, applied to a cube in the two possible orders. The results are not the same position, and the two composite quaternions differ before any cube is drawn.

Rotations of a solid body do not commute either. Turn a book a quarter turn about a vertical axis and then a quarter turn about a horizontal one, and it ends somewhere; do the same two turns the other way round, and it ends somewhere else. That is an experiment anybody can perform, and it is the reason a system of numbers describing rotations has to be non-commutative. The strangeness in the multiplication table is not a defect being tolerated — it is the feature that makes the system fit the thing it describes.

A turn about j and one about k, in both orders. A cube in its starting position and the two positions reached by applying the same two quarter turns in the two possible orders, which are not the same position.
Fig. 3 The same demonstration with different axes and a different angle. Neither the axes nor the angle matter to the conclusion; what matters is that the two axes are different.

The way a quaternion performs a rotation is by conjugation. Write a point as a quaternion with no real part, and send it to qvq1q v q^{-1}; the result is again a point, its length is unchanged, and the map is a rotation. That is checked in every figure here — the conjugated point is required to have no real part, the matrix is required to have determinant one, and the two composite matrices are required to differ.

Half the angle, and two turns home

Conjugation applies the quaternion twice, once on each side, and that has an immediate consequence: the rotation turns through twice the quaternion’s own angle. A quaternion at angle θ/2\theta/2 performs a rotation by θ\theta.

One full turn returns the object and not the quaternion. A row of squares showing an object's orientation as it turns through two full revolutions, above a plot of the scalar part of the quaternion performing the turn, which reaches minus one after the first revolution and one only after the second.
Fig. 4 An object’s orientation along the top and the quaternion performing it below. After a full turn the object is back where it started; the quaternion is at −1, and needs a second full turn to come home.

The half-angle is not a convention that could have been chosen otherwise. It follows from conjugation, and it forces a strange arrangement: qq and q-q perform exactly the same rotation, checked here to twelve decimal places at every sampled angle. So the map from unit quaternions to rotations is two to one, and the space of unit quaternions — a three-dimensional sphere sitting in four-dimensional space — is a double cover of the space of rotations.

The consequence is the one the picture is about. Take an object and turn it through a full revolution. The object is back where it began; the quaternion describing the journey has arrived at 1-1. Turn it through a second full revolution and the quaternion returns to 11. So the path taken by an orientation through a full turn is not contractible, and the path through two full turns is — which is a topological statement, provable with the covering machinery, and demonstrable with a belt.

That is worth stating plainly because it is easy to read as a quirk of notation. It is not. The rotation group is a space with a loop that cannot be pulled tight, exactly like a ring with a hole in it, and the quaternions are its unrolling. The double cover exists because the loop exists, and the two-to-one map is the same integer-valued obstruction seen a third time.

What survives the loss

Losing commutativity sounds like losing everything, so it is worth being precise about what is left, because the surviving structure is what makes the system usable.

Associativity survives. (ab)c(ab)c and a(bc)a(bc) agree for every triple, and the figure checks all five hundred and twelve triples of the eight units rather than quoting the axiom. Without it there is no group of unit quaternions, no composing of rotations, and nothing to build on.

Lengths multiply. The length of a product is the product of the lengths, which is the four-square identity Euler had written a century before Hamilton and which is exactly the statement that the quaternions of length one are closed under multiplication. That closure is why unit quaternions form a group, and it is why a normalised quaternion stays a rotation under composition.

Every non-zero element has an inverse, namely its conjugate divided by the square of its length — the same formula as for complex numbers, with three imaginary parts negated instead of one.

And the real numbers stay central. A real number commutes with everything, so scaling behaves as expected and the four-dimensional space really is a vector space over the reals with a multiplication on it. Almost everything one wants to do with numbers still works; the single casualty is the freedom to reorder a product.

What each doubling costs: the reals, the complex numbers, the quaternions, the octonions. A table of the four division algebras with their dimensions, the number of ordered pairs of basis units that fail to commute, and the number of triples that fail to associate, each count made by multiplying them out.
Fig. 5 The tower stopped short of the octonions, with the counts made by multiplying out. The reals and the complex numbers commute; the quaternions do not, and every one of them associates.

Where the tower stops

Hamilton’s discovery raises an obvious question: what next? The reals are one-dimensional, the complex numbers two, the quaternions four. Is there an eight?

What each doubling costs: the reals, the complex numbers, the quaternions, the octonions. A table of the four division algebras with their dimensions, the number of ordered pairs of basis units that fail to commute, and the number of triples that fail to associate, each count made by multiplying them out.
Fig. 6 Each algebra built from the one below it by the doubling construction, with the failures counted rather than quoted: how many ordered pairs of basis units fail to commute, and how many triples fail to associate.

There is, and it costs more. The octonions are eight-dimensional, every non-zero element can be divided by, and multiplication is no longer even associative: (xy)z(xy)z and x(yz)x(yz) are different for some triples of basis units, and the figure finds them by multiplying every triple out.

Each step of the tower is the same construction — pairs of elements from the level below, with a multiplication built from that level’s multiplication and its conjugation — and each step gives something up:

  • from one dimension to two, the ordering goes: there is no way to say one complex number is larger than another that respects the arithmetic;
  • from two to four, commutativity goes;
  • from four to eight, associativity goes;
  • and from eight to sixteen, division goes, which ends the tower.

The last step is a theorem of Hurwitz’s from 1898: over the real numbers there are exactly four algebras in which every non-zero element has an inverse and the length of a product is the product of the lengths, and they have dimensions one, two, four and eight. There is no other, and no amount of ingenuity produces one.

Multiplying two complex numbers. In the complex plane, multiplying adds the two angles and multiplies the two lengths.
Fig. 7 The two-dimensional case, where none of this has gone wrong yet: multiplication by a complex number is a turn and a scaling, and the order does not matter.

The eight units are a group, and a small one

There is a finite object hiding inside all of this, and it is the smallest place the non-commutativity can be examined without any geometry at all.

The eight elements ±1,±i,±j,±k\pm 1, \pm i, \pm j, \pm k are closed under multiplication. They contain an identity, every one of them has an inverse, and the product of any two is again one of the eight — so they form a group of order eight, usually called the quaternion group. It is one of exactly two non-commutative groups of that size, the other being the symmetries of a square, and the two are not the same group: the square’s group has five elements whose square is the identity, and this one has exactly two.

That comparison is the cleanest way to see that “non-commutative of order eight” does not pin a group down, and it is also a reminder that the quaternions’ strangeness is not exotic. A group of eight elements in which order matters is an entirely ordinary object; what is unusual is that this particular one extends to a system of numbers in which everything can be divided by.

The subgroup structure says something too. Every subgroup of the quaternion group is normal, which is rare and which means the group has no way of acting on a small set without acting trivially — it has no faithful action on fewer than eight points. That is the algebraic residue of the double cover: the group cannot be made to act on three dimensions the way its elements’ rotations suggest, because qq and q-q do the same thing.

What it costs

Nothing can be ordered. Even the complex numbers gave that up, and it is worth naming as the first casualty rather than the least. A statement like “the larger root” has no meaning once the numbers are two-dimensional.

Division needs care about the side. With abbaab \neq ba, the equation ax=bax = b and the equation xa=bxa = b have different solutions, and “divide by aa” is ambiguous until a side is chosen. Every identity has two versions and the two are not interchangeable.

The conjugation formula costs a multiplication. Rotating a point by qvq1qvq^{-1} is two quaternion products where a three-by-three matrix would be one matrix-vector product, and for a single point the matrix is cheaper. The quaternion wins when rotations are being composed rather than applied, because composing is one product either way and the quaternion carries four numbers instead of nine — and stays a rotation, whereas a matrix accumulating rounding drifts away from being one.

Where it fails, and what it needs

The double cover is a feature and a hazard. Two quaternions name each rotation, so comparing two orientations for equality means comparing qq with ±q\pm q', and code that forgets this reports two identical orientations as different. Interpolating between orientations has the same trap: the short way round and the long way round differ by a sign.

Not every quaternion is a rotation. The formula needs a unit quaternion, and the figures here check the length before using it. A quaternion of length rr conjugates to a rotation composed with a scaling by r2r^2, which is occasionally useful and usually a bug.

A rotation has an axis, and finding it is a separate step. The quaternion carries the axis and the angle in a mixed form — a real part that is the cosine of half the angle and an imaginary part pointing along the axis with length the sine of half the angle — so extracting either one is arithmetic on the components rather than a reading-off. Near the identity the axis is numerically ill-determined, because a very small rotation has almost no imaginary part to point with.

And the three dimensions the rotations act on are not the three imaginary units. It looks as though ii, jj and kk are the three axes, and in a sense they are — but they are the axes of rotation, not coordinates of the space being rotated, and the correspondence between the two is exactly the two-to-one map. Reading the quaternions as “a real part plus a vector” is the standard shortcut and the standard source of confusion.

Where it came from

Hamilton spent from 1830 to 1843 trying to multiply triples. He could add them, and he could not find a multiplication for which lengths multiplied — which, by Hurwitz’s later theorem, was not a failure of imagination. The story of the flash of insight on Brougham Bridge in Dublin, and the four characters carved into the stonework, is one of the few anecdotes in mathematics that appears to be true; the carving is gone and a plaque records it.

What Hamilton actually gave up was not commutativity in the abstract but the belief that it was negotiable. Nobody before him had written down an arithmetic in which abbaab \neq ba and treated it as legitimate rather than as an error, and the significance of the quaternions is at least as much that as the algebra itself. Within a generation, matrices, group algebras and everything else non-commutative followed.

The quaternions then had a strange career. For fifty years they were the standard language of three-dimensional physics; then Gibbs and Heaviside split the quaternion product into the dot and cross products, vector notation won comprehensively, and quaternions became a historical curiosity. They returned in the second half of the twentieth century, in computer graphics and robotics and spacecraft attitude control, for exactly the reason above: composing rotations is cheap, and a normalised quaternion is always a rotation.

What the pictures cannot show

The cubes drawn here are three-dimensional and the quaternions are four-dimensional, so the figure shows what a quaternion does and never shows a quaternion. The unit quaternions form a three-sphere in four-space and no drawing of one exists.

The double-cover figure draws the quaternion’s scalar part against the angle turned, which is a one-dimensional shadow of a path on that sphere. What it correctly shows is that the path returns to 1-1 after one turn; what it cannot show is that the path is a loop that cannot be pulled tight, which is the content, and which is a statement about the sphere rather than about the graph.

The table of division algebras reports counts of commuting and associating triples, and those counts are performed. It does not show that the tower stops — Hurwitz’s theorem is quoted and not proved, and no exhaustion could prove it, because it is a statement about every algebra of every dimension rather than about a list.

The ladder from here

Below: multiplying is turning, the two-dimensional case where the same idea costs nothing, and eight ways to leave a square alone, where a group of motions is written out and composed. Sideways: the directions a map leaves alone, which is what an axis of rotation is in the language of matrices, and the same loop, unrolled, where the double cover is the general construction rather than a curiosity. Above: the octonions and their exceptional symmetry group, Hurwitz’s theorem, and rotations in four dimensions, which take two quaternions rather than one.

What is worth carrying away

Giving something up can buy more than it costs. Every step of the tower of division algebras abandons a property that had seemed non-negotiable, and every step buys a dimension — and the property abandoned at the fourth step, commutativity, turns out to be exactly the property that rotations do not have.

That is the pattern worth taking. When a construction keeps failing, the question is not how to try harder but which assumption is doing the blocking, and whether the thing being described actually has it. Hamilton spent thirteen years assuming multiplication commutes because everything he had ever multiplied did; what he wanted to describe did not.