Home › Permutations vs Combinations › Lesson 6

Fixed Points, Derangements and Restricted Cycle Structure

Lesson 6 of 13

Key idea of this section

Dₙ = #{σ ∈ Sₙ without fixed points} = n! ∑ₖ₌₀ⁿ (−1)ᵏ/k!, the nearest integer to n!/e.
Dₙ = (n − 1)(Dₙ₋₁ + Dₙ₋₂),   Dₙ = n·Dₙ₋₁ + (−1)ⁿ,   ∑ Dₙ xⁿ/n! = e−x/(1 − x).
The number of fixed points of a random permutation converges to Poisson(1).

Inclusion–exclusion

A derangement is a permutation with no fixed points. The problem of counting them — the problème des rencontres — was posed and solved by Pierre Rémond de Montmort in 1708, and further studied by Nicolaus Bernoulli and Euler.

Theorem 6.1. The number of derangements of [n] is Dₙ = ∑ₖ₌₀ⁿ (−1)ᵏ C(n, k)(n − k)! = n! ∑ₖ₌₀ⁿ (−1)ᵏ/k!.

Proof. For i ∈ [n] let Aᵢ be the set of permutations fixing i. A permutation fixing every point of a k-element set K is a permutation of [n] ∖ K, so |∩_(i∈K) Aᵢ| = (n − k)!. Inclusion–exclusion gives the number of permutations in none of the Aᵢ as ∑K (−1)|K| (n − |K|)! = ∑ₖ (−1)ᵏ C(n, k)(n − k)!, and C(n, k)(n − k)! = n!/k!. ∎

Corollary 6.2. For n ≥ 1, Dₙ is the integer nearest to n!/e.

Proof. n!/e − Dₙ = n! ∑ₖ₌ₙ₊₁∞ (−1)ᵏ/k!. This alternating series has terms strictly decreasing in absolute value, so its absolute value is less than its first term n!/(n+1)! = 1/(n + 1) ≤ 1/2. ∎

The first values are D₀ = 1, D₁ = 0, D₂ = 1, D₃ = 2, D₄ = 9, D₅ = 44, D₆ = 265, D₇ = 1854, D₈ = 14,833, D₉ = 133,496, D₁₀ = 1,334,961.

Recurrences with bijective content

Theorem 6.3. For n ≥ 2, Dₙ = (n − 1)(Dₙ₋₁ + Dₙ₋₂), and for n ≥ 1, Dₙ = n·Dₙ₋₁ + (−1)ⁿ.

Proof. Let σ be a derangement of [n] and let j = σ(n) ≠ n (n − 1 choices). If σ(j) = n, then (n j) is a 2-cycle of σ and the rest is a derangement of the remaining n − 2 points: Dₙ₋₂ possibilities. If σ(j) ≠ n, let i = σ⁻¹(n), so that i ≠ j, and define σ' on [n − 1] by σ'(i) = j and σ'(x) = σ(x) for x ≠ i; that is, remove n from its cycle. Then σ' is a derangement of [n − 1] with σ'(i) = j, and conversely every derangement of [n − 1] arises exactly once for each choice of j (insert n immediately before j in the cycle of j). This gives Dₙ₋₁ possibilities for each j. The second recurrence follows from the first by induction: Dₙ − nDₙ₋₁ = −(Dₙ₋₁ − (n − 1)Dₙ₋₂), and D₁ − 1·D₀ = −1. Alternatively it follows at once from the formula of Theorem 6.1. ∎

Generating functions and the rencontres numbers

Since every permutation is uniquely a set of fixed points together with a derangement of the remaining points, n! = ∑ₖ C(n, k) Dₙ₋ₖ. In exponential generating functions this reads 1/(1 − x) = eˣ · D(x), whence D(x) = ∑ Dₙ xⁿ/n! = e−x/(1 − x). The same decomposition shows that the number of permutations of [n] with exactly k fixed points (the rencontres number) is Dₙ,ₖ = C(n, k)Dₙ₋ₖ. For example, the number of permutations of [8] with exactly three fixed points is C(8, 3) · D₅ = 56 · 44 = 2464.

The distribution of fixed points

Let F(σ) be the number of fixed points of a uniformly random σ ∈ Sₙ. Writing F = ∑ᵢ 1[σ(i) = i] and using P(σ(i₁) = i₁, …, σ(ir) = ir) = (n − r)!/n! for distinct i₁, …, ir, the r-th factorial moment is

E[(F)r] = r! · C(n, r) · (n − r)!/n! = 1   for every r ≤ n.

These are the factorial moments of a Poisson(1) random variable. Consequently E[F] = 1, Var(F) = 1 for n ≥ 2, and by the method of moments P(F = k) → e⁻¹/k! as n → ∞. In particular the probability that a random permutation is a derangement tends to 1/e ≈ 0.3679, and the convergence is extraordinarily fast: the error at n is less than 1/(n + 1)!.

Restricted cycle structure

The exponential formula of Lesson 5 counts permutations with constrained cycles in one stroke. Permutations with no cycles of length at most m have exponential generating function exp(−x − x²/2 − ⋯ − xᵐ/m)/(1 − x); the case m = 1 is D(x). Involutions (σ² = 1) are permutations with all cycles of length 1 or 2, with generating function exp(x + x²/2). Their number Iₙ satisfies Iₙ = Iₙ₋₁ + (n − 1)Iₙ₋₂ (either n is fixed, or n is paired with one of the other n − 1 points), giving 1, 1, 2, 4, 10, 26, 76, 232, … for n = 0, 1, 2, …. More generally the permutations with σᵈ = 1 are those whose cycle lengths all divide d, with generating function exp(∑m | d xᵐ/m).

A classical relative of the derangement problem is the ménage problem of Lucas (1891): in how many ways can n couples be seated alternately by sex at a round table so that no one sits next to their partner? After the women are seated, the count reduces to the number Uₙ of permutations σ of [n] with σ(i) ∉ {i, i + 1 (mod n)} for all i, and Touchard's formula gives Uₙ = ∑ₖ₌₀ⁿ (−1)ᵏ (2n/(2n − k)) C(2n − k, k)(n − k)!. The first values are U₃ = 1, U₄ = 2, U₅ = 13, U₆ = 80. The proof is again inclusion–exclusion, the factor (2n/(2n − k))C(2n − k, k) counting the ways to choose k pairwise disjoint edges in a 2n-cycle.

Exercise

  • (a)
    Compute D₇ using Dₙ = nDₙ₋₁ + (−1)ⁿ.
  • (b)
    How many permutations of [8] have exactly three fixed points?
  • (c)
    Compute the number I₆ of involutions in S₆.
Show solution

Answers: (a) D₇ = 7 · 265 − 1 = 1854. (b) C(8, 3)D₅ = 56 · 44 = 2464. (c) From I₄ = 10 and I₅ = I₄ + 4I₃ = 10 + 16 = 26, we get I₆ = I₅ + 5I₄ = 26 + 50 = 76.

V.3.1