Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Counting the infinite

Asking how many real numbers there are invites the answer "infinitely many", and that answer says nothing until "how many" has a meaning that works for infinite sets.

The previous lesson ranked the elements of a set by order, ended on Zorn's lemma, a principle about infinite sets, and left a prior question: how large is an infinite set, and how many reals are there? This lesson answers it with functions alone, assuming from the lesson on functions injective, surjective and bijective maps, inverses, and the facts that a composite of injections is an injection and a composite of bijections is a bijection. It also uses the well-ordering principle: every non-empty set of natural numbers has a least element. As throughout the course, ℕ={1,2,3,…} starts at 1, and P(A) is the power set of A.

Same size without counting

Someone who cannot count can still tell whether there are as many cups as saucers: put one cup on each saucer and see whether anything is left over. That pairing is a bijection, and it is the definition. Sets A and B are equinumerous, or have the same size, written |A|=|B|, when there is a bijection A→B. And |A|≤|B| means there is an injection A→B, which seats every element of A in its own place in B, perhaps with places to spare. Finally |A|<|B| means that |A|≤|B| and not |A|=|B|: an injection exists and a bijection does not.

Proposition. For all sets A, B and C: (i) |A|=|A|; (ii) if |A|=|B| then |B|=|A|; (iii) if |A|=|B| and |B|=|C| then |A|=|C|; (iv) |A|≤|A|, and if |A|≤|B| and |B|≤|C| then |A|≤|C|; (v) if A⊆B then |A|≤|B|.

Proof. (i) The identity idA is a bijection. (ii) A bijection has an inverse, which is a bijection B→A. (iii) If f:A→B and g:B→C are bijections, so is g∘f:A→C. (iv) The identity is an injection, and a composite of injections is an injection. (v) The inclusion map a↦a from A to B is an injection. □

The notation is suggestive, and it is worth being clear about what it does not yet say. No object called |A| has been defined; "|A|=|B|" is a statement about the two sets, and so is "|A|≤|B|". In particular, nothing so far says that |A|≤|B| and |B|≤|A| together give |A|=|B|. For numbers that is antisymmetry, and it is free. For sets it says that injections both ways produce a bijection, which is a real theorem, proved later in this lesson. In the language of the lesson on order, "|A|≤|B|" is a preorder on sets, and the theorem says its ties are exactly the equinumerous pairs.

Nor is "smaller" the same as "subset". The natural numbers are a proper subset of the integers, and the next sections show |ℕ|=|ℤ|. For finite sets a proper subset is always smaller, and that is the first thing to prove.

Finite sets and the pigeonhole principle

For n≥1 write [n]={1,2,…,n}, and let [0]=∅. A set A is finite, with n elements, when |A|=|[n]| for some n≥0; a bijection [n]→A is a way of counting A, naming its elements first, second, and so on up to nth. A set that is not finite is infinite.

For the definition to make sense, a set must not have both m and n elements for different m and n. That is the pigeonhole principle, from the lesson on contradiction, in its sharpest form.

Lemma (pigeonhole). If m>n≥0, there is no injection [m]→[n].

Proof. By induction on n. For n=0: [m] is not empty, since m≥1, and there is no function at all from a non-empty set to ∅.

Suppose the claim holds for n, and suppose for a contradiction that f:[m]→[n+1] is an injection with m>n+1. We build an injection [m−1]→[n]. If no element of [m−1] is sent to n+1, then f restricted to [m−1] is already an injection into [n]. Otherwise f(k)=n+1 for some k≤m−1, and by injectivity k is the only such element, so f(m)≠n+1. Define g on [m−1] by g(k)=f(m) and g(i)=f(i) for i≠k. The values of g are values of f at the distinct points of [m]∖{k}, so they are distinct and none is n+1; g is an injection [m−1]→[n]. Either way, since m−1>n, this contradicts the claim for n. □

Corollary. (a) If |[m]|=|[n]| then m=n, so the number of elements of a finite set is well defined. (b) ℕ is infinite. (c) A finite set is not equinumerous with any proper subset of itself.

Proof. (a) A bijection [m]→[n] is an injection, so m≤n by the lemma; its inverse gives n≤m.

(b) Suppose h:ℕ→[n] were a bijection. Restricted to [n+1]⊆ℕ it is an injection [n+1]→[n], which the lemma forbids.

(c) Let A have n elements, with φ:[n]→A a bijection, and suppose h:A→S is a bijection onto a proper subset S of A. Then g=φ−1∘h∘φ is an injection [n]→[n] whose image misses some k, namely φ−1(a) for any a∈A∖S. So n≥1. The map s:[n]∖{k}→[n−1] that fixes numbers below k and lowers numbers above k by one is injective, and s∘g is an injection [n]→[n−1], which the lemma forbids. □

Part (c) is what fails for infinite sets. Richard Dedekind turned it round in 1888 and defined a set to be infinite when it is equinumerous with a proper subset of itself, a definition the next section shows ℕ meets. The same lemma, restated, is the everyday pigeonhole principle: if more than n objects are put into n boxes, some box receives two, because the assignment of boxes cannot be an injection.

Hilbert's hotel and countable sets

David Hilbert gave the infinite case its best known picture in a Göttingen lecture of 1924, and George Gamow made it famous in his 1947 book One Two Three... Infinity. A hotel has a room for every natural number, all taken, when a new guest arrives. The manager asks the guest in room n to move to room n+1. Everyone still has a room, nobody shares, and room 1 is free.

The move is s:ℕ→ℕ∖{1}, s(n)=n+1, and it is a bijection. It is injective, since m+1=n+1 gives m=n. It is surjective, since each k in ℕ∖{1} has k≥2, so k−1∈ℕ and s(k−1)=k. So |ℕ∖{1}|=|ℕ|, and ℕ is infinite in Dedekind's sense. When a coach brings a guest for every natural number, moving each guest from room n to room 2n frees the odd rooms for them, so ℕ is the same size as two copies of itself. "The whole is greater than the part" is Euclid's fifth common notion, true for finite collections by part (c) of the corollary and false for infinite ones.

A set is countably infinite when it is equinumerous with ℕ, countable when it is finite or countably infinite, and uncountable otherwise. A bijection g:ℕ→A is a list of A, g(1) first, g(2) second, in which every element appears exactly once and is reached after finitely many steps. Cantor wrote ℵ0 (aleph null) for the size of ℕ. Starting ℕ at 0 instead changes nothing, since the hotel's shift n↦n+1 is a bijection from {0,1,2,…} to ℕ.

The integers run off in both directions, so listing them in their usual order has no first term. Alternating works: 0,1,−1,2,−2,…

Example. Prove that f:ℕ→ℤ, given by f(n)=n2 for even n and f(n)=1−n2 for odd n, is a bijection, so that ℤ is countable.

The values are integers (1−n is even when n is odd), beginning f(1)=0, f(2)=1, f(3)=−1, f(4)=2. Injective: for even n, f(n)=n2≥1, while for odd n, f(n)=1−n2≤0 because n≥1. So if f(m)=f(n), then m and n have the same parity, and either m2=n2 or 1−m2=1−n2; both give m=n. Surjective: let k∈ℤ. If k≥1, put n=2k, an even natural number, and f(n)=k. If k≤0, put n=1−2k, which is odd and at least 1, so n∈ℕ, and f(n)=1−(1−2k)2=k. Hence f is a bijection and |ℤ|=|ℕ|.

