Countable and Uncountable Sets

Chapter 8: Infinite Sets

Learning objectives

  • Prove Q\mathbb{Q} is countable by exhibiting an enumeration
  • State and apply Cantor's diagonal argument to show R\mathbb{R} is uncountable
  • Decide whether a given set is countable or uncountable
  • Appreciate the philosophical and computational consequences of multiple sizes of infinity

Are there different sizes of infinity? Until 1874, mathematicians implicitly treated "infinite" as a single, undifferentiated label — an infinite set was simply "not finite," with no further structure. Then Georg Cantor proved that the set of real numbers cannot be put in bijection with the natural numbers, no matter how clever the proposed listing. His proof — the diagonal argument — is one of the most influential ideas in modern mathematics. It splits infinity into a hierarchy: 0\aleph_0 for the countable infinities (N\mathbb{N}, Z\mathbb{Z}, Q\mathbb{Q}) and strictly larger cardinalities for sets like R\mathbb{R} and P(N)\mathcal{P}(\mathbb{N}). The same diagonal trick later powered Russell's paradox, Gödel's incompleteness theorems, and Turing's undecidability of the halting problem — arguably the three deepest results of 20th-century logic.

Q\mathbb{Q} is countable

The rationals are dense in R\mathbb{R} — between any two reals you can find infinitely many rationals — yet surprisingly they are still countable. The standard trick lists the positive rationals on a two-dimensional grid: cell (m,n)(m, n) holds m/nm/n. Then we traverse the grid diagonally:

11,  12,  21,  13,  22,  31,  14,  23,  32,  41,  \frac{1}{1}, \;\frac{1}{2}, \;\frac{2}{1}, \;\frac{1}{3}, \;\frac{2}{2}, \;\frac{3}{1}, \;\frac{1}{4}, \;\frac{2}{3}, \;\frac{3}{2}, \;\frac{4}{1}, \;\ldots

Skipping duplicates (e.g., 2/2=1/12/2 = 1/1), we obtain an enumeration of Q+\mathbb{Q}^{+}. Interleaving with negatives and zero gives an enumeration of Q\mathbb{Q}. Therefore Q=0|\mathbb{Q}| = \aleph_0.

Cantor's diagonal argument: R\mathbb{R} is uncountable

Theorem (Cantor, 1891). The open interval (0,1)(0, 1) is uncountable; consequently so is R\mathbb{R}.

Proof. Suppose for contradiction that some function f ⁣:N(0,1)f \colon \mathbb{N} \to (0, 1) is a surjection (enumerates every real in (0,1)(0, 1)). Write each f(n)f(n) in decimal:

f(0)=0.d00d01d02d03f(0) = 0.d_{00} d_{01} d_{02} d_{03} \ldots
f(1)=0.d10d11d12d13f(1) = 0.d_{10} d_{11} d_{12} d_{13} \ldots
f(2)=0.d20d21d22d23f(2) = 0.d_{20} d_{21} d_{22} d_{23} \ldots

(and so on, where dijd_{ij} is a decimal digit). Now construct the number x=0.x0x1x2x = 0.x_0 x_1 x_2 \ldots by the diagonal rule: pick xnx_n to be any digit different from dnnd_{nn} — say xn=5x_n = 5 if dnn5d_{nn} \neq 5, otherwise xn=6x_n = 6 (this also avoids the 0.999=1.0000.999\ldots = 1.000\ldots ambiguity).

Then x(0,1)x \in (0, 1), but xf(n)x \neq f(n) for every nn, because xx and f(n)f(n) differ in the nn-th decimal place. So ff cannot be surjective — contradiction. Therefore no such enumeration exists, and (0,1)(0, 1) is uncountable. \blacksquare

The cardinality of R\mathbb{R} is denoted c\mathfrak{c} ("the continuum") and we have just proved 0<c\aleph_0 < \mathfrak{c}. There is no biggest infinity either: Cantor's theorem says A<P(A)|A| < |\mathcal{P}(A)| for every set AA, so the chain N<P(N)<P(P(N))<|\mathbb{N}| < |\mathcal{P}(\mathbb{N})| < |\mathcal{P}(\mathcal{P}(\mathbb{N}))| < \cdots never terminates.

