1. Home
  2. Numberphile

May 16, 2025

Why mixed-up infinite keys still have a 63% match chance

18 min → 3:00

Overview

Dr. Tom Crawford uses the inclusion-exclusion principle to find the probability that at least one randomly placed key in Hilbert's infinite hotel lands on its correct hook.

3 things to know

Numberphile: A derangement puts no item in its original spot

Numberphile calculates the probability of getting at least one correct placement, which is the exact opposite of a derangement where no element appears in its original position.

More

This is the classical name for the problem being discussed. The video calculates the probability of the opposite of a derangement (at least one correct placement).

▶ Watch at 0:23

Inclusion-Exclusion Principle

A counting technique for finding the size of a union of multiple sets.

More

It involves systematically adding the sizes of the individual sets, subtracting the sizes of all pairwise intersections, adding back the sizes of all three-way intersections, and so on, with alternating signs.

▶ Watch at 5:05

Numberphile says Euler's number is approximately 2.718 in the solution

Numberphile's solution involves the mathematical constant Euler's number, which is approximately equal to 2.718, using the Taylor series expansion for e to the power of -1, or 1/e.

More

The solution involves the Taylor series expansion for e^x, specifically for e^-1, which is equal to 1/e.

Also in this episode

Numberphile simplifies the odds by multiplying numbers down to one

Numberphile shows how the probability calculations in the inclusion-exclusion principle simplify to terms involving factorials, which are the product of all positive whole numbers up to a given number.

More

The probability calculations in the inclusion-exclusion principle simplify to terms involving factorials.

Numberphile uses Hilbert's Hotel to show how infinite sets behave

Numberphile uses the Hilbert's Hotel Paradox as a fun setting for an infinite probability problem that shows the counterintuitive properties of infinite sets.

▶ Watch at 15:43

Quotes

“The probability that at least one key is correct is 1 - 1/e, which is about 63% chance.”

▶ Watch at 15:43

“All of those infinite keys are just in a big old bucket. And we have to figure out... what is the probability we actually end up putting the correct key on the correct room hook?”

▶ Watch at 0:23

“What we've got here is the n=2 and n=3 version of something called the inclusion-exclusion principle, which is an excellent name because it basically tells you what to do.”

▶ Watch at 5:05

Full summary

Episode Overview

  • The episode explores a variation of the classic "hat-check problem" set in the context of Hilbert's Hotel, which has an infinite number of rooms.
  • The core question is: If all the infinite keys are muddled in a bucket and randomly placed on hooks, what is the probability that at least one key ends up on its correct hook?
  • The host, Dr. Tom Crawford, uses the inclusion-exclusion principle to break down the problem for a finite number of keys (n).
  • The solution surprisingly converges to a constant value related to Euler's number (e) as the number of keys approaches infinity.

Key Concepts

  • Hilbert's Hotel Paradox: A thought experiment illustrating the counterintuitive properties of infinite sets, used here as a fun setting for an infinite probability problem.
  • Derangement Problem: This is the classical name for the problem being discussed. A derangement is a permutation of the elements of a set, such that no element appears in its original position. The video calculates the probability of the opposite of a derangement (at least one correct placement).
  • Inclusion-Exclusion Principle: A counting technique for finding the size of a union of multiple sets. It involves systematically adding the sizes of the individual sets, subtracting the sizes of all pairwise intersections, adding back the sizes of all three-way intersections, and so on, with alternating signs.
  • Euler's Number (e): The mathematical constant approximately equal to 2.718. The solution involves the Taylor series expansion for e^x, specifically for e^-1, which is equal to 1/e.
  • Factorials: The product of all positive integers up to a given integer (e.g., 5! = 5 × 4 × 3 × 2 × 1). The probability calculations in the inclusion-exclusion principle simplify to terms involving factorials.

Quotes

  • At 00:23 - "All of those infinite keys are just in a big old bucket. And we have to figure out... what is the probability we actually end up putting the correct key on the correct room hook?" - The host clearly and concisely states the core problem of the episode.
  • At 05:05 - "What we've got here is the n=2 and n=3 version of something called the inclusion-exclusion principle, which is an excellent name because it basically tells you what to do." - Dr. Crawford introduces the key mathematical principle used to solve the problem.
  • At 15:43 - "The probability that at least one key is correct is 1 - 1/e, which is about 63% chance." - The host reveals the final, counterintuitive answer for the infinite case.

Takeaways

  • The probability of at least one person getting the right item in a random assignment problem is not small, even with an infinite number of items.
  • When solving problems involving "at least one" success, it's often easier to calculate the probability of "zero" successes and subtract that from 1.
  • The inclusion-exclusion principle is a powerful method for calculating probabilities of unions of events by alternating between adding and subtracting the probabilities of their intersections.
  • Many complex probability problems simplify neatly when extended to an infinite case, often converging to values involving fundamental mathematical constants like 'e'.

Watch the full episode 18 min

Read along with the audio summary

Picture an infinite number of hotel room keys muddled in a big old bucket, and ask yourself the question Dr. Tom Crawford raises: when you place them randomly on hooks, what is the probability that at least one key ends up on its correct room hook? In this episode, which came out on May 16, 2025, host Dr. Tom Crawford walks us through a variation of the classic hat check problem. By the end, you will learn how a seemingly impossible infinite probability puzzle simplifies into a single surprising number.

A thought experiment about infinite rooms gives this probability puzzle its setting. Infinity has counterintuitive properties, and Hilbert's Hotel Paradox is a famous thought experiment designed to illustrate them. Here, a hotel with an infinite number of rooms serves as a fun backdrop for an infinite probability problem. All the keys to those infinite rooms are muddled together in a bucket and placed at random onto the room hooks.

This infinite key mix up is actually a variation of a classic puzzle known as the derangement problem. In mathematics, a derangement is a rearrangement, or permutation, of the elements of a set where no single element ends up in its original position. Think of it as every hotel key landing on the wrong hook. Rather than finding the odds that every key is wrong, Dr. Crawford calculates the probability of the exact opposite outcome, where at least one key is placed on its correct hook.

To find that probability, you need a counting technique whose name tells you exactly what to do. When solving problems about getting at least one success, Dr. Crawford breaks the problem down for a finite number of keys, such as two or three, using the inclusion exclusion principle. This technique finds the combined size of multiple overlapping sets by systematically adding the sizes of the individual sets, subtracting the sizes of all pairs of overlapping sets, and then adding back the sizes of three way overlaps. By alternating between adding and subtracting these intersections, you can accurately calculate the probability of a union of events.

As the number of keys approaches infinity, that alternating pattern of additions and subtractions converges to a famous mathematical constant. Euler's number, denoted by the letter e, is a fundamental constant approximately equal to 2.718. The solution to the hotel key puzzle relies on a mathematical formula called the Taylor series expansion for powers of e, and specifically for e raised to the power of negative one, which equals one divided by e.

The reason the inclusion exclusion math links so neatly to Euler's number comes down to factorials. A factorial is the product of all positive whole numbers up to a given number, so five factorial is five times four times three times two times one. When you work through the probability calculations in the inclusion exclusion principle, the fractions simplify neatly into terms involving factorials, which then converge to the formula using Euler's number.

Even with an infinite number of randomly assigned items, the probability of at least one person getting the right item is not small, because many complex probability problems simplify neatly when extended to infinity. The probability that at least one key is correct is one minus one over e, which is about a sixty three percent chance.

More from Numberphile

Related Episodes