What are numbers? In the previous post, we looked at the foundation of set theory to give us a tool to understand this question. Make sure to read that post here, and then come back to this article! It’ll be worth it; I promise.

In this post, we’ll dive into the meat of the problem: how do we use sets to define numbers?

### From Sets to Numbers

Before we embark on our ambitious task to construct the real numbers, let’s start with something a bit easier. We’ll start with our basic counting numbers, working our way to integers, rational numbers, and then the formiddable foe of the reals. Let’s break down this problem into a couple of levels:

1. $\mathbb{N}$, the natural numbers (0, 1, 2, …)
2. $\mathbb{Z}$, the integers (…, -2, -1, 0, 1, 2, …)
3. $\mathbb{Q}$, the rational numbers (fractions)
4. $\mathbb{R}$, the reals

#### Level 1: $\mathbb{N}$

The natural numbers are what we’d consider as basic counting numbers, starting at 0 and going till infinity. (Sidenote: some people believe that natural numbers start at 1, but we’ll start with 0). To beat this level, we need to have a unique representation for all of these numbers.

This seems hard at first; we have to have a unique way to define each number all the way till infinity! Also, we can’t have squirmy definitions, it should be clearly defined since we’re going through all this effort anyways.

Let’s start with the first natural number: $0$. $0$ symbolizes nothing, so it feels natural to assign it as $\emptyset$, or $\{\}$. This is valid from one of our ZFC axioms, saying that there exists an empty set.

Now we have a starting point, how do we construct the next number? Let us define the successor operation:

$$S(n) = n \cup \{ n \}$$

This successor function takes a set and returns a new set as above. Let’s do an example: What’s the successor of $\emptyset$?

Well, $S(\emptyset) = \{ \} \cup \{ \{ \} \}$. We’re taking the union of these two sets, so we want to create a set that contains all the elements in each of the two sets. The first set, $\{ \}$, contains no elements, so it won’t “contribute” anything. The second set contains $\{ \}$, so the union of the two sets must contain it as well. Thus, we get $S(\emptyset) = \{ \{ \} \}$.

Let’s run the successor function again on this result. So we want to calculate $S(S(\emptyset))$.

$$S(S(\emptyset)) = S(\{ \{ \} \}) = S( \{ \emptyset \})$$

$$S( \{ \emptyset \}) = \{ \emptyset \} \cup \{ \{ \emptyset \} \}$$

$$S( \{ \emptyset \}) = \{ \emptyset, \{ \emptyset \} \}$$

That’s a lot of curly braces! Don’t let that distract from what we’re doing: establishing a recursive function that creates a new set from our previous result.

Here’s the cool part: you’ve just defined the natural numbers. We assigned $0$ as $\emptyset$, and then we can assign $1$ as $S(\emptyset)$, $2$ as $S(S(\emptyset))$, and so on.

At this point, I encourage you to try constructing $3$ and check your answer here:

Now that we’ve gone through this effort, it’s worth reflecting on what we’ve done. We have defined the successor function to define $n+1$ by calculating $S(n)$. Why do we have to go through this relatively complex process as opposed to other ways to construct $\mathbb{N}$? Let’s look at two candidates for what we could’ve done.

1. Define $n$ to be the number of items in a set. This set doesn’t have to contain numbers, but just contain random objects. For example, $0 = \{ \}$, $1=\{ red \}$, $2 = \{red, blue\}$. We define a number to be the number of elements in the set.

Problems with this approach:

a. This is circular! How do we count the number of elements in a set without knowing what numbers are to begin with?

b. There isn’t a unique representation for each number. With this definition, $2 = \{red, blue\}$, but $2 = \{red, green\}$. For every natural number other than $0$, there are an infinite number of ways to represent each number.

2. Define a recursive function such that $n+1 = \{ n\}$. Here, we wrap the previous element in another set and define $0 = \emptyset$.

Problems with this approach:

Technically, this doesn’t seem to be a bad approach. It simplifies our construction of each number much more. But, there’s a reason we chose to define the natural numbers with the successor function, because it allows for us to understand operations like addition and subtraction much more easily.

