ratiocin1/17 published
Back to graph
Ch.1Setsmedium●●●○

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 [0,1][0, 1]. Each can be written as an infinite binary expansion:

r=0.b1b2b3where bi{0,1}r = 0.b_1 b_2 b_3 \ldots \quad \text{where } b_i \in \{0, 1\}

Assume for contradiction that we can enumerate all such reals in a list:

s1=0.b1,1  b1,2  b1,3  s2=0.b2,1  b2,2  b2,3  s3=0.b3,1  b3,2  b3,3      \begin{aligned} s_1 &= 0.\,b_{1,1}\; b_{1,2}\; b_{1,3}\; \ldots \\ s_2 &= 0.\,b_{2,1}\; b_{2,2}\; b_{2,3}\; \ldots \\ s_3 &= 0.\,b_{3,1}\; b_{3,2}\; b_{3,3}\; \ldots \\ &\;\;\vdots \end{aligned}

Interactive Visualization

Diagonal Argument Explorer

Explore the argument step by step. Click any cell to modify a digit, then press Play to watch the proof unfold.

6×6

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.

Cantor diagonal gridToggle binary digits, then play the animation to construct a sequence missing from the list.b1b2b3b4b5b6s1010101s2101010s3010101s4101010s5010101s6101010

The Diagonal Construction

Define a new number d=0.d1d2d3\tip{d — the number we construct by flipping the diagonal}{d} = 0.\,d_1\, d_2\, d_3 \ldots by flipping the diagonal:

di={1if bi,i=00if bi,i=1\tip{d_i — the i-th digit of our constructed number}{d_i} = \begin{cases} 1 & \text{if } b_{i,i} = 0 \\ 0 & \text{if } b_{i,i} = 1 \end{cases}

In other words, dibi,id_i \neq b_{i,i} for every ii.

The Contradiction

Proof

1

Assume a complete enumeration s1,s2,s3,s_1, s_2, s_3, \ldots of all reals in [0,1][0,1] exists.

2

Construct dd by flipping the diagonal: set di=1bi,id_i = 1 - b_{i,i}.

3

For every nNn \in \mathbb{N}, the number dd differs from sns_n at position nn, so dsnd \neq s_n.

4

But d[0,1]d \in [0,1], so dd should be in the list — contradiction.

Result

Conclusion: There is no surjection f:N[0,1]f: \mathbb{N} \to [0,1]. The set of real numbers is uncountable: R>N|\mathbb{R}| > |\mathbb{N}|.

We write N=0|\mathbb{N}| = \aleph_0 and R=c=20|\mathbb{R}| = \mathfrak{c} = 2^{\aleph_0}.

Cantor's Theorem

From Reals to Power Sets

Proof

Cantor's Theorem. For any set AA, there is no surjection f:AP(A)f: A \to \mathcal{P}(A).

Define the rogue set R={aA:af(a)}\tip{R — the rogue set: all elements of A not contained in their own image under f}{R} = \left\{\, a \in A : a \notin f(a) \,\right\}. Then Rf(x)R \neq f(x) for every xx: if xRx \in R then xf(x)=Rx \notin f(x) = R, and if xRx \notin R then xf(x)=Rx \in f(x) = R — either way a contradiction. Flipping membership (\in vs \notin) plays the same role as flipping bits.

Interactive: Power Set Argument

Power Set Diagonal Explorer

Explore Cantor's Theorem with a finite set. Toggle memberships in the grid, then watch the rogue set construction unfold.

4

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.

Power set membership gridToggle set memberships, then play the animation to build the rogue set.1234f(1)f(2)f(3)f(4)

Rogue Set R

R = { a ∈ A : a ∉ f(a) }

?Is 1 ∈ f(1)?
?Is 2 ∈ f(2)?
?Is 3 ∈ f(3)?
?Is 4 ∈ f(4)?