Derangements
n guests check their hats at a restaurant. The hats are returned in a uniformly random order. What is the probability that no guest receives their own hat?
A permutation where no element appears in its original position is called a derangement. The count of derangements of n items is:
The remarkable limit
The probability that a random permutation is a derangement converges rapidly:
Already at n=3 this is within 2% of 1/e. The formula is a truncated alternating series — the pattern converges so fast that the n=6 value is indistinguishable from 1/e to 6 decimal places.
Distribution of fixed points
More generally, let X be the number of items that land in their original position. The full PMF is:
This looks like a Poisson(1) distribution — and indeed as n → ∞, X converges in distribution to Poisson(1). The probability of exactly k fixed points approaches 1/(e · k!), which is exactly the Poisson(1) PMF.
Inclusion-exclusion
The derivation uses inclusion-exclusion. Let Aᵢ be the event that item i is fixed. We want P(none fixed) = 1 − P(A₁ ∪ … ∪ Aₙ). By inclusion-exclusion:
P(at least one fixed) = Σ P(Aᵢ) − Σᵢ<ⱼ P(Aᵢ ∩ Aⱼ) + …
Each P(Aᵢ₁ ∩ … ∩ Aᵢₖ) = (n−k)!/n! regardless of which k items are chosen. There are C(n,k) such terms, giving the alternating series above after cancellation.