Among the possible kinds of numbers, natural numbers stand out for being extremely simple. All we need to do is to define zero, and to define a successor function that, given a natural number, gives back the next one. We can add any two natural numbers. However, we can’t do most typical arithmetic operations if we only have naturals. For example, we can’t always subtract. If we try to solve \(x = 5 - 7\), for example, we already need a new kind of number.

So, let’s introduce the integers. These are like the naturals, but with negation (\(-1, -2, -3, \dots\)). We’ve lost a little bit of the simplicity of naturals, but now we can subtract any two integers. We can even multiply without issues. However, what if we wanted some kind of inverse multiplication…division? \(x = \frac{-3}{2}\) requires yet another new kind of number.

These numbers are the rationals. We can now add, subtract, multiply, divide (with the divide-by-zero caveat), even exponentiate sometimes. However, what if we wanted to find \(2 ^ \frac{1}{2} = \sqrt{2}\)? We need another kind of number, since \(\sqrt{2}\) can’t be expressed as a rational.

These numbers are the reals. We can solve many kinds of equations now, but not this one: \(x = \sqrt{-1}\).

For that, we need complex numbers. Out of all these kinds of numbers we’ve seen so far, these are the first to have a certain special property: they’re algebraically closed. What this means is that if some polynomial can be expressed with complex numbers, then so can its roots.

However, that’s not the final possible step on the road to weirder kinds of numbers. Just as a complex number is the pair of a real and imaginary part, we can think of quaternions as a pair of two complex numbers, written something like \(a + b\boldsymbol{i} + c\boldsymbol{j} + d\boldsymbol{k}\). I’ve only ever personally seen these used inside game engines, for calculating rotations in 3D space more easily. It’s interesting that at this level, some common properties of the previous numbers start to break down. For example, multiplication of quaternions is not commutative, but it is for all previous kinds of numbers.

Even a step beyond that, there is such a thing as an octonion. It’s like a pair of quaternions, a number in eight parts. Like quaternions, operations like multiplication aren’t commutative, but what’s more, they’re not even associative! (We can, of course, continue this process further. It’s using something called the Cayley–Dickson construction—doubling the dimension of our numbers at each step. After octonions come sedonions, then trigintaduonions.)

I find it really interesting that we can keep adding on properties to the kinds of numbers we’re working with, to get more power in using them. However, it’s especially intriguing that this can be taken too far: once you get high enough on the ladder, familiar properties like associativity and commutativity can drop away. As with virtually anything else, there’s a bit of an art to picking the right level of number to use—naturals are simple, but can’t do all that much, complex numbers get us through algebraic closure but are a bit more…complex to work with, and trigintaduonions aren’t all that useful to anybody, so far as I can tell.

Of course, numbers aren’t the only kinds of mathematical object to come in this kind of spectrum-like hierarchy.

We can build algebraic structures from two parts: a set of mathematical objects, and an operation that works on those kinds of objects.

Let’s start with the humble magma. A magma is a set along with a closed binary operation. Because we haven’t imposed many restrictions, we also don’t get much information about what a magma can do—the operation can be virtually anything that takes two elements of the set and gives back an element of the set.

If we add associativity to magmas, we get semigroups. These can be occasionally useful, but also aren’t that powerful.

Walking further up this ramp, we get to monoids. Monoids are like semigroups—their operations are closed, associative, and binary—but monoids also come with a distinguished element of the set we call the identity. For example, addition over the natural numbers gives us a monoid, with identity 0. Monoids also come up in the kinds of programming I like: for example, imagine the set of strings with concatenation as the operation. The identity is simply `""`

, the empty string.

With even more power, groups are like monoids but with inverse elements. For example, addition on integers gets us a group, while addition on naturals can only get us a monoid. Putting it together, we get that group operations are closed, associative, and binary, and that the group has an identity element, and that members of the group’s set have inverse elements.

An abelian group is just like a group, except with the added restriction that the operation must be commutative.

After groups we can add more structure by introducing a second operation! This takes us to rings. Rings have two closed, associative, binary operations, an identity, and additionally one of the operations distributes over the other. (Think of the way that multiplication distributes over addition in e.g. \(2 * (3 + 4)\)).

In rings, one of the operations has to be commutative. In a commutative ring, all operations must be commutative. Kind of like abelian groups.

We can keep going! Fields are like commutative rings, but both operations have inverses for each element in the underlying set. There is a requirement on the non-zero elements, which boils down to the idea that all the non-zero elements in a field must form an abelian group.

There’s a lot we can build just by slowly adding more and more properties!