The surjectivity step also found the inverse: f−1(k)=2k for k≥1 and f−1(k)=1−2k for k≤0. So −3 sits at position 7 in the list.

Now you. Prove that g:ℕ→ℤ∖{0}, given by g(n)=n2 for even n and g(n)=−n+12 for odd n, is a bijection.

Answer

For even n, g(n)=n2≥1, and for odd n, g(n)=−n+12≤−1, a non-zero integer. Injective: g(m)=g(n) forces equal parity, since only even inputs give positive values, and then m2=n2 or −m+12=−n+12 gives m=n. Surjective: let k≠0. If k≥1, then n=2k is even and g(n)=k. If k≤−1, then n=−2k−1 is odd and at least 1, and g(n)=−−2k−1+12=k. So g is a bijection, listing −1,1,−2,2,…

Finding an explicit bijection can be fiddly, and the next theorem often removes the need: to show a set is countable, it is enough to inject it into ℕ.

Theorem. Every subset of ℕ is countable. Consequently, a set A is countable if and only if there is an injection A→ℕ, and a non-empty set A is countable if and only if there is a surjection ℕ→A.

Proof. Let S⊆ℕ be infinite; we list it in increasing order. Let s1=minS, and for k≥1 let sk+1=min(S∖{s1,…,sk}). The set on the right is never empty, since otherwise S={s1,…,sk} would be finite, so by well-ordering each sk is defined. The sequence is strictly increasing: sk+1 lies in S∖{s1,…,sk−1}, whose least element is sk, and sk+1≠sk. So k↦sk is injective, and, by induction, sk≥k for every k. It is also surjective. Let t∈S, and suppose t is not among s1,…,st. Then t∈S∖{s1,…,st−1}, so its least element st satisfies st≤t; with st≥t this gives st=t, a contradiction. So k↦sk is a bijection ℕ→S.

For the first consequence: a countable set injects into ℕ, through a bijection with ℕ or with some [n]⊆ℕ. Conversely, an injection h:A→ℕ is a bijection from A onto its image h(A)⊆ℕ, which is countable, so A is countable.

For the second: if A is countable and non-empty, a bijection ℕ→A is a surjection, and if A has n≥1 elements, the bijection [n]→A extended by sending every k>n to the image of 1 is a surjection. Conversely, given a surjection q:ℕ→A, send each a∈A to the least element of {n:q(n)=a}, which exists by well-ordering. This map is injective, since different elements a have disjoint sets of such n, so A is countable by the first consequence. □

So subsets and surjective images of countable sets are countable. A countable set is the smallest kind of infinite set, in a sense made precise in the following question.

Does every infinite set contain a copy of ℕ?

Yes, if one is allowed to choose. Let A be infinite. Then A is not empty, so choose a1∈A. The set A∖{a1} is not empty, since otherwise A would have one element, so choose a2 in it. In general A∖{a1,…,ak} is never empty, since A is not finite, and ak+1 can be chosen from it. The map k↦ak is an injection ℕ→A, since each ak+1 differs from all earlier terms. So |ℕ|≤|A| for every infinite set A: no infinite size is smaller than ℵ0.

The proof makes infinitely many choices, one after another, with no rule saying which element to take. When A is a set of natural numbers, "take the least" is a rule, and the proof of the theorem above did exactly that. For an arbitrary set there may be no rule, and the argument needs a weak form of the axiom of choice, met in the lesson on functions, called countable choice or, more precisely for a sequence of choices each depending on the last, dependent choice.

With it, the two definitions of infinite agree. Given an injection k↦ak from ℕ into A, the hotel's shift moves ak to ak+1 and fixes every other element, a bijection from A onto A∖{a1}. So every infinite set is infinite in Dedekind's sense. Without any form of choice this can fail: set theorists have built models of the other axioms containing infinite sets with no countably infinite subset, sets that are infinite and yet equinumerous with none of their proper subsets.

Pairs and the rationals

The set ℕ×ℕ is an infinite grid, with (m,n) in row m and column n. Listing row 1 first never reaches row 2. The way out is to list by diagonals. There are exactly s−1 pairs with m+n=s, from (1,s−1) to (s−1,1), so list the diagonal with sum 2, then sum 3, and so on, each by increasing first coordinate:

(1,1),(1,2),(2,1),(1,3),(2,2),(3,1),(1,4),…

The position of (m,n) in this list is a formula. Write T(k)=k(k+1)2=1+2+⋯+k, with T(0)=0. With s=m+n, the earlier diagonals hold 1+2+⋯+(s−2)=T(s−2) pairs, and (m,n) is in place m on its own, so its position is

p(m,n)=T(m+n−2)+m=(m+n−2)(m+n−1)2+m

This is the Cantor pairing function, shifted so that ℕ starts at 1. It gives p(1,1)=1, p(1,2)=2, p(2,1)=3 and p(3,5)=T(6)+3=24.

Theorem. The function p is a bijection ℕ×ℕ→ℕ. In particular ℕ×ℕ is countable.

Proof. Fix s≥2. The pairs with m+n=s are those with 1≤m≤s−1, and p sends them to T(s−2)+1,T(s−2)+2,…,T(s−2)+(s−1)=T(s−1). So p maps diagonal s injectively onto the block Bs={N∈ℕ:T(s−2)<N≤T(s−1)}.

The blocks B2,B3,B4,… are disjoint and cover ℕ. They are disjoint because T is increasing, so the ranges (T(s−2),T(s−1)] do not overlap. They cover ℕ because, given N∈ℕ, the set of s≥2 with T(s−1)≥N is not empty (T(N)≥N), so it has a least element s; then T(s−1)≥N, and T(s−2)<N, either because s=2 and T(0)=0 or by the minimality of s. So N∈Bs.

Now p is injective: two pairs on the same diagonal have different images, and two pairs on different diagonals land in different blocks. And p is surjective: each N lies in some block Bs, which is the image of diagonal s. □

As a check, the 1770 pairs with m+n≤60 (diagonals 2 to 60, holding 1+2+⋯+59=1770 pairs) are sent to exactly 1 to 1770, since the last block ends at T(59)=1770. A second, shorter bijection, (m,n)↦2m−1(2n−1), is Problem 5.

Since ℕ×ℕ is countable, so is A×B for any countable sets A and B: injections a:A→ℕ and b:B→ℕ give the injection (x,y)↦p(a(x),b(y)) from A×B to ℕ. By induction on k, then, ℤk=ℤk−1×ℤ is countable for every k≥1.

Between two rationals lies their average, so ℚ cannot be listed in increasing order. It can be listed in another.

Example. Prove that ℚ is countable.

Every rational has exactly one form ab in lowest terms with a∈ℤ and b∈ℕ. With f the bijection ℕ→ℤ above, define h:ℚ→ℕ×ℕ by h(ab)=(f−1(a),b), using that form; its uniqueness is what makes h a function. If h(ab)=h(cd), then f−1(a)=f−1(c), so a=c on applying f, and b=d; so the rationals are equal, and h is injective. Then p∘h:ℚ→ℕ is a composite of injections, hence an injection, and by the theorem of the previous section ℚ is countable. It is infinite, since it contains ℕ, so |ℚ|=|ℕ|.

