Key idea of this section
∑σ∈Sₙ qinv(σ) = [n]q! = [1]q [2]q ⋯ [n]q, where [m]q = 1 + q + ⋯ + qm−1. [n k]q = [n]q!/([k]q! [n−k]q!) = ∑ qinv(w) over 0–1 words w with k ones. [n k]q = number of k-dimensional subspaces of 𝔽qⁿ.
The Lehmer code
Definition 9.1. The Lehmer code of σ ∈ Sₙ is the sequence L(σ) = (L₁, …, Lₙ), where Lᵢ = #{j > i : σ(j) < σ(i)} is the number of entries to the right of position i that are smaller than σ(i).
Clearly 0 ≤ Lᵢ ≤ n − i, and ∑ Lᵢ = inv(σ), since each inversion (i, j) with i < j is counted exactly once, at its left end.
Theorem 9.2. The map σ ↦ L(σ) is a bijection from Sₙ to the set of sequences (L₁, …, Lₙ) of integers with 0 ≤ Lᵢ ≤ n − i.
Proof. Both sets have n! elements, so it suffices to recover σ from L. Given L, σ(1) must be the element of [n] having exactly L₁ smaller elements among the remaining ones, that is, the (L₁ + 1)-st smallest element of [n]. Remove it; then σ(2) is the (L₂ + 1)-st smallest of the remaining n − 1 elements, and so on. Each step is forced and always possible because Lᵢ ≤ n − i. ∎
The Mahonian distribution
Theorem 9.3 (Rodrigues 1839; MacMahon). ∑σ∈Sₙ qinv(σ) = ∏ᵢ₌₁ⁿ (1 + q + ⋯ + qi−1) = [n]q!.
Proof. Under the bijection of Theorem 9.2, inv(σ) = L₁ + ⋯ + Lₙ with the Lᵢ ranging independently over {0, …, n − i}. Hence ∑ qinv(σ) = ∏ᵢ (1 + q + ⋯ + qn−i), which is [n]q! after reindexing. ∎
For n = 4 the coefficients are 1, 3, 5, 6, 5, 3, 1, and for n = 5 they are 1, 4, 9, 15, 20, 22, 20, 15, 9, 4, 1. The distribution is symmetric (σ ↦ σ composed with the reversal maps inv to n(n−1)/2 − inv) and unimodal. Because a uniformly random σ has independent uniformly distributed Lehmer digits, the number of inversions has mean ∑ (n − i)/2 = n(n − 1)/4 and variance ∑ⱼ₌₁ⁿ (j² − 1)/12 = n(n − 1)(2n + 5)/72, and it satisfies a central limit theorem.
MacMahon (1913) discovered that the major index maj(σ) = ∑ i over the descents i (positions with σ(i) > σ(i + 1)) has the same distribution as inv. A statistic with generating function [n]q! is now called Mahonian; Foata (1968) gave an explicit bijection φ : Sₙ → Sₙ with inv(φ(σ)) = maj(σ).
Gaussian binomial coefficients
Definition 9.4. The Gaussian (q-)binomial coefficient is [n k]q = [n]q!/([k]q! [n − k]q!) for 0 ≤ k ≤ n.
Theorem 9.5. (i) [n k]q = ∑w qinv(w), where w ranges over words of length n with k letters 1 and n − k letters 0, and inv(w) counts pairs of positions i < j with wᵢ = 1, wⱼ = 0. In particular [n k]q is a polynomial in q with nonnegative integer coefficients, and it reduces to C(n, k) at q = 1. (ii) The q-Pascal recurrence holds: [n k]q = [n−1 k−1]q + qᵏ [n−1 k]q. (iii) If q is a prime power, [n k]q is the number of k-dimensional subspaces of the vector space 𝔽qⁿ.
Proof. (ii) for the word sum: if the last letter of w is 1, it creates no inversions, leaving a word of length n − 1 with k − 1 ones; if it is 0, each of the k ones precedes it, contributing qᵏ times the sum over words of length n − 1 with k ones. The quotient [n]!/([k]![n−k]!) satisfies the same recurrence, as one checks from [n]q = [k]q + qᵏ[n − k]q, and the same boundary values, proving (i). For (iii), count ordered k-tuples of linearly independent vectors in 𝔽qⁿ: the i-th vector must avoid the span of the previous ones, giving (qⁿ − 1)(qⁿ − q)⋯(qⁿ − qk−1) tuples. Each k-dimensional subspace has (qᵏ − 1)(qᵏ − q)⋯(qᵏ − qk−1) ordered bases. The quotient is ∏ᵢ₌₀k−1 (qn−i − 1)/(qk−i − 1), and dividing every factor by q − 1 shows it equals [n k]q. ∎
Part (iii) is the precise sense in which counting subspaces is the q-analogue of counting subsets, and in which the general linear group GLₙ(𝔽q), of order ∏ᵢ₌₀n−1 (qⁿ − qⁱ), is a q-analogue of Sₙ. The argument in its proof — count ordered bases, then divide by the number of orderings of a basis — is exactly the argument C(n, k) = (n)ₖ/k! of Lesson 7 with "ordered list" replaced by "ordered basis". For example,
[4 2]q = (1 + q²)(1 + q + q²) = 1 + q + 2q² + q³ + q⁴,
which at q = 1 gives C(4, 2) = 6 and at q = 2 gives 35, the number of 2-dimensional subspaces of 𝔽₂⁴; directly, (2⁴ − 1)(2⁴ − 2)/((2² − 1)(2² − 2)) = 15 · 14/6 = 35. The q-binomial theorem ∏ᵢ₌₀n−1 (1 + qⁱx) = ∑ₖ qk(k−1)/2 [n k]q xᵏ is the q-analogue of the binomial theorem.
Exercise
- (a)Find the Lehmer code and the number of inversions of σ = 3 1 4 2.
- (b)How many permutations of [5] have exactly 4 inversions?
- (c)Compute the number of 2-dimensional subspaces of 𝔽₃⁴.
Show solution
Answers: (a) L = (2, 0, 1, 0), so inv(σ) = 3, as found in Lesson 3. (b) The coefficient of q⁴ in [5]q!, which is 20. (c) (3⁴ − 1)(3⁴ − 3)/((3² − 1)(3² − 3)) = 80 · 78/(8 · 6) = 6240/48 = 130.