Chapter 1 · Sets — medium
Cantor's Diagonal Argument
Proof that the real numbers are uncountable — there is no bijection between ℕ and ℝ.
Setup
Consider the real numbers in the interval . Each can be written as an infinite binary expansion:
Assume for contradiction that we can enumerate all such reals in a list:
Build the Missing Witness
Diagonal Witness Builder
Use the grid as a proposed complete list. The side panel extracts the diagonal, flips it into the witness , and records the exact row where each mismatch happens. Click any cell to modify a digit, then press Play to watch the proof unfold.
The grid shows 6 binary sequences — each row is a real in [0,1] written in binary. We want to prove no list can contain all of them.
Edit cells or resize with ±. Press Play to watch the diagonal argument.
Binary decimal prefixes
0.b1b2... is a real in [0,1]
Witness Builder
d escapes the list
The grid is only the source. The proof is the witness: read one diagonal digit from each row, flip it, then keep one mismatch certificate per row.
d = 0.······
Press Play to turn the diagonal into a missing sequence.
Note
How to read it: the proof is not the colored grid. The grid supplies diagonal facts; the witness panel turns those facts into and then into one certificate for every row: differs from at digit .
Another View: Binary Addresses
Nested Interval Microscope
The matrix is not the only way to see the trick. A binary expansion is also an address inside : each digit chooses the left or right half of the current interval. The construction of can be viewed as repeatedly choosing the opposite half from row at digit .
Nested interval view
Flip one address digit, then zoom in
current prefix
0.110101
Less Conventional Examples
Other Ways to Break a List
The diagonal proof is the central result here, but the educational examples do not have to be literal diagonals. One route uses length instead of self-disagreement; other routes keep the anti-list idea while replacing binary decimals with everyday yes/no objects.
The Diagonal Construction
Define a new number by flipping the diagonal:
In other words, for every .
The Contradiction
Proof
Assume a complete enumeration of all reals in exists.
Construct by flipping the diagonal: set .
For every , the number differs from at position , so .
But , so should be in the list — contradiction.
Result
Conclusion: There is no surjection . The set of real numbers is uncountable: .
We write and .
Cantor's Theorem
From Reals to Power Sets
Proof
Cantor's Theorem. For any set , there is no surjection .
Define the rogue set . Then for every : if then , and if then — either way a contradiction. Flipping membership ( vs ) plays the same role as flipping bits.
Interactive: Rogue Set Argument
Rogue Set Builder
Explore Cantor's Theorem with a finite set. The grid is only a membership lookup table; the right panel builds the rogue set and compares it against every proposed image. Toggle memberships, then press Play.
Set up a mapping f: A → P(A) where A = {1,…,4}. Each row i shows which elements belong to f(i). We'll prove no such map can be surjective.
Toggle cells to change membership. Resize with ±, then press Play.
Rogue Set R
R = { a ∈ A : a ∉ f(a) }