A set can be either finite or infinite, meaning it has a finite number of elements or an infinite number.

The set of natural numbers is the set containing the whole positive numbers:

$$ \mathbb{N} = \{1, 2, 3, 4, 5, \ldots \} $$

Sometimes we include zero and denote this with a subscript zero on the $\mathbb{N}$:

$$ \mathbb{N}_0 = \{ 0, 1, 2, 3, 4, 5, \ldots \} $$

Note it is an infinite set.

We have a natural ordering of the natural numbers, in the sense that everyone knows that $1 < 2$ and $2 < 3$ and therefore $1 < 3$.

The set doesn't know about this ordering, we impose it on the set.

A finite set can be put into a one-to-one correspondance with a single subset of $ \mathbb{N} $ starting at $1$ and containing consecutive numbers.

For example, the set containing my fingers can be put into a one-to-one correspondance with the subset $ \{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 \} $.

This is a very formal way to think of counting.

Counting infinity

We can apply the same idea to infinite sets.

Suppose we could put a set in one-to-one correspondance with the natural numbers: would you agree they have the same size?

Take the even natural numbers $ 2 \mathbb{N} = \{ 2, 4, 6, 8, 10, \ldots \} $:

$\mathbb{N}$ $2 \mathbb{N}$
$1$ $2$
$2$ $4$
$3$ $6$
$4$ $8$
$\vdots$ $\vdots$

Every element in $\mathbb{N}$ is paired with a distinct element of $2 \mathbb{N}$ - no two elements of $\mathbb{N}$ are paired with the same element of $2 \mathbb{N}$ - and vice versa.

The sets must have the same number of elements in some sense.

Does this work for all infinite sets?

Real numbers

Let's look at the set of real numbers $\mathbb{R}$.

Take the number line - a line where two points have been marked as 0 and 1:

The number line

Any point on the that line represents a real number which is it's distance from 0.

You can measure the distance because 1 has been marked off.

The set $\mathbb{R}$ is the set of all of these numbers.

It includes $-123$, $-1.55$, $0$, $0.00001$, $\frac{1}{3}$, $\pi$, $1000000$, $1234567.89$ and all the other numbers (except complex numbers, obvs).

It's an infinite set.

Different infinities

Here's the punchline of this section: $\mathbb{R}$ and $\mathbb{N}$ are not the same size even though they're both infinite.

We'll prove this by contradiction: suppose they are the same size.

Then we put them into one-to-one correspondance - for every natural number we can write a single, unique real number beside it that it is paired with.

Imagine the list of these numbers (as above with $\mathbb{Z}$ - I'll pick a few real numbers myself just as an example.

I'll write the real numbers as having an infinite number of decimal places after them, so I'll write $1$ as $1.00000\ldots$.

$\mathbb{N}$ $\ $ $\mathbb{R}$
$1$ $\ $ $0.12352623623324\ldots$
$2$ $\ $ $2.23425617987665\ldots$
$3$ $\ $ $9.84575574572342\ldots$
$4$ $\ $ $2.12452623623324\ldots$
$\vdots$ $\ $ $\vdots$

Now, if $\mathbb{N}$ and $\mathbb{R}$ have been paired off then every natural number is paired with a unique real number and vice versa.

Here's the contradiction: I can find a real number that hasn't been paired.

Let's write that nubmer down - start with a 0 and a decimal point:


Now take the first decimal place of the real number paired with $1$. If it's a 0, write a 1 down, if it's a 1 write a 2 down, and so on. If it's a 9 then write a 0 down. So just add 1 (mod 10) to the first decimal place in the number paired with the natural number 1.

The second decimal place of the new number will be the second decimal place of the number paired with the natural number 2 plus 1 mod 10.

The third will be the third decimal place of the number paired with 3, and so on.

This guarantees that the new number is different from all the numbers paired with the natural numbers.

So there is an extra real number and you don't have a one-to-one correspondance between the natural and real numbers.

The infinite set $\mathbb{R}$ is bigger than the infinite set $\mathbb{N}$.

Does this matter?

Alan Turing

It does - Turing used this basic argument to prove that there are some problems that computers can't solve.

Consider the problem of determining if a given whole number is a prime number. We know of algorithms that will answer this question: given enough time and memory the algorithm can output True if the whole number you give it is a prime and False otherwise and it will finish its job in a finite number of steps.

However, there is no algorithm that takes as input any program (which is just a finite string of 0's and 1's) and outputs True if the program halts in a finite number of steps and False otherwise in a finite number of steps. This is called the halting problem and it os undecidable.