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.7-15

Exercise 1.2.7-15

proved in Lean solution written

RatingM23
MarkersM (mathematical)
KindK3, find a value: compute a number, a set or a closed form from the written solution
SectionSection 1.2.7 of Volume 1. Companion chapter: Harmonic numbers

The task

Express ∑k=1nHk2\sum_{k=1}^{n}H_k^2 in terms of nn and HnH_n.

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

Use summation by parts (exercise 10) with ak=ka_k = k and bk=Hk2b_k = H_k^2.

Hint 2

The difference Hk+12−Hk2H_{k+1}^2 - H_k^2 factors. Then the sums that remain are given by eq. (8).

Solution

Show the solution

Apply exercise 10 with ak=ka_k = k, bk=Hk2b_k = H_k^2, and the upper limit n+1n + 1:

∑1≤k≤nHk2=(n+1)Hn+12−H12−∑1≤k≤n(k+1)(Hk+12−Hk2).\sum_{1 \le k \le n}H_k^2 = (n+1)H_{n+1}^2 - H_1^2 - \sum_{1 \le k \le n}(k+1)\left(H_{k+1}^2 - H_k^2\right).

Since Hk+1−Hk=1k+1H_{k+1} - H_k = \frac{1}{k+1}, it follows that Hk+12−Hk2=1k+1(2Hk+1−1k+1)H_{k+1}^2 - H_k^2 = \frac{1}{k+1}\left(2H_{k+1} - \frac{1}{k+1}\right). So (k+1)(Hk+12−Hk2)=2Hk+1−1k+1(k+1)\left(H_{k+1}^2 - H_k^2\right) = 2H_{k+1} - \frac{1}{k+1}. By eq. (8), ∑1≤k≤nHk+1=∑j=1n+1Hj−H1=(n+2)Hn+1−(n+1)−1\sum_{1 \le k \le n}H_{k+1} = \sum_{j=1}^{n+1}H_j - H_1 = (n+2)H_{n+1} - (n+1) - 1. Also ∑1≤k≤n1k+1=Hn+1−1\sum_{1 \le k \le n}\frac{1}{k+1} = H_{n+1} - 1. Therefore

∑k=1nHk2=(n+1)Hn+12−1−2((n+2)Hn+1−n−2)+Hn+1−1=(n+1)Hn+12−(2n+3)Hn+1+2n+2.\sum_{k=1}^{n}H_k^2 = (n+1)H_{n+1}^2 - 1 - 2\left((n+2)H_{n+1} - n - 2\right) + H_{n+1} - 1 = (n+1)H_{n+1}^2 - (2n+3)H_{n+1} + 2n + 2.

Now put Hn+1=Hn+1n+1H_{n+1} = H_n + \frac{1}{n+1}. The square gives (n+1)Hn+12=(n+1)Hn2+2Hn+1n+1(n+1)H_{n+1}^2 = (n+1)H_n^2 + 2H_n + \frac{1}{n+1}, and (2n+3)Hn+1=(2n+3)Hn+2n+3n+1(2n+3)H_{n+1} = (2n+3)H_n + \frac{2n+3}{n+1}. So the sum is (n+1)Hn2−(2n+1)Hn+1−2n−3n+1+2n+2(n+1)H_n^2 - (2n+1)H_n + \frac{1 - 2n - 3}{n+1} + 2n + 2, and −2n−2n+1=−2\frac{-2n-2}{n+1} = -2. The result is

∑k=1nHk2=(n+1)Hn2−(2n+1)Hn+2n.\sum_{k=1}^{n}H_k^2 = (n+1)H_n^2 - (2n+1)H_n + 2n.

Check

For n=3n = 3: 1+94+12136=119181 + \frac94 + \frac{121}{36} = \frac{119}{18}. The formula gives 4⋅12136−7⋅116+6=1219−776+6=119184 \cdot \frac{121}{36} - 7 \cdot \frac{11}{6} + 6 = \frac{121}{9} - \frac{77}{6} + 6 = \frac{119}{18}. Python checks n=1,…,39n = 1, \ldots, 39 with exact fractions. For n=1n = 1 the formula gives 2−3+2=12 - 3 + 2 = 1.

Remarks

An induction proof is also short: the difference of the right sides for nn and n−1n - 1 is Hn2H_n^2. Exercise 1.2.7-22 evaluates a similar convolution of harmonic numbers.

This solution is checked, 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.

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

Something is wrong? Report it.