I would assume that a Cantor diagonal argument using a list of all rationals between 0 and 1 would produce an irrational number between 0 and 1.

Consider the sequence $c_i$ with Cantor's standard numbering of the rationals - 1/2, 1/3, 2/3, 1/4, 2/4, 3/4, 1/5, 2/5, 3/5, 4/5, etc.

List these numbers in their binary representation, and for any number of the form $p/2^q$, choose the representation that ends in an infinite sequence of 1s. So represent 1/2 as .0111...

c1  = 1/2 = .0111111111111111....
c2  = 1/3 = .0101010101010101....
c3  = 2/3 = .1010101010101010....
c4  = 1/4 = .0011111111111111....
c5  = 2/4 = .0111111111111111....
c6  = 3/4 = .1011111111111111....
c7  = 1/5 = .0011001100110011....
c8  = 2/5 = .0110011001100110....
c9  = 3/5 = .1001100110011001....
c10 = 4/5 = .1100110011001100....

Now create sequence $d_i$ from $c_i$ - make $d_1$ = $c_1$. Then assign the next $c_i$ to $d_j$ when the next j bit in $c_i$ = 1. A 1 can always be found because $c_i$ has the representation that does not end in an repreating 0. The intermediate $d_j$'s should be filled with some number - say .01111111...

d1  = c1  = 1/2 = .0111111111111111.... (original assignment)
d2  = c2  = 1/3 = .0101010101010101.... (cause the 2nd  bit of c2   is 1)
d3  = c3  = 2/3 = .1010101010101010.... (cause the 3rd  bit of c3  is 1) 
d4  = c4  = 1/4 = .0011111111111111.... (cause the 4th  bit of c4  is 1)
d5  = c5  = 2/4 = .0111111111111111.... (cause the 5th  bit of c5  is 1)
d6  = c6  = 3/4 = .1011111111111111.... (cause the 6th  bit of c6  is 1)
d7  = c7  = 1/5 = .0011001100110011.... (cause the 7th  bit of c7  is 1)
d8  = filler #  = .0111111111111111.... (cause the 8th  bit of c8  is 0)
d9  = filler #  = .0111111111111111.... (cause the 9th  bit of c8  is 0)
d10 = c8  = 2/5 = .0110011001100110.... (cause the 10th bit of c8  is 1)
d11 = filler #  = .0111111111111111.... (cause the 11th bit of c9  is 0)
d12 = c9  = 3/5 = .1001100110011001.... (cause the 12th bit of c9  is 1)
d13 = c10 = 4/5 = .1100110011001100.... (cause the 13th bit of c10 is 1)

So every $c_i$ winds up in $d_i$ somewhere.

Now look at the diagonal - it's .0111111111111... Flipping the bits yields .1000000000.... Normally that would be thought of as 1/2, but it's not actually explicitly anywhere in the sequence cause the rationals are always represented with an infinite numbers of 1s in $d_i$.

However while .10000000... is not in the sequence, it's also not an irrational number. It seems like it's more akin to not being a number. I'm not sure how to describe it.

So where does this construction go off the tracks? And if the construction is valid, does it say anything about the validity of the Cantor diagonal argument?

  • $\begingroup$ Why do you think this construction "goes off the tracks"? What fact do you think is contradicted by this construction? $\endgroup$ – Matthew Conroy Feb 15 '14 at 19:24
  • $\begingroup$ I assumed I would have constructed an irrational from the diagonal's flipped bits since all rationals in (0,1) are on the list. So something seems wrong. $\endgroup$ – MikeO Feb 15 '14 at 19:46
  • $\begingroup$ But if you extend that thinking so that $c_i$ is a proposed enumeration of all reals in (0,1), and also choose $c_i$ so that you always pick the representation that doesn't end in 0s. And then construct $d_i$ in the same fashion. You wind up with the same result that .100000... as the diagonal counter example, but clearly that number (1/2) is the first element on the list. $\endgroup$ – MikeO Feb 15 '14 at 19:52

The diagonal argument should properly be stated in terms of a list of sequences. It only guarantees to generate a sequence that is not in the original list. In your example, it has certainly done that.

Let's follow this and see where it leads.

Given a list $\{f_1, f_2, f_3,\ldots\}$ of sequences $f_i$, where each sequence $f_i$ is understood to be a function from $\Bbb N$ to $S$, for some set $S$ with at least 2 elements, the diagonal argument guarantees to construct a new sequence $g:\Bbb N\to S$ which is different from every one of the $f_i$.

Let's make the construction explicit: $S$ has at least two elements, so let $p$ and $q$ be elements of $S$ with $p\ne q$. Then let $g$ be defined as follows: $$g(n) = \begin{cases} q,\text{ if $f_n(n) = p$},\\ p\text{ otherwise}\end{cases}$$ Now $g$ is different from $f_i$ for every $i$, because $g(i)\ne f_i(i)$.

