Tutorials › Topology (Undergraduate) › Cantor’s Diagonal Argument for the Real Numbers

Countability and Cardinality · Tutorial 30 of 799

Cantor's Diagonal Argument for the Real Numbers

Learn how to construct a real number in the open unit interval that cannot appear in any proposed sequence listing its points.

Intermediate 10 min read

What You'll Learn

  • Explain what it means for a sequence to list every point of the open unit interval.
  • Obtain canonical decimal digits for each real number in the interval.
  • Prove why canonical decimal expansions avoid tails of repeating nines.
  • Construct a diagonal decimal whose digits differ from the listed numbers.
  • Identify how ambiguous decimal representations can invalidate a careless diagonal argument.

Why a Decimal Diagonal Needs Care

To show that \((0,1)\) is uncountable, it is enough to show that no sequence of its points lists every point. The diagonal idea is to change the \(n\)th decimal digit of the \(n\)th listed number. But a difference between decimal strings does not always mean a difference between real numbers: \(0.2000\ldots=0.1999\ldots\). We will use decimal expansions that are never eventually all nines, then construct a new decimal using only the digits 1 and 2. These choices make the comparison of digits valid as a comparison of real numbers.

Here, a sequence \((x_n)\) lists a set if every point of the set occurs as at least one term; repetitions are allowed. A set is countable if it is finite or can be listed by a sequence. Since \((0,1)\) is nonempty, the empty set of terms cannot list it.

Definition: A decimal expansion \(0.a_1a_2a_3\ldots\), with each \(a_k\) an integer from 0 to 9, represents the real number \(\sum_{k=1}^{\infty}a_k10^{-k}\). The expansion is canonical if its digits are not eventually all 9; that is, there is no index after which every digit equals 9.

Canonical Decimal Expansions

We first establish that every \(x\in(0,1)\) has a canonical decimal expansion. For each \(k\geq 0\), let \(m_k=\lfloor 10^kx\rfloor\), where \(\lfloor t\rfloor\) is the greatest integer not exceeding \(t\), and set \(m_0=0\). For \(k\geq1\), define \(a_k=m_k-10m_{k-1}\). Since \(m_k\leq 10^kx<m_k+1\), the integer \(m_k\) is either \(10m_{k-1}+r\) for some integer \(r\) from 0 through 9. Thus \(a_k\) is a decimal digit.

Proposition: For every \(x\in(0,1)\), the digits \(a_k\) just defined give a canonical expansion of \(x\).

Proof. From \(a_k=m_k-10m_{k-1}\), summing after division by \(10^k\) gives, for every \(N\geq1\), \(\sum_{k=1}^{N}a_k10^{-k}=m_N10^{-N}\): the terms involving \(m_1,\ldots,m_{N-1}\) cancel. The floor inequalities give \(0\leq x-m_N10^{-N}<10^{-N}\). As \(N\) increases, this error tends to zero, so \(x=\sum_{k=1}^{\infty}a_k10^{-k}\).

It remains to check that the digits are not eventually all 9. If \(a_k=9\) for every \(k\geq N\), then the expansion just obtained gives \(x=m_{N-1}10^{-(N-1)}+\sum_{k=N}^{\infty}9\,10^{-k}=(m_{N-1}+1)10^{-(N-1)}\). For \(N=1\), this says \(x=1\), contrary to \(x\in(0,1)\). For \(N>1\), it says \(10^{N-1}x=m_{N-1}+1\), so \(\lfloor10^{N-1}x\rfloor=m_{N-1}+1\), contradicting the definition of \(m_{N-1}\). The expansion is therefore canonical. \(\square\)

We also need the reason canonical expansions can be compared digit by digit.

Proposition: Two different canonical decimal digit sequences cannot represent the same real number.

Proof. Suppose two canonical sequences \((a_k)\) and \((b_k)\) represent the same real number but are not identical. Let \(j\) be the first index at which they differ. Interchanging the sequences if necessary, assume \(a_j<b_j\). The difference between the represented numbers is \((b_j-a_j)10^{-j}+\sum_{k>j}(b_k-a_k)10^{-k}\). For every \(k>j\), \(b_k-a_k\geq-9\), and \(\sum_{k>j}9\,10^{-k}=10^{-j}\). Therefore this difference is at least \((b_j-a_j)10^{-j}-10^{-j}\geq0\). For the numbers to be equal, both inequalities must be equalities. In particular \(b_j-a_j=1\), and every later difference must be \(-9\). That forces \(a_k=9\) and \(b_k=0\) for every \(k>j\), so \((a_k)\) is eventually all 9. This contradicts its being canonical. Hence distinct canonical sequences represent distinct real numbers. \(\square\)

Worked Example: Finding Canonical Digits

For \(x=0.375\), compute the first three digits using the floor construction. We have \(m_0=\lfloor0.375\rfloor=0\), \(m_1=\lfloor3.75\rfloor=3\), \(m_2=\lfloor37.5\rfloor=37\), and \(m_3=\lfloor375\rfloor=375\). Therefore \(a_1=3-10(0)=3\), \(a_2=37-10(3)=7\), and \(a_3=375-10(37)=5\). For \(k\geq4\), \(m_k=375\cdot10^{k-3}\), so \(a_k=0\). The expansion is \(0.375000\ldots\), which represents \(375/1000=0.375\) and is not eventually all 9. This also checks the computed digits against the original value.

