Derangements: Nobody Gets Their Own Item
The classic combinatorics puzzle of counting permutations where no item lands in its original position, and why the probability of a total mismatch converges to about 1/e as the number of items grows.
A classic setup: n people write their names on gifts, the gifts get shuffled randomly, and everyone receives one gift. What's the probability that nobody receives their own gift? A permutation with this property, nothing ends up in its original spot, is called a derangement.
Counting derangements directly is fiddly, but inclusion-exclusion gives a clean formula: the number of derangements of n items is n! times the alternating sum . For n = 4, that's derangements out of 24 total permutations, so the probability nobody gets their own gift is 9/24 = 0.375.
What makes the puzzle memorable is that as n grows, that alternating sum converges extremely fast to , so the probability of a total mismatch settles near 37% regardless of whether there are 10 people or 10,000, a rare case where a combinatorics answer stops depending on the size of the problem almost as soon as n passes single digits.
The probability that a random permutation of n items leaves nothing in its original position converges rapidly to as n grows, and is already close to that value for n as small as 6 or 7.
Discussion
💡 Discussion rules
- Ask and answer about this concept. Off-topic gets removed.
- No homework dumps. Show what you tried first.
- Corrections are welcome. Cite a source when you claim an error.
Loading discussion…
Related concepts
Practice in interviews
Further reading
- Classic interview brainteaser, various sources