Quaternions: upping the dimensions of complex numbers

Quaternions
Last week, after I wrote about complex numbers, a bunch of folks wrote and said “Do quaternions next!” My basic reaction was “Huh?” I somehow managed to get by without ever being exposed to quaternions before. They’re quite interesting things.
The basic idea behind quaterions is: we see some amazing things happen when we expand the dimensionality of numbers from 1 (the real numbers) to 2 (the complex numbers). What if we add *more* dimensions?
It doesn’t work for three dimensions But you *can* create a system of numbers in *four* dimensions. As with complex numbers, you need a distinct unit for each dimension. In complex, those were 1 and i. For quaternions, you need for units: we’ll call them “1”, “i”, “j”, and “k”. In quaternion math, the units have the following properties:
1. i2 = j2 = k2 = ijk = -1
2. ij = k, jk = i, and ki=j
3. ji = -k, kj = -i, and ik=-j
No, that last one is *not* an error. Quaternion multiplication is *not* commutative: ab &neq; ba. It *is* associative over multiplication, meaning (a*b)*c = a*(b*c). And fortunately, it’s both commutative and associative over addition.
Anyway, we write a quaternion as “a + bi + cj + dk”; as in “2 + 4i -3j + 7k”.
Aside from the commutativity thing, quaternions work well as numbers; they’re a non-abelian group over multiplication (assuming you omit 0); they’re an abelian group over addition; they form a division algebra *over* the reals (meaning that you can define an algebra with operations up to multiplication and division over the quaternions, and operations in this algebra will generate the same results as normal real algebra if the i,j, and k components are 0.)
History
———
Quaternions are a relatively recent creation, so we know the history quite precisely. Quaternions were invented by a gentleman named William Hamilton on October 16th, 1843, while walking over the Broom bridge with his wife. He had been working on trying to work out something like the complex numbers with more dimensions for a while, and the crucial identity “ijk=-1” struck him while he was walking over the bridge. He immediately *carved it into the bridge* before he forgot it. Fortunately, this act of vandalism wasn’t taken seriously: the Broom bridge now has a plaque commemorating it!
Quaternion_Plague_on_Broom_Bridge.jpg
Quaternions were controversial from the start. The fundamental step that Hamilton had taken in making quaternions work was abandoning commutativity, and many people believed that this was simply *wrong*. For example, Lord Kelvin said “Quaternions came from Hamilton after his really good work had been done; and, though beautifully ingenious, have been an unmixed evil to those who have touched them in any way.”
Why are they non-commutative?
——————————-
Quaternions are decidedly strange things. As I mentioned above, they’re non-commutative. Doing math with things where ab &neq; ba was a *huge* step, and it can be strange. But it is necessary for quaternions. Here’s why.
Let’s take the fundamental identity of quaternions: ijk = -1
Now, let’s multiply both sides by k: ij(k2) = -1k
So, ij(-1)=-k, and ij=k.
Now, multiply by *i* on the left on both sides: i2j = ik
And so, -1j = ik, and ik=-j.
Keep playing with multiplication in the identities, and you find that the identities simple *do not work* unless it’s non-commutative.
What are they good for?
————————-
For the most part, quaternions aren’t used much anymore. Initially, they were used in many places where we now use complex vectors, but that’s mostly faded away. What they *are* used for is all sorts of math that in any way involves *rotation*. Quaternions capture the essential properties of rotation.
To describe a rotation well, you actually need to have *extra* dimensions. To describe an *n*-dimensional rotation, you need *n+2* dimensions. Since in our three dimensional world, we rotate things around a *line* which is two dimensional, the description of the rotation needs *four* dimensions. And further, rotation itself is non-commutative.
Take a book and put it flat on the table, with the binding to the left. Flip it so that the binding stays on the same side, but now you’ve got the back cover on top, upside-down. Then rotate it clockwise 90 degrees on the table. You now have the book with its back cover up, and the binding facing away from you.
Now, start over: book right side up, binding facing left. Rotate it clockwise 90 degrees. Now flip it the same way you did before (over the x axis if you think of left as -x, right as +x, away from you as +y, up as +z, etc.)
rotate.jpg
What’s the result? You get the book with its back cover up, and the binding factor *towards* you. It’s 180 degrees different depending on which order you do it in. And 180 degrees is a reverse equivalent to the sign difference that you get in quaternion multiplication! Quaternions have exactly the right properties for describing rotations – and in particular, the *composition* of rotations.
The use of quaternions for rotations is used in computer graphics (when something rotates on the screen of your PS2, it’s doing quaternion math!); in satellite navigation; and in relativity equations (for symmetry wrt rotation).

