Math 2.0

Combinatorics Proof

Proof of the formula for the number of derangements by inclusion–exclusion

Builds on DerangementPermutationInclusion–exclusion principleNumber of permutationsNumber of k-element subsetsFactorial formula for binomial coefficientsComplement principleFactorialBijection principle

Proof

We apply the inclusion–exclusion principle to the permutations that fix a given point.

  1. Let XX be a set with nn elements. Choose a bijection β:X→[n]\beta : X \to [n], where [n]={1,…,n}[n] = \set{1, \dots, n}.
  2. The map σ↦βσβ−1\sigma \mapsto \beta \sigma \beta^{-1} is a bijection from the permutations of XX to those of [n][n]. Its inverse is τ↦β−1τβ\tau \mapsto \beta^{-1} \tau \beta.
  3. We have βσβ−1(β(x))=β(x)\beta \sigma \beta^{-1}(\beta(x)) = \beta(x) exactly when σ(x)=x\sigma(x) = x. So this bijection sends derangements to derangements, in both directions.
  4. By the bijection principle, it suffices to count the derangements of [n][n].
  5. If n=0n = 0, the only permutation of [0]=∅[0] = \varnothing is the empty map. It has no fixed point, so D0=1D_0 = 1. The formula gives 0!⋅10!=10! \cdot \frac{1}{0!} = 1. From now on let n≥1n \ge 1.
  6. Let Σ\Sigma be the set of permutations of [n][n]. By the number of permutations, ∣Σ∣=n!|\Sigma| = n!.
  7. For i∈[n]i \in [n], let Ai={σ∈Σ:σ(i)=i}A_i = \set{\sigma \in \Sigma : \sigma(i) = i}. A permutation is a derangement exactly when it lies in no AiA_i.
  8. So the derangements form the complement of ⋃i=1nAi\bigcup_{i=1}^{n} A_i in Σ\Sigma. By the complement principle, Dn=n!−∣⋃i=1nAi∣D_n = n! - \left| \bigcup_{i=1}^{n} A_i \right|.
  9. Let I⊆[n]I \subseteq [n] have kk elements, and let AI=⋂i∈IAiA_I = \bigcap_{i \in I} A_i, the permutations that fix every point of II. We claim ∣AI∣=(n−k)!|A_I| = (n - k)!.
  10. Let σ∈AI\sigma \in A_I and x∉Ix \notin I. If σ(x)=i∈I\sigma(x) = i \in I, then σ(x)=σ(i)\sigma(x) = \sigma(i) with x≠ix \ne i, against injectivity. So σ\sigma maps [n]∖I[n] \setminus I into itself.
  11. This restriction is injective. It is also surjective: if y∉Iy \notin I and y=σ(x)y = \sigma(x), then x∉Ix \notin I, since otherwise y=σ(x)=x∈Iy = \sigma(x) = x \in I.
  12. So restriction is a map from AIA_I to the permutations of [n]∖I[n] \setminus I. Its inverse extends a permutation of [n]∖I[n] \setminus I by the identity on II.
  13. Hence AIA_I is in bijection with the permutations of an (n−k)(n - k)-element set. By the number of permutations, ∣AI∣=(n−k)!|A_I| = (n - k)!.
  14. By the number of kk-element subsets, there are (nk)\binom{n}{k} sets II with kk elements. By the factorial formula, (nk)(n−k)!=n!k!\binom{n}{k} (n - k)! = \frac{n!}{k!}.
  15. The inclusion–exclusion principle, with terms grouped by k=∣I∣k = |I|, gives ∣⋃i=1nAi∣=∑k=1n(−1)k+1(nk)(n−k)!=∑k=1n(−1)k+1n!k!.\left| \bigcup_{i=1}^{n} A_i \right| = \sum_{k=1}^{n} (-1)^{k+1} \binom{n}{k} (n - k)! = \sum_{k=1}^{n} (-1)^{k+1} \frac{n!}{k!}.
  16. By step 8, and since n!=(−1)0n!0!n! = (-1)^0 \frac{n!}{0!} by the definition of the factorial, Dn=n!−∑k=1n(−1)k+1n!k!=∑k=0n(−1)kn!k!=n!∑k=0n(−1)kk!.D_n = n! - \sum_{k=1}^{n} (-1)^{k+1} \frac{n!}{k!} = \sum_{k=0}^{n} (-1)^k \frac{n!}{k!} = n! \sum_{k=0}^{n} \frac{(-1)^k}{k!}.

