Key idea of this section
For uniform σ ∈ Sₙ, the number of cycles Kₙ is a sum of independent Bernoulli(1/i), i = 1, …, n. E[Kₙ] = Hₙ = ln n + γ + o(1), Var(Kₙ) = Hₙ − Hₙ⁽²⁾ ∼ ln n. The number of j-cycles has mean exactly 1/j and converges to Poisson(1/j).
The cycle count as a sum of independent indicators
Let σ be uniformly distributed on Sₙ, and let Kₙ = κ(σ). By Theorem 5.3 the probability generating function of Kₙ is
E[xKₙ] = x(x + 1)⋯(x + n − 1)/n! = ∏ᵢ₌₁ⁿ ( (1 − 1/i) + x/i ).
The i-th factor is the generating function of a Bernoulli random variable Bᵢ with P(Bᵢ = 1) = 1/i. Since the generating function of a sum of independent variables is the product of their generating functions, Kₙ has the same distribution as B₁ + B₂ + ⋯ + Bₙ with the Bᵢ independent.
The Feller coupling makes this concrete. Build σ by determining its values along its cycles: start with x = 1, and at each step choose σ(x) uniformly among the values not yet used as images, then move to x = σ(x); whenever the chosen value is the first element of the current cycle, the cycle closes, and the next step starts from the least symbol not yet placed. At step i (i = 1, …, n), i − 1 values have been used, so there are n − i + 1 equally likely choices, exactly one of which closes the current cycle. Different sequences of choices give different permutations, and there are n(n − 1)⋯1 = n! sequences, so σ is uniform. The cycle count is the number of closures, a sum of independent Bernoulli variables with parameters 1/n, 1/(n − 1), …, 1/1. Consequently
E[Kₙ] = ∑ᵢ₌₁ⁿ 1/i = Hₙ, Var(Kₙ) = ∑ᵢ₌₁ⁿ (1/i)(1 − 1/i) = Hₙ − Hₙ⁽²⁾,
with Hₙ⁽²⁾ = ∑ 1/i² → π²/6. Since Hₙ = ln n + γ + 1/(2n) + O(1/n²), where γ ≈ 0.5772 is the Euler–Mascheroni constant, a random permutation has about ln n cycles. A well-shuffled deck of 52 cards, regarded as a permutation, has on average H₅₂ ≈ 4.54 cycles. Because Kₙ is a sum of independent bounded variables whose variance tends to infinity, the Lindeberg central limit theorem gives Goncharov's theorem (1940s): (Kₙ − ln n)/√(ln n) converges in distribution to the standard normal law.
Counts of cycles of each length
Let Cj(σ) be the number of j-cycles of σ. There are C(n, j)(j − 1)! possible j-cycles, and each appears in (n − j)! permutations, so
E[Cj] = C(n, j)(j − 1)!(n − j)!/n! = 1/j for 1 ≤ j ≤ n.
Summing over j recovers E[Kₙ] = Hₙ; the case j = 1 recovers E[F] = 1 from Lesson 6. By Theorem 4.3 and the formula ∑ 1/zλ = 1, the joint distribution of (C₁, …, Cₙ) is
P(C₁ = m₁, …, Cₙ = mₙ) = ∏ⱼ (1/j)mⱼ / mⱼ! whenever ∑ j·mⱼ = n.
Up to the conditioning on ∑ j·mⱼ = n, this is the joint law of independent Poisson variables with means 1/j. Goncharov and, in sharper form, Arratia and Tavaré (1992) proved that for each fixed b the vector (C₁, …, Cb) converges in distribution to independent Poisson variables Z₁, …, Zb with E[Zⱼ] = 1/j, and the total variation distance tends to zero super-exponentially fast in n/b.
The cycle containing a given point
Proposition 13.1. The length of the cycle containing 1 is uniformly distributed on {1, …, n}.
Proof. The number of permutations in which 1 lies in a cycle of length ℓ is C(n − 1, ℓ − 1)(ℓ − 1)!(n − ℓ)!: choose the other ℓ − 1 members of the cycle, arrange them in a cycle with 1, and permute the rest. This equals (n − 1)! for every ℓ, so each length has probability (n − 1)!/n! = 1/n. ∎
In particular the probability that σ is an n-cycle is 1/n. A cycle of length j > n/2 can occur at most once, so the events "σ has a j-cycle" for j > n/2 are disjoint, each with probability E[Cj] = 1/j. Hence
P(σ has a cycle longer than n/2) = ∑n/2 < j ≤ n 1/j → ln 2.
The hundred prisoners
This computation solves a celebrated puzzle of Gál and Miltersen (2003). One hundred prisoners, numbered 1 to 100, are each allowed to open 50 of 100 boxes, which contain their numbers in a uniformly random arrangement; all are freed if every prisoner finds his own number, and they may agree on a strategy beforehand but not communicate afterwards. If each prisoner opens boxes independently at random, the probability of success is 2⁻¹⁰⁰. If instead prisoner i opens box i, then the box whose label is the number found there, and so on, he follows the cycle of the permutation containing i and succeeds exactly when that cycle has length at most 50. All succeed if and only if σ has no cycle longer than 50, which happens with probability
1 − ∑ⱼ₌₅₁¹⁰⁰ 1/j = 1 − (H₁₀₀ − H₅₀) ≈ 0.3118,
and as n → ∞ the corresponding probability decreases to 1 − ln 2 ≈ 0.3069. The strategy is optimal (Curtin and Warshauer, 2006).
The longest cycle and the order
Let Lₙ be the length of the longest cycle. Shepp and Lloyd (1966) proved that E[Lₙ]/n → λ ≈ 0.62433, the Golomb–Dickman constant, which also governs the largest prime factor of a random integer; the distribution of Lₙ/n converges to a limit described by the Dickman function. More generally the sorted cycle lengths divided by n converge to the Poisson–Dirichlet distribution PD(1). The order of a random permutation is much larger than its number of cycles but much smaller than Landau's g(n): Erdős and Turán (1967) proved that ln ord(σ) is asymptotically normal with mean (ln n)²/2 and variance (ln n)³/3.
The Ewens distribution
The uniform measure is the member θ = 1 of the Ewens family Pθ(σ) = θκ(σ)/θ⁽ⁿ⁾, θ > 0, which arises in population genetics as the distribution of allelic partitions under neutral mutation, and in the Chinese restaurant process, where customer i joins an existing table at the right of a seated customer with probability 1/(θ + i − 1) each, or starts a new table with probability θ/(θ + i − 1). Under Pθ the number of cycles is a sum of independent Bernoulli(θ/(θ + i − 1)) variables, with mean ≈ θ ln n, and the cycle counts converge to independent Poisson(θ/j) variables.
Exercise
- (a)Compute E[K₁₀] exactly and to four decimal places.
- (b)Compute the exact variance of K₄, both from the formula Hₙ − Hₙ⁽²⁾ and from the row 6, 11, 6, 1 of Stirling numbers.
- (c)Ten prisoners each open 5 of 10 boxes using the cycle strategy. What is the exact probability that all succeed?
Show solution
Answers: (a) H₁₀ = 7381/2520 ≈ 2.9290. (b) H₄ = 25/12 and H₄⁽²⁾ = 205/144, so Var = 300/144 − 205/144 = 95/144. Directly, E[K₄] = (6 + 22 + 18 + 4)/24 = 25/12 and E[K₄²] = (6 + 44 + 54 + 16)/24 = 5, so Var = 5 − 625/144 = 95/144. (c) 1 − (1/6 + 1/7 + 1/8 + 1/9 + 1/10) = 1 − 1627/2520 = 893/2520 ≈ 0.3544.