ProofComplete

Proof that the Rationals are Countable

One of the most surprising results in set theory is that the rational numbers Q\mathbb{Q}, despite being dense in the real line, have the same cardinality as the natural numbers. This stands in stark contrast to the real numbers, which are uncountable. The proof illustrates powerful techniques for showing countability.

TheoremCountability of the Rationals

The set of rational numbers Q\mathbb{Q} is countably infinite, i.e., Q=N=0|\mathbb{Q}| = |\mathbb{N}| = \aleph_0.

Proof

We will construct an explicit bijection between N\mathbb{N} and Q\mathbb{Q}, though showing that Q\mathbb{Q} is countable only requires an injection into N\mathbb{N} or a surjection from N\mathbb{N}.

Method 1: Cantor's Enumeration

Every rational number can be written uniquely in lowest terms as p/qp/q where q>0q > 0 and gcd(p,q)=1\gcd(p, q) = 1. We arrange the positive rationals in an infinite array:

1/11/21/31/42/12/22/32/43/13/23/33/44/14/24/34/4\begin{array}{ccccccc} 1/1 & \to & 1/2 & & 1/3 & \to & 1/4 & \cdots \\ \downarrow & \nearrow & & \searrow & & \nearrow & \\ 2/1 & & 2/2 & & 2/3 & & 2/4 & \cdots \\ & \searrow & & \nearrow & & \searrow & \\ 3/1 & & 3/2 & & 3/3 & & 3/4 & \cdots \\ \downarrow & \nearrow & & \searrow & & \nearrow & \\ 4/1 & & 4/2 & & 4/3 & & 4/4 & \cdots \\ \vdots & & \vdots & & \vdots & & \vdots & \end{array}