For instance −34 goes to (7,4) and then to p(7,4)=T(9)+7=52. Position p(4,2)=14 is not used, since (4,2) would stand for 22, which is not in lowest terms. The injection is not a bijection, and the theorem on subsets of ℕ closes the gap: listing the image of p∘h in increasing order and sending each rational to the rank of its code in that list is an explicit bijection ℚ→ℕ. Problem 12 gives a more elegant list of the positive rationals, in which each appears exactly once and no gaps need closing.

Now you. Prove that F(a,b)=p(f−1(a),f−1(b)) is a bijection ℤ×ℤ→ℕ, and compute F(−1,2).

Answer

Let G(a,b)=(f−1(a),f−1(b)) from ℤ×ℤ to ℕ×ℕ, and H(m,n)=(f(m),f(n)). Since f and f−1 undo each other in each coordinate, H∘G and G∘H are identities, so G has an inverse and is a bijection. Then F=p∘G is a composite of bijections, hence a bijection, and ℤ×ℤ is countable. With f−1(−1)=3 and f−1(2)=4, F(−1,2)=p(3,4)=T(5)+3=18.

Countable unions

A countable set of countable sets has a countable union. This is the most used closure property of countable sets, and it follows from the pairing function.

Theorem. Let A1,A2,A3,… be countable sets. Then A1∪A2∪A3∪⋯ is countable. The same holds for finitely many countable sets.

Proof. Let U be the union. If every An is empty, so is U. Otherwise, discard the empty sets; what remains is a finite or infinite sequence of non-empty countable sets with the same union, and repeating one of them if necessary makes it an infinite sequence A1,A2,… of non-empty countable sets. By the theorem on countable sets, for each n there is a surjection gn:ℕ→An; choose one for each n. Define G:ℕ×ℕ→U by G(n,k)=gn(k). It is surjective: an element of U lies in some An, and is gn(k) for some k. Then G∘p−1:ℕ→U is a surjection, and U is countable. □

For example, ℚ is the union over b∈ℕ of the sets {ab:a∈ℤ}, each countable as the image of ℤ, which gives a second proof that ℚ is countable.

Where does the proof "choose one for each n", and does it matter?

It chose a surjection gn:ℕ→An for every n at once. Each An is countable, so for each n surjections exist, often many of them, but the hypothesis supplies no rule for picking one. Making infinitely many such choices simultaneously is an application of the axiom of choice, met in the lesson on functions, in its countable form.

Usually the sets come with lists already attached, and then nothing is chosen: in the second proof for ℚ, the list of {ab:a∈ℤ} is k↦f(k)b, one formula for every b. The same is true in the Example below and in almost every application. When the lists are given, the theorem holds in set theory without choice.

When they are not, choice cannot be avoided. Solomon Feferman and Azriel Lévy showed in 1963 that it is consistent with the axioms of set theory other than choice that ℝ is a countable union of countable sets. Since ℝ is uncountable (proved below without any choice), in such a world the theorem fails. This does not make the theorem doubtful in ordinary mathematics, which accepts choice; it shows exactly which assumption carries the weight.

Example. Prove that the set ℤ[x] of polynomials with integer coefficients is countable.

For n≥0, let Pn be the set of polynomials c0+c1x+⋯+cnxn with every ci∈ℤ, that is, the polynomials of degree at most n (together with the zero polynomial). Such a polynomial is determined by its list of coefficients, and every list gives a polynomial, so (c0,…,cn)↦c0+c1x+⋯+cnxn is a bijection ℤn+1→Pn. Since ℤn+1 is countable, so is Pn, and this bijection is an explicit list of it (composed with a list of ℤn+1), so no choice is involved. Every polynomial has some degree n, so ℤ[x]=P0∪P1∪P2∪⋯, a countable union of countable sets, and ℤ[x] is countable.

Now you. Prove that the set of all finite subsets of ℕ is countable.

Answer

For n≥0, let Fn be the set of subsets of [n]. It is finite, with 2n elements, so countable, and it can be listed explicitly, for instance by the rule below. Every finite subset S of ℕ is a subset of [n] for some n (take n=0 if S is empty, and n=maxS otherwise), so the set of finite subsets of ℕ is F0∪F1∪F2∪⋯, a countable union of countable sets, and is countable.

An explicit bijection also exists. Send a finite set S⊆ℕ to β(S)=∑k∈S2k−1, with β(∅)=0. Every non-negative integer has exactly one binary expansion, and the binary expansion of β(S) has a 1 in exactly the places k−1 for k∈S. So β is a bijection from the finite subsets of ℕ onto {0,1,2,…}; for instance β({1,3})=1+4=5, which is 101 in binary.

The same pattern shows that the set of all finite sequences of natural numbers is countable (the union over k of the countable sets ℕk), and so is the set of all finite strings over a finite or countable alphabet. Every book, proof or computer program is such a string, so there are only countably many of each.

Intervals and the real line

Before asking whether ℝ is countable, it helps to see that its size does not depend on which piece of the line is taken. The lesson on functions proved that x↦x1+|x| is a bijection ℝ→(−1,1), and x↦x+12 is a bijection (−1,1)→(0,1), with inverse y↦2y−1. Composing, |ℝ|=|(0,1)|: the whole line has as many points as a short open piece of it. The same stretching shows that any two open intervals (a,b) and (c,d) with a<b and c<d are equinumerous, through x↦c+(x−a)(d−c)b−a.

Endpoints look harder, since no continuous bijection turns [0,1) into (0,1). But bijections need not be continuous, and the hotel's trick absorbs a point.

Example. Give an explicit bijection h:[0,1)→(0,1).

The point 0 needs a room in (0,1). Pick a sequence of distinct points inside (0,1), say 12,13,14,…, and shift along it, as the hotel shifts its guests: send 0 to 12, each 1n with n≥2 to 1n+1, and every other point to itself.

