MethodMath
Chloe Villeneuve
Apr 5, 2026

How to prove that the set of rational numbers is countable?

In my Real Analysis class, we proved that Q\mathbb{Q} is countable by constructing a bijection with N\mathbb{N}. The standard proof uses the diagonal array argument:

11121314212223243132333441424344\begin{matrix}
\frac{1}{1} & \frac{1}{2} & \frac{1}{3} & \frac{1}{4} & \cdots \\\frac{2}{1} & \frac{2}{2} & \frac{2}{3} & \frac{2}{4} & \cdots \\\frac{3}{1} & \frac{3}{2} & \frac{3}{3} & \frac{3}{4} & \cdots \\\frac{4}{1} & \frac{4}{2} & \frac{4}{3} & \frac{4}{4} & \cdots \\\vdots & \vdots & \vdots & \vdots & \ddots
\end{matrix}

Then we traverse along diagonals and skip duplicates. But I'm confused: doesn't Cantor's diagonal argument also show that R\mathbb{R} is uncountable? Why does the same diagonal argument work for countability of Q\mathbb{Q} but uncountability of R\mathbb{R}?

1 answers65 views
Loading comments...

1 Answer

PR
Prof. Robert FischerApr 6, 2026 Accepted
These 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...
Login or Register to post an answer