Report

Help us improve this tool

Hilbert's Hotel Paradox Calculator

Explore David Hilbert's infinite hotel paradox: calculate new room assignments for finite guests, countably infinite guests, or infinite buses of guests with step-by-step room mappings.

O M T

Understanding Hilbert's Grand Hotel Paradox

Hilbert's Grand Hotel paradox is a famous thought experiment devised by German mathematician David Hilbert in 1924 to illustrate the counterintuitive properties of infinite sets. Unlike a finite hotel that has a maximum occupancy limit, a hypothetical hotel with a countably infinite number of rooms ($\aleph_0$, or aleph-null) can accommodate additional guests even when every single room is already occupied.

How the Infinite Hotel Accommodates New Guests

The key mathematical principle behind Hilbert's Hotel is that countably infinite sets can be put into a one-to-one correspondence (bijection) with proper subsets of themselves. Depending on how many new guests arrive, the hotel manager applies different relocation algorithms:

1. Accommodating a Single New Guest ($k = 1$)

When one new guest arrives at a fully booked infinite hotel, the manager asks the guest currently in Room 1 to move to Room 2, the guest in Room 2 to move to Room 3, and generally the guest in Room $n$ to move to Room $n + 1$:

$$f(n) = n + 1$$

This shifts all infinitely many current guests simultaneously, vacating Room 1 for the new arrival. In set theory terms, adding one element to a countably infinite set does not increase its cardinality: $\aleph_0 + 1 = \aleph_0$.

2. Accommodating $k$ Finite Guests

If a finite group of $k$ travelers arrives, each current resident in Room $n$ shifts to Room $n + k$:

$$f(n) = n + k$$

This simultaneously frees up the first $k$ rooms ($1, 2, \dots, k$) for all $k$ new arrivals.

3. Accommodating an Infinite Bus of Guests ($\aleph_0$)

Suppose an infinitely long bus carrying countably infinite passengers ($\aleph_0$) pulls up. The manager instructs every current resident in Room $n$ to move to Room $2n$:

$$f(n) = 2n$$

This moves current occupants into all the even-numbered rooms ($2, 4, 6, 8, \dots$). This leaves all infinitely many odd-numbered rooms ($1, 3, 5, 7, \dots$) vacant. The passenger at seat $m$ on the incoming bus is assigned to Room $2m - 1$:

$$g(m) = 2m - 1$$

Because there are infinitely many odd numbers, every bus passenger receives a private room: $\aleph_0 + \aleph_0 = \aleph_0$.

4. Accommodating Infinitely Many Infinite Buses ($\aleph_0 \times \aleph_0$)

When an infinite convoy of buses arrives, each carrying infinitely many passengers, the hotel manager has multiple mathematical strategies:

  • Prime Factorization Method: Assign existing hotel guests in Room $n$ to Room $2^n$. Passengers on Bus $k$ at seat $m$ are placed into Room $p_{k+1}^m$, where $p_i$ is the $i$-th prime number (Bus 1 goes to $3^m$, Bus 2 goes to $5^m$, Bus 3 goes to $7^m$, etc.). By the Fundamental Theorem of Arithmetic, no two guests are ever assigned to the same room.
  • Cantor's Diagonal Pairing Method: By treating the original hotel as Bus 0, every guest can be represented as a pair $(b, g)$ where $b$ is the bus index and $g$ is the seat number. Cantor's pairing function maps $(b, g)$ to a unique positive integer without leaving any unoccupied rooms.

Summary of Relocation Formulas

Arrival Scenario Current Guest ($n$) Moves To New Guest ($m$) Assigned To Cardinal Arithmetic
1 New Guest $n + 1$ Room 1 $\aleph_0 + 1 = \aleph_0$
$k$ Finite Guests $n + k$ Rooms $1, 2, \dots, k$ $\aleph_0 + k = \aleph_0$
1 Infinite Bus ($\aleph_0$) $2n$ (even rooms) $2m - 1$ (odd rooms) $\aleph_0 + \aleph_0 = \aleph_0$
$B$ Infinite Buses $(B + 1)n$ $(B + 1)(m - 1) + b$ $\aleph_0 + B\aleph_0 = \aleph_0$
$\infty$ Infinite Buses (Primes) $2^n$ $p_{k+1}^m$ (e.g. $3^m, 5^m$) $\aleph_0 \times \aleph_0 = \aleph_0$

Explore other mathematical sequences and paradoxes using our Hilbert Curve Generator, Collatz Conjecture Calculator, and Arithmetic Sequence Generator.

Frequently Asked Questions

Can Hilbert's Hotel ever run out of rooms?

No. Because the hotel contains countably infinite rooms indexed by the set of natural numbers $\mathbb{N} = \{1, 2, 3, \dots\}$, there is no last room. Any finite or countably infinite number of new guests can always be accommodated by defining an injective mapping to vacate room slots.

What happens if uncountably infinite guests arrive?

If an uncountably infinite number of guests arrive (having cardinality $2^{\aleph_0}$ or $\mathfrak{c}$, such as the real numbers $\mathbb{R}$), Hilbert's Hotel cannot accommodate them. Georg Cantor's diagonal argument proves that no one-to-one function exists between the natural numbers $\mathbb{N}$ and the real numbers $\mathbb{R}$.

Why are there empty rooms when using the prime powers method?

Under the prime powers method, room numbers must be powers of a single prime (such as $2^n, 3^m, 5^m$). Numbers that have multiple distinct prime factors (such as $6 = 2 \times 3$, $10 = 2 \times 5$, $12 = 2^2 \times 3$) and the number $1$ are never assigned to anyone. These remain spare rooms.

Where does the current guest in Room 500 move if 1 infinite bus arrives?

When 1 infinite bus arrives, existing guests move according to $f(n) = 2n$. Therefore, the guest in Room 500 moves to Room $2 \times 500 = 1000$.

Which room does passenger #4 on the incoming bus get?

Incoming bus passengers receive odd-numbered rooms via $g(m) = 2m - 1$. For passenger $m = 4$, the assigned room is $2(4) - 1 = 7$.