← mapSet Theory

Cardinality & Infinity

⚗ Dr. Möbius, from the lab

This is it — the fucking boss fight, and I have been waiting for this since the first lesson. Everything in this stratum was training for the single most mind-melting result in elementary mathematics: there are different sizes of infinity. Some infinities are bigger than others. Not metaphorically. Provably. A man named Georg Cantor proved this in the 1870s and the mathematical establishment called him a charlatan, a corrupter of youth, a danger to the science — his own doctoral advisor turned against him. He spent years in a psychiatric clinic. He died there in 1918. He was completely, devastatingly, permanently right, and the people who persecuted him are remembered only because they were wrong about him. Tonight you're going to watch the proof with your own eyes, understand it completely, and feel what it felt like to be Georg Cantor alone in the room with an idea that was too true to be believed. Light the accelerator. Let's go count the uncountable.

THE BIG IDEA

Two sets have the same size exactly when a bijection exists between them — and by this measure ℝ is strictly larger than ℕ, so infinity comes in different sizes.

Same size = a bijection exists. Counting without counting.

How do you know two finite sets have the same size without counting? You pair them up. If every left sock matches exactly one right sock with none left over, there are equally many — no counting required, just a bijection (last lesson: a perfect pairing, no collisions, no orphans).

Cantor's leap — and it is a genuine intellectual leap, the kind that separates genius from competence: make that the definition, and let it run on infinite sets. Two sets AA and BB have the same cardinality, written A=B|A| = |B|, exactly when there exists a bijection f:ABf : A \to B. That's it. No counting, just pairing. This single definition will show you that your intuition about infinity is completely, hilariously wrong, and by the end of this lesson you will love it for that. (And because bijections compose and invert — proven last lesson — "same cardinality" is an equivalence relation: reflexive via id\operatorname{id}, symmetric via f1f^{-1}, transitive via gfg \circ f. The relations lesson cashes its check.)

A set is countable if it's finite or has the same cardinality as N\mathbb{N} — i.e. you can list it a0,a1,a2,a_0, a_1, a_2, \dots so every element appears exactly once. That list is the bijection nann \mapsto a_n. Hold onto "countable means listable." Everything turns on it.

Hilbert's Hotel: infinity breaks your intuition

David Hilbert ran a thought-hotel with rooms 1,2,3,1, 2, 3, \dots — one per natural number, all full. A new guest arrives. "No vacancy," says your intuition. Your intuition is about to get humiliated.

The manager announces: everyone move from room nn to room n+1n+1. Room 11 empties; the new guest checks in. Every original guest still has a room. A full infinite hotel absorbed another guest. The map nn+1n \mapsto n + 1 is an injection of N\mathbb{N} into itself that misses one room — proof that an infinite set can biject with a proper subset of itself. No finite set can do that; it's the signature of infinity.

Push harder. N\mathbb{N} and the even numbers have the same size. The pairing n2nn \mapsto 2n is a bijection N{0,2,4,}\mathbb{N} \to \{0, 2, 4, \dots\}: injective (2a=2ba=b2a = 2b \Rightarrow a = b) and surjective (every even number 2k2k is hit by kk). "Half" of N\mathbb{N} is the same size as N\mathbb{N}. And Z\mathbb{Z}? Same size too — list it by zig-zagging: 0,1,1,2,2,3,3,0, 1, -1, 2, -2, 3, -3, \dots, hitting every integer exactly once. That list is a bijection NZ\mathbb{N} \to \mathbb{Z}. So N=Z=evens|\mathbb{N}| = |\mathbb{Z}| = |\text{evens}|. Infinite sets do not obey "the part is smaller than the whole." Throw that finite intuition in the incinerator and light it on fire — Hilbert's Hotel is what infinity actually looks like, and it is deeply, gloriously weird.

ℚ is countable: the zigzag through the grid

Surely the rationals are bigger than N\mathbb{N} — they're dense, infinitely many crammed between any two integers, no gaps, suffocatingly close together. Your intuition is about to get humiliated again. Q\mathbb{Q} is countable too, and the proof is one of the prettiest pictures in mathematics.

Arrange the positive rationals pq\tfrac{p}{q} in an infinite grid: row pp, column qq holds pq\tfrac{p}{q}.

