This is my first post, so I think a brief introduction is appropriate. My name is John McKenna. I’ve been a programmer at Ubisoft Reflections for what feels like forever. But I’m not here to talk about game development. I want to talk Mathematics.

Not the usual mathematics that game devs always talk about – vectors and matrices and quaternions and spherical harmonics and all that. There are plenty of good resources for them already. I want to get into the deeper theory behind them. It is by belief (or my hope) that game developers (the programmers, at least) have an interest in these things, but might not have had the opportunity to explore them properly.

None of this will be remotely useful, but I hope you find at least some of it interesting.

Where should I start? At the beginning?

**Where Do Numbers Come From?**

## Part 1: The Natural Numbers

What are numbers? This is the sort of question that sounds trivial until you think about it. Real numbers are particularly troublesome. What exactly is ? We can’t define it in terms of anything physical, as we have no way of measuring things infinitely precisely, and it isn’t clear that there is any physical meaning below some very small scale. Mathematics is good at providing models for reality, but we should never identify the two. We need to look elsewhere.

Counting sounds safe. We all know how to count, and the Peano axioms give us a precise summary of the process. There are a number of different ways of stating them, and different versions of what gets included, depending on which texts you read and what you want to do with them. For now, I just want a good idea of what natural numbers are, and this will do the job:

- is a number.
- Every number has a successor , which is a number.
- is not the successor of any number.
- If , then .

The first axiom tells us that is a number, and the third says that counting starts there. The second tells us that we can count, and we can count as high as we want. The fourth tells us that there is only one way to count: if we’ve reached a particular number, there is only one way we could have got there.

So our numbers start and continue on forever. For convenience, we call ‘one’, and write it . Similarly, is , and so on. Since these are the only numbers we have so far, I’ll use ‘number’ and ‘natural number’ interchangeably.

You might protest that I’ve told you how these numbers behave, but I haven’t told you what they are. And I will concede that you have a point, but it isn’t the point you think it is.

As Timothy Gowers says in his excellent little book “Mathematics: A Very Short Introduction”, a mathematical object *is* what it *does*. Mathematics is the art of abstraction. It is not concerned with any kind of reality, physical, Platonic, or otherwise. The natural numbers are only how they behave. The question of what they ‘really’ are is meaningless.

But there is a sense in which we should be concerned about their existence. Will working with these things ever produce a contradiction? Is it possible for any object in a consistent mathematical theory to behave in the way we want the natural numbers to behave?

The way that this question is answered is a bit of a cheat. We don’t really answer it; we just move the concern somewhere else. If we can define natural numbers in terms of some other mathematical object, then they will inherit whatever faith we have in that other object.

The object of choice, and the foundation of modern mathematics, is set theory. Everything in mathematics can be defined in terms of sets. As long as we’re happy that they are well behaved, everything will be fine. I’ll leave the philosophers to fight that one out.

So how can we build numbers from sets? Here’s one way:

- The empty set is called .
- If is a number, then is called .

( is the union of the sets and )

The first is clear. The second, perhaps less so. Some examples might help:

is

is .

is .

is .

Remember, this is not what the natural numbers ‘really’ are. This is just one way that we can construct them to help convince ourselves that we can legitimately use them.

It can be proved that these numbers satisfy the Peano axioms. I’ll spare you the details, as I’ve gone on long enough already.

Next time, we will use the natural numbers to create the rest of the integers. That means inventing arithmetic.