Imagine a hotel with infinitely many rooms, every one occupied, and a new guest walks in asking for a bed. The manager doesn’t turn them away. Every existing guest shifts along one door, so whoever was in room 2 takes room 3, whoever was in room 3 takes room 4, and the pattern continues down the corridor, freeing room 1 for the newcomer. That is Hilbert’s hotel, a thought experiment the mathematician David Hilbert first told in a lecture in January 1924, though he never published it himself.

The trick works because an infinite hotel behaves nothing like a finite one. In a hotel with a last room, the last guest would have nowhere to go. With no last room, everybody simply shifts along one, and the story only works if every guest moves at the same time, because moving one after another might take infinitely long to reach the new arrival.

It scales far past one guest

The same shuffle handles more than a single latecomer. If infinitely many new guests turn up at once, the manager can still fit them all in by asking the guest currently in room n to move to room 2n, which frees every odd-numbered room for the new arrivals. Push the puzzle further still, to infinitely many buses each carrying infinitely many passengers, and the hotel can still find every one of them a bed, using the fact that every whole number factors into primes in only one way to hand out room numbers without a clash.

What the hotel cannot always do is take in an infinite stack of infinite layers, guests arriving in infinitely many waves that are each infinitely deep.

Folklore before physics

For decades, nobody was quite sure whether Hilbert had told the story at all, or whether it was mathematical folklore attached to his name after the fact. Research tracing its origin found that Hilbert did introduce the hotel in that 1924 lecture, but it stayed obscure until the physicist George Gamow described it in a book in 1947, and took nearly three more decades after that to reach wide notice in scientific, philosophical and theological writing.

The idea has since left the seminar room for the laboratory. Physicists have built a working analogue of the hotel’s room-shuffling trick in continuous-variable quantum mechanics, mapping the amplitudes of an infinite set of quantum states to new positions the way Hilbert’s guests move to new rooms, and demonstrated the protocol experimentally using the orbital angular momentum of a light field. A century after Hilbert’s unpublished lecture, the same counting trick is being used to reshuffle real quantum states rather than imaginary guests.