34 thoughts on “Quaternions: upping the dimensions of complex numbers

  1. danvk

    From what I’ve learned, the greatest thing about complex numbers is that you can do calculus with them. Real functions can be analytically continued to complex function, and cool things often ensue (i.e. the Riemann zeta function). Is there a “quaternion analysis” analogous to Complex analysis?

    Reply
  2. lytefoot

    “It doesn’t work for three dimensions”
    In what way does it not work?

    Well, suppose we take the integers, and we introduce two new units, i and j, so that i^2 = j^2 = -1. Then we’re left with the question: what is i*j? We want i*j to be a unit–if it isn’t, our algebraic structure breaks down.
    We want an integral domain, so we’ll assume that we can cancel. So we have a few possiblities.
    i*j=i. Then we cancel the i’s, and we find j=1; that’s no good.
    i*j=j. We cancel the j’s, and i=1, no good again.
    i*j=-i and i*j=-j give the same problems, except we get j=-1 and i=-1, respectively.
    If i*j=1, that means that i*j are multiplicative inverses–so that also means that j*i=1. So (i*j)*(j*i)=1*1=1. We need associativity, though, so (i*j)*(j*i)=i*(j*j)*i. We defined j^2=-1, so we have i*(-i)=1. Thus i*j=i*(-i), and by cancelling, we get j=-i. That’s bad again.
    Finally, if i*j=-1, well, we already know that i*i=-1. So i*j=i*i, and by cancellation, j=i.
    We simply need a fourth unique unit, k, so we can have i*j=k.
    (This demonstration also shows why the quaternians need to be anticommutative.)

    Reply
  3. lytefoot

    Oh… now that you’ve yeilded to the pressure to do the quaternians, will you do the octonians next? They don’t even get to be associative 🙂

    Reply
  4. malpollyon

    Octonions are for wimps, sedenions are where its at. None of that namby pambp a * b = 0 implies a = 0 or b = 0 nonsense. Zero Divisors FTW!
    I absolutely love the gradual loss of algebraic properties over the Cayley-Dickson algebras, losing order, then associativity, then alternativity [(xx)y = x(xy), (yx)x = y(xx)].

    Reply
  5. Uffe

    It is great to use normalised quaternions for rotation of objects in space. Not only do you get rid of the singularities of Euler angles, you even get linear kinematical equations in return for that effort. That’s why quaternions are used everywhere in aerospace or anywhere where you need to work with computer representations of large rotations of objects.
    By this you also discover something more strange: Every rotation of an object in 3D space is mapped (isomorphic?) to one, and only one, point on a four dimensional unit sphere.
    The half angles you get in all the equations is a nice hint of the strange 4 Pi symmetry in object rotations known in topology (in addition to the obvious 2 Pi symmetry).
    I have worked so much with quaternions over the years that I once went to check the bridge mentioned by Hamilton on a trip to Dublin. A destination much less popular than the musicians in the Temple Bar area, but, yes, it is still there!

    Reply
  6. Torbjörn Larsson

    You guys will give me a headache some day.
    Someone who writes *a lot* about quaternions and similar creations is John Baez. He discusses generalisations of quaternions when rotating on more complex spaces ( http://math.ucr.edu/home/baez/week106.html ; “octooctonions”, great!), Bott periodicity on Clifford algebras ( http://math.ucr.edu/home/baez/week105.html ; 2×2 matrices of quaternions, great!) and I’m quite sure he discussed the loss of algebraic properties in some other posts. He even has a paper on octonions and Lie spaces ( http://math.ucr.edu/home/baez/octonions/ ).
    “C*-algebras”?
    mathworld to the rescue: “A C*-algebra is a Banach algebra with an antiautomorphic involution *”, ie a nicely normed space with a conjugating operator for squaring. What use are they? Used in K-theory, where modules (commutative) over C*-algebras (presumably non-commutative) are found to correspond to vector bundles, ie base manifolds with a vector space as fiber. Now we are talking, since this sounds naively like classic field theory, and rotations must be described somehow.
    And again Baez has been busy ( http://math.ucr.edu/home/baez/cstar.html ). He explains that since quantum field theory has noncommutative observables, they are instead directly describable by C*-algebras. Spontaneous symmetry breaking in QFT’s leads to that “Each different vacuum gives a different representation of the C*-algebra of observables as operators on a Hilbert space”. And through QFT there is a connection to statistical mechanics and thermal equilibria.
    So in an abstract way I can fool myself I dimly see what is going on here, from rotations to field theory and quantum non-commutating operators. As long as the nitty-gritty is spared…
    “the strange 4 Pi symmetry in object rotations known in topology”
    Halfinteger fermionic spin, from topology? Well yes, it’s about basic symmetries, but: wow.

    Reply
  7. wintermute

    Since in our three dimensional world, we rotate things around a line which is two dimensional, the description of the rotation needs four dimensions.

    Isn’t a line one-dimensional?

    Reply
  8. G Barnett

    My question is: in quaternion math, when you take sqrt(-1), how do you know if you’re getting i, j, or k?

    Reply
  9. Mark C. Chu-Carroll

    G Barnett:
    Why does it need to be only one?
    Remember – in complex numbers, taking the sqaure root of -1 gives you too answers: +i, and -i. In quaternions, there’s more than one answer to sqrt(-1) – one in each of the vector dimensions. (I don’t think I said this in the original post: Hamilton called the “real” component the “scalar”, and the i, j, and k components the “vector”).

    Reply
  10. Strabo

    Fascinating stuff.
    If we can do algebra in 1, 2, 4 and 8 dimensions, can we go further? What about 16 or 32?

    Reply
  11. Torbjörn Larsson

    You guys will give me a headache some day.
    Someone who writes *a lot* about quaternions and similar creations is John Baez. He discusses generalisations of quaternions when rotating on more complex spaces ( http://math.ucr.edu/home/baez/week106.html ; “octooctonions”, great!), Bott periodicity on Clifford algebras ( http://math.ucr.edu/home/baez/week105.html ; 2×2 matrices of quaternions, great!) and I’m quite sure he discussed the loss of algebraic properties in some other posts. He even has a paper on octonions and Lie spaces ( http://math.ucr.edu/home/baez/octonions/ ).
    “C*-algebras”?
    mathworld to the rescue: “A C*-algebra is a Banach algebra with an antiautomorphic involution *”, ie a nicely normed space with a conjugating operator for squaring. What use are they? Used in K-theory, where modules (commutative) over C*-algebras (presumably non-commutative) are found to correspond to vector bundles, ie base manifolds with a vector space as fiber. Now we are talking, since this sounds naively like classic field theory, and rotations must be described somehow.
    And again Baez has been busy ( http://math.ucr.edu/home/baez/cstar.html ). He explains that since quantum field theory has noncommutative observables, they are instead directly describable by C*-algebras. Spontaneous symmetry breaking in QFT’s leads to that “Each different vacuum gives a different representation of the C*-algebra of observables as operators on a Hilbert space”. And through QFT there is a connection to statistical mechanics and thermal equilibria.
    So in an abstract way I can fool myself I dimly see what is going on here, from rotations to field theory and quantum non-commutating operators. As long as the nitty-gritty is spared…
    “the strange 4 Pi symmetry in object rotations known in topology”
    Halfinteger fermionic spin, from topology? Well yes, it’s about basic symmetries, but: wow.

    Reply
  12. Steve

    I don’t understand your statement that rotations exist in n+2 dimensions. My understanding is that in n-dimensional space, rotations always take place in a plane. The generator of the rotation in the plane with coordinates x and y is $x ∂_y – y ∂_x$ (the “eth” is supposed to be a partial derivative). It just so happens that in 3 dimensions, the plane of rotation is dual to a line perpendicular to that plane, hence the naive notion of rotation “about an axis”. In general, the dual has dimension n-2.

    Reply
  13. andy.s

    Strabo: As other poster have hinted, things get weirder as you go to higher and higher dimensions, but basically the answer is yes.
    There are only 4 division algebras, i.e. algebras where ax=b has a solution: real, complex, quaternions and octonions.
    However, there are all sorts of n-dimensional algebras.
    Clifford Algebra scales to any dimension.

    Reply
  14. Stephen Wells

    I met the quaternions under a different guise in geometric (Clifford) algebras. The 2- and 3-D geometric algebras are really fun to work with, so I use a lot of rotor math for 3-D orientations. I think I prefer the Clifford approach to the Hamilton definitions, as you can naturally get the (1,i,j,k) quaternion algebra as the even-grade elements of the 3-D geometric algebra ( basis is 1; vectors e1, e2, e3; bivectors (quaternions) e1e2, e2e3, e3e1; and a pseudoscalar e1e2e3). It’s quite neat that you can make all these geometric entities which square to -1, and I find it easier to understand the operation of the bivectors as rotation operators as they and the vectors are part of the same algebra.

    Reply
  15. G Barnett

    Well, I’ll just chalk that goofy question up to the way-too-many years since I last cracked open a mathematics book of any sort. Now that my memory has been jogged about sqrt(-1) in the complex set, yeah, all that makes sense now.
    I’ll just quietly wander off and ponder |sqrt(-1)| now. 🙂

    Reply
  16. Xanthir

    Hmm. In the complex plane, sqrt(-1) is two-valued. Both i and –i fulfill it. In quaternion space, is sqrt(-1) six-valued? It appears that +/- i, j, and k would all suffice.
    Also! This should probably go in the i post, but I’ll put it here because this is more open. All right, complex numbers lose the property of order. But within the complex numbers is the real line, where you *do* have a well-defined order property. Does this extend generally so that any radial line in the complex plane is well-ordered, but numbers that aren’t in the same radius can’t be compared?
    That is, if 4 i i? What about 1+2i and 2+4i? If I’m right, all of these pairs can be compared, but you can’t compare, say, 1 and i, right?

    Reply
  17. andy.s

    stephen w.
    You sound like a fellow member of the Hestenes cult 🙂
    Are you taking GA at a college/univ ?

    Reply
  18. Stephen Wells

    Xanthir: in 3-D, there are four geometric objects that square to -1: basis vectors a,b,c give you bivectors ab,bc,ca, for each of which e.g. abab= -abba = -aa = -1. Also the pseudoscalar abc has abcabc = abccab = abab = -1. So in total you have, sqrt(-1) has eight values! +/- each bivector and the pseudoscalar.
    Andy: I met GA with the Cavendish group in Cambridge (Gull and Lazenby) and found the rotor equations made sense in a way that matrices don’t to me. I used them in my mineral-physics PhD (rigid unit modes in silicates) and now in protein simulation. Hestenes is here at ASU but I’m not really in the cult 🙂

    Reply
  19. archgoon

    danvk wrote:
    Is there a “quaternion analysis” analogous to Complex analysis?
    Well, in order to do analysis, you need to take derivatives. In order to take derivatives, we need two things, limits and quotients. We can make sense of the idea of a sequence of quaternions getting close to another quaternion by taking the differnce of the two quaternions and then taking their norm.
    The next part is the quotients. Quaternoins have inverses, given any non-zero quaternion q_1, we can find another, unique quaternion, such that q_1*q_2 = 1.
    So with quotients, and derivatives, we can make sense
    of the following definition
    lim[h->0,(f(x+h)-f(x))/h)]
    So yes, there is quaternionic analyis, and like complex analysis, the derivative of a quaternionic function gives you a quaternionic function (unlike, say the derivatives in multi-variable calculus where you start with a function f:R^3->R and the object you end up with is a 1×3 matrix. Hated that)

    Reply
  20. Harald Hanche-Olsen

    Square roots of −1? The quaternion has infinitely many of them, not only six. Every “unit vector quaternion”, meaning any quaternion of the form ai+bj+ck where a2+b2+c2=1, is a square root of −1.
    Second comment: The quaternions do not form a C*-algebra, because C*-algebras are complex algebras and hence have a copy of the complex numbers in their center. But the center of the quaternions (the set of quaternions commuting with every other quaternion) is just the real numbers. But the quaternions can be embedded in the C*-algebra consisting of 2×2 matrices over the complex numbers. (Generated by the identity and i times the Pauli spin matrices, if memory serves.)

    Reply
  21. Ben St. John

    It’s probably worth pointing out that rotations/orientations only correspond to unit quaternions, and that, in fact, there are two quaternions corresponding to each rotation, q and -q.
    This sometimes leads to problems interpolating between quaternions. The fact that you can interpolate between them is one of their major advantages over matrices for expressing rotations.
    David Eberly has a number of good papers on quaternions too.

    Reply
  22. Cat lover

    Relating to what archagon said, there is an unfortunate ending to the story, however… the only differentiable functions are the linear functions with real slopes! One can do calculus on the quaternions by the usual trick of *defining* d/dx(x^n) = n*x^(n-1) and going from there, but AFAIK, analysis just doesn’t go anywhere, due to the above difficulty.

    Reply
  23. Ben St. John

    Interpolating between quaternions means exactly that. You have two quaternions, presumably representing two different orientations, and you can smoothly move from one to the other. It’s frequently used in animations, and is the best way to interpolate between two orientations. You can imagine that it’s rather difficult to do with rotation matrix, since there are so many redundant elements.
    With quaternions you can interpolate quite nicely and smoothly, although it gets a little trickier when you want to be exact, as you need to consider that you’re interpolating along a spherical surface, rather than just a line.
    Google for David Eberly, or look in “Game Programming Gems” or an animation or rendering book for more details.

    Reply
  24. Thony C.

    An interesting historical fact about quaternions is that they were the first non-standard algebra ever published. Before Hamilton, who by the way was a mega-nerd, there was only “algebra” the stuff that kids still get taught at school, with the quaternions Hamilton opened a whole new can of worms and therefore the oposition. The second non-standard algebra was Boole’s logical algebra in 1847 soon to be followed by Cayley’ matrix algebra and Grassman’s theory of extentions (vectors) after which there was no limit to the number of algebras which can and have been invented. I find it interesting that the spell checker in Word does not recognise a plural for algebra either in English or in German, obviously the person who writes the Micro-Shit dictionaries never got passed the school stage where there was only one algebra!

    Reply
  25. Wardell Lindsay

    Truth is Beauty and Beauty is Truth.
    Quaternion Differential Calculus can be had using a Quaternion Differential Change Operator, X:
    X = d/cdt + id/dx + jd/dy + kd/dz = d/cdt + DEL = R + DEL
    where ‘c’ is the speed of light and R=d/cdt=d/dw, and a Quaternion filed B= Bs + Bv, the ‘ s ‘ denotes scalar and the ‘ v ‘ denotes vector.
    The Equations of Electromagnetism are given by:
    0=XB = (d/cdt + DEL)(Bs + Bv) = (dBs/cdt – DEL.Bv) + (dBv/cdt + DELxBv + DEL Bs)
    Electromagnetic fields are related by : E = cB =zH =czD.
    Multiplying thru by ‘c’ the speed of light gives the traditional two fields:
    0 = XE = (dBs/dt -DEL.Ev) + (dBv/dt + DELxEv + DEL Es)
    Truth is Beauty and Beauty is Truth.

    Reply

Leave a Reply to Xanthir Cancel reply