Closure properties of countability

A handful of facts together justify nearly all countability proofs in practice:

  • Every subset of a countable set is countable.
  • A countable union of countable sets is countable (use the same diagonal trick on a list of lists).
  • N×N\mathbb{N} \times \mathbb{N} is countable (Cantor's pairing function from the previous section).
  • The set of finite strings over a finite alphabet is countable — the basis for "there are only countably many programs."
  • The set of all infinite binary sequences {0,1}N{0, 1}^{\mathbb{N}} is uncountable, by exactly the same diagonal argument.

Pause and think: The rationals Q\mathbb{Q} are dense in R\mathbb{R} — between any two reals there are infinitely many rationals. Yet Q=0<c=R|\mathbb{Q}| = \aleph_0 < \mathfrak{c} = |\mathbb{R}|. How can a dense subset be strictly smaller? (Hint: "dense" is about topological distribution, not about cardinality. The set Q\mathbb{Q} has plenty of "room" between every pair of reals, but it skips over uncountably many irrationals at every point.)

Mapping ArrowsInteractive figure — enable JavaScript to interact.

Try it

  • Before reading further: a friend hands you the "list" f(0)=0.1234f(0) = 0.1234\ldots, f(1)=0.5678f(1) = 0.5678\ldots, f(2)=0.9012f(2) = 0.9012\ldots. Construct a real in (0,1)(0, 1) not on the list by changing the diagonal digits. Then explain why your construction always works, no matter what list is presented.
  • Predict first: is the set of algebraic real numbers (roots of polynomials with integer coefficients) countable or uncountable? Why?
  • The set of all infinite binary sequences {0,1}N{0, 1}^{\mathbb{N}} is uncountable. Adapt the diagonal argument from decimals to binary sequences.
  • Prove that the irrationals are uncountable. (Hint: write R=Q(RQ)\mathbb{R} = \mathbb{Q} \cup (\mathbb{R} \setminus \mathbb{Q}) and use that a countable union of countable sets is countable.)
  • The set of finite subsets of N\mathbb{N} is countable; the set of all subsets of N\mathbb{N} is uncountable. Where does the boundary lie? (Think about the difference between finite descriptions and infinite ones.)

A trap to watch for

Beginners often mentally translate "uncountable" as "really really big finite." That is wrong on two levels. First, an uncountable set is not finite at all — it has infinitely many elements. Second, "uncountable" is a specific structural claim: there is no surjection NA\mathbb{N} \twoheadrightarrow A at all, no matter how the elements are arranged. It is not that the listing would be "too long"; it is that every listing must miss something (and Cantor's diagonal explicitly produces the missing element). The right mental model is not "more numerous" but "structurally beyond enumeration." This is also why Q\mathbb{Q} being dense in R\mathbb{R} does not make Q\mathbb{Q} uncountable: density is geometric, countability is combinatorial, and the two notions can disagree.

What you now know

You can prove Q\mathbb{Q} countable by an explicit enumeration, prove R\mathbb{R} uncountable via Cantor's diagonal argument, and apply the closure facts (subsets and countable unions of countable sets remain countable; P(A)\mathcal{P}(A) always strictly exceeds AA). In the final section we get the most powerful tool for comparing infinite cardinalities — the Cantor-Schröder-Bernstein theorem — which lets us conclude A=B|A| = |B| from a pair of injections without ever constructing a bijection explicitly.

References

  • Velleman, D. J. (2019). How to Prove It: A Structured Approach (3rd ed.). Cambridge University Press, ch. 8.
  • Cantor, G. (1891). "Über eine elementare Frage der Mannigfaltigkeitslehre." Jahresbericht der Deutschen Mathematiker-Vereinigung, 1, 75–78.
  • Halmos, P. R. (1960). Naive Set Theory. Springer.
  • Jech, T. (2003). Set Theory: The Third Millennium Edition. Springer.
  • Aigner, M., Ziegler, G. M. (2018). Proofs from THE BOOK (6th ed.). Springer (Cantor diagonal chapter).

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.