In how many ways can 5 people exchange letters (each mails to one of the others) so that nobody receives their own lett…
In how many ways can 5 people exchange letters (each mails to one of the others) so that nobody receives their own letter back?
In how many ways can 5 people exchange letters (each mails to one of the others) so that nobody receives their own letter back?
44.
This is the number of derangements of 5 elements — permutations with no fixed point (no one maps to themselves). It is written !5 (the subfactorial of 5).
Why. A derangement is exactly an assignment in which no element stays in its original position, which matches "no one gets their own letter." The count is given by:
!n = n! · Σ_{k=0}^{n} (−1)^k / k!
For n = 5:
!5 = 120 · (1 − 1 + 1/2 − 1/6 + 1/24 − 1/120) = 120 · (44/120) = 44
Cross-checks.
For comparison, total permutations are 5! = 120, so derangements are the 44 of those with zero fixed points; the fraction 44/120 ≈ 0.367 ≈ 1/e, the well-known limiting probability that a random permutation is a derangement.
Quick verification in Python:
from itertools import permutations
print(sum(all(p[i] != i for i in range(5)) for p in permutations(range(5)))) # 44
Sources: