Maths WorkshopMaths problems with full solutions
Exercise 994Combinatorics › Inclusion-exclusionL1Added 3 Nov 2026

Derangements

#derangements#permutations#no fixed point

Statement

Count the number DnD_n of derangements of {1,…,n}\{1,\ldots,n\} (permutations with no fixed point).

Hint

Inclusion-exclusion on "permutation fixes ii".

Show solutionHide solution

Solution

Sets. Let Ai={σ:σ(i)=i}A_i=\{\sigma:\sigma(i)=i\}. Count A1∪⋯∪An‾\overline{A_1\cup\cdots\cup A_n}.

Intersection size. ∣Ai1∩⋯∩Aik∣=(n−k)!|A_{i_1}\cap\cdots\cap A_{i_k}|=(n-k)!.

IE.
Dn=∑k=0n(−1)k(nk)(n−k)!=n!∑k=0n(−1)kk!.D_n=\sum_{k=0}^n(-1)^k\binom{n}{k}(n-k)!=n!\sum_{k=0}^n\frac{(-1)^k}{k!}.

Conclusion. Dn=n!∑k=0n(−1)kk!D_n=n!\sum_{k=0}^n\frac{(-1)^k}{k!}.

Values. D3=2D_3=2, D4=9D_4=9, D5=44D_5=44.