Cantor's Diagonal Argument: ℝ is Uncountable
Some infinite sets can be put into a list — the natural numbers, the integers, even the fractions. Cantor's diagonal argument shows that the real numbers cannot: any list of real numbers, however it is made, leaves some real number out. That is what it means for to be uncountable, and it was the first proof that there are different sizes of infinity.
Theorem
The set of real numbers is uncountable. There is no surjection from to .
A set is countable when its elements can be listed as , every element appearing at some finite position. It is enough to show that the interval cannot be listed: a list of all reals would contain, as a sub-list, a list of all reals in .
Proof (Cantor's diagonal argument, 1891)
Take any sequence of real numbers in . We build a number in that is not in it.
Write each as a decimal expansion:
If has two expansions, pick either one; it will not matter. Construct a new number whose -th digit differs from the diagonal digit , choosing it from only:
Then for every . Suppose instead . The only real numbers with two decimal expansions are those with one expansion ending in and the other ending in ; the digits of are all 4s and 5s, so has exactly one expansion. The expansion we wrote down for is an expansion of , hence it is that one — yet the two differ in the -th place. So is in and is not in the list, and no list contains every real in .
The proof is not really by contradiction: it is a recipe that turns any list into a number the list misses. The contradiction appears only when we assumed the list was complete.
Eight real numbers written out as rows of digits; the diagonal digits are collected and each is changed to build a new number d, which differs from every row at that row's own position.
A worked example
The card starts from 8 familiar numbers — π − 3, e − 2, √2 − 1, 1/3, 1/2, 1/7, φ − 1, ln 2 — written to 10 places. Reading down the diagonal, the first digit of the first row, the second of the second and so on, gives . Replacing each digit by the rule gives . Step through the card and it points at the digit where parts from each row; for that happens before its diagonal digit is even reached. Press "random list" and is rebuilt from the new diagonal: the recipe works the same whatever the list contains.
In binary mode the card flips each diagonal bit, and . That is Cantor's own 1891 setting: he worked with infinite sequences of two symbols, not with decimals. For sequences the argument needs no repair at all — a sequence is its digits, so differing in one place means being a different sequence. Passing from binary sequences to real numbers needs one more step, because . The cleanest one: send the sequence to the number , whose base-3 digits are only 0s and 2s. Different sequences give different numbers, so the reals contain an uncountable set.
Why the list cannot be repaired
The tempting reply is: "Then add to the list." Put first and shift everything else down one place. That is a new list, and the same construction applied to it gives a new number that it misses. Adding — even infinitely many of them, interleaved — still gives just another list, and the argument applies to it as well. The theorem is not that one particular list is incomplete; it is that the map "list missing number" is defined on every list.
What it does not show: the rationals are countable
The same reasoning does not prove that is uncountable, and seeing why makes the argument clearer. The rationals can be listed. Every positive fraction is for a pair of natural numbers, and pairs can be numbered one by one; the Cantor pairing function
is a bijection from to , walking the grid of pairs along its anti-diagonals. Apply the diagonal construction to a list of all rationals in and you get a number that is not on the list — and therefore not rational. No contradiction: the list was only ever supposed to contain rationals. The argument bites for precisely because whatever digits ends up with, it is still a real number.
The same counting shows that the algebraic numbers (roots of integer polynomials) are countable, which is how Cantor first deduced in 1874 that transcendental numbers exist — almost all reals are transcendental. Likewise, there are only countably many computer programs, so almost every real number is not computable by any program.
Bigger infinities: Cantor's theorem
The diagonal idea works for any set. Cantor's theorem: for every set , no function onto the set of all subsets of exists, so . Given , consider
If for some , then exactly when , which is impossible. So is missed. This is the diagonal again: row is the subset , and disagrees with row about the element .
Infinite binary sequences are the same thing as subsets of (bit says whether is in), so . Applying the theorem again gives , and so on without end: there is no largest infinity.
What the argument does not settle is whether any set is strictly bigger than and strictly smaller than . The claim that none is, the continuum hypothesis, is independent of the standard ZFC axioms: Gödel (1940) showed it cannot be disproved from them, Cohen (1963) that it cannot be proved.
Where the diagonal reappears
- Russell's paradox. Take to be the identity on "all sets": becomes , the set of all sets that do not contain themselves. It contains itself exactly when it does not, so there is no set of all sets.
- The halting problem. Suppose a program decides whether program halts on input . Build that, given , asks and does the opposite: loops if would halt, halts otherwise. Then run on itself contradicts . Turing (1936) built exactly this diagonal on the table of programs against inputs.
- Gödel's incompleteness theorems rest on a diagonal lemma: a sentence that says of itself that it is unprovable.
Common misconceptions
- "Infinity is infinity, so you can always make room." Adding finitely or countably many elements to a countable set keeps it countable. The obstacle is not a shortage of room; it is that every list misses something.
- "The proof is only about decimal notation." With digits restricted to 4 and 5, or with Cantor's binary sequences mapped into base 3, the argument concerns numbers, not ways of writing them.
- "It would prove the rationals uncountable too." It would only if the diagonal number were rational, and in general it is not.
- "Uncountable means big in length." Size in the sense of counting is different from length: the Cantor set is uncountable yet has length zero, and the countable set is dense in the interval.
- "The diagonal argument was Cantor's first proof." His first proof that is uncountable, in 1874, used nested intervals; the diagonal argument came in 1891 and was general enough to give .
Short answers
What is Cantor's diagonal argument in simple terms?
Take any list of real numbers between 0 and 1, written as decimals. Build a new number whose n-th digit differs from the n-th digit of the n-th number on the list. The new number differs from every listed number somewhere, so it is not on the list. No list, however long, contains all real numbers.
Why are the real numbers uncountable but the rationals countable?
The rationals can be listed: arrange the fractions m/n in a grid and walk it diagonally, skipping repeats. The diagonal construction applied to that list produces a number that is not rational, so it contradicts nothing. For the reals, the number it produces is a real number, and that is the contradiction.
Can you fix the list by adding the diagonal number to it?
No. Adding the missing number gives a new list, and the same construction applied to the new list produces another number missing from it. The argument works for every list, so no amount of patching ever completes one.
What about numbers like 0.4999… that equal 0.5?
Some numbers have two decimal expansions, so a new digit string could in principle name a number already on the list. The standard fix is to build the new number from the digits 4 and 5 only. Such a number has exactly one decimal expansion, so differing in a digit means differing as a number.
Does the diagonal argument prove the continuum hypothesis?
No. It shows the reals are strictly more numerous than the natural numbers. Whether some set lies strictly in between is the continuum hypothesis, which Gödel (1940) and Cohen (1963) showed can be neither proved nor disproved from the usual axioms of set theory.
How is the diagonal argument related to the halting problem?
Turing's proof that no program decides halting has the same shape. Assume a decider exists, build a program that does the opposite of what the decider predicts about that program run on itself, and the program differs from every entry on the diagonal of the table of programs and inputs.
Further reading
- G. Cantor, "Über eine elementare Frage der Mannigfaltigkeitslehre", Jahresbericht der Deutschen Mathematiker-Vereinigung 1 (1891), 75–78. The diagonal argument, stated for sequences of two symbols.
- G. Cantor, "Über eine Eigenschaft des Inbegriffes aller reellen algebraischen Zahlen", Journal für die reine und angewandte Mathematik 77 (1874), 258–262. The first proof of uncountability, and the countability of algebraic numbers.
- M. Aigner, G. M. Ziegler, Proofs from THE BOOK, Springer. The chapter "Sets, functions, and the continuum hypothesis".
- P. R. Halmos, Naive Set Theory, Van Nostrand, 1960. Countable sets, cardinals and Cantor's theorem, briefly and rigorously.
- A. M. Turing, "On computable numbers, with an application to the Entscheidungsproblem", Proceedings of the London Mathematical Society (2) 42 (1936), 230–265.
- P. J. Cohen, "The independence of the continuum hypothesis", Proceedings of the National Academy of Sciences 50 (1963), 1143–1148.