h(x)={12x=01n+1x=1nfor some integern≥2xotherwise

Let Q={1n:n≥2}. Then h maps {0}∪Q into Q, and [0,1)∖({0}∪Q) into itself by the identity, so its values lie in (0,1). Injective: two points in the third case have different images since h is the identity there, and their images are not in Q, while images in the first two cases are in Q; within {0}∪Q, the images 12 (of 0) and 1n+1 (of 1n) are all different, since n↦n+1 is injective and n+1≥3. Surjective: let y∈(0,1). If y∉Q, then h(y)=y. If y=12, then h(0)=y. If y=1m with m≥3, then h(1m−1)=y, as m−1≥2. So h is a bijection.

Now you. Give an explicit bijection [0,1]→(0,1).

Answer

Now two points need rooms. Use the same sequence and shift by two: send 0 to 12, 1 to 13, each 1n with n≥2 to 1n+2, and every other point to itself.

With Q={1n:n≥2}, the map sends {0,1}∪Q into Q and fixes everything else in [0,1], so all values lie in (0,1). Injective: points outside {0,1}∪Q are fixed and their images are outside Q; inside {0,1}∪Q the images 12, 13 and 1n+2 for n≥2 are all different. Surjective: y∉Q is its own image; 12 is the image of 0; 13 is the image of 1; and 1m with m≥4 is the image of 1m−2, where m−2≥2.

So every interval with more than one point, open, closed or half open, bounded or not, has the same size as ℝ. The Schröder and Bernstein theorem, later in the lesson, will make results like this one line long, at the price of not exhibiting the bijection.

Cantor's diagonal argument

Georg Cantor proved in 1874 that the reals are not countable, and in 1891 gave the proof now called the diagonal argument. It uses decimal expansions of numbers in (0,1), and has one trap.

This lesson takes two facts about decimals from school, and the lesson on the real numbers proves them from its definitions: every real number in (0,1) has a decimal expansion 0.d1d2d3…, and every such expansion names a real number in [0,1]. Some numbers have two expansions: 0.4999…=0.5, since the tail 0.0999… is a geometric series with sum 9100⋅109=110. This is the only way it happens. Two different expansions first disagree at some place k, and the later digits can make up at most one unit in place k, which they do only when one tail is all 9s and the other all 0s. So an expansion with no 0 and no 9 is the only expansion of its number. For numbers with two, use the one that does not end in 9s.

Here is the start of a list of numbers in (0,1), with the nth digit of the nth number in bold:

nxnexpansionnth digitnew digit
1π−30.1415926...15
2e−20.7182818...15
32−10.4142135...45
4120.5000000...05
53−10.7320508...54
6ln20.6931471...75

The new digit is 5, unless the diagonal digit is 5, when it is 4. The number 0.555545… built from them differs from every xn in place n.

Example. Prove that there is no surjection ℕ→(0,1).

Let g:ℕ→(0,1) be any function, and let dn,k be the kth digit of g(n), using the expansion chosen above. Put cn=4 if dn,n=5 and cn=5 otherwise, and let y=0.c1c2c3…. Every digit of y is 4 or 5, so 49=0.444…≤y≤0.555…=59, and y∈(0,1). Suppose y=g(n) for some n. The expansion of y has no 0 or 9, so it is the only one y has, and the chosen expansion of g(n) must be it. Then dn,n=cn, contradicting the choice of cn. So y is not a value of g, and g is not surjective.

So (0,1) is uncountable: it is not empty, and no surjection from ℕ reaches all of it. Hence ℝ is uncountable too, since |ℝ|=|(0,1)|, and so is every interval with more than one point. The care over 0s and 9s is needed. With the rule "replace each diagonal digit d by 9−d", a list that starts with 0.5000… and has every later diagonal digit 0 produces 0.4999…, which is the first number again.

Two consequences follow at once. The irrational numbers are uncountable, since otherwise ℝ=ℚ∪(ℝ∖ℚ) would be a union of two countable sets. And |ℕ|<|ℝ|: the inclusion is an injection, and no bijection exists. So there are at least two infinite sizes.

Now you. Let S be the set of infinite sequences (t1,t2,…) with every term 0 or 1. Prove that there is no surjection ℕ→S.

Answer

Let g:ℕ→S be any function, with g(n)=(tn,1,tn,2,…). Define u by un=1−tn,n, so each un is 0 or 1 and u∈S. For every n, un≠tn,n, so u and g(n) differ in term n and u≠g(n). Hence u is not a value of g, and g is not surjective. No trap arises here, because two sequences are equal only when every term agrees.

Why doesn't the same argument prove that ℚ is uncountable?

Run it on a list of the rationals in (0,1), which exists because ℚ is countable. The construction produces a number y with digits 4 and 5 that differs from every rational on the list. There is no contradiction, because nothing says y is rational. It is not: a real number is rational exactly when its decimal expansion is eventually periodic (Problem 13 of the lesson on the real numbers proves this), and if y were rational it would be on the list, which the construction has just shown it is not. So the argument, applied to a complete list of the rationals, proves that a certain explicit real number is irrational, and nothing more.

The general lesson is that the diagonal argument needs the new object to belong to the set being listed. For binary sequences and for real numbers in (0,1) that is automatic, since any sequence of digits 4 and 5 names such a number. For the rationals, or for the algebraic numbers of the next section, or for any countable set of reals, the diagonal number escapes the set.

The same point sinks a tempting "proof" that ℕ is uncountable, written out in Problem 7. There the diagonal construction produces an infinite string of non-zero digits, which is not a natural number at all, so it escapes the list without contradicting anything.

A second view shows what really separates ℚ from ℝ. Cantor's first proof, of 1874, avoided decimals: given any sequence of reals, it built nested closed intervals avoiding one more term at each stage, and a point common to all the intervals was missed by the sequence. For a list of the rationals the intervals still shrink, but the point they close in on is irrational, so inside ℚ they have nothing in common. What the reals have and the rationals lack is the existence of that common point, the completeness that the next lesson makes into an axiom.

Algebraic and transcendental numbers

A real number is algebraic when it is a root of some non-zero polynomial with integer coefficients, and transcendental otherwise. Every rational ab is algebraic, as a root of bx−a. So is 2, a root of x2−2, and so is 2+3: if x=2+3 then x2=5+26, so (x2−5)2=24, and x is a root of x4−10x2+1. Sums and products of algebraic numbers are again algebraic (a theorem of algebra, not needed here), and for a long time nobody knew whether any real number is not.

Theorem (Cantor, 1874). The set of real algebraic numbers is countable. Consequently transcendental numbers exist, and the set of them is uncountable.

Proof. A non-zero polynomial of degree n has at most n real roots, as Mathematical Foundations shows (each root contributes a linear factor). So for each non-zero q∈ℤ[x], the set Z(q) of its real roots is finite. The algebraic numbers are the union of the sets Z(q) over all non-zero q∈ℤ[x], and ℤ[x] is countable by the Example of the previous section, so this is a countable union of finite sets, which is countable by the theorem on countable unions. No choice is involved: each Z(q) is listed in increasing order, and ℤ[x] has the explicit list built above.

If the transcendental numbers formed a countable set, then ℝ, the union of the algebraic and the transcendental numbers, would be a union of two countable sets, and countable. It is not, so the transcendental numbers are uncountable, and in particular there is at least one. □

The proof is a strange one. It shows that almost every real number is transcendental, in the sense that the transcendental ones are uncountable and the algebraic ones only countable, without identifying a single one. Joseph Liouville had exhibited the first explicit transcendental numbers in 1844, by a quite different argument about how closely algebraic numbers can be approximated by rationals. Charles Hermite proved that e is transcendental in 1873, and Ferdinand von Lindemann did the same for π in 1882, which settled the ancient problem of squaring the circle with ruler and compasses: it cannot be done. Cantor's argument, published in 1874, gave existence with no example at all, a non-constructive proof in the sense of the lesson on direct proof.

The count also puts a limit on description. Every number that can be defined by a finite text, in any fixed language, corresponds to at least one finite string of symbols, and there are only countably many such strings. So only countably many real numbers can be defined at all, and almost all real numbers can never be individually named.

Cantor's theorem

The diagonal idea, build an object that disagrees with the nth item at the nth place, is not about decimals. It works for any set A and its power set.

Theorem (Cantor). For every set A, |A|<|P(A)|.

Proof. The map a↦{a} is an injection A→P(A), since {a}={a′} forces a=a′. So |A|≤|P(A)|. It remains to show that no F:A→P(A) is surjective, and then in particular none is a bijection. Each F(a) is a subset of A, which may or may not contain a. Collect the elements not in their own image:

D={a∈A:a∉F(a)}

This is a subset of A. Suppose D=F(d) for some d∈A. If d∈D, the definition of D gives d∉F(d)=D. If d∉D, then d∉F(d), which is exactly the condition for d∈D. Either way there is a contradiction, so D is not a value of F, and F is not surjective. □

For a finite set with n elements this is n<2n. For ℕ the diagonal is visible: with F(n) as row n of a table whose columns are 1,2,3,… and whose entries say whether each number is in F(n), the question "is n∈F(n)?" reads down the diagonal, and D answers each one the other way. The subsets of ℕ correspond exactly to the 0 and 1 sequences of the last Now you (a set S corresponds to the sequence with 1 in the places belonging to S), and the two proofs are the same proof.

Applied repeatedly, the theorem gives an unending ladder, so there is no largest infinity:

|ℕ|<|P(ℕ)|<|P(P(ℕ))|<⋯

The set D should look familiar. Russell's paradox, from the lesson on sets, concerns the set of all sets that are not members of themselves, and Russell reached it in 1901 by studying this proof: run it on a supposed set of all sets with F(x)=x, and D becomes {x:x∉x}. Inside a genuine set A, the same self-reference yields a theorem rather than a paradox.

Is there a largest set, the set of all sets?

No, and Cantor's theorem is one proof. Suppose V were a set containing every set. Every subset of V is a set, so it is an element of V, and P(V)⊆V. Then the inclusion is an injection P(V)→V, so |P(V)|≤|V|, while Cantor's theorem gives |V|<|P(V)|. Together these would make |V|=|P(V)| by the theorem of the next section, contradicting Cantor's theorem. (Without that theorem, the contradiction can be reached directly: an injection P(V)→V yields a surjection V→P(V), by sending each image back where it came from and everything else to ∅, and Cantor's proof shows no such surjection exists.)

