Five hats, five owners: 44 ways for nobody to get their own back

The number of permutations with no fixed point, computed as an alternating sum and checked against 5/e.

Statistics and data · Level: Classic result · Updated on 2026-11-10

Five people hand their hats to a cloakroom that returns them at random. Out of 5! = 120 possible returns, the number in which nobody receives their own hat is 44. The workbench gets there from the alternating sum 120·(1/2 − 1/6 + 1/24 − 1/120), which is 60 − 20 + 5 − 1: the inclusion–exclusion recipe, counted over pairs, triples and quadruples of people who do get their own hat back.

The probability that nobody matches is 44/120 = 0.3666…, and it converges to 1/e = 0.367879… as the number of hats grows, which is why the third link — 120 divided by the thirteen-digit e — prints 44.145532940574. That is not the answer, it is the answer's approximation: !n is the nearest integer to n!/e for every n ≥ 1, and 44 is what rounding 44.1455 gives. The same 1/e turns up in the shuffle problem fifty-two hats away, where the expected number of fixed points is 1 whatever the deck size.

Answer

44

How to read it

The inclusion–exclusion sum on the workbench. The second link is 5!, the total number of returns, and the third is 120/e, whose nearest integer is the answer.

Source

!n, the number of derangements, from the inclusion–exclusion sum n!(1/0! − 1/1! + 1/2! − … + (−1)ⁿ/n!); the matching problem is discussed by Abraham de Moivre in 1708 and by Montmort in the same years, and the limit !n/n! → 1/e is the standard result

Work it in the calculator

These links open the right calculator with this problem's numbers already typed in. The line above is what the screen should show — check it yourself.

This is an independent third-party tool site. It is not affiliated with, sponsored by, or authorised by Casio, Texas Instruments or their distributors. Model names and product names are trademarks of their respective owners and appear here only to identify devices.

The keystroke sequences in these manuals were written from this site's own layout data — the same data the online calculator renders — plus publicly available product facts. Specifications and regional configurations are confirmed against the physical device and the manufacturer's most recent material.