Why does Cantor’s diagonalization not disprove the countability of rational numbers

cantor setrational numbersreal numberssequences-and-series

Say we enumerate the list of rational numbers in the way given in the standard proof of rational numbers being countable (the link of the proof is given below). Then we take all of the numbers from the list whose decimal representation includes only the numbers $1$ and/or $0$. Now we construct the number $x$ in the way that Cantor's diagonalization suggests. $x$ should not be in the given list, hence rational numbers should not be countable.
Could you please point out the flaw in this logic?

Cantor's diagonalization;
Proof that rational numbers are countrable

Best Answer

In the proof of uncountably many irrational numbers, you just need to show it is real and not in the list already. However for rational numbers, you also need the decimal expansion to be periodic, which cannot be ensured by diagonization, even when you're constructing $x$ from rational numbers with only $1$ and $0$.

An example would be the Liouville Number which only has $1$ and $0$, but is not periodic and thus not rational.

Related Question