Countable and Uncountable Sets

Chapter 8, Infinite Sets

Learning objectives

  • Prove β„š\mathbb{Q} is countable by exhibiting an enumeration
  • State and apply Cantor's diagonal argument to show ℝ\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 (β„•\mathbb{N}, β„€\mathbb{Z}, β„š\mathbb{Q}) and strictly larger cardinalities for sets like ℝ\mathbb{R} and 𝒫(β„•)\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.

β„š\mathbb{Q} is countable

The rationals are dense in ℝ\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 β„š+\mathbb{Q}^{+}. Interleaving with negatives and zero gives an enumeration of β„š\mathbb{Q}. Therefore βˆ£β„šβˆ£=β„΅0|\mathbb{Q}| = \aleph_0.

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

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

Proof. Suppose for contradiction that some function f ⁣:β„•β†’(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.d00d01d02d03…f(0) = 0.d_{00} d_{01} d_{02} d_{03} \ldots f(1)=0.d10d11d12d13…f(1) = 0.d_{10} d_{11} d_{12} d_{13} \ldots f(2)=0.d20d21d22d23…f(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.x0x1x2…x = 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 dnnβ‰ 5d_{nn} \neq 5, otherwise xn=6x_n = 6 (this also avoids the 0.999…=1.000…0.999\ldots = 1.000\ldots ambiguity).

Then x∈(0,1)x \in (0, 1), but xβ‰ f(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 ℝ\mathbb{R} is denoted 𝔠\mathfrak{c} ("the continuum") and we have just proved β„΅0<𝔠\aleph_0 < \mathfrak{c}. There is no biggest infinity either: Cantor's theorem says ∣A∣<βˆ£π’«(A)∣|A| < |\mathcal{P}(A)| for every set AA, so the chain βˆ£β„•βˆ£<βˆ£π’«(β„•)∣<βˆ£π’«(𝒫(β„•))∣<β‹―|\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).
  • β„•Γ—β„•\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}β„•\{0, 1\}^{\mathbb{N}} is uncountable, by exactly the same diagonal argument.
Where this shows up
  • Floating point is necessarily incomplete: IEEE 754 double precision uses 64 bits, so it can represent at most 2642^{64} distinct values, a finite set. Even the entire space of finite-length decimal strings is countable. But ℝ\mathbb{R} is uncountable, so almost every real number is unrepresentable in any digital format. The "rounding error" of numerical computing is a cardinality phenomenon, not just an engineering one.
  • Turing's halting problem: Turing's 1936 proof that the halting problem is undecidable uses a diagonal argument structurally identical to Cantor's. Programs are countable; the set of functions β„•β†’{0,1}\mathbb{N} \to \{0, 1\} is uncountable; so there must be functions no program can compute, including the function that decides whether a given program halts.
  • GΓΆdel's incompleteness: GΓΆdel's self-referential sentence ("this sentence is not provable") is built by a diagonal-style construction inside arithmetic. The countability of formulas (versus the uncountability of "true" statements about β„•\mathbb{N}) is what makes the gap inevitable.
  • 19th-century controversy: Cantor's discovery initially scandalized the mathematical establishment, Kronecker dismissed it as "corruption of youth", precisely because completed infinity had been a theological taboo. Today it is the foundation of set theory and category theory.

Pause and think: The rationals β„š\mathbb{Q} are dense in ℝ\mathbb{R}, between any two reals there are infinitely many rationals. Yet βˆ£β„šβˆ£=β„΅0<𝔠=βˆ£β„βˆ£|\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 β„š\mathbb{Q} has plenty of "room" between every pair of reals, but it skips over uncountably many irrationals at every point.)

f : A β†’ BAB1234abcd

Try it

  • Before reading further: a friend hands you the "list" f(0)=0.1234…f(0) = 0.1234\ldots, f(1)=0.5678…f(1) = 0.5678\ldots, f(2)=0.9012…f(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}β„•\{0, 1\}^{\mathbb{N}} is uncountable. Adapt the diagonal argument from decimals to binary sequences.
  • Prove that the irrationals are uncountable. (Hint: write ℝ=β„šβˆͺ(β„βˆ–β„š)\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 β„•\mathbb{N} is countable; the set of all subsets of β„•\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 β„•β† A\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 β„š\mathbb{Q} being dense in ℝ\mathbb{R} does not make β„š\mathbb{Q} uncountable: density is geometric, countability is combinatorial, and the two notions can disagree.

What you now know

You can prove β„š\mathbb{Q} countable by an explicit enumeration, prove ℝ\mathbb{R} uncountable via Cantor's diagonal argument, and apply the closure facts (subsets and countable unions of countable sets remain countable; 𝒫(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.

Mark section complete β†’

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.