where row pp and column qq contains p/qp/q. We enumerate by following diagonal paths (Cantor's diagonal argument):

1/1,2/1,1/2,3/1,2/2,1/3,4/1,3/2,2/3,1/4,1/1, \quad 2/1, 1/2, \quad 3/1, 2/2, 1/3, \quad 4/1, 3/2, 2/3, 1/4, \quad \ldots

Skipping duplicates (like 2/2=1/12/2 = 1/1), we get an enumeration of all positive rationals. Including 00 and negative rationals (by interleaving), we obtain an enumeration of all of Q\mathbb{Q}.

Method 2: Pairing Function

Define the height of a rational p/qp/q in lowest terms (with q>0q > 0) as h(p/q)=p+qh(p/q) = |p| + q. For each finite height nn, there are only finitely many rationals of height nn. List all rationals in order of increasing height, breaking ties arbitrarily:

  • Height 1: 0/10/1
  • Height 2: 1/1,1/11/1, -1/1
  • Height 3: 2/1,2/1,1/2,1/22/1, -2/1, 1/2, -1/2
  • Height 4: 3/1,3/1,1/3,1/3,2/3,2/33/1, -3/1, 1/3, -1/3, 2/3, -2/3
  • ...

This produces an enumeration Q={q0,q1,q2,}\mathbb{Q} = \{q_0, q_1, q_2, \ldots\}, giving a bijection nqnn \mapsto q_n from N\mathbb{N} to Q\mathbb{Q}.

Method 3: Using Cantor Pairing

The Cantor pairing function π:N×NN\pi: \mathbb{N} \times \mathbb{N} \to \mathbb{N} is a bijection defined by:

π(m,n)=(m+n)(m+n+1)2+n\pi(m, n) = \frac{(m + n)(m + n + 1)}{2} + n

This function is bijective, showing N×N=N|\mathbb{N} \times \mathbb{N}| = |\mathbb{N}|.

Now, the positive rationals are in bijection with (N{0})×(N{0})(\mathbb{N} \setminus \{0\}) \times (\mathbb{N} \setminus \{0\}) via (m,n)m/n(m, n) \mapsto m/n (not injective, but surjective). Since there is a surjection from N×N\mathbb{N} \times \mathbb{N} onto Q+\mathbb{Q}^+, and N×N=N|\mathbb{N} \times \mathbb{N}| = |\mathbb{N}|, we have Q+N|\mathbb{Q}^+| \leq |\mathbb{N}|. Combined with the obvious injection NQ\mathbb{N} \hookrightarrow \mathbb{Q}, Schröder-Bernstein gives Q=N|\mathbb{Q}| = |\mathbb{N}|.

Remark

The key insight is that Q\mathbb{Q} can be organized into a sequence of finite layers (by height or diagonal), allowing systematic enumeration. This strategy works for any countable union of countable sets—a general theorem we prove next.

TheoremCountable Union of Countable Sets

If {An:nN}\{A_n : n \in \mathbb{N}\} is a countable collection of countable sets, then n=0An\bigcup_{n=0}^\infty A_n is countable.

Proof

For each nn, since AnA_n is countable, there is an enumeration An={an,0,an,1,an,2,}A_n = \{a_{n,0}, a_{n,1}, a_{n,2}, \ldots\} (possibly finite). Arrange these in an array:

a0,0a0,1a0,2a0,3a1,0a1,1a1,2a1,3a2,0a2,1a2,2a2,3a3,0a3,1a3,2a3,3\begin{array}{ccccc} a_{0,0} & a_{0,1} & a_{0,2} & a_{0,3} & \cdots \\ a_{1,0} & a_{1,1} & a_{1,2} & a_{1,3} & \cdots \\ a_{2,0} & a_{2,1} & a_{2,2} & a_{2,3} & \cdots \\ a_{3,0} & a_{3,1} & a_{3,2} & a_{3,3} & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \end{array}

Enumerate by diagonals as before. This gives a surjection Nn=0An\mathbb{N} \twoheadrightarrow \bigcup_{n=0}^\infty A_n, proving the union is countable.

ExampleApplications of Countability

Using the theorem that countable unions of countable sets are countable:

  1. Algebraic numbers: The set of roots of polynomials with rational coefficients is countable (countable union over degree, each degree is countable)

  2. Finite sequences: The set of all finite sequences of natural numbers is countable: n=0Nn\bigcup_{n=0}^\infty \mathbb{N}^n is countable

  3. Computable reals: The set of Turing-computable real numbers is countable (countable number of Turing machines)

  4. Rational points: The set Qn=Q××Q\mathbb{Q}^n = \mathbb{Q} \times \cdots \times \mathbb{Q} (n times) is countable for any finite nn

Remark

The proof that countable unions of countable sets are countable requires the axiom of countable choice, a weak form of the axiom of choice. Without it, we cannot guarantee that each countable set AnA_n has an enumeration simultaneously. This shows that even seemingly elementary results in set theory can depend on choice principles.

TheoremUncountability of the Reals

In contrast to Q\mathbb{Q}, the real numbers are uncountable: R>N|\mathbb{R}| > |\mathbb{N}|. In fact, R=P(N)=20|\mathbb{R}| = |\mathcal{P}(\mathbb{N})| = 2^{\aleph_0}.

Proofsketch

Cantor's diagonal argument: Suppose R\mathbb{R} were countable with enumeration {r0,r1,r2,}\{r_0, r_1, r_2, \ldots\}. Write each rnr_n in decimal expansion. Construct a new real rr by ensuring its nn-th decimal digit differs from the nn-th digit of rnr_n. Then rrnr \neq r_n for all nn, contradicting completeness of the enumeration.

ExampleThe Cardinality Hierarchy

We now have an infinite hierarchy of cardinalities:

=0N=0 (countably infinite)Q=0R=20=c (the continuum)P(R)=2cP(P(R))=22c\begin{align*} |\emptyset| &= 0 \\ |\mathbb{N}| &= \aleph_0 \text{ (countably infinite)} \\ |\mathbb{Q}| &= \aleph_0 \\ |\mathbb{R}| &= 2^{\aleph_0} = \mathfrak{c} \text{ (the continuum)} \\ |\mathcal{P}(\mathbb{R})| &= 2^\mathfrak{c} \\ |\mathcal{P}(\mathcal{P}(\mathbb{R}))| &= 2^{2^\mathfrak{c}} \\ &\vdots \end{align*}

The continuum hypothesis (CH) conjectures that there is no cardinality strictly between 0\aleph_0 and c\mathfrak{c}, i.e., c=1\mathfrak{c} = \aleph_1. Kurt Gödel and Paul Cohen showed that CH is independent of ZFC: it can neither be proved nor disproved from the standard axioms.

The countability of Q\mathbb{Q} and uncountability of R\mathbb{R} reveal the subtle and counterintuitive nature of infinity. Despite Q\mathbb{Q} being dense in R\mathbb{R}, it has "measure zero" from the perspective of cardinality. These results form the foundation for modern analysis and topology.