taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.6-10

Exercise 1.2.6-10

proved in Lean solution written

RatingM25
MarkersM (mathematical)
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.6 of Volume 1. Companion chapter: Binomial coefficients

The task

For a prime pp, prove six congruences modulo pp for binomial coefficients, ending with Lucas's theorem and its form in base pp digits.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

For (b), (c) and (d) use eq. 1.2.6(7) and the product form of (p−1k)\binom{p-1}{k}.

Hint 2

For Lucas's theorem work in the ring of polynomials modulo pp and expand (1+x)n(1+x)^n. The key fact is (1+x)p≡1+xp(1+x)^p \equiv 1 + x^p.

Hint 3

Write n=qp+sn = qp + s with 0≤s<p0 \le s < p. Then (1+x)n≡(1+xp)q(1+x)s(1+x)^n \equiv (1+x^p)^q (1+x)^s, and the powers xjx^j from the second factor are below pp, so they cannot mix with the powers of xpx^p.

Solution

Show the solution

Plan: prove (b), (c), (d) by direct arguments, prove Lucas's theorem (e) with polynomials, and get (a) and (f) from (e).

(b) Let 1≤k≤p−11 \le k \le p-1. By eq. 1.2.6(7), k(pk)=p(p−1k−1)k \binom{p}{k} = p \binom{p-1}{k-1}. The prime pp divides the right side. It does not divide kk, since 0<k<p0 < k < p. So pp divides (pk)\binom{p}{k}.

(c) Let 0≤k≤p−10 \le k \le p-1. The definition (3) gives (p−1k)=∏j=1kp−jj.\binom{p-1}{k} = \prod_{j=1}^{k} \frac{p-j}{j}. Multiply by k!k!, which is prime to pp since k<pk < p: k!(p−1k)=∏j=1k(p−j)≡∏j=1k(−j)=(−1)kk!(modp)k!\binom{p-1}{k} = \prod_{j=1}^k (p-j) \equiv \prod_{j=1}^k (-j) = (-1)^k k! \pmod p. Cancel k!k!, which is allowed modulo pp because p∤k!p \nmid k!. The result is (p−1k)≡(−1)k(modp)\binom{p-1}{k} \equiv (-1)^k \pmod p.

(d) Let 2≤k≤p−12 \le k \le p-1. Eq. 1.2.6(9) gives (p+1k)=(pk)+(pk−1)\binom{p+1}{k} = \binom{p}{k} + \binom{p}{k-1}. Both kk and k−1k-1 are in the range 11 to p−1p-1, so both terms are ≡0\equiv 0 by (b).

(e) Work with polynomials whose coefficients are taken modulo pp. By (b), the binomial theorem (13) gives (1+x)p≡1+xp(1+x)^p \equiv 1 + x^p, because the middle coefficients are ≡0\equiv 0. Let n=qp+sn = qp + s with q=⌊n/p⌋q = \lfloor n/p \rfloor and 0≤s<p0 \le s < p. Then (1+x)n=((1+x)p)q(1+x)s≡(1+xp)q(1+x)s=∑i(qi)xpi∑j(sj)xj.(1+x)^n = \bigl((1+x)^p\bigr)^q (1+x)^s \equiv (1+x^p)^q (1+x)^s = \sum_{i} \binom{q}{i} x^{pi} \sum_{j} \binom{s}{j} x^j. Let k=ap+bk = ap + b with 0≤b<p0 \le b < p. A term of the product has the exponent pi+jpi + j with 0≤j≤s<p0 \le j \le s < p. It equals kk only for i=ai = a and j=bj = b, because j<pj < p fixes jj as the remainder of the exponent modulo pp. So the coefficient of xkx^k in the product is (qa)(sb)\binom{q}{a}\binom{s}{b}. The coefficient of xkx^k in (1+x)n(1+x)^n is (nk)\binom{n}{k}. Hence (nk)≡(⌊n/p⌋⌊k/p⌋)(n mod pk mod p)(modp).\binom{n}{k} \equiv \binom{\lfloor n/p \rfloor}{\lfloor k/p \rfloor}\binom{n \bmod p}{k \bmod p} \pmod p.

(a) Put k=pk = p in (e): then a=1a = 1, b=0b = 0, and (np)≡(q1)(s0)=q=⌊n/p⌋\binom{n}{p} \equiv \binom{q}{1}\binom{s}{0} = q = \lfloor n/p \rfloor.

(f) Induct on rr. For r=0r = 0 both n=a0n = a_0 and k=b0k = b_0 are below pp, and there is nothing to prove. For r≥1r \ge 1, the numbers ⌊n/p⌋=arpr−1+⋯+a1\lfloor n/p \rfloor = a_r p^{r-1} + \cdots + a_1 and ⌊k/p⌋\lfloor k/p \rfloor have the digits ar,…,a1a_r, \ldots, a_1 and br,…,b1b_r, \ldots, b_1, and n mod p=a0n \bmod p = a_0, k mod p=b0k \bmod p = b_0. By (e) and the induction hypothesis, (nk)≡(a0b0)⋅(⌊n/p⌋⌊k/p⌋)≡(a0b0)∏i=1r(aibi)\binom{n}{k} \equiv \binom{a_0}{b_0} \cdot \binom{\lfloor n/p \rfloor}{\lfloor k/p \rfloor} \equiv \binom{a_0}{b_0} \prod_{i=1}^{r} \binom{a_i}{b_i}.

Check

Take p=5p = 5, n=17=3⋅5+2n = 17 = 3 \cdot 5 + 2, k=7=1⋅5+2k = 7 = 1 \cdot 5 + 2. Then (177)=19448≡3(mod5)\binom{17}{7} = 19448 \equiv 3 \pmod 5, and Lucas's rule gives (31)(22)=3\binom{3}{1}\binom{2}{2} = 3. For (a), (175)=6188≡3=⌊17/5⌋(mod5)\binom{17}{5} = 6188 \equiv 3 = \lfloor 17/5 \rfloor \pmod 5. For (c) with p=7p = 7, k=3k = 3: (63)=20≡6≡(−1)3(mod7)\binom{6}{3} = 20 \equiv 6 \equiv (-1)^3 \pmod 7.

Remarks

Part (f) shows that (nk)\binom{n}{k} is divisible by pp exactly when some digit of kk exceeds the digit of nn in the same place. Exercise 1.2.6-11 gives the exact power of pp and Exercise 1.2.6-12 uses the case p=2p = 2.

This solution is drafted, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only. Lean states the parts one by one.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.