Massachusetts Institute of Technology Lecture ?? 6.042J/18.062J: Mathematics for Computer Science September 28, 1995 Professors Nancy Lynch and Tom Leighton

Notes 7

1 Infinite Sets

Last time we began to see that some of the intuitive results we’d expect from the pigeonhole principle break down when we deal with infinite sets. For example, if A and B are finite sets, and we know that B is a proper subset of A, then the following is true. For any function f : A → B, there are two distinct elements of A that get mapped to the same element in B. This is just another way of looking at the pigeonhole principle.

But this “obvious” fact isn’t even true for infinite sets. For example, A could be the natural numbers {0, 1, 2, …}, B could be the even natural numbers {0, 2, 4, …}, and the function f(x) = 2x maps distinct elements of A to distinct elements of B.

So it’s clear that infinite sets are pretty tricky things, and we need to be careful in how we handle them. Let’s start with a formal definition of what it means for a set to be infinite.

Definition 1.1 We say that a set S is finite if there is an n ∈ ℕ and a bijection f : {1, 2, …, n} → S.

Definition 1.2 We say that a set T is infinite if it is not finite. That is, T is infinite if for every n ∈ ℕ, T has more than n elements.

So for example, the set {1, 2, …, n} is finite for each n, but ℕ is infinite.

As a more interesting proof that a set is infinite, consider the following.

Theorem 1.3 The set P of all prime numbers is infinite.

Proof. By contradiction. Suppose that P is finite; then there is an n ∈ ℕ so that P = {p_{1}, …, p_{n}}. By the fundamental theorem of arithmetic, this would mean that every natural number would have a factor from this finite set. In particular, the number m = p_{1}p_{2} ⋯ p_{n}+1 would have such a factor. That is, for some i, p_{i} | m. But we also have m − 1 = p_{1}p_{2} ⋯ p_{n}, so p_{i} | m − 1. Since p_{i} | m and p_{i} | m − 1, we have p_{i} | 1, a contradiction.

It’s not always so easy to show that a set of natural numbers is infinite. For example, the following is a famous open problem in number theory.

Definition 1.4 A twin prime is a pair (n, n + 2) where both n and n + 2 are prime.

So (3, 5), (11, 13), and (101, 103) are all examples of twin primes.

Question: Are there an infinite number of twin primes?

This question goes back to the ancient Greeks, and we still don’t know the answer.

2 Countability

As we’ve seen, if we have a finite set S, we can write it as S = {s_{1}, …, s_{n}} for some natural number n. There are some infinite where a related kind of “listability” property holds — that is, there are infinite sets T for which we can list out the elements in such a way that for every t ∈ T, there is a natural number i so that t eventually appears as the i^{th} element of the list.

Let’s show some examples of what we mean:

ℕ = {0, 1, 2, 3, …}

evens = {0, 2, 4, 6, …}

primes = {2, 3, 5, 7, …}

In the first case, the natural number n will appear as the n^{th} entry in the list. (If we number the entries starting from 0.) In the second case, the even number 2k will appear as the k^{th} entry in the list. In the third case, we can argue that every prime number will eventually appear as an entry in the list, though we don’t have a nice closed form expression for which entry a given prime number p will appear as.

The infinite sets that can be listed in this way are said to be countable sets. Formally, we are saying that they can be put in a one-to-one correspondence with the natural numbers (this represents the way in which we “count” them).

Definition 2.1 An infinite set T is said to be countably infinite iff there is a bijection f : ℕ → T.

Definition 2.2 A set S is said to be countable if it is finite or is countably infinite.

So for example, the even numbers are countably infinite because f : ℕ → evens defined by f(i) = 2i is a bijection between the naturals and the even numbers.

3 Uncountablity

When you first see the notion of countably infinite sets, there is no compelling reason not to think (as Georg Cantor did in the 1870’s when he introduced the idea of coutablitlity) that all infinite sets are countable. But this is in fact not true, and the real numbers provide a counterexample. After failing to put the set ℝ of all real numbers in a bijection with the naturals, Cantor came up with the following remarkable proof that in fact there cannot exist such a bijection.

Theorem 3.1 ℝ is not countable.

Proof. The proof is by contradiction; suppose that f : ℕ → ℝ is a bijection.

Now there’s some notational trouble in deciding how to represent a real number — let’s represent it in decimal expansion; and for those real numbers that have terminating decimal expansions, we’ll add on an infinite string of 0’s at the end. (So, for example, 1.23 will get written as 1.2300000 · · ·.)

The proof will use a method called diagonalization; roughly, it goes as follows. We construct a number r and show

