Imagine winding the hour hand of a clock back from 3 o’clock to noon. Mathematicians have long known how to describe this rotation as a simple multiplication: A number representing the initial position of the hour hand on the plane is multiplied by another constant number. But is a similar trick possible for describing rotations through space? Common sense says yes, but William Hamilton, one of the most prolific mathematicians of the 19th century, struggled for more than a decade to find the math for describing rotations in three dimensions. The unlikely solution led him to the third of just four number systems that abide by a close analog of standard arithmetic and helped spur the rise of modern algebra.

The real numbers form the first such number system. A sequence of numbers that can be ordered from least to greatest, the reals include all the familiar characters we learn in school, like –3.7, the square root of 5, and 42. Renaissance algebraists stumbled upon the second system of numbers that can be added, subtracted, multiplied and divided when they realized that solving certain equations demanded a new number, i, that didn’t fit anywhere on the real number line. They took the first steps off that line and into the “complex plane,” where misleadingly named “imaginary” numbers couple with real numbers like capital letters pair with numerals in the game of Battleship. In this planar world, “complex numbers” represent arrows that you can slide around with addition and subtraction or turn and stretch with multiplication and division.

Hamilton, the Irish mathematician and namesake of the “Hamiltonian” operator in classical and quantum mechanics, hoped to climb out of the complex plane by adding an imaginary j axis. This would be like Milton Bradley turning “Battleship” into “Battlesubmarine” with a column of lower case letters. But there was something off about three dimensions that broke every system Hamilton could think of. “He must have tried millions of things and none of them worked,” said John Baez, a mathematician at the University of California, Riverside. The problem was multiplication. In the complex plane, multiplication produces rotations. No matter how Hamilton tried to define multiplication in 3-D, he couldn’t find an opposing division that always returned meaningful answers.

To see what makes 3-D rotation so much harder, compare turning a steering wheel with spinning a globe. All the points on the wheel move together in the same way, so they’re being multiplied by the same (complex) number. But points on the globe move fastest around the equator and slower as you move north or south. Crucially, the poles don’t change at all. If 3-D rotations worked like 2-D rotations, Baez explained, every point would move.

The solution, which a giddy Hamilton famously carved into Dublin’s Broome Bridge when it finally hit him on October 16, 1843, was to stick the globe into a larger space where rotations behave more like they do in two dimensions. With not two but three imaginary axes, i, j and k, plus the real number line a, Hamilton could define new numbers that are like arrows in 4-D space. He named them “quaternions.” By nightfall, Hamilton had already sketched out a scheme for rotating 3-D arrows: He showed that these could be thought of as simplified quaternions created by setting a, the real part, equal to zero and keeping just the imaginary components i, j and k — a trio for which Hamilton invented the word “vector.” Rotating a 3-D vector meant multiplying it by a pair of full 4-D quaternions containing information about the direction and degree of rotation. To see quaternion multiplication in action, watch the newly released video below by the popular math animator 3Blue1Brown.

Everything you could do with the real and complex numbers, you could do with the quaternions, except for one jarring difference. Whereas 2 × 3 and 3 × 2 both equal 6, order matters for quaternion multiplication. Mathematicians had never encountered this behavior in numbers before, even though it reflects how everyday objects rotate. Place your phone face-up on a flat surface, for example. Spin it 90 degrees to the left, and then flip it away from you. Note which way the camera points. Returning to the original position, flip it away from you first and then turn it to the left second. See how the camera points to the right instead? This initially alarming property, known as non-commutativity, turns out to be a feature the quaternions share with reality.

But a bug lurked within the new number system too. While a phone or arrow turns all the way around in 360 degrees, the quaternion describing this 360-degree rotation only turns 180 degrees up in four-dimensional space. You need two full rotations of the phone or arrow to bring the associated quaternion back to its initial state. (Stopping after one turn leaves the quaternion inverted, because of the way imaginary numbers square to –1.) For a bit of intuition about how this works, take a look at the rotating cube above. One turn puts a twist in the attached belts while the second smooths them out again. Quaternions behave somewhat similarly.

Upside-down arrows produce spurious negative signs that can wreak havoc in physics, so nearly 40 years after Hamilton’s bridge vandalism, physicists went to war with one another to keep the quaternion system from becoming standard. Hostilities broke out when a Yale professor named Josiah Gibbs defined the modern vector. Deciding the fourth dimension was entirely too much trouble, Gibbs decapitated Hamilton’s creation by lopping off the a term altogether: Gibbs’ quaternion-spinoff kept the i, j, k notation, but split the unwieldy rule for multiplying quaternions into separate operations for multiplying vectors that every math and physics undergraduate learns today: the dot product and the cross product. Hamilton’s disciples labeled the new system a “monster,” while vector fans disparaged the quaternions as “vexatious” and an “unmixed evil.” The debate raged for years in the pages of journals and pamphlets, but ease of use eventually carried vectors to victory.

Quaternions would languish in the shadow of vectors until quantum mechanics revealed their true identity in the 1920s. While the normal 360 degrees suffice to fully rotate photons and other force particles, electrons and all other matter particles take two turns to return to their initial state. Hamilton’s number system had been describing these as-yet undiscovered entities, now known as “spinors,” all along.

Still, physicists never adopted quaternions in their day-to-day calculations, because an alternative scheme for dealing with spinors was found based on matrices. Only in the last few decades have quaternions experienced a revival. In addition to their adoption in computer graphics, where they serve as efficient tools for calculating rotations, quaternions live on in the geometry of higher-dimensional surfaces. One surface in particular, called a hyperkähler manifold, has the intriguing feature that it allows you to translate back and forth between groups of vectors and groups of spinors — uniting the two sides of the vector-algebra war. Since vectors describe force particles while spinors describe matter particles, this property holds extreme interest to physicists who wonder if a symmetry between matter and forces, called supersymmetry, exists in nature. (However, if it does, the symmetry would have to be severely broken in our universe.)

For mathematicians, meanwhile, quaternions never really lost their shine. “As soon as Hamilton invented the quaternions, everyone and his brother decided to make up their own number system,” Baez said. “Most were completely useless, but eventually … they led to what we now think of as modern algebra.” Today, abstract algebraists study a vast array of number systems in any number of dimensions and with all manner of exotic properties. One not-so-useless construction turned out to be the fourth and final number system that permits a multiplication analog and an associated division, discovered shortly after the quaternions by Hamilton’s friend, John Graves. Some physicists suspect that these peculiar, eight-dimensional “octonions” may play a deep role in fundamental physics.

“I think there’s still a lot more to discover about geometry based on the quaternions,” said Nigel Hitchin, a geometer at the University of Oxford, “but if you want a new frontier, then it’s the octonions.”

### More Great WIRED Stories

- Why you need a physical vault to secure a virtual currency
- The rise and fall of the supercut video
- Free speech is not the same as free reach
- It’s time to stop sending money on Venmo
- Say hello to the most audacious flying machine ever
- Looking for more? Sign up for our daily newsletter and never miss our latest and greatest stories