111213212223313233\begin{array}{cccc} \tfrac{1}{1} & \tfrac{1}{2} & \tfrac{1}{3} & \cdots \\ \tfrac{2}{1} & \tfrac{2}{2} & \tfrac{2}{3} & \cdots \\ \tfrac{3}{1} & \tfrac{3}{2} & \tfrac{3}{3} & \cdots \\ \vdots & & & \ddots \end{array}

Now walk the diagonals: 11\tfrac{1}{1}; then 12,21\tfrac{1}{2}, \tfrac{2}{1}; then 31,22,13\tfrac{3}{1}, \tfrac{2}{2}, \tfrac{1}{3}; and so on, sweeping each finite anti-diagonal before moving deeper. Skip any fraction already seen in lowest terms (22=11\tfrac{2}{2} = \tfrac{1}{1}, already counted). This single snaking path hits every positive rational exactly once — so it's a list, hence a bijection with N\mathbb{N}. Tack on 00 and the negatives by the Z\mathbb{Z}-style zig-zag, and all of Q\mathbb{Q} is countable. The density was a red herring; you can still line them up single file.

So far every infinite set we've met is the same size as N\mathbb{N}. You might start to suspect all infinities are equal — that the universe is tidier than it looks. Cantor is about to detonate that suspicion with a single argument so clean it should make you angry at every math teacher who never showed it to you.

Cantor's diagonal argument: ℝ is uncountable

Theorem. The real numbers in [0,1)[0, 1) cannot be listed. There is no bijection N[0,1)\mathbb{N} \to [0,1). R\mathbb{R} is uncountable — strictly bigger than N\mathbb{N}.

Proof (by contradiction — diagonalization). Suppose, for contradiction, that [0,1)[0,1) is countable. Then we can list every such real by its decimal expansion:

r0=0.d00d01d02d03r1=0.d10d11d12d13r2=0.d20d21d22d23  \begin{aligned} r_0 &= 0.\,d_{00}\,d_{01}\,d_{02}\,d_{03}\cdots \\ r_1 &= 0.\,d_{10}\,d_{11}\,d_{12}\,d_{13}\cdots \\ r_2 &= 0.\,d_{20}\,d_{21}\,d_{22}\,d_{23}\cdots \\ &\ \ \vdots \end{aligned}

where dijd_{ij} is the jj-th digit of the ii-th number. By assumption this list contains every real in [0,1)[0,1). Now I build a number that cannot be on it.