The Diagonal Construction

Theorem: No sequence of points of \((0,1)\) lists every point of \((0,1)\). Consequently, \((0,1)\) is uncountable.

Proof. Suppose a sequence \((x_n)\) of points in \((0,1)\) is given. Repetitions are permitted. Write the canonical decimal expansion of each term as \(x_n=0.a_{n1}a_{n2}a_{n3}\ldots\), using the construction above. Define a digit \(d_n\) by \(d_n=1\) if \(a_{nn}\ne1\), and \(d_n=2\) if \(a_{nn}=1\). Then \(d_n\in\{1,2\}\), and \(d_n\ne a_{nn}\) for every \(n\). Set \(y=\sum_{n=1}^{\infty}d_n10^{-n}\). Since \(1\leq d_n\leq2\), the geometric series gives \(0<\sum_{n=1}^{\infty}10^{-n}\leq y\leq\sum_{n=1}^{\infty}2\,10^{-n}=2/9<1\). Thus \(y\in(0,1)\). Its displayed decimal digits are all 1 or 2, so this expansion is canonical.

For each \(n\), the \(n\)th digit of \(y\) differs from the \(n\)th digit of \(x_n\). If \(y=x_n\), the uniqueness proposition for canonical expansions would force all corresponding digits to agree, including the \(n\)th digit. This is a contradiction. Hence \(y\) is not any term \(x_n\), and the sequence does not list \((0,1)\).

To conclude uncountability, the empty finite list cannot list \((0,1)\), which is nonempty. Any nonempty finite list can be extended to a sequence by repeating one of its entries. The theorem shows that this sequence misses a point, so the finite list does too. An infinite countable listing is already a sequence and is ruled out by the theorem. Thus \((0,1)\) is not countable. \(\square\)

Worked Example: A Finite Decimal Table

Consider the three entries \(x_1=0.314000\ldots\), \(x_2=0.027000\ldots\), and \(x_3=0.006000\ldots\). Their diagonal digits are \(a_{11}=3\), \(a_{22}=2\), and \(a_{33}=6\). The rule gives \(d_1=1\), \(d_2=1\), and \(d_3=1\), so the beginning of the constructed decimal is \(0.111\ldots\); if the same rule is continued for a full sequence, its later digits are determined by the later diagonal entries. At the first row the new first digit 1 differs from 3; at the second row the new second digit 1 differs from 2; at the third row the new third digit 1 differs from 6. This finite table illustrates the row-by-row comparison, but alone it does not establish uncountability: the theorem applies the construction to an entire infinite sequence.

Worked Example: A Sequence with a Simple Diagonal

Let \(x_n=3/10^n\) for each \(n\in\mathbb{N}\). Its canonical decimal has digit 3 in position \(n\) and digit 0 in every other position. Thus \(a_{nn}=3\) for every \(n\), and the construction gives \(d_n=1\) for every \(n\). The resulting number is \(y=\sum_{n=1}^{\infty}10^{-n}\). The geometric-series formula gives \(y=(1/10)/(1-1/10)=1/9\), which lies strictly between 0 and 1. For every \(n\), the \(n\)th digit of \(y=0.111\ldots\) is 1, whereas the \(n\)th digit of \(x_n\) is 3; both expansions are canonical, so the uniqueness proposition verifies \(y\ne x_n\). The construction has produced a point outside this particular sequence.

A Common Pitfall: Changing Digits Is Not Enough

Changing every diagonal digit does not automatically prove that the resulting real number differs from each listed real. If the new decimal is allowed to end in repeating nines, it may equal another decimal with different digits. For a concrete failure, consider the sequence \(x_1=0.8000\ldots\), \(x_2=0.2000\ldots\), and \(x_n=0.1000\ldots\) for \(n\geq3\). The incorrect rule \(d_n=9-a_{nn}\) gives \(d_1=9-8=1\), \(d_2=9-0=9\), and \(d_n=9-0=9\) for every \(n\geq3\). The resulting decimal is \(0.1999\ldots\), which equals \(0.2000\ldots=x_2\): indeed, \(\sum_{n=2}^{\infty}9\,10^{-n}=1/10\), so \(0.1+\sum_{n=2}^{\infty}9\,10^{-n}=0.2\). The digit at position 2 differs from the corresponding digit of \(x_2\), but the real numbers are equal.

The repair is not to assume that different decimal strings always mean different numbers. Instead, use canonical expansions for the listed reals and choose new digits from \(\{1,2\}\). The constructed expansion is then canonical too, and the uniqueness proposition makes the digit-by-digit contradiction valid. The restriction to digits 1 and 2 also keeps the new number strictly within \((0,1)\).

Check Your Understanding

Use the definitions and the diagonal construction to answer the following questions.

  1. Why does the construction ensure that the new number is positive and less than 1?
  2. What is the \(n\)th digit of the constructed number when \(a_{nn}=1\), and why does it differ from \(a_{nn}\)?
  3. Explain why the floor construction cannot produce a decimal that is eventually all 9 for a point of \((0,1)\).
  4. Why does the empty finite list need to be considered separately when converting a finite list into a sequence?
  5. Verify that \(0.3999\ldots=0.4000\ldots\), and explain why canonical expansions avoid this ambiguity.