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.4-45

Exercise 1.2.4-45

not stated yet in Lean solution written

RatingM28
MarkersM (mathematical), recommended
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.4 of Volume 1. Companion chapter: Integer functions and elementary number theory

The task

Show that ∑0≤j<nf(⌊mj/n⌋)\sum_{0 \le j < n} f(\lfloor mj/n \rfloor) can be rewritten as a sum over rr with ceilings, for any function ff, and deduce a binomial coefficient identity.

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

Group the terms by the value r=⌊mj/n⌋r = \lfloor mj/n \rfloor, which runs from 00 to m−1m - 1. How many jj give rr or more?

Hint 2

Let cr=⌈rn/m⌉c_r = \lceil rn/m \rceil. Show that ⌊mj/n⌋≥r\lfloor mj/n \rfloor \ge r exactly when j≥crj \ge c_r.

Hint 3

Then sum by parts. For the binomial identity take f(r)=(r+1k)f(r) = \binom{r+1}{k}.

Solution

Show the solution

Counting. For an integer rr with 0≤r≤m0 \le r \le m and an integer jj, ⌊mj/n⌋≥r  ⟺  mj/n≥r  ⟺  j≥rn/m  ⟺  j≥cr,\lfloor mj/n \rfloor \ge r \iff mj/n \ge r \iff j \ge rn/m \iff j \ge c_r, where cr=⌈rn/m⌉c_r = \lceil rn/m \rceil. Note c0=0c_0 = 0 and cm=nc_m = n. Among j=0,…,n−1j = 0, \ldots, n-1, the number with ⌊mj/n⌋≥r\lfloor mj/n \rfloor \ge r is n−crn - c_r for 0≤r≤m0 \le r \le m. Hence the number with ⌊mj/n⌋=r\lfloor mj/n \rfloor = r is (n−cr)−(n−cr+1)=cr+1−cr(n - c_r) - (n - c_{r+1}) = c_{r+1} - c_r for 0≤r≤m−10 \le r \le m - 1. All values ⌊mj/n⌋\lfloor mj/n \rfloor lie in {0,…,m−1}\{0, \ldots, m-1\}, since j<nj < n.

Summation by parts. Grouping by the value of rr, ∑0≤j<nf(⌊mj/n⌋)=∑r=0m−1f(r)(cr+1−cr)=∑r=1mcrf(r−1)−∑r=0m−1crf(r).\sum_{0 \le j < n} f(\lfloor mj/n \rfloor) = \sum_{r=0}^{m-1} f(r)(c_{r+1} - c_r) = \sum_{r=1}^{m} c_r f(r-1) - \sum_{r=0}^{m-1} c_rf(r). The first sum has the term r=mr = m, namely nf(m−1)nf(m-1), and the terms 1≤r≤m−11 \le r \le m - 1. The second has the term r=0r = 0, which is 00 because c0=0c_0 = 0, and the terms 1≤r≤m−11 \le r \le m-1. Combining, ∑0≤j<nf(⌊mj/n⌋)=nf(m−1)+∑r=1m−1cr(f(r−1)−f(r)).\sum_{0 \le j < n} f(\lfloor mj/n \rfloor) = nf(m-1) + \sum_{r=1}^{m-1} c_r\bigl(f(r-1) - f(r)\bigr). Since c0=0c_0 = 0, the sum can start at r=0r = 0 for any value of f(−1)f(-1). This is the formula of the exercise. □\square

The binomial identity. Take an integer k≥0k \ge 0 and f(r)=(r+1k)f(r) = \binom{r+1}{k}. Pascal's rule gives f(r−1)−f(r)=(rk)−(r+1k)=−(rk−1)f(r-1) - f(r) = \binom{r}{k} - \binom{r+1}{k} = -\binom{r}{k-1}. The formula reads ∑0≤j<n(⌊mj/n⌋+1k)=n(mk)−∑0≤r<m⌈rnm⌉(rk−1),\sum_{0 \le j < n}\binom{\lfloor mj/n \rfloor + 1}{k} = n\binom{m}{k} - \sum_{0 \le r < m}\Bigl\lceil \frac{rn}{m} \Bigr\rceil\binom{r}{k-1}, because f(m−1)=(mk)f(m-1) = \binom mk. Move the second sum to the left side. □\square

Check

Take m=3m = 3, n=5n = 5, f(r)=r2f(r) = r^2. The values ⌊3j/5⌋\lfloor 3j/5 \rfloor for j=0,…,4j = 0, \ldots, 4 are 0,0,1,1,20, 0, 1, 1, 2, with ∑f=0+0+1+1+4=6\sum f = 0 + 0 + 1 + 1 + 4 = 6. The right side: c0=0c_0 = 0, c1=⌈5/3⌉=2c_1 = \lceil 5/3 \rceil = 2, c2=⌈10/3⌉=4c_2 = \lceil 10/3 \rceil = 4, so c1(f(0)−f(1))+c2(f(1)−f(2))+5f(2)=2(0−1)+4(1−4)+5⋅4=−2−12+20=6c_1(f(0) - f(1)) + c_2(f(1) - f(2)) + 5f(2) = 2(0 - 1) + 4(1 - 4) + 5 \cdot 4 = -2 - 12 + 20 = 6. For the binomial identity with m=3m = 3, n=5n = 5, k=2k = 2: ∑j(⌊3j/5⌋+12)=0+0+1+1+3=5\sum_j \binom{\lfloor 3j/5 \rfloor + 1}{2} = 0 + 0 + 1 + 1 + 3 = 5, and ∑j<3⌈5j/3⌉(j1)=0+2⋅1+4⋅2=10\sum_{j<3}\lceil 5j/3 \rceil\binom j1 = 0 + 2 \cdot 1 + 4 \cdot 2 = 10. The total is 15=5(32)15 = 5\binom 32. A run over 1≤m,n≤81 \le m, n \le 8 with random ff and 0≤k≤40 \le k \le 4 confirms both.

Remarks

For f(r)=rf(r) = r the formula gives ∑j⌊mj/n⌋=(m−1)(n−1)/2\sum_j \lfloor mj/n \rfloor = (m-1)(n-1)/2 in the coprime case once the ceilings are evaluated, and this is the case x=0x = 0 of Exercise 1.2.4-37. The next exercise removes the restriction that the sum has exactly nn terms.

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

In Lean

not stated yet The exercise is not stated in Lean yet.

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

Something is wrong? Report it.