Maths WorkshopMaths problems with full solutions
Exercise 1235Combinatorics › Inclusion-exclusionOlympiadAdded 4 Nov 2026

Derangements and the number 1/e

#inclusion-exclusion#permutations#derangements

Statement

A derangement of {1,…,n}\{1,\dots,n\} is a permutation with no fixed point. Let DnD_n be their number.

  1. Prove that Dn=n!∑k=0n(−1)kk!D_n=n!\displaystyle\sum_{k=0}^n\frac{(-1)^k}{k!}.
  2. Compute D4D_4, and show that for n≥2n\ge2, DnD_n is the integer closest to n!e\dfrac{n!}e.
Hint

Let AiA_i be the set of permutations fixing ii. Apply inclusion–exclusion to A1∪⋯∪AnA_1\cup\dots\cup A_n.

Show solutionHide solution

Solution

1. Inclusion–exclusion. Dn=n!−∣A1∪⋯∪An∣D_n=n!-\left|A_1\cup\dots\cup A_n\right|. For a set II of kk indices, the permutations fixing every element of II number (n−k)!(n-k)!. There are (nk)\binom nk such sets. Therefore
Dn=∑k=0n(−1)k(nk)(n−k)!=∑k=0n(−1)kn!k!=n!∑k=0n(−1)kk!.D_n=\sum_{k=0}^n(-1)^k\binom nk(n-k)!=\sum_{k=0}^n(-1)^k\frac{n!}{k!}=n!\sum_{k=0}^n\frac{(-1)^k}{k!}.

2. Values. D4=24−24+12−4+1=9D_4=24-24+12-4+1=9.

Closest integer. Since e−1=∑k≥0(−1)kk!e^{-1}=\sum_{k\ge0}\frac{(-1)^k}{k!},
n!e−Dn=n!∑k>n(−1)kk!.\frac{n!}e-D_n=n!\sum_{k>n}\frac{(-1)^k}{k!}.
The series is alternating with decreasing terms, so its absolute value is at most the first term: ∣n!e−Dn∣≤n!(n+1)!=1n+1≤13<12\left|\frac{n!}e-D_n\right|\le\frac{n!}{(n+1)!}=\frac1{n+1}\le\frac13<\frac12 for n≥2n\ge2. So DnD_n is the integer closest to n!e\frac{n!}e.

Consequence. The probability that a random permutation has no fixed point tends to 1e\frac1e.

Lesson. Inclusion–exclusion: when the intersections of the bad events all have the same size depending only on the number of events, the sum collapses to a clean formula.