Cantor noticed this in the late 1890s, and it is sometimes called Cantor's paradox. It is a cousin of Russell's paradox and of the Burali-Forti paradox about the set of all ordinals, and all three were read the same way: some collections are too big to be sets. Zermelo's axioms of 1908, from which the modern system ZF grew, avoid them by never allowing a set to be formed from an unrestricted property, only by carving a subset out of a set already known, by pairing, union and power set, and by a few other operations. None of these builds a set of all sets. The collection of all sets still makes sense as something mathematicians talk about, but it is called a class, and classes are not members of anything.

The ladder above also answers a quieter question. Is there some set that is at least as big as every set? If B were one, then |P(B)|≤|B|, and the same argument gives a contradiction. So every set is outranked by another, and there are infinitely many infinite sizes.

The Schröder and Bernstein theorem

For finite sets, injections both ways give equal numbers of elements by the pigeonhole lemma. For infinite sets the corresponding statement is a genuine theorem, and the most useful tool for proving that two sets have the same size.

Theorem (Cantor, Schröder, Bernstein). If there are injections f:A→B and g:B→A, then there is a bijection A→B.

The difficulty is that neither f nor g need be surjective, and no simple combination of them obviously is. The idea is to use f on part of A and the inverse of g on the rest, and to find the right split. Elements of A outside the image g(B) cannot be handled by g−1, so they must use f. Then so must anything of the form g(f(x)) for such x, because otherwise g−1 would send it to f(x), which f already hits. Following this requirement round and round gives the set on which f is used.

Proof. Define subsets of A by

C0=A∖g(B),Cn+1=g(f(Cn))forn≥0

and let C=C0∪C1∪C2∪⋯. If x∈A∖C, then x∉C0, so x∈g(B), and since g is injective there is exactly one y∈B with g(y)=x; write it g−1(x). Define h:A→B by