(i) It is a valid real number.

(ii) It is not equal to f(i) for any natural number i.

This will give a contradiction to our assumption that f is a bijection.

We construct r digit by digit. To get the i^{th} digit of r, we take the i^{th} digit of f(i) and add 5 to it modulo 10. We can picture this construction using the following table.

\begin{aligned}f(0) & = & . & 3 & 1 & 4 & 3 & ⋯ \\ f(1) & = & . & 5 & 8 & 2 & 9 & ⋯ \\ f(2) & = & . & 9 & 1 & 1 & 1 & ⋯ \\ f(3) & = & ⋯ & ⋯ & ⋯ & ⋯ & ⋯ & ⋯ \\ ⋯ & ⋯ & ⋯ & ⋯ & ⋯ & ⋯ & ⋯ & ⋯ \end{aligned}

Then, following our recipe for constructing r, r would begin r = .836 · · ·. The term “diagonalization” comes from the fact that we’re moving down the diagonal of this infinite table, explicitly changing digits as we go.

Now let’s observe that r ∈ ℝ, since we have specified its decimal expansion.

But (the crucial point), we claim that r is not equal to f(i) for any natural number i. To see this, suppose that r = f(j). But r differs from f(j) by 5 in the j^{th} decimal place; this would contradict the fact that r = f(j).

Thus, f does not map any natural number to r; this contradicts our assumption that f was a bijection.

Diagonalization arguments (of which this was the first, historically) have become very important in logic and computer science. In 6.045, you’ll use them to show that there are some problems that cannot be solved by any computer program.

4 Proving Sets are Countable

The usual way to prove a set is countable is to construct an explicit “listing” of it — that is, an explicit bijection with the naturals. Let’s try this out on a few sets.

Theorem 4.1 The integers ℤ = {…, −2, −1, 0, 1, 2, …} are countable.

Proof. We list the integers as 0, −1, 1, −2, 2, −3, 3, . . .. To decide if this is a valid listing (i.e. a bijection with the naturals), we need to consider the following question:

(*) For every integer x, is there a natural number i so that x will appear as the i^{th} element of the list?

In this case, the answer is yes — if x = 0 then i = 0; if x < 0 then i = 2x − 1; and if x > 0 then i = 2x.

Note that there are some listings of ℤ that are of no use in proving it is countable. For example, consider

ℤ = 0, 1, 2, 3, …, −1, −2, −3, ….

We ask the same question (*) — but now, there is no natural number i so that −1 appears as the i^{th} entry of the list.

Now let’s consider a set that seems much bigger than the natural numbers — ℚ, the set of rational numbers. Actually, to keep our notational headaches to a minimum, let’s talk about ℚ^{+}, the set of positive rational numbers. (The arguments are roughly the same in either case.)

So is ℚ^{+} countable or uncountable? There are certainly some problems with counting it – since there is no smallest positive rational, it’s not clear where to begin; and between any two positive rationals there is another positive rational. Nevertheless, ℚ^{+} is a countable set, and the proof of this introduces a very useful “dove-tailing” technique for counting a set.

Theorem 4.2 The set ℚ^{+} is countable.

Proof. The positive rational numbers are precisely those numbers that can be written in the form a/b, where a and b are positive natural numbers. To make sure that we eventually get to all the elements of ℚ^{+}, we list them in the following order:

(1) All a/b with a + b = 1,

(2) All a/b with a + b = 2,

(3) All a/b with a + b = 3, … and so on …

The point here is that for any k, there are at most k + 1 rational numbers of the form a/b, where a + b = k — so in each of the above steps, we only have to list a finite number of rationals.

We can picture this way of listing the rationals using the following table:

\begin{matrix}1/1 & 2/1 & 3/1 & 4/1 & ⋯ \\ 1/2 & 2/2 & 3/2 & 4/2 & ⋯ \\ 1/3 & 2/3 & 3/3 & 4/3 & ⋯ \\ 1/4 & 2/4 & 3/4 & 4/4 & ⋯ \\ ⋯ & ⋯ & ⋯ & ⋯ & ⋯ \end{matrix}

We sweep diagonally through this table, listing the numbers as

1/1, 2/1, 1/2, 3/1, 2/2, 1/3, 4/1, …

Note that a number like 1 will get listed many times — as 1/1, 2/2, 3/3, . . .. But this is not a problem, since we can just remove it from the list every time it appears after the first.

As always, to see if this is a valid listing, we have to ask the following question:

(*) For every positive rational a/b, is there a natural number i so that x will appear as the i^{th} element of the list?