Idea

A derangement is a permutation that avoids every set AiA_i of permutations fixing ii. The permutations that fix kk given points are just the permutations of the other n−kn - k points, so inclusion–exclusion has easy terms. They simplify to (−1)kn!/k!(-1)^k n!/k!.

Reading path

To understand this page from the ground up, read these 67 pages in order. The foundations come first. The path takes the proofs Proof of the number of k-element subsets by induction, Proof that a composition of injections is injective, Proof that a function is bijective iff it has a two-sided inverse, Proof of the complement principle, Proof of the number of injections, Proof of Pascal's rule from the recursive definition, Proof that a composition of surjections is surjective, Proof of the alternating sum of binomial coefficients from the binomial theorem, Proof of the inclusion–exclusion principle by counting each element, Proof of the factorial formula for binomial coefficients by induction, Proof of the binomial theorem by induction, Proof of the rule of sum, Proof of the number of permutations by counting injections, Proof of the bijection principle.

  1. Binomial coefficient definition
  2. Cardinality of a finite set definition
  3. Combination definition
  4. Double counting concept
  5. Element definition
  6. Factorial definition
  7. Falling factorial definition
  8. Group concept
  9. Permutation definition
  10. Proposition concept
  11. Proof of Pascal's rule from the recursive definition proof
  12. Set definition
  13. Ring definition
  14. Derangement definition
  15. Conjunction definition
  16. Implication definition
  17. Predicate definition
  18. Pascal's rule statement
  19. Empty set object
  20. Ordered pair definition
  21. Commutative ring definition
  22. Intersection definition
  23. Existential quantifier definition
  24. Universal quantifier definition
  25. Proof of the factorial formula for binomial coefficients by induction proof
  26. Cartesian product definition
  27. Disjoint sets definition
  28. Subset definition
  29. Uniqueness quantifier definition
  30. Factorial formula for binomial coefficients statement
  31. Binary relation definition
  32. Proof of the binomial theorem by induction proof
  33. Function definition
  34. Binomial theorem statement
  35. Codomain definition
  36. Function composition definition
  37. Identity function definition
  38. Injective function definition
  39. Restriction of a function definition
  40. Proof of the alternating sum of binomial coefficients from the binomial theorem proof
  41. Surjective function definition
  42. Left inverse definition
  43. Right inverse definition
  44. Proof that a composition of injections is injective proof
  45. Alternating sum of binomial coefficients statement
  46. Proof that a composition of surjections is surjective proof
  47. Bijective function definition
  48. Composition of injections is injective statement
  49. Composition of surjections is surjective statement
  50. Proof of the rule of sum proof
  51. Proof that a function is bijective iff it has a two-sided inverse proof
  52. Rule of sum statement
  53. Bijective iff it has a two-sided inverse statement
  54. Inclusion–exclusion for two sets statement
  55. Proof of the complement principle proof
  56. Proof of the bijection principle proof
  57. Complement principle statement
  58. Bijection principle statement
  59. Proof of the number of k-element subsets by induction proof
  60. Proof of the number of injections proof
  61. Number of k-element subsets statement
  62. Number of injections statement
  63. Proof of the inclusion–exclusion principle by counting each element proof
  64. Proof of the number of permutations by counting injections proof
  65. Inclusion–exclusion principle statement
  66. Number of permutations statement
  67. Proof of the formula for the number of derangements by inclusion–exclusion proof

Where this leads

2 pages build on this one.

Further reading

  1. Web https://en.wikipedia.org/wiki/Derangement, Derivation by inclusion–exclusion principle
About this page
Tag67S4PPN54V
URIm2://67S4PPN54V
Kindproof
WritingW0 stub
MSC05A05
ProvesFormula for the number of derangements
UsesDerangement, Permutation, Inclusion–exclusion principle, Number of permutations, Number of k-element subsets, Factorial formula for binomial coefficients, Complement principle, Factorial, Bijection principle
Changed4 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.