h(x)={f(x)x∈Cg−1(x)x∉C

h is injective. Let h(x)=h(x′) with x≠x′. If both are in C, then f(x)=f(x′), contradicting injectivity of f. If neither is, then g−1(x)=g−1(x′), and applying g gives x=x′. If x∈C and x′∉C, then f(x)=g−1(x′), so x′=g(f(x)). Now x∈Cn for some n, so x′∈g(f(Cn))=Cn+1⊆C, a contradiction. The remaining case is the same with x and x′ exchanged.

h is surjective. Let y∈B. If g(y)∉C, then h(g(y))=g−1(g(y))=y. If g(y)∈C, then g(y)∈Cn for some n, and n≠0 because g(y)∈g(B). So g(y)∈Cn=g(f(Cn−1)), that is, g(y)=g(f(x)) for some x∈Cn−1. Since g is injective, y=f(x), and since x∈C, h(x)=f(x)=y. □

Cantor stated the theorem without a proof he was satisfied with. Richard Dedekind proved it in 1887 but did not publish; Felix Bernstein, a nineteen-year-old in Cantor's seminar, proved it in 1897; and Ernst Schröder published a proof at about the same time that was later found to contain a gap. The proof uses no choice at all: every step is determined by f and g. Problem 13 of the lesson on order gives a second proof, from a fixed point theorem for power sets.

With the theorem, a bijection no longer has to be built. For the Now you of the section on intervals, the inclusion (0,1)→[0,1] and the map x↦x+13, which sends [0,1] into [13,23]⊆(0,1), are injections both ways, so |[0,1]|=|(0,1)| in one line.

Example. Prove that |ℝ|=|P(ℕ)|.

An injection P(ℕ)→ℝ. Send a set S⊆ℕ to the number 0.d1d2d3… with dn=1 if n∈S and dn=0 if n∉S. Different sets give digit strings that differ in some place, and neither string contains a 9. Two different expansions of the same number must have one ending in 9s, so these strings name different numbers, and the map is injective.

An injection ℝ→P(ℕ). Send x∈ℝ to the set L(x)={q∈ℚ:q<x}. If x<y, there is a rational q with x<q<y (the rationals are dense, as the lesson on the real numbers proves), and q∈L(y) while q∉L(x). So x↦L(x) is an injection ℝ→P(ℚ). Let φ:ℚ→ℕ be a bijection. Then T↦φ(T)={φ(q):q∈T} is a bijection P(ℚ)→P(ℕ), with inverse U↦φ−1(U). Composing gives an injection ℝ→P(ℕ).

By the Schröder and Bernstein theorem, |ℝ|=|P(ℕ)|. So the size of the real line is the second rung of Cantor's ladder, and ℝ has the same size as the set of 0 and 1 sequences. This size is called the continuum. Since |ℕ|<|P(ℕ)| by Cantor's theorem, this gives a proof that ℝ is uncountable which uses decimals only for the injection P(ℕ)→ℝ, where no digit 9 ever appears.

Now you. Prove that |ℝ×ℝ|=|ℝ|: the plane has no more points than the line.

Answer

An injection ℝ→ℝ×ℝ is x↦(x,0).

An injection ℝ×ℝ→ℝ. Since |ℝ|=|(0,1)|, there is a bijection b:ℝ→(0,1), and (x,y)↦(b(x),b(y)) is a bijection ℝ×ℝ→(0,1)×(0,1). So it is enough to inject (0,1)×(0,1) into ℝ. Write u=0.u1u2u3… and v=0.v1v2v3… using the expansions that do not end in 9s, and send (u,v) to the number with the interleaved expansion 0.u1v1u2v2u3v3…. The interleaved string does not end in 9s, since that would force both u and v to end in 9s. Different pairs give different strings, since the pair can be read back from the odd and even places, and two different strings neither of which ends in 9s name different numbers. So the map is injective.

By the Schröder and Bernstein theorem, |ℝ×ℝ|=|ℝ|. By induction, |ℝn|=|ℝ| for every n∈ℕ. Cantor found this in 1877 and wrote to Dedekind that he saw it but did not believe it. It shows that dimension is not a matter of how many points a space has; what distinguishes the line from the plane is how the points are arranged, and a continuous bijection between them is impossible.

The continuum hypothesis

Two infinite sizes are now in hand: that of ℕ, shared by ℤ, ℕ×ℕ, ℚ and the algebraic numbers, and the strictly larger size of ℝ, shared by every interval, by the plane and by P(ℕ). Every infinite set of reals met so far has one of these two sizes. In 1878 Cantor asked whether that is always so.

The continuum hypothesis. Every infinite subset of ℝ is either countable or equinumerous with ℝ.

Equivalently, assuming the axiom of choice, there is no set A with |ℕ|<|A|<|ℝ|. Cantor believed the hypothesis and spent years trying to prove it. It was the first of the twenty-three problems David Hilbert set out in Paris in 1900 as the challenges for the new century.

What does it mean that the continuum hypothesis cannot be settled?

Kurt Gödel showed in 1940 that the continuum hypothesis cannot be disproved from the usual axioms of set theory, ZF together with the axiom of choice, provided those axioms are consistent. He built, inside any model of the axioms, a smaller model, the constructible universe, in which every set is built in a precisely controlled way, and in which the hypothesis is true. Paul Cohen showed in 1963 that it cannot be proved from them either, by inventing forcing, a method of enlarging a model by adding new sets, and using it to add many new subsets of ℕ, so that the continuum becomes much larger than the first size beyond ℵ0. Cohen received the Fields Medal in 1966 for this work.

So the hypothesis is independent of the axioms: both it and its negation are consistent with them. This is not a statement that the question is meaningless or that the answer is unknown for lack of effort. It is a theorem about what the axioms that ground the rest of mathematics can prove, in the same way that Euclid's parallel postulate was eventually shown to be independent of his other axioms.

What remains is a question of which further axioms to adopt. The hypothesis does hold for the well-behaved sets that analysis usually meets: Cantor and Ivar Bendixson showed in the 1880s that every closed set of reals is countable or has the size of ℝ, and later work extended this to much larger families of sets. Whether set theory should be extended by axioms that decide the hypothesis for all sets, and which way, is an open debate among set theorists.

The count settles a difference between two number systems that look alike. The rationals and the reals are both ordered and closed under the four operations, and between any two rationals lies another. Yet the rationals can be listed and the reals cannot, so something about the reals is missing from the rationals. Nothing so far has said what: counting shows the difference exists without locating it. The next lesson names it, as a property of least upper bounds called completeness.

Problems

Work each problem on paper before opening anything; for Core and Challenge problems, try the hint before the solution.

Warm-up

1. Give an explicit bijection from ℕ to each set, and prove that it is one: (a) the even natural numbers; (b) {n∈ℤ:n≥−5}; (c) ℕ×{1,2}.

Solution

(a) Let E={2,4,6,…} and a(n)=2n. Its values are even natural numbers. It is injective, since 2m=2n gives m=n, and surjective, since an even natural number k is 2m with m=k2∈ℕ, and a(m)=k.

(b) Let b(n)=n−6. For n≥1, b(n)≥−5, so the values lie in the set. It is injective, since m−6=n−6 gives m=n. It is surjective: given an integer k≥−5, the number n=k+6 is at least 1, and b(n)=k. So b lists the set as −5,−4,−3,….

(c) Let c(n)=(⌈n2⌉,2−(nmod2)), so that odd n=2j−1 goes to (j,1) and even n=2j goes to (j,2). Its inverse is (j,1)↦2j−1 and (j,2)↦2j: composing either way gives the identity, since every natural number is exactly one of 2j−1 or 2j for a unique j∈ℕ (by the division algorithm). A function with an inverse is a bijection.

2. Using p(m,n)=T(m+n−2)+m with T(k)=k(k+1)2, and the bijection f:ℕ→ℤ from the lesson: (a) compute p(5,3); (b) find the pair (m,n) with p(m,n)=20; (c) find f−1(−6) and f(10).

Solution

(a) p(5,3)=T(6)+5=21+5=26.

(b) The blocks are Bs={N:T(s−2)<N≤T(s−1)}. Since T(5)=15<20≤21=T(6), the number 20 lies in B7, so m+n=7 and m=20−T(5)=5, giving (m,n)=(5,2). Check: p(5,2)=T(5)+5=20.

(c) For k≤0, f−1(k)=1−2k, so f−1(−6)=13. For even n, f(n)=n2, so f(10)=5.

3. Say whether each set is countable or uncountable, with a reason: (a) the set of all finite words in the letters a to z; (b) ℚ×ℚ; (c) the set of infinite 0 and 1 sequences with only finitely many 1s; (d) the set of all infinite 0 and 1 sequences; (e) the set of irrational numbers in (0,1); (f) the set of circles in the plane whose centre has rational coordinates and whose radius is rational.

Solution

(a) Countable. For each k≥0 there are 26k words of length k, a finite set, and the set of all words is the union of these countably many finite sets.

(b) Countable, as a product of two countable sets.

(c) Countable. Sending such a sequence to the set of places where it has a 1 is a bijection onto the finite subsets of ℕ, which are countable by the Now you of the section on countable unions.

(d) Uncountable, by the Now you of the section on the diagonal argument.

(e) Uncountable. If it were countable, then (0,1) would be the union of the countable set ℚ∩(0,1) and a countable set, hence countable, which the diagonal argument forbids.

(f) Countable. A circle is determined by its centre (a,b) and radius r, so sending the circle to (a,b,r) is an injection into ℚ×ℚ×ℚ, which is countable.

4. Prove: (a) if B is countable and f:A→B is an injection, then A is countable; (b) if A is countable and g:A→B is a surjection, then B is countable.

Solution

(a) Since B is countable, there is an injection b:B→ℕ, by the theorem on countable sets. Then b∘f:A→ℕ is a composite of injections, hence an injection, and by the same theorem A is countable.

(b) If B is empty, it is finite and so countable. Otherwise A is non-empty too, since g is onto B, so there is a surjection a:ℕ→A by the theorem. Then g∘a:ℕ→B is a surjection (every y∈B is g(x) for some x, and x=a(n) for some n), and by the theorem B is countable.

Core

5. Prove that F(m,n)=2m−1(2n−1) is a bijection ℕ×ℕ→ℕ.

Hint

Show that every natural number k can be written as 2iq with i≥0 and q odd in exactly one way.

Solution

Every k∈ℕ is 2iq with i≥0 and q odd. Let I={i≥0:2i∣k}. It contains 0, and it is bounded, since 2i∣k gives 2i≤k<2k, so i<k. So I has a greatest element i, and k=2iq for some q∈ℕ. If q were even, 2i+1 would divide k, contradicting the choice of i. So q is odd.

The form is unique. Suppose 2iq=2jr with q, r odd, and suppose i<j. Then q=2j−ir is even, a contradiction. So i=j by symmetry, and then q=r.

F is a bijection. F(m,n)=2m−1(2n−1) has i=m−1≥0 and q=2n−1 odd. Injective: if F(m,n)=F(m′,n′), uniqueness of the form gives m−1=m′−1 and 2n−1=2n′−1, so (m,n)=(m′,n′). Surjective: given k, write k=2iq with q odd; then m=i+1∈ℕ and n=q+12∈ℕ satisfy F(m,n)=k. For instance F(3,2)=4×3=12, and 40=23×5 is F(4,3).

6. Let A be a set with a countably infinite subset, and let B be countable. Prove that |A∪B|=|A|. Deduce that the set of irrational numbers has the same size as ℝ.

Hint

Replace B by B∖A. Then use the hotel: a countably infinite part of A can absorb a countable set of extra guests.

Solution

Let B′=B∖A, a subset of a countable set and so countable, with A∪B=A∪B′ and A∩B′=∅. Let K⊆A be countably infinite. Then K∪B′ is countable, as a union of two countable sets, and infinite, since it contains K, so it is countably infinite. Two countably infinite sets are equinumerous, both being equinumerous with ℕ, so there is a bijection φ:K∪B′→K.

Define h:A∪B′→A by h(x)=φ(x) for x∈K∪B′, and h(x)=x for x∈A∖K. The domain splits into the disjoint pieces K∪B′ and A∖K (disjoint because B′∩A=∅), and the codomain into the disjoint pieces K and A∖K. On the first piece h is the bijection φ onto K, and on the second it is the identity onto A∖K. So h is injective (images from different pieces lie in different pieces) and surjective, and |A∪B|=|A|.

For the irrationals, let A=ℝ∖ℚ and B=ℚ. The set K={2+n:n∈ℕ} is a countably infinite subset of A, since 2+n rational would make 2 rational. So |ℝ|=|A∪B|=|A|: there are exactly as many irrational numbers as real numbers.

7. Find the flaw in this argument.

Claim. ℕ is uncountable.

Proof. Let g:ℕ→ℕ be any function. Write each g(n) in decimal as an infinite string of digits running leftwards, …dn,3dn,2dn,1, padded with 0s, so that dn,k is the kth digit from the right. Let ck=4 if dk,k=5 and ck=5 otherwise, and let c be the number …c3c2c1. Then c differs from g(n) in the nth digit from the right, so c≠g(n) for every n, and g is not surjective.

Hint

Is c a natural number?

Solution

Every digit ck is 4 or 5, so the string …c3c2c1 has infinitely many non-zero digits. A natural number has only finitely many non-zero digits: if 10j−1≤N<10j, every digit beyond the jth from the right is 0. So the string names no natural number, and c∉ℕ. The argument shows only that a certain infinite string is not among the values of g, which is true and harmless, and it does not show that some natural number is missed.

This is the requirement from the discussion of ℚ after the diagonal argument: the diagonal object must belong to the set being listed. For (0,1) it does, since an infinite string of digits after a decimal point names a real number; for ℕ it does not. Indeed the claim is false, since the identity is a bijection ℕ→ℕ.

8. Prove or disprove each claim. (a) The set of infinite subsets of ℕ is countable. (b) The set of sequences (a1,a2,…) of non-negative integers with only finitely many non-zero terms is countable. (c) If A is uncountable and B⊆A is countable, then A∖B is uncountable. (d) Every uncountable subset of ℝ contains an interval (a,b) with a<b.

Hint

For (a) and (c), write a known uncountable set as a union. For (d), think of a set that meets no interval completely.

Solution

(a) False. P(ℕ) is the union of the set of finite subsets of ℕ, which is countable, and the set of infinite subsets. If the latter were countable, P(ℕ) would be a union of two countable sets and countable, contradicting Cantor's theorem.

(b) True. For n≥0 let En be the set of such sequences with ak=0 for all k>n. The map (a1,a2,…)↦(a1,…,an) is a bijection from En to the set of n-tuples of non-negative integers, which is countable as a finite product of countable sets (E0 has one element). Every such sequence lies in En for n its last non-zero place, or n=0, so the set is E0∪E1∪⋯, a countable union of countable sets with explicit lists, hence countable.

(c) True. A=B∪(A∖B). If A∖B were countable, A would be a union of two countable sets, hence countable.

(d) False. The irrationals are uncountable (as shown after the diagonal argument), but contain no interval (a,b) with a<b, since every such interval contains a rational number.

9. Consider a family of open intervals (a,b), each with a<b, no two of which overlap. Prove that the family is countable.

Hint

Every interval of positive length contains a rational number. Fix a list of the rationals, and use it to name one rational in each interval without choosing.

Solution

Fix a bijection k↦qk from ℕ to ℚ. Every interval I=(a,b) with a<b contains a rational number (by density of ℚ, proved in the lesson on the real numbers), so the set {k∈ℕ:qk∈I} is not empty, and by well-ordering it has a least element r(I). This defines a function r on the family, with no choice involved.

The function r is injective. If r(I)=r(J)=k, then qk lies in both I and J, so they overlap, and since no two different intervals of the family overlap, I=J. So the family injects into ℕ and is countable.

The same argument shows that a function φ:ℝ→ℝ that is increasing can have only countably many jumps: at each jump there is a gap between the left and right limits, and the gaps at different jumps are disjoint open intervals.

10. Let ℕℕ be the set of all sequences (a1,a2,…) of natural numbers. Prove that |ℕℕ|=|P(ℕ)|, and hence |ℕℕ|=|ℝ|.

Hint

Use the Schröder and Bernstein theorem. For one injection, encode a set by a sequence of 1s and 2s. For the other, send a sequence to its graph, a subset of ℕ×ℕ.

Solution

An injection P(ℕ)→ℕℕ. Send S⊆ℕ to the sequence with an=2 if n∈S and an=1 otherwise. Different sets differ at some n, where the sequences differ, so the map is injective.

An injection ℕℕ→P(ℕ). Send a sequence a to its graph Γ(a)={(n,an):n∈ℕ}⊆ℕ×ℕ. If a≠a′, they differ at some n, and then (n,an)∈Γ(a) but (n,an)∉Γ(a′), since the only pair in Γ(a′) with first coordinate n is (n,an′). So Γ is an injection ℕℕ→P(ℕ×ℕ). The pairing bijection p:ℕ×ℕ→ℕ gives a bijection T↦p(T) from P(ℕ×ℕ) to P(ℕ), and the composite is an injection ℕℕ→P(ℕ).

By the Schröder and Bernstein theorem |ℕℕ|=|P(ℕ)|, and |P(ℕ)|=|ℝ| by the Example in that section, so |ℕℕ|=|ℝ|.

11. Prove that no power set is countably infinite: there is no set A with |P(A)|=|ℕ|.

Hint

If P(A) is countable, what does that say about A? Treat finite and infinite A separately.

Solution

Suppose |P(A)|=|ℕ|. The map a↦{a} is an injection A→P(A), and P(A) is countable, so A is countable by Problem 4(a).

If A is finite with n elements, then P(A) has 2n elements, as the lesson on sets proved by induction, so P(A) is finite and not equinumerous with ℕ (part (b) of the corollary on finite sets, together with the fact that equinumerosity is symmetric and transitive).

If A is countably infinite, let φ:A→ℕ be a bijection. Then S↦φ(S) is a bijection P(A)→P(ℕ), with inverse T↦φ−1(T). So |P(ℕ)|=|P(A)|=|ℕ|, contradicting Cantor's theorem.

Either way there is a contradiction. So a power set is finite (of size 2n) or uncountable, and never of size ℵ0.

Challenge

12. Build a tree of fractions: the root is 11, and each node ab has a left child aa+b and a right child a+bb. Prove that every positive rational number appears in the tree exactly once, and in lowest terms. Deduce an explicit list of the positive rationals in which each appears exactly once.

Hint

Left children are less than 1 and right children greater than 1. For existence and uniqueness, use strong induction on a+b for ab in lowest terms, and ask which node could be the parent of ab.

Solution

Write every node as the pair (a,b) of positive integers that the construction produces, so the root is (1,1) and the children of (a,b) are (a,a+b) and (a+b,b).

Every node is in lowest terms. The root is. If gcd(a,b)=1, then a common divisor d of a and a+b divides (a+b)−a=b, so d divides both a and b, and d=±1; the same holds for a+b and b. By induction on the depth of a node, every node (a,b) has gcd(a,b)=1.

Left, right and root. A left child (a,a+b) has value aa+b<1, a right child (a+b,b) has value greater than 1, and the root has value 1.

Existence. We prove by strong induction on a+b that every pair (a,b) of positive integers with gcd(a,b)=1 is a node. If a=b, then gcd(a,b)=a=1, and (1,1) is the root. If a<b, then (a,b−a) is a pair of positive integers with gcd(a,b−a)=1 (a common divisor of a and b−a divides their sum b), and a+(b−a)=b<a+b, so by hypothesis (a,b−a) is a node, and its left child is (a,b). If a>b, then in the same way (a−b,b) is a node, and its right child is (a,b).

Uniqueness. We prove by strong induction on a+b that (a,b) is at most one node. If a=b, a node equal to (a,b) is in lowest terms, so a=b=1, and every node other than the root is a left or right child, with value different from 1, so only the root is (1,1). If a<b: a node equal to (a,b) is not the root and not a right child, so it is the left child of some node (a′,b′) with (a′,a′+b′)=(a,b), which forces (a′,b′)=(a,b−a). By hypothesis, (a,b−a) is a single node, and it has a single left child. So (a,b) occurs once. The case a>b is the same with right children.

Since every positive rational has exactly one representation ab with a,b∈ℕ and gcd(a,b)=1, every positive rational occurs at exactly one node.

The list. Level k of the tree (the nodes at distance k from the root) has 2k nodes. Listing level 0, then level 1 from left to right, then level 2, and so on, reaches every node after finitely many steps, and each once. So it is a bijection from ℕ to the nodes, and hence, by what was proved, to the positive rationals:

1,12,2,13,32,23,3,14,43,35,52,25,53,34,4,…

This is the Calkin and Wilf enumeration, published by Neil Calkin and Herbert Wilf in 2000. Unlike the injection in the lesson, it skips nothing.

13. Prove that the set of all bijections ℕ→ℕ has the same size as ℝ.

Hint

For an injection from the 0 and 1 sequences, let a sequence decide which of the pairs {1,2}, {3,4}, {5,6}, and so on are swapped. For the other direction, use Problem 10.

Solution

Let Σ be the set of bijections ℕ→ℕ, and S the set of infinite 0 and 1 sequences. Recall |S|=|P(ℕ)|=|ℝ|: a set corresponds to the sequence with 1s exactly at its members, and the Example of the section on Schröder and Bernstein gives |P(ℕ)|=|ℝ|.

An injection S→Σ. For t=(t1,t2,…)∈S, let σt swap 2k−1 and 2k when tk=1 and fix both when tk=0, for each k∈ℕ. Every natural number is 2k−1 or 2k for exactly one k, so σt is defined on all of ℕ, and σt∘σt is the identity, so σt is its own inverse and a bijection. If t≠t′, they differ at some k, and then one of σt(2k−1), σt′(2k−1) is 2k and the other is 2k−1, so σt≠σt′.

An injection Σ→ℕℕ. Every bijection ℕ→ℕ is in particular a sequence of natural numbers, (σ(1),σ(2),…), so the inclusion Σ⊆ℕℕ is an injection. By Problem 10, |ℕℕ|=|ℝ|=|S|, so there is an injection Σ→S.

By the Schröder and Bernstein theorem, |Σ|=|S|=|ℝ|. In particular the set of permutations of ℕ is uncountable, while the set of permutations of ℕ that move only finitely many numbers is countable (each is determined by a finite list of values), which shows how much the infinite permutations add.

14. Let (A,⪯) be a countable totally ordered set. Prove that there is an injection f:A→ℚ with a≺b implying f(a)<f(b): every countable total order is a suborder of the rationals.

Hint

List A as a1,a2,a3,… and define f(an) one step at a time. At step n, the earlier values split into those that must lie below f(an) and those that must lie above it; the rationals always have room in between, and beyond either end.

Solution

If A is empty there is nothing to do. Otherwise list A without repetitions as a1,a2,…, finite or infinite. We define f(an) by recursion on n so that, at every stage, f is strictly increasing on {a1,…,an}.

Let f(a1)=0. Suppose f(a1),…,f(an−1) are defined with f strictly increasing on {a1,…,an−1}, where n≥2. Let L={i<n:ai≺an} and U={i<n:an≺ai}; since the order is total and the ai are distinct, every i<n lies in exactly one of them. Every element indexed by L is below every element indexed by U, since ai≺an≺aj; so, as f is increasing on the earlier elements, f(ai)<f(aj) for all i∈L and j∈U. Put λ=max{f(ai):i∈L} and μ=min{f(aj):j∈U} when these sets are non-empty, and define

f(an)={λ+μ2L≠∅andU≠∅λ+1U=∅μ−1L=∅

(At least one of L and U is non-empty, since n≥2.) In each case f(an) is rational, greater than every f(ai) with i∈L, and less than every f(aj) with j∈U, because λ<λ+μ2<μ when λ<μ. So f is strictly increasing on {a1,…,an}.

Now let a≺b in A, say a=ai and b=aj. At stage max(i,j), both values are defined and f is strictly increasing on the elements defined so far, so f(a)<f(b). Values are never changed after they are defined, so this holds for f itself. Finally f is injective: if a≠b, then a≺b or b≺a by totality, and f(a)≠f(b).

The construction used only that ℚ has no greatest or least element and that between two rationals lies a third. Cantor proved in 1895 that these properties characterise the rationals: any two countable totally ordered sets that are dense in this sense and have no greatest or least element are order-isomorphic. The standard proof runs the construction above alternately from each side, and is known as the back and forth method.