Why Quaternions Matter

The plaque commemorating the discovery of quaternions by William Rowan Hamilton.

Yesterday marked a significant anniversary whose importance is more subtle than the usual ones we celebrate. On October 16, 1843, the great Irish mathematician William Rowan Hamilton was walking along the Royal Canal in Dublin. He had been pondering whether complex numbers could be extended to higher dimensions, and during his perambulation, he realized the answer was “yes”, and carved his solution on the Brougham Bridge. The plaque shown on the right commemorates the discovery. (For physics enthusiasts: Hamilton is the same man who discovered Hamiltonian dynamics, which in turn underlies quantum mechanics and much of chaos theory.)

To understand Hamilton’s solution, recall that an imaginary number is the square root of a negative real number. (A real number, in turn, includes all the counting numbers, negative numbers, ratios, and irrational numbers: numbers like π that can’t be expressed as fractions.) The imaginary unit is the square root of -1:

Illustration of the complex plane: the connection between complex numbers and points in two dimensions. Four points are plotted so you can see the correspondence between x and y coordinates and the real and imaginary parts of the complex numbers.

Complex numbers are the sum of a real number and an imaginary number. Just as you can place a real number on the number line, you can place a complex number on the complex plane: the x coordinate is the real part, while the y coordinate is the imaginary part. This means complex numbers are a very simple way to represent two-dimensional quantities (location on a map, for example). There is also a very deep connection between points on the surface of a sphere and complex numbers, which I may return to in a future post because it’s pretty awesome, but which is beside the point for today.

The math of complex numbers is very rich, but they also play many roles in physics and engineering, too many to list here. Instead, let’s focus on one particular case: representing rotations in two dimensions.

As far as I can tell from my historical readings, Hamilton wasn’t thinking about applications to science particularly when he started trying to generalize complex numbers to higher dimensions: he just wanted to see if he could discover a system of numbers with two imaginary units, i and j, which might represent points in three dimensions. But he couldn’t find one that was consistent. What he realized during that walk on October 16, 1843 is that he could do it with three different imaginary numbers i, j, and k , making a four-dimensional set called quaternions — but with a crucial new concept. Ordinary numbers can be multiplied in any order without changing the result: 4 × 2 = 2 × 4 ; complex numbers also behave this way, so for example

This is called commutativity: the order of multiplication doesn’t affect the answer.

Hamilton’s quaternions don’t work that way — changing the order of multiplication changes the result!  Here are a few of the multiplications of the quaternion imaginary units with each other:It might look like reversing the order of multiplication just gives you the negative, but that’s not going to be true in general because of all the different imaginary units. (More details about quaternion algebra are down at the bottom of this post, for those who are interested.)

This may sound incredibly complicated, but it’s less so if you think about language rather than algebra. The order of words in a sentence makes a big difference; words order sentence a The big of in makes difference a. It’s even more dramatic if you let the letters themselves be scrambled. We’re used to the arrangement of things being important, so the fact that multiplication of real or complex numbers doesn’t have that property is more a special case than anything. We just have to rethink what multiplication means if we’re expanding our ideas of what numbers are.

Rotations around two different axes don't commute with each other – the order makes a big difference. In this case, the axes point toward you (z axis) and toward me in the photo (x axis). In the first row, I rotated the book by 90° around the x-axis, then 90° around the z-axis; the second row shows what happens if you do the same rotations in reverse. (The book is Symmetry by Hermann Weyl; the t-shirt is "Math is Delicious" by Jeph Jacques.)

In fact, you already have a pretty clear notion of non-commutativity in a physical context: take a book and perform the rotations shown in the photos above. The two end results aren’t the same; the order of rotations matters. In two dimensions, the order is irrelevant, since there’s only two directions to go: clockwise or counter-clockwise. With three dimensions to work with, you have a lot of choices of directions for rotation, so order means a lot, as anyone who has tried carrying a sofa-bed up a narrow staircase can attest. In fact, we can think about rotations using multiplication of quaternions.

Hamilton’s quaternions look like they need four coordinates (real part, plus three imaginary parts) to plot, so we can’t draw them on a piece of paper. However, if you assign the three coordinates of space (x, y, and z) to the imaginary parts of the quaternion (leaving out the real bit), you can draw that. In fact, those of you who have taken introductory physics or certain math classes may recognize the (i, j, k) notation has been adopted for unit vectors, mathematical constructs corresponding to the simplest perpendicular directions in three-dimensional space. Quaternions are even more powerful than that: you can represent both directions (using just the imaginary parts) and rotations (using the whole quaternion).