There can be many ways to construct the natural numbers; there isn’t one right answer. But we’ll stick to this successor approach.

The last thing to examine is whether this successor approach is really valid. It checks out because we’re using only our axioms for the function: the union operation is defined and the empty set is defined.

##### Defining operations

When we talk about natural numbers, we understand what it means to add, multiply and exponentiate. It follows that it should make sense with our construction.

To this end, we can use something called Peano Arithemetic. To maintain the focus of the article, I won’t go into it here, but if you want to know how we define these important operations, I’d recommend checking out the Wikipedia page!

#### Level 2: $\mathbb{Z}$

For our next challenge, we need to construct the integers. This is like the natural numbers, but includes negative numbers as well.

Let’s think intuitively: how do we know what a negative number is? Well, if I take a number like 0 and subtract 7, then we get -7. But how do we formalize that?

If you recall in the last post, we defined what an ordered pair was. We can write the number -7 as the ordered pair (0, 7), such that 0 - 7 = -7. In this way, we’ve created a negative number using natural numbers (which is totally valid since we’ve defined the natural numbers above).

The problem is that this isn’t unique. If I write the ordered pair $(1,8)$, we get $1-8 = -7$ just like $0-7 = -7$. This shouldn’t be too much of a worry when we define what is known as an equivalence class. What this means, loosely, is that if I have ordered pairs $(a,b)$ and $(c,d)$ and $a-b = c-d$, then we consider these ordered pairs to exist in the same equivalence class, meaning we can treat them as the same object. If you’d like a more rigorous explanation, I encourage you to check out the Wikipedia page linked above.

We can always also construct the natural numbers this way as well. For example, $3 = (4,1)$. This approach lets us define a value for all the integers.

#### Level 3: $\mathbb{Q}$

Now, we want to construct the rationals, basically just fractions (more explicitly, a quotient between two integers, where the denominator is non-zero). Before you read ahead, I encourage you to think about how we constructed $\mathbb{Z}$ and see if you can come up with a construction for $\mathbb{Q}$.

Hopefully, you recognized we can use ordered pairs again. To represent $\frac{2}{5}$, we can write it as $(2,5)$. To represent $\frac{-17}{14}$, we can write it as $(-17, 14)$. Remember, we can use any of the integers at our disposal because we’ve devised a valid way to construct them.

With the issue that this is not unique if we have a representation like $(2,5)$ and $(4,10)$ representing the same numbers, we can again use the idea from equivalence classes. Two pairs $(a,b)$ and $(c,d)$ are considered to be in the same equivalence class if $\frac{a}{b} = \frac{c}{d}$. If this seems circular to you, we can rewrite it as $ad = bc$ to avoid any problems.

#### Level 4: $\mathbb{R}$

This is what we’ve been waiting for. This is a much harder problem than what we had above: how do we create an all encompassing definition for numbers like $\sqrt{2}$, $\pi$, and $\frac{-e^{17}}{9}$?

Now, we can’t just stick it in an ordered pair like we’ve done before, because we can’t capture all of the reals this way.

Luckily, our good friend Cauchy is here, with what is known as a Cauchy sequence. A Cauchy sequence is a sequence (order matters!) of rational numbers such that the sequence converges to some number. We say that this Cauchy sequence is a representation of the number it converges to.

What does convergence mean? Let’s say we have a sequence $\{a_1, a_2, a_3, …\}$. If I were to pick any small positive number $\epsilon$, I should be able to find an $M$ such that all $m > M$ satisfy the following property:

$$| a_m - L | < \epsilon$$

where $L$ is the limit. More simply, what this says is that the sequence will get closer and closer to the limit value.

Let’s see a visual example of how this works.

n=15

Drag the text with $n$ above and see how the graph changes!

What we’re looking at is a sequence of numbers that converges to a limit, in this case $5$. Now, this visualization of the sequence we have above only goes to $n=30$, but we can have an infinite number of elements if we want. Another important idea to consider is that all of these items in the sequence are rational numbers, because we already know how to define them.

