A hotel has one room for every positive integer, and every room has a guest in it. One more guest arrives and asks for a room. In a hotel with finitely many rooms the answer would be no, so can an infinite hotel do better without putting two people in one room or turning anyone away? This page writes down room assignments that make space for one guest, for a bus with infinitely many passengers and even for infinitely many such buses, checks that each assignment gives every person a room of their own, and explains why only an infinite hotel allows this.
Key terms
Hilbert’s Hotel
Definition Hilbert’s Hotel is an imaginary hotel with one room for each positive integer and no last room, in which every room holds exactly one guest. When new people arrive, the manager announces a rule that names one room for every person, old guests and newcomers alike, and everyone moves to their room at the same moment. A rule works when every person gets exactly one room and no two people get the same room. Rooms may be left empty. The paradox is that the hotel is full, since no room is empty, and yet working rules exist for one new guest, for a bus with one passenger for each positive integer, and even for one such bus for each positive integer. The resolution is that “full” only says that every room is taken. In a hotel with finitely many rooms, a rule that gives the guests different rooms uses as many rooms as there are guests, so it uses every room and leaves none for a newcomer. With infinitely many rooms the old guests can be given different rooms that leave some rooms free, because after every room there is a room . The hotel is a model of assignments between sets of numbers. It says nothing about a real building or about how long the moves would take. It is named after David Hilbert, who described it in a lecture in 1924.
In plain words A full infinite hotel can still take more guests, because the manager can move everyone along the hallway and the hallway never ends. Nobody is pushed out at the far end, since there is no far end.
Example One new guest arrives. The manager asks the guest in room to move to room and gives room to the newcomer, so the guest in room goes to room and the guest in room goes to room . This rule works. Old guests from different rooms go to the different rooms . Each room receives exactly one old guest, the one from room , and room receives only the newcomer.
Next a bus arrives with seats numbered and a passenger in every seat. Moving everyone one room along frees only room , so the manager uses two rules at once. The old guest in room moves to room , and the passenger in seat takes room ,
The old guests fill the even rooms and the passengers in seats take rooms , and in general the passengers fill the odd rooms. Every positive integer is either even or odd and not both, so every room gets exactly one person and nobody is left without a room.
One-to-one correspondence
Definition A one-to-one correspondence, also called a bijection, between two sets and is a rule that gives each element of one partner in so that two conditions hold. First, no two elements share a partner, which means that only when . Second, every element of is the partner of some element of . A rule with the first property is called injective, and in some books one-to-one, while a rule with the second property is called onto, or surjective. So a one-to-one correspondence is a rule that is both injective and onto. Two sets have the same size, or the same cardinality, when there is a one-to-one correspondence between them. For finite sets this means exactly that they have the same number of elements.
In plain words A one-to-one correspondence pairs off two sets so that everything on either side has exactly one partner. It compares sizes without counting, the way a theater in which every seat holds one person and nobody is standing shows that there are as many people as seats.
Example The rule is a one-to-one correspondence between the positive integers and the odd positive integers . It is injective, because forces , and it is onto, because each odd number is the partner of the positive integer . Two other rules on the positive integers show what can go wrong. The rule is injective but not onto, since is nobody’s partner. The rule that sends to the largest integer at most , written , gives , so it reaches every positive integer but is not injective, since and share the partner . As room assignments, the first rule leaves room empty and the second puts two guests in every room.
Countably infinite set
Definition A set is countably infinite when there is a one-to-one correspondence between it and the set of positive integers . Equivalently, its elements can be written as an endless list in which every element appears exactly once, each at some finite position. Some books start counting at , and that changes nothing, because is a one-to-one correspondence between and the positive integers. A countably infinite set that gains one new element, or finitely many, or a whole countably infinite set of new elements, is still countably infinite, which is what the hotel shows. This does not make infinity a number that can be subtracted from itself. Removing a countably infinite set from the positive integers can leave infinitely many numbers, just one number or none, depending on which numbers are removed.
In plain words A set is countably infinite when its elements can be numbered first, second, third and so on forever, so that each element gets its own number. The rooms of the hotel, its guests and the passengers of each bus are such sets.
Example The integers form a countably infinite set, listed as
In this list is first, each positive integer is at position and its negative is at position , so every integer has exactly one place. Subtraction is a different matter. Taking the even numbers away from the positive integers leaves the odd numbers, infinitely many of them. Taking away leaves only , and taking away every positive integer leaves nothing. Each time a countably infinite set was removed from the same countably infinite set, so an expression such as has no single value.
Proper subset
Definition A set is a subset of a set when every element of is also an element of , and a proper subset when in addition has at least one element that is not in . A finite set is never in one-to-one correspondence with a proper subset of itself, because a proper subset of a set with elements has fewer than elements. A countably infinite set always is. If lists it, the rule is a one-to-one correspondence between the whole set and the proper subset that leaves out .
In plain words Taking elements away from a finite collection always leaves fewer of them. An infinite collection can lose some of its elements, even infinitely many, and still match the whole collection one to one. Hilbert’s Hotel is this fact told as a story.
Example The even positive integers form a proper subset of the positive integers, since are missing, yet is a one-to-one correspondence between the two sets. It is injective because forces , and onto because each even number is the partner of . This is why all the old guests fit into the even rooms. Compare a hotel with rooms, all taken. The rule would send the guest in room to room , which does not exist. Any rule that gives the guests different rooms among the rooms uses all of them, so a newcomer cannot be placed.
Pairing function
Definition A pairing function is a one-to-one correspondence between the set of ordered pairs of positive integers, in which and count as different pairs, and the set of positive integers. The diagonal pairing used here orders the pairs by their sum , smallest sum first, and pairs with the same sum by increasing . The pairs with sum are , which makes of them, and the smaller sums account for pairs. So the pair with sum gets the position
The pairs with sums fill the positions in consecutive blocks of lengths , so every positive integer is the position of exactly one pair. This is a version of the Cantor pairing function, shifted to start at . Listing the pairs one row at a time does not work, because the pairs alone would take up every position, and would never get one.
In plain words To put a grid with infinitely many rows and columns into one queue, read it along short diagonals. Each diagonal is finite, so the queue finishes it and moves on, and every entry of the grid is reached after only finitely many others.
Example Let be a bus number and a seat number, with one bus for each positive integer and one passenger in every seat. The queue begins
and continues with , and . The passenger in seat of bus has , so
The pairs with sums to come first, followed by , and . To house all the buses, the manager sends the old guest in room to room and the passenger at queue position to room , so this passenger gets room . Going backward, room is odd, so it belongs to queue position . The positions up to belong to sums up to and positions to to the sum , so position is the third pair with sum , which is .
Check yourself
- Three new guests arrive at the full hotel. Give a rule that makes room for them and check that it works.
Show the answer
Move the guest in room to room and give rooms , and to the newcomers. Old guests from different rooms stay in different rooms after adding . Each room receives exactly one old guest, the one from room , and rooms to hold one newcomer each, so every person has a room of their own. The same idea works for any finite number of newcomers with the rule . In a finite hotel it fails, because the guests in the last rooms would have nowhere to go.
- A manager tries to seat one bus by sending the old guest in room to room and the passenger in seat to room . Does this rule work? What about sending passenger to room instead?
Show the answer
The first rule fails. Room is assigned to the old guest from room , since , and also to the passenger in seat , since . In general room receives both the old guest from room and the passenger in seat , so every multiple of is assigned twice. The rule also leaves rooms such as , and empty, but empty rooms are allowed. The two people sharing a room are what break it.
The second rule works. Old guests go to even rooms and passengers to the odd rooms , so no old guest meets a passenger, and different seats give different rooms . Everyone has a room of their own, and room stays empty, which is allowed.
- Infinitely many buses arrive and the manager uses the diagonal queue from the pairing function. Which room does the passenger in seat of bus get, and who is in rooms and afterward?
Show the answer
The pair is with sum , so its queue position is
and the passenger gets room .
Room is even, so it holds the old guest from room . Room is odd, so it holds the passenger at queue position . The sums to account for positions, so position is the first pair with sum , which is . Room holds the passenger in seat of bus . The formula agrees, since .