In other words, though quaternions may be a little more complicated than the algebra you learned in high school, they are a very convenient way to represent real-world phenomena. Aerospace and robotics engineers use quaternions to model the positions and orientations of planes and robots; I even know some computer graphics designers who are fond of them. You may not have learned them in school (though maybe we should teach them more than we do!), but they paved the way to Maxwell’s theory of electromagnetism and a lot of the geometrical work my own research is based on.

Now it’s time for me to take a little walk.

Appendix: A Bit More About Quaternion Algebra

Skip over this part if you don’t want to see a lot of equations.

Here are the basic multiplication rules for quaternions:So let’s take two simple quaternions and multiply them together both possible ways:The only difference between Q×R and R×Q is whether 4k is positive or negative, but that’s enough that the results aren’t equal, or simply negatives of each other. I’ll spare you more complicated examples, since you probably can see where they would go.

Now how to represent rotations? Let’s go back to the book picture from above. The spine of the book is oriented along the y-axis, which isn’t shown, and we have two rotations, around the x– and z-axes to content with. Here are these three things, represented with quaternions:(The fraction in front is to make numbers work out. Don’t sweat its meaning.) We also need something known as the quaternion conjugate, which swaps the signs of the imaginary units, but leaves the real parts alone:Now let’s rotate from the first frame to the second:leaving the book’s spine along the z-axis, but facing away from me. The second rotation works in a similar way, but since the spine is already lined up along the z-axis, the rotation won’t affect it at all:(I chose the spine arbitrarily; you could also pick a line along the bottom of the book. This is a simple example, after all.)

Now let’s do the bottom row, starting again with the book’s spine facing up along the y-axis. The first rotation is around the z-axis:leaving the spine facing away from you. The final rotation is around the x-axis, so it won’t affect which way the spine points, just how the cover faces:

Now all that might seem like a lot of work, but it’s not once you’re used to it. It’s also very easy to program a computer to do these types of manipulations, including ones for weird axes and angles other than 90°. Computers don’t make algebra mistakes, and don’t mind doing the same kinds of calculations over and over and over again (which you and I do), so this bit of 19th century mathematics is very relevant to modern computer simulations!


13 responses to “Why Quaternions Matter”

  1. […] The Pendulum is Mightier Than the Sword BlogAbout the Author « Why Quaternions Matter […]

  2. […] helped me become better at explaining, at least as far as I can tell. Some of my posts are pretty blatantly pedagogical. Not every science writer I respect is pedagogical, of course; I’d say most aren’t, so […]

  3. […] and other operations; in fact you can use quaternions to perform Möbius transformations, and we know how powerful quaternions are. His professorship at Leipzig was actually in astronomy, though that’s certainly not what […]

  4. […] The main thing is that it’s standard, built into scientific calculators, and well-understood. The imaginary unit i also appears in the equation: recall that So this is where things get interesting: e and π are real irrational numbers, but […]

  5. […] studied quaternions (along with the work of German mathematician Hermann Günter Grassmann) and sought to extend their […]

  6. […] “Why Quaternions Matter” and “Science is For Everyone Including (Gasp!) […]

  7. […] century mathematics foundational to 20th century physics: non-Euclidean geometry, complex numbers, quaternions, and Clifford algebras. I doubt I’ll ever cover all of it, and of course I can only provide a […]

  8. […] the math is the same. This type of symmetry is known as SU(2) symmetry, which is related to the math of quaternions. Similarly, the symmetry in electromagnetism is akin to rotations around a single axis, which we […]

  9. Very good introduction.
    I only miss this:
    ijk = −1
    and then multiply both sides with k,
    for the rest is your example better than wikipedia,
    maybe you can insert that there.
    Greetings Arthur

  10. […] not phenomenally harder. The order of multiplication doesn’t matter, as it does with quaternions, Clifford numbers, or Grassmann numbers. In fact, for some applications like electrical engineering […]

  11. […] post is adapted from "Why Quaternions Matter", which first appeared on this blog on October 17, […]

%d bloggers like this: