Probability No One Gets Their Own Hat

Probability · Medium · Free problem
$n$ men attend a formal party where they check their distinct hats into a closet at the entrance. At the end of the night the lights go out, and each man grabs a hat uniformly at random (without replacement, so the result is a random permutation of all $n$ hats). Let $p(n)$ be the probability that *none* of the $n$ men ends up with his own hat. 1. Derive a closed-form expression for $p(n)$. 2. Evaluate $p(5)$.

Open the full interactive solver, hints, and worked solution →