Quaternions are two things: an extension of the complex numbers and a handy way of representing rotations in computer graphics. I’m only covering the first one here. This actually wasn’t covered at GDC, probably because you don’t actually have to understand quaternions to look up the algorithms for using them. I like being complete.

`i`

^{2} = -1

`i`

is the square root of negative one. They teach that in algebra 1 (or maybe it’s algebra 2). Complex numbers are numbers that have `i`

in them; they look like `a + bi`

, as if `i`

were a variable. `(3i) * (4i) = 12i`

^{2} = -12.

Quaternions are complex numbers except that they have 3 magic letters instead of 1; the familiar `i`

, as well as `j`

and `k`

. Imaginative, I know.

In quaternions `i`

isn’t *the* square root of negative one. It’s *a* square root of negative one. So are `j`

and `k`

.

`i`

^{2} = j^{2} = k^{2} = -1

There are a couple more rules for Quats, but really not that many:

```
```
- ij = k
- ji = -k
- jk = i
- kj = -i
- ki = j
- ik = -j

Notice that `ij != ji`

. Multiplication is not commutative (in fact it’s anti-commutative; `ab = -ba`

. These rules are enough to multiply two quats, via one big distribution:

(a_{1} + b_{1}i + c_{1}j + d_{1}k) (a_{2} + b_{2}i + c_{2}j + d_{2}k)

`= a`

_{1}(a_{2} + b_{2}i + c_{2}j + d_{2}k)

+ b_{1}i(a_{2} + b_{2}i + c_{2}j + d_{2}k)

+ c_{1}j(a_{2} + b_{2}i + c_{2}j + d_{2}k)

+ d_{1}j(a_{2} + b_{2}i + c_{2}j + d_{2}k)

```
```= a_{1}a_{2} + a_{1}b_{2}i + a_{1}c_{2}j + a_{1}d_{2}k

+ b_{1}a_{2}i + b_{1}b_{2}i^{2} + b_{1}c_{2}ij + b_{1}d_{2}ik

+ c_{1}a_{2}j + c_{1}b_{2}ji + c_{1}c_{2}j^{2} + c_{1}d_{2}jk

+ d_{1}a_{2}k + d_{1}b_{2}ki + d_{1}c_{2}kj + d_{1}d_{2}k^{2}

= a_{1}a_{2} + a_{1}b_{2}i + a_{1}c_{2}j + a_{1}d_{2}k

+ b_{1}a_{2}i - b_{1}b_{2} + b_{1}c_{2}k - b_{1}d_{2}j

+ c_{1}a_{2}j - c_{1}b_{2}k - c_{1}c_{2} + c_{1}d_{2}i

+ d_{1}a_{2}k + d_{1}b_{2}j - d_{1}c_{2}i - d_{1}d_{2}

`= (a`

_{1}a_{2} - b_{1}b_{2} - c_{1}c_{2} - d_{1}d_{2})

+ (a_{1}b_{2} + b_{1}a_{2} + c_{1}d_{2} - d_{1}c_{2})i

+ (a_{1}c_{2} - b_{1}d_{2}+ c_{1}a_{2} + d_{1}b_{2})j

+ (a_{1}d_{2} + b_{1}c_{2} - c_{1}b_{2} + d_{1}a_{2})k

[…] Quaternions are an Extension of Complex Numbers Quaternions are two things: an extension of the complex numbers and a handy way of representing rotations in computer […] […]

If you think that it cool, consider setting your sights a little higher. In

geometric alegbrathat i^2 = -1 thing goes from an interesting quirk to a deep statement about geometry (of more than just the complex plane). The general idea is that some physicists took Hamilton’s quaterions and did them right, for all spaces, regardless of dimension and signature, unifying geometry and algebra once and for all. The result, surprisingly, is actually useful in the real world — well, at least to programmers who may do something with a vector once and a while. You don’t usually hear about mathematical controversy, but some people really hate geometric algebra and prefer their unintuitive but familiar traditions while other people want to teach it to kids because, not counting time spend unlearning the old ways, it is much simpler — and itscales.I haven’t found the perfect introduction yet, but the book Geometric Algebra for Computer Science is pretty nifty to have in hand — the first chapter is online here: http://geometricalgebra.org/downloads/ga4cs_chapter1.pdf. I think another group is working on a game-oriented GA book, but it isn’t out yet.

Heh. In grad school, I worked briefly with David Hestenes and dabbled in Geometric Algebra while trying to come up with a thesis… just before I dropped out…