Again, the answer is yes. a/b will be listed by the time we reach step a + b — that is, it will be entry i for some i that is at most (a + b + 1)^{2}.

I think the reason this is called a “dove-tailing” argument is that we merge all the infinite rows of the above table together very carefully, like the feathers of a dove’s tail.

5 Sizes of Infinite Sets

We said earlier, without really thinking too hard about it, that two finite sets have the same size if they have the same number of elements. But when we get to infinite sets, it becomes tricky to define what it means for two sets to be “the same size”.

The best way to define this seems to be in terms of bijections. We say that A and B have the same size, written |A| = |B|, if there is a bijection from A to B.

So for example, |ℕ| = |ℚ|, but |ℕ| ≠ |ℝ|. More generally, we say

Definition 5.1 |A| ≤ |B| iff there is an injection f : A → B.

Definition 5.2 |A| ≥ |B| iff there is a surjection f : A → B.

Definition 5.3 |A| = |B| iff there is a bijection f : A → B.

After showing that |ℕ| < |ℝ|, Cantor asked the next most natural question: is there an infinite sequence of infinite sets A_{0}, A_{1}, A_{2}, …, so that for each i we have |A_{i}| < |A_{i+1}|? That is, are there infinitely different “types” of infinite sets, none of which can be put in bijection with each other.

Cantor showed that the answer to this question is yes, with the following sweeping generalization of |ℕ| < |ℝ|. Recall that if S is a set, we use P(S) to denote the power set of S — that is, the set of all subsets of S.

Theorem 5.4 For all sets S, we have |S| < |P(S)|.

Proof. We have to show two things: |S| ≤ |P(S)|, and |S| ≠ |P(S)|.

To show the first, we need to find an injection g : S → P(S). This is not so difficult; we could define g by g(a) = {a} for each a ∈ S.

To show the second fact (the hard part), we need to show there is not bijection f : S → P(S).

Suppose there were such a bijection f; we want to get a contradiction. The argument that gives the contradiction is actually very short, but very tricky; it is based on the idea behind Russell’s Paradox.

For a ∈ S, f(a) is a subset of S, so it makes sense to ask whether or not a is an element of f(a). Let’s define T ⊂ S as

T = {a ∈ S | a ∉ f(a)}.

Now, since we’re supposing f is a bijection, there is some b ∈ S such that f(b) = T.

Now we ask: is b an element of T?

• Case 1: b ∈ T. Then since T = f(b), we have b ∈ f(b), contradicting the definition of T.

• Case 2: b ∉ T. Again, since T = f(b), we have b ∉ f(b), contradicting the definition of T.

As we get a contradiction in either case, our assumption that f is a bijection must be wrong.

So this answers the question about an infinite “increasing sequence” of infinite sets. We can take

A_{0} = ℕ
A_{1} = P(ℕ)
A_{2} = P(P(ℕ))
· · · · · · · · ·
A_{i+1} = P(A_{i})
· · · · · · · · ·

This list produces some really big sets. We can show that |ℝ| = |P(ℕ)| by giving a bijection between them (we won’t do this here) — so we could just as well have used ℝ as the set A_{1}.

The quantity |A|, for a set A, is called a cardinality, and we can use a variable to denote it. Usually we write ℵ_{0} for |ℕ|, ℵ_{1} for the next largest cardinality of infinite set, and so on.

Cantor asked one more very natural question, and this will be the last thing we talk about. Namely, does our list of increasing sets A_{0}, A_{1}, … exhaust all possible cardinalities of infinite sets? That is, could there be an infinite set B so that for some A_{i} on the list, |A_{i}| < |B| < |A_{i+1}|? The conjecture that there is no such “in-between” set B is the Generalized Continuum Hypothesis; the weaker conjecture, that at least there is no B in between ℕ and ℝ, is the Continuum Hypothesis.

Cantor didn’t see how to settle the Continuum Hypothesis, and at the International Congress of Mathematicians in 1900, this was the first problem on David Hilbert’s list of 24 open problems for the coming century. The question was finally resolved by Paul Cohen in 1963, in a very strange way. He didn’t construct a set B so that |ℕ| < |B| < |ℝ|, and he didn’t prove that such a set can’t exist. Instead, he showed that the existence of such a set was independent of the axioms of set theory. That is, provided the axioms of set theory are consistent, you could include a new axiom asserting the existence of such a B, or you could include a new axiom asserting that no such B exists — and either way, the axioms would remain consistent. This “independence” result came as a big surprise, and it’s certainly one of the nicest theorems of 20th century mathematics.