The Riddle That Seems Impossible Even If You Know The Answer
Based on Veritasium's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Random guessing yields a success probability of (1/2)^100, effectively zero, because each prisoner’s 50-box search is independent in that naive approach.
Briefing
A counterintuitive prison riddle turns out to have a surprisingly high escape chance—about 31%—once prisoners stop treating their searches as independent coin flips and instead follow a shared “follow the permutation” strategy. In the classic setup, 100 prisoners each may open only 50 boxes to find the slip with their own number; if even one fails, all are executed. Random guessing gives an astronomically small success probability of (1/2)^100, essentially zero.
The winning plan is simple: when a prisoner enters, they open the box labeled with their own number, read the number inside, then go to the box with that number. They repeat this chain—always jumping to the box indicated by the slip they just found—until they either locate their own slip or they run out of the 50-box limit. This works because the arrangement of slips and box labels forms a directed graph where every box points to exactly one other box. That structure decomposes into disjoint cycles (“loops”). Starting from the box with a prisoner’s number guarantees that the prisoner will stay on the cycle containing their own slip.
Whether a prisoner succeeds depends entirely on the cycle length. If the cycle containing their number has length 50 or less, the prisoner will reach their slip within the allowed 50 steps. If the cycle length is 51 or more, the prisoner will not find their slip before exhausting the 50-box search. Crucially, all prisoners on the same long cycle either succeed together or fail together, because they are trapped in the same loop structure.
So the group success probability becomes a question about random cycle lengths: what is the chance that a random arrangement of 100 slips into 100 boxes contains no cycle longer than 50? Computing this requires counting cycle structures within permutations. The probability that a random permutation has a cycle of length exactly k is 1/k, and the probability of having any cycle longer than 50 is the sum 1/51 + 1/52 + … + 1/100. That sum is about 0.69, meaning a 69% failure rate and roughly a 31% chance that all 100 prisoners escape.
The riddle also resists “it only works for 100” skepticism. For larger numbers of prisoners, the success probability stays near 30.7% and approaches a limit. Using the same harmonic-series logic, the failure probability converges to ln(2), so the success probability approaches 1 − ln(2) ≈ 30.7%. The strategy’s power comes from coupling everyone’s outcomes through the shared cycle decomposition: instead of each prisoner having an independent 50% shot, the group either clears the 50-step constraint for every cycle or it doesn’t.
Even potential adversarial interference has a twist. A guard who swaps two boxes can split a single too-long cycle into shorter ones, improving odds. A guard who anticipates the strategy can force long cycles, but the prisoners can counter by renumbering boxes (equivalently randomizing the permutation), restoring the same ~31% baseline. The bottom line is that what initially feels impossible—everyone finding their number with only half the boxes—actually holds steady at better than a 30% chance, even as the prisoner count grows without bound.
Cornell Notes
The classic 100-prisoner box riddle has an essentially zero success chance if each prisoner searches randomly. The breakthrough is a shared strategy: start at the box with your number, then repeatedly open the box whose label matches the number you just found, until you either find your own slip or hit the 50-box limit. The arrangement of slips into boxes forms disjoint cycles (loops) in a permutation. A prisoner succeeds exactly when their cycle length is 50 or less; otherwise they fail after 50 steps. Group success happens precisely when there is no cycle longer than 50, which occurs with probability about 31% (failure about 69%). As the number of prisoners grows, the success probability approaches 1 − ln(2) ≈ 30.7%.
Why does the “follow the numbers” strategy outperform random searching so dramatically?
What determines whether a prisoner finds their own number—random chance at each step or something more structural?
How is the group success probability computed for 100 prisoners?
Why are the prisoners’ outcomes not independent even though each can open only 50 boxes?
What happens as the number of prisoners grows very large?
How can a guard affect the outcome, and why can prisoners still recover?
Review Questions
- In the loop strategy, what exact condition on the cycle length guarantees a prisoner finds their slip within 50 openings?
- Why does the probability of all prisoners succeeding reduce to “no cycle longer than 50,” and how does the sum 1/51 + … + 1/100 relate to failure?
- For very large numbers of prisoners, what constant does the success probability approach, and how is it connected to ln(2)?
Key Points
- 1
Random guessing yields a success probability of (1/2)^100, effectively zero, because each prisoner’s 50-box search is independent in that naive approach.
- 2
The optimal coordinated strategy is to follow the chain: open your-number box, then jump to the box labeled with the number you find, repeating until you either find your slip or hit 50 steps.
- 3
The arrangement of slips into boxes forms disjoint cycles (loops) in a permutation, and starting from your-number box traps you on the cycle containing your slip.
- 4
A prisoner succeeds if and only if the cycle containing their slip has length at most 50; otherwise they fail after exhausting 50 openings.
- 5
All prisoners on the same long cycle succeed together or fail together, creating strong dependence between outcomes.
- 6
For 100 prisoners, the group succeeds with probability about 31% because failure equals the chance of at least one cycle longer than 50: 1/51 + 1/52 + … + 1/100 ≈ 0.69.
- 7
As the prisoner count grows, the success probability approaches 1 − ln(2) ≈ 30.7%, staying above 30% even for arbitrarily large groups.