The visualization above also only shows the limit of some arbitrary sequence to $5$, but we already know we can define $5$. Let’s try this method with something we know is irrational: $\pi$. Now $\pi$ presents a problem: we can’t represent it as a rational number. We can approximate it with values like $\frac{22}{7}$, but it’ll never be $\pi$.

The way we defined a real number is as a sequence of converging rational numbers. How can we write a sequence for $\pi$? Well, let’s think of this intuitively. We approximate $\pi$ by writing it to a certain number of decimal places. What do I mean by this? $3$ is close to $\pi$, but $3.1$ is even closer, and then $3.14$ is even more closer. We can construct a sequence as the following: $\{3, 3.1, 3.14, 3.141, 3.1415, 3.14159, 3.141592, …\}$. With each item in the sequence, we “reveal” one more number in the decimal.

These decimal numbers can be represented as rational numbers (think about why this is the case!). This means we have our Cauchy sequence! Let’s look at a visualization for how this would look like.

n=50

A bit anticlimactic. But it looks like a sequence of points that basically approaches the value of $\pi$, which is what we wanted! And these are all rational numbers, so everything checks out.

Let’s try this method with something a bit more obscure: $\frac{\pi^2}{6}$, which is approximately $1.644934$. There’s no way we can write this as a rational, because $\pi$ itself is irrational. So our goal is to find a sequence of rational numbers that converges to this irrational number.

Let’s define a sequence such that each element $a_n = \sum_{x=1}^{n} \frac{1}{x^2}$. According to this definition, the sequence would look like this: $( \frac{1}{1}, \frac{1}{1} + \frac{1}{4}, \frac{1}{1} + \frac{1}{4} + \frac{1}{9}, …)$, more compactly written as $(1, \frac{5}{4}, \frac{49}{36}, …)$.

It’s clear that this satisfies our condition that each element is rational, but does this converge to $\frac{\pi^2}{6}$? Let’s look at our visualization.

n=50

It works! We can see that the sequence of rational numbers is converging on $\frac{\pi^2}{6}$. If this sequence kept going on forever, it would converge to this number. This particular sequence was derived from the Basel problem, if you want to look more into it.

We now have an intuitive grasp that it works, but what’s really going on? This post isn’t going to mathematically prove it for you (if you’re curious, you can read up here). The reason Cauchy sequences can work is because the rationals are dense. Let’s imagine a unit square, the graph with $x$ within $0$ and $1$ and with $y$ within $0$ and $1$. There are an infinite number of rational numbers in this area. If I were to “zoom in” on any area in this unit square, there would still be an infinite number of rational numbers (I encourage you to think why this is the case).

Now let’s go back to the sequence of rational numbers we have that converge to an irrational number. Because the rational numbers are dense, if I choose any rational number, there is always another rational number that is closer to the irrational number. This is the key reason why we can construct an infinite sequence of rational numbers that converge to an irrational number.

We now have a representation of $\mathbb{R}$! When we talk about an element in $\mathbb{R}$, such as $\sqrt{2}$, the underlying meaning of $\sqrt{2}$ is an infinite sequence of rational numbers that converges to $\sqrt{2}$. The last thing to keep in mind is that there can be multiple sequences that converge to $\sqrt{2}$. We can use the same logic that we did in the previous levels, considering sequences that converge to the same number as lying in the same equivalence class.

Now Cauchy sequences are not the only representations of $\mathbb{R}$; another popular method is something called a Dedekind cut, which uses a similar construction, but is a little bit different.

### Conclusion

And with that, you now know how to construct numbers from purely sets!

Why does this matter? In math, we want to have precise and accurate definitions. Without stable definitions, complex topics become ardent debates about terminology rather than content.

What’s the takeaway? In elementary school, you learned about counting numbers, then fractions, and eventually about real numbers. But what are these numbers? This post showed one way that we can attach a definition to these numbers, more than just abstract understandings of them.

I hope this visual walk-through on constructing the real numbers was helpful. If you think I’ve earned it, I would appreciate subscribing below (I promise there won’t be any spam). If this two-part tutorial was helpful or if you have any feedback, reach out to me at contact at mywebsitename dot com.