Key idea of this section
n = ∑ nᵢ pⁱ, k = ∑ kᵢ pⁱ (base p) ⟹ C(n, k) ≡ ∏ᵢ C(nᵢ, kᵢ) (mod p)
The Frobenius lemma
Lemma 7.1. Let p be prime. Then p divides C(p, k) for 0 < k < p, and consequently (1 + x)pʲ ≡ 1 + xpʲ in Fp[x] for all j ≥ 0. Proof. In C(p, k) = p!/(k!(p − k)!) the prime p divides the numerator once and does not divide the denominator. Thus (1 + x)ᵖ ≡ 1 + xᵖ, and the general case follows by induction: (1 + x)pj+1 = ((1 + x)pʲ)ᵖ ≡ (1 + xpʲ)ᵖ ≡ 1 + xpj+1. ∎
This is the statement that the Frobenius map u ↦ uᵖ is a ring homomorphism in characteristic p.
Lucas' theorem and its proof
Theorem 7.2 (Lucas, 1878). Let p be prime, and let n = n₀ + n₁p + ⋯ + nr pʳ and k = k₀ + k₁p + ⋯ + kr pʳ with digits 0 ≤ nᵢ, kᵢ ≤ p − 1. Then C(n, k) ≡ C(n₀, k₀) C(n₁, k₁) ⋯ C(nr, kr) (mod p), with the convention C(a, b) = 0 for b > a.
Proof. In Fp[x], by Lemma 7.1,
(1 + x)ⁿ = ∏ᵢ ((1 + x)pⁱ)nᵢ ≡ ∏ᵢ (1 + xpⁱ)nᵢ = ∏ᵢ ∑jᵢ=0nᵢ C(nᵢ, jᵢ) xjᵢ pⁱ
Expanding the product, each monomial has exponent ∑ jᵢ pⁱ with 0 ≤ jᵢ ≤ nᵢ ≤ p − 1. By uniqueness of base-p expansions, the exponent k arises from exactly one choice, jᵢ = kᵢ for all i, provided kᵢ ≤ nᵢ for all i, and from no choice otherwise. Comparing coefficients of xᵏ gives the theorem. ∎
C(2026, 626) mod 5: 2026 = 31101₅, 626 = 10001₅ ≡ C(3, 1) C(1, 0) C(1, 0) C(0, 0) C(1, 1) = 3 (mod 5)
C(1000, 300) mod 7: 1000 = 2626₇, 300 = 0606₇ ≡ C(2, 0) C(6, 6) C(2, 0) C(6, 6) = 1 (mod 7)
Consequences
Corollary 7.3. (i) p ∣ C(n, k) if and only if some base-p digit of k exceeds the corresponding digit of n. (ii) C(n, k) is odd if and only if every binary digit 1 of k is also a digit 1 of n, that is k AND n = k in bitwise notation. (iii) (Fine, 1947) The number of k ∈ {0, …, n} with p ∤ C(n, k) equals ∏ᵢ (nᵢ + 1). (iv) (Glaisher, 1899) Row n contains exactly 2s₂(n) odd entries. (v) All of C(n, 1), …, C(n, n − 1) are divisible by p if and only if n is a power of p. (vi) No entry of row n is divisible by p if and only if n = c pᵐ − 1 with m ≥ 0 and 1 ≤ c ≤ p, that is, all base-p digits of n other than the leading one equal p − 1.
Proof. (i) and (ii) are immediate from Theorem 7.2, since C(nᵢ, kᵢ) with nᵢ, kᵢ < p is divisible by p exactly when kᵢ > nᵢ. For (iii), k is admissible exactly when kᵢ ∈ {0, …, nᵢ} for each i, independently. (iv) is (iii) with p = 2. For (v), by (iii) the number of nonzero entries is ∏(nᵢ + 1), and this equals 2 (only the two ends) exactly when n has a single nonzero digit equal to 1. For (vi) we need ∏(nᵢ + 1) = n + 1. We claim ∏(nᵢ + 1) ≤ n + 1 always, with equality exactly when all digits below the leading one equal p − 1. Write n = n′ + d pʳ with leading digit d ≥ 1 and n′ < pʳ; by induction the product over the digits of n′ is at most n′ + 1, so ∏(nᵢ + 1) ≤ (d + 1)(n′ + 1) = d(n′ + 1) + n′ + 1 ≤ d pʳ + n′ + 1 = n + 1, with equality throughout if and only if n′ = pʳ − 1 (all lower digits p − 1, for which the inductive bound is an equality). Then n + 1 = (d + 1)pʳ with 2 ≤ d + 1 ≤ p, and together with n = 0 this is the stated family. ∎
For p = 2, (vi) says that every entry of row n is odd exactly when n = 2ᵐ − 1, which is the case visible in the triangle at rows 1, 3, 7, 15, 31.
Extensions
Lucas' theorem fails for prime powers: in base 4, 4 = 10₄ and 2 = 02₄, so the naive analogue would predict C(4, 2) ≡ C(1, 0) C(0, 2) = 0 (mod 4), whereas C(4, 2) = 6 ≡ 2 (mod 4). Davis and Webb (1990) and Granville (1997) found correct generalizations to prime powers, the latter in terms of factorials with the multiples of p removed. There is a multinomial version (Lesson 10) and a q-analogue (Lesson 11): if ζ is a primitive dth root of unity, the Gaussian coefficient [n k] evaluated at q = ζ equals C(⌊n/d⌋, ⌊k/d⌋) times the Gaussian coefficient of the remainders n mod d and k mod d evaluated at ζ.
Exercise
- (a)How many odd entries are there in row 2026?
- (b)How many entries of row 2026 are not divisible by 5?
- (c)Compute C(50, 20) mod 7 and C(100, 19) mod 3.
Show solution
Answers: (a) 2026 = 11111101010₂ has eight 1s, so 2⁸ = 256. (b) 2026 = 31101₅, so (3 + 1)(1 + 1)(1 + 1)(0 + 1)(1 + 1) = 32. (c) 50 = 101₇ and 20 = 026₇; the middle digit 2 exceeds 0, so C(50, 20) ≡ 0 (mod 7). 100 = 10201₃ and 19 = 00201₃, so C(100, 19) ≡ C(1, 0)C(0, 0)C(2, 2)C(0, 0)C(1, 1) = 1 (mod 3).