Walk down the diagonal — the digits d00,d11,d22,d_{00}, d_{11}, d_{22}, \dots — and construct a new number x=0.x0x1x2x = 0.\,x_0\,x_1\,x_2\cdots by the rule: make each digit differ from the diagonal, xn={5if dnn5,4if dnn=5.x_n = \begin{cases} 5 & \text{if } d_{nn} \ne 5, \\ 4 & \text{if } d_{nn} = 5. \end{cases} (Using only 44s and 55s dodges the 0.4999=0.50000.4999\ldots = 0.5000\ldots duplicate-expansion loophole — xx has a unique expansion.)

Now ask: is xx anywhere on the list? Suppose x=rkx = r_k for some kk. Then their kk-th digits must agree: xk=dkkx_k = d_{kk}. But we built xkx_k to differ from dkkd_{kk} — that's the whole point of the rule. Contradiction. So xrkx \ne r_k for every kk: xx differs from r0r_0 in digit 00, from r1r_1 in digit 11, from r2r_2 in digit 22, and so on forever. The diagonal is a perfect alibi — xx is a genuine real in [0,1)[0,1) that appears nowhere on the supposedly-complete list.

That contradicts "the list contains every real." So no such list exists: [0,1)[0,1), and hence R\mathbb{R}, is uncountable. \blacksquare

Sit with what just happened. We didn't fail to find a list — we proved that every conceivable list must miss something, by manufacturing its own counterexample from its diagonal. This is not a limitation of our imagination. This is a proof that no such list can exist, full stop, forever, for anyone. R\mathbb{R} has strictly more elements than N\mathbb{N}. There are at least two sizes of infinity. The smaller, N|\mathbb{N}|, is named 0\aleph_0; the size of R\mathbb{R} is strictly bigger. This is what Cantor showed the world. This is what they called him a charlatan for. The bastards.

The punchline: infinitely many infinities

One more turn of the screw, because Cantor didn't stop. Remember the power set P(A)\mathcal{P}(A) — all subsets of AA — and that P(A)=2A|\mathcal{P}(A)| = 2^{|A|} for finite AA (the on/off-switch argument, way back in the membership lesson)?

Cantor's Theorem. For every set AA, A<P(A)|A| < |\mathcal{P}(A)|. The power set is always strictly bigger.

The proof is diagonalization again, stripped to its bones. Suppose some f:AP(A)f : A \to \mathcal{P}(A) were a bijection (so AA and P(A)\mathcal{P}(A) were the same size). Build the "diagonal" set D={aAaf(a)}D = \{\, a \in A \mid a \notin f(a) \,\} — the elements that aren't in the subset they're assigned to. Since ff is surjective, D=f(d)D = f(d) for some dAd \in A. Now ask the lethal question: is dDd \in D? If dDd \in D, then by DD's definition df(d)=Dd \notin f(d) = D — contradiction. If dDd \notin D, then df(d)d \notin f(d), so by definition dDd \in D — contradiction. Either way, disaster. No such bijection exists, so P(A)>A|\mathcal{P}(A)| > |A|. \blacksquare

Apply it forever: N<P(N)<P(P(N))<|\mathbb{N}| < |\mathcal{P}(\mathbb{N})| < |\mathcal{P}(\mathcal{P}(\mathbb{N}))| < \cdots — an endless tower of ever-larger infinities, each strictly dwarfing the last. There is no biggest infinity. The "number" of sizes of infinity is itself unbounded. That fact is so insane I want you to just stare at it for a second before scrolling down.

You started this stratum learning that a set is a bag with no opinions. You're ending it holding a proof that infinity comes in infinitely many sizes, built entirely from bijections, diagonals, and the empty goddamn bag. That is the whole power of rigor: the unhinged is true, and you can prove it. The Federation of Boring Textbook Authors will tell you this is "too advanced." They are cowards. You did it. Now go finish the gauntlet — you've earned the kill.

🔬 SPECIMENS (worked examples)

Worked example 1 — a bijection proving same size (Galileo was spooked; you won't be)

Prove that N={0,1,2,}\mathbb{N} = \{0, 1, 2, \dots\} and the set of perfect squares S={0,1,4,9,16,}S = \{0, 1, 4, 9, 16, \dots\} have the same cardinality.

Same cardinality means: exhibit a bijection NS\mathbb{N} \to S. The natural candidate is f(n)=n2f(n) = n^2.

Injective. If f(a)=f(b)f(a) = f(b) then a2=b2a^2 = b^2 with a,b0a, b \ge 0, so a=ba = b (no negative inputs to cause ±\pm collisions). ✓

Surjective onto SS. Every element of SS is by definition k2k^2 for some kNk \in \mathbb{N}, and f(k)=k2f(k) = k^2 hits it. ✓

So ff is a bijection NS\mathbb{N} \to S, hence N=S|\mathbb{N}| = |S|.

Pause on how strange this is: SS is a vanishingly thin subset of N\mathbb{N} — squares get rarer and rarer (the gap between 1002100^2 and 1012101^2 is 201201). Yet there are exactly as many squares as naturals, because we can pair them off perfectly. Galileo noticed this paradox in 1638 and it spooked him into giving up on infinity. Cantor picked it up and made it the definition. The part equals the whole — welcome to infinity.

Worked example 2 — running the diagonal on a small list

Here are the first three entries of a claimed list of all reals in [0,1)[0,1): r0=0.3172,r1=0.5041,r2=0.1886r_0 = 0.\mathbf{3}172\ldots,\quad r_1 = 0.5\mathbf{0}41\ldots,\quad r_2 = 0.18\mathbf{8}6\ldots Using the rule "xn=5x_n = 5 if dnn5d_{nn} \ne 5, else 44", find the first three digits of a number xx guaranteed not to be r0,r1r_0, r_1, or r2r_2, and explain why.

Read the diagonal digits dnnd_{nn} (bolded): d00=3d_{00} = 3, d11=0d_{11} = 0, d22=8d_{22} = 8.

Apply the rule digit by digit:

  • d00=35d_{00} = 3 \ne 5, so x0=5x_0 = 5.
  • d11=05d_{11} = 0 \ne 5, so x1=5x_1 = 5.
  • d22=85d_{22} = 8 \ne 5, so x2=5x_2 = 5.

So x=0.555x = 0.555\ldots (so far). Why is xx not on the list?

  • x0=53=d00x_0 = 5 \ne 3 = d_{00}, so xx differs from r0r_0 in the first digit — xr0x \ne r_0.
  • x1=50=d11x_1 = 5 \ne 0 = d_{11}, so xx differs from r1r_1 in the second digit — xr1x \ne r_1.
  • x2=58=d22x_2 = 5 \ne 8 = d_{22}, so xx differs from r2r_2 in the third digit — xr2x \ne r_2.

By construction xx disagrees with the nn-th listed number in its nn-th digit, forever. No matter how long the list, xx has a built-in alibi against every single entry. That's the engine of the full proof — the list can never contain its own diagonal-dodger.

Worked example 3 — the twist: a 'two-dimensional' set that's actually the same damn size

A student insists N×N\mathbb{N} \times \mathbb{N} (all pairs of naturals) must be strictly bigger than N\mathbb{N} — "it's two-dimensional!" Settle it: is N×N\mathbb{N} \times \mathbb{N} countable?

The student's intuition says two-dimensional infinity beats one-dimensional infinity. It doesn't — and the proof is the same zigzag that tamed Q\mathbb{Q}.

Arrange the pairs (p,q)(p, q) in an infinite grid: row pp, column qq. Now walk the finite anti-diagonals — the sets where p+qp + q is constant:

  • p+q=0p + q = 0: just (0,0)(0,0).
  • p+q=1p + q = 1: (0,1),(1,0)(0,1), (1,0).
  • p+q=2p + q = 2: (0,2),(1,1),(2,0)(0,2), (1,1), (2,0).
  • p+q=3p + q = 3: (0,3),(1,2),(2,1),(3,0)(0,3), (1,2), (2,1), (3,0) — and so on.

Each anti-diagonal is finite (only finitely many pairs sum to a given value), so listing them in order — (0,0),(0,1),(1,0),(0,2),(1,1),(2,0),(0,0), (0,1), (1,0), (0,2), (1,1), (2,0), \dots — sweeps up every pair exactly once. That list is a bijection NN×N\mathbb{N} \to \mathbb{N} \times \mathbb{N}.

Therefore N×N\mathbb{N} \times \mathbb{N} is countable: N×N=N|\mathbb{N} \times \mathbb{N}| = |\mathbb{N}|. The trap is assuming "more dimensions = bigger infinity." For countable sets, products stay countable — the zigzag flattens any finite-dimensional grid into a single line. (This is exactly why Q\mathbb{Q} was countable: rationals are essentially pairs (p,q)(p,q).) The student's "two-dimensional" intuition is a finite-world reflex, and infinity does not care.

☠ KNOWN HAZARDS

  • Thinking "infinite" is one size. N=Z=Q|\mathbb{N}| = |\mathbb{Z}| = |\mathbb{Q}| but N<R|\mathbb{N}| < |\mathbb{R}|. Some infinities are strictly bigger. "Infinite = infinite" is exactly the intuition Cantor destroyed — and that destruction is the whole point of this lesson.

  • Believing a proper subset must be smaller. True for finite sets, false for infinite ones: the evens are a proper subset of N\mathbb{N} yet the same size (bijection n2nn \mapsto 2n). The part can equal the whole. This is not a paradox; it is the definition of infinite.

  • Misreading the diagonal argument as "we just haven't found the list yet." It proves every list is incomplete by constructing a missing number from the list itself — not a failure to search, a proof of impossibility. The argument doesn't say "hard." It says "impossible." Forever.

  • Forgetting why the digit rule avoids 44 and 55 only / dodges 0.49990.4999\ldots. The argument must produce a number with a unique decimal expansion so it can't secretly equal a listed number written differently. Using just 44s and 55s guarantees that. Miss this detail and the proof has a hole; mind the hole.

TL;DR

  • A=B|A| = |B| means a bijection ABA \to B exists — counting without counting. "Same cardinality" is an equivalence relation (id, f1f^{-1}, gfg\circ f).

  • Countable = finite or same size as N\mathbb{N} (listable). Hilbert's Hotel: N\mathbb{N}, Z\mathbb{Z}, and the evens all share one size; infinite sets biject with proper subsets of themselves.

  • Q\mathbb{Q} is countable via the diagonal zigzag through the pq\tfrac{p}{q} grid — density doesn't make it bigger than N\mathbb{N}.

  • Cantor's diagonal: R\mathbb{R} is uncountable. Any list of [0,1)[0,1) is defeated by the anti-diagonal number that differs from the nn-th entry in the nn-th digit. No list can be complete.

  • Cantor's Theorem: A<P(A)|A| < |\mathcal{P}(A)| always, so there are infinitely many sizes of infinity — an endless tower with no top.