Suppose we want to show that the real numbers are uncountable. First we restrict our attention to real numbers in $[0, 1)$; if we can show that these are uncountable, that is enough. Then we identify each real number with its decimal expansion, which we can understand as a sequence of decimal digits $\Bbb N\to \{0,1,\ldots,9\}$; here $S= \{0,1,\ldots,9\}$. Then we have to repair the problem that some real numbers have two decimal expansions, so we agree that we will identify those real numbers with their 0-terminating expansions and represent them thus in our list. Then we make a list of real numbers $\{r_1, r_2, r_3, \ldots\}$, represented as their decimal expansions. We claim that there must be a real number not on the list, and we hope that the diagonal construction will give it to us.

But Cantor's argument is not quite enough. It does indeed give us a decimal expansion which is not on the list. But unless we take more care, the decimal expansion it gives us might be something like $.1379999\ldots$, which would prove nothing. Although the diagonal argument gave us a sequence that certainly is not on the list, we are not interested in sequences; we are interested in real numbers. But this sequence corresponds to $\frac{69}{500}$, and there is no reason to suppose that that real number is not already on the list in the form $.1380000\ldots$. We wanted the diagonal argument to give us a real number not on the list, but it only works with sequences, which is not quite enough. So we have failed to prove that the real numbers are uncountable.

To make the proof work, we have to adjust the Cantor construction of $g$ so that it does not ever produce the decimal expansion of some number whose other decimal expansion is already on the list. We can do this by tinkering with the construction a little bit, making it construct a $g$ that contains only the decimal digits 4 and 7, for example. (Take $\{p, q\} = \{4, 7\}$ in the construction.) Then it must produce a decimal such as $0.477474744474744\ldots$ which is the only decimal expansion for a certain real number, and since that number's decimal expansion is, by construction, not on the list, that number does not appear.

But to make the argument work we had to take care of a lot of fussy details. The base argument works only in terms of sequences, and for sequences it is much simpler. (It is used in this form, for example, to prove the existence of noncomputable functions: Pick a programming language and enumerate all possible programs in some order. Let $f_i$ be the function computed by the $i$th program. Let $g(n) = f_n(n)+1$. Then $g$ is not computed by any program.)

Now let's return to what you wanted to do. You want to enumerate all rational numbers, but to do that you have to identify rational numbers with sequences, so you take $S=\{0,1\}$ and identify each rational number with its radix-2 expansion, choosing the 1-terminating expansion when there are two expansions. Then you made a list, and applied the Cantor argument, and you got a sequence that ended with zeroes. All Cantor promised was to produce a sequence not on your list, and the procedure has done this.

If you want to argue about rational numbers, you have to add something more; if you expected it to produce an irrational number, you have to add a bit more, and the paragraphs above should suggest how to do it.


Given a list of digit sequences, the diagonal argument constructs a digit sequence that isn't on the list already.

There are indeed technical issues to worry about when the things you are actually interested in are real numbers rather than digit sequences, because some real numbers correspond to more than one digit sequences.

The method I see most often to work around this technicality is to choose the digits for the diagonal in a way that they can only produce a real number that has only one corresponding digit sequence: e.g. choose to use decimal digits, and only pick 3 or 6 for the digits of the digit sequence you construct using the diagonal argument.


No, one can easily arrange for a list whose diagonal "flip" is a rational number. Consider the following list:

$$f_n(k)=\begin{cases}0&n\neq k\\ 1& n=k\end{cases}$$

Then the list looks like this:

$$\begin{matrix} 1&0&0&0&0&0&0&0&0&0&0&0&\ldots\\ 0&1&0&0&0&0&0&0&0&0&0&0&\ldots\\ 0&0&1&0&0&0&0&0&0&0&0&0&\ldots\\ 0&0&0&1&0&0&0&0&0&0&0&0&\ldots\\ 0&0&0&0&1&0&0&0&0&0&0&0&\ldots\\ 0&0&0&0&0&1&0&0&0&0&0&0&\ldots\\ 0&0&0&0&0&0&1&0&0&0&0&0&\ldots\\ 0&0&0&0&0&0&0&1&0&0&0&0&\ldots\\ 0&0&0&0&0&0&0&0&1&0&0&0&\ldots\\ 0&0&0&0&0&0&0&0&0&1&0&0&\ldots\\ 0&0&0&0&0&0&0&0&0&0&1&0&\ldots\\ 0&0&0&0&0&0&0&0&0&0&0&1&\ldots\\ \vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots \end{matrix}$$

Clearly every real number represented by a binary sequence in this list is rational, as it only contains one non-zero coordinate. But what does the diagonal argument generates? $f(k)=1-f_k(k)=0$, so the sequence generated is $0$.

And if $0$ is not a rational number, I don't know what is. Using this list it's quite easy to generate any rational number as a diagonal output, but I'll leave that to you to find out how.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.