How to prove that the set of rational numbers is countable?
In my Real Analysis class, we proved that is countable by constructing a bijection with . The standard proof uses the diagonal array argument:
Then we traverse along diagonals and skip duplicates. But I'm confused: doesn't Cantor's diagonal argument also show that is uncountable? Why does the same diagonal argument work for countability of but uncountability of ?
1 answers65 views
Loading comments...
1 Answer
PR
Prof. Robert FischerApr 6, 2026 AcceptedThese two diagonal arguments are **different** despite both involving a 2D array.
**For $\mathbb{Q}$ (showing countability):**
We arrange all positive rationals in an infinite grid where entry $(i,j) = i/j$. We then traverse the grid along **finite diagonals** (constant $i+j$) and list each new rational the first time we encounter it. This gives a **sequence** that hits every positive rational. Since a sequence is exactly a bijection with $\mathbb{N}$, this shows $\mathbb{Q}^+$ is countable. Extending to all of $\mathbb{Q}$ is then straightforward.
The grid traversal works because each diagonal is finite, so every rational appears at a finite position.
**For $\mathbb{R}$ (showing uncountability — Cantor's diagonal argument):**
Assume $\mathbb{R}$ is countable, so we can list all real numbers in $[0,1]$ as $r_1, r_2, r_3, \ldots$. Write each in decimal form:
\begin{align*}
r_1 &= 0.d_{11}d_{12}d_{13}\ldots \\
r_2 &= 0.d_{21}d_{22}d_{23}\ldots \\
r_3 &= 0.d_{31}d_{32}d_{33}\ldots \\
&\vdots
\end{align*}
Construct a new number $x = 0.x_1x_2x_3\ldots$ where $x_i \
eq d_{ii}$ (e.g., $x_i = 5$ if $d_{ii} \
eq 5$, else $x_i = 6$). Then $x$ differs from every $r_i$ in the $i$-th decimal place, so $x$ is not in the list — a contradiction. Hence $\mathbb{R}$ is uncountable.
The key difference: the $\mathbb{Q}$ grid uses **finite diagonals** and produces an enumeration. Cantor's diagonal proof uses the **diagonal of the enumeration itself** to construct a missing element. One shows existence of a listing; the other shows impossibility of a listing.
Loading comments...