Countable Infinity and Hilbert's Hotel
Tour a full hotel with endlessly many rooms to see how countable infinity works, which sets fit inside it, and which do not.
Key takeaways
- Countably infinite means the members can be listed in a sequence that eventually reaches each one.
- A full hotel with rooms numbered 1, 2, 3, ... can take one more guest, any finite number, or countably many more.
- Even countably many busloads of countably many people fit, so the positive rationals are countable.
- Some sets, including the real numbers, are too large to be listed at all.
A set is countably infinite if its members can be matched one for one with the counting numbers 1, 2, 3 and so on. Hilbert's Hotel, with one room for each counting number, shows the strange consequence: even when every room is full, there is still space for more guests.
Nothing about the hotel is contradictory. It only behaves differently from any finite building. Once you see how the room moves work, you can tell which infinite collections fit in the hotel and meet the first ones that never will.
The rules of the hotel
Imagine a hotel with rooms numbered 1, 2, 3, ..., with no last room. Tonight every room holds exactly one guest. A new traveler arrives. In an ordinary hotel, "full" means "no". Here the manager asks everyone to move at the same moment from room n to room n + 1.
Each guest has a definite new room. No two guests land in the same one, since different numbers stay different after adding 1. Room 1 is now empty, and the newcomer takes it. Nobody is left without a room, because there is no final guest who has nowhere to go.
If k new guests arrive, move everyone from room n to room n + k. Rooms 1 through k open up.
The illustration is usually credited to David Hilbert, who used it in lectures in the 1920s, and it became widely known through George Gamow's popular writing in the 1940s.
A bus with endlessly many passengers
Now a bus pulls up carrying passengers numbered 1, 2, 3, ... with no end. Shifting everyone by a fixed amount will not do. Instead, send the guest in room n to room 2n.
current guests: n → room 2n (all the even rooms)
bus passenger k: k → room 2k − 1 (all the odd rooms) Check a few: the guest in room 5 goes to room 10, and passenger 5 goes to room 9. Every room gets exactly one person. In mathematical terms, you have found a bijection between the combined crowd and the rooms.
The same two formulas show that there are as many even counting numbers as counting numbers, even though the evens are only part of the whole. An infinite set can be matched with a proper subset of itself. For finite sets that is impossible.
Infinitely many buses
Next comes a convoy: bus 1, bus 2, bus 3 and so on, each with seats 1, 2, 3 and so on. Number the current guests as "bus 0", with the guest in room s in seat s. Now send the person in bus b, seat s, to this room:
room = 2ᵇ × (2s − 1)
bus 0, seat 3 → 1 × 5 = 5
bus 1, seat 3 → 2 × 5 = 10
bus 3, seat 1 → 8 × 1 = 8 Why does it work? Every positive integer can be written in exactly one way as a power of 2 times an odd number. Take 48 = 16 × 3: the power is 4 and the odd part is 3 = 2 × 2 − 1, so room 48 belongs to bus 4, seat 2. Every room gets one occupant and no two people collide.
This relies on unique factorization into primes. A popular alternative sends bus passengers to powers of odd primes. That also avoids collisions, but it leaves many rooms empty, such as room 15.
What countable means
A set is countably infinite if there is a bijection between it and the counting numbers. A set is countable if it is finite or countably infinite, though some authors use "countable" only for the infinite case.
In practice, you show a set is countable by listing it so that every member appears at some finite position.
The integers look twice as big as the counting numbers, but this list catches them all:
position: 1 2 3 4 5 6 7 ...
integer: 0 1 −1 2 −2 3 −3 ... The integer 100 sits at position 200, and −100 sits at position 201. A list such as 0, 1, 2, 3, ..., then −1, −2, ... fails, because the negative numbers never get a finite position.
Listing the fractions
The rational numbers are packed densely: between any two lies another. Surely they cannot be listed? They can. Arrange positive fractions p/q by the sum p + q, and skip any that are not in lowest terms.
| Sum p + q | New fractions in lowest terms |
|---|---|
| 2 | 1/1 |
| 3 | 1/2, 2/1 |
| 4 | 1/3, 3/1 |
| 5 | 1/4, 2/3, 3/2, 4/1 |
| 6 | 1/5, 5/1 |
Each sum contributes only finitely many fractions, so any particular fraction is reached after finitely many steps. For example, 7/9 appears in the group with sum 16. In row 4, the fraction 2/2 is skipped because it equals 1/1, already listed.
The order of the list has nothing to do with the order of size. That is allowed. A list only has to reach everything.
Grids and zigzags
Many countability proofs are the same picture. Lay out the pairs of positive integers in a grid, with row m and column n. Reading along the first row is hopeless, since you never reach the second. Reading along the slanting diagonals works, because each diagonal is finite.
diagonal 2: (1,1)
diagonal 3: (1,2) (2,1)
diagonal 4: (1,3) (2,2) (3,1)
position of (3,1): sixth in the list Before diagonal number s there are 1 + 2 + ... + (s − 2) entries, so every pair gets a definite position. The pair (10, 10) lies on diagonal 20. The earlier diagonals hold 1 + 2 + ... + 18 = 171 pairs, and (10, 10) is the tenth entry on its own diagonal, so its position is 181.
In hotel language, this is another way to house endlessly many endless buses: send the passenger in bus m, seat n, to the room given by that position.
The pattern extends. Triples of positive integers are pairs of a pair and a number, so they are countable too, and so are lists of any fixed finite length. What breaks the pattern is infinite length. Lists that go on forever, even using just two symbols, cannot be counted.
More countable sets
The same grouping idea handles a surprising range of collections.
- Finite strings over a finite alphabet: list by length, then alphabetically. Hence all possible texts, and all computer programs in a given language, form a countable set.
- Polynomials with integer coefficients: group by the sum of the degree and the sizes of the coefficients.
- Algebraic numbers, meaning roots of such polynomials: each polynomial has finitely many roots.
Since the real numbers are not countable, most of them are not algebraic. That argument for the existence of transcendental numbers goes back to Cantor. Likewise there are only countably many programs, so most real numbers cannot be computed by any of them.
The guest the hotel cannot take
Suppose a bus arrives with one passenger for every infinite sequence of zeros and ones. No room assignment can fit them all. Given any proposed assignment, you can write down a sequence that differs from the sequence in room 1 at the first place, from the one in room 2 at the second place, and so on. That sequence has no room.
This is the heart of Cantor's diagonal argument, and it shows there is more than one size of infinity.
Departures and puzzles
Guests can leave, too. If all guests in odd-numbered rooms check out, infinitely many people leave. Move each remaining guest from room n to room n/2 and the hotel is full again. If instead everyone in rooms 4 and higher leaves, again infinitely many people go, but only 3 remain. So "infinity minus infinity" has no single value.
Some common reactions deserve an answer.
- "The last guest has nowhere to go." There is no last guest.
- "Moving everyone takes forever." The mathematics describes a rule assigning new rooms all at once. Whether a physical process could carry it out is a separate question.
- "This proves infinity is absurd." It proves that infinite collections do not obey every rule that finite ones do, such as "a part is smaller than the whole".
Try it yourself
First, house three endless buses in an empty hotel. One solution uses remainders: passenger k of bus 1 goes to room 3k − 2, of bus 2 to room 3k − 1, and of bus 3 to room 3k. Every room has exactly one remainder pattern, so none is shared and none is empty.
Next, find the passenger in a given room. Room 100 can be written as 3 × 34 − 2, so it holds passenger 34 of bus 1.
Then try a harder one. Using the rule room = 2ᵇ × (2s − 1), find who sleeps in room 72. Since 72 = 8 × 9 and 9 = 2 × 5 − 1, it is the passenger in bus 3, seat 5. Running a rule backward like this is the quickest way to check that it really is a one-for-one match.
The lesson carries well beyond the hotel. To show that a collection is countable, find a scheme that gives each member a finite address, and make sure that no two members share it. If sharing happens, you can still conclude countability by skipping repeats, just as the fraction list skipped 2/2.