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-2

Exercise 1.2.7-2

proved in Lean solution written

Rating13
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.7 of Volume 1. Companion chapter: Harmonic numbers

The task

Change the argument for H2m≥1+m/2H_{2^m} \ge 1 + m/2 so that it proves H2m≤1+mH_{2^m} \le 1 + m.

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

Study the sum H2m+1−H2mH_{2^{m+1}} - H_{2^m}. It has 2m2^m terms.

Hint 2

Bound each of these terms from above, and not from below as in the text.

Solution

Show the solution

For m≥0m \ge 0,

H2m+1−H2m=12m+1+12m+2+⋯+12m+1.H_{2^{m+1}} - H_{2^m} = \frac{1}{2^m + 1} + \frac{1}{2^m + 2} + \cdots + \frac{1}{2^{m+1}}.

This sum has 2m+1−2m=2m2^{m+1} - 2^m = 2^m terms. Each term is at most 12m+1\frac{1}{2^m + 1}, which is less than 12m\frac{1}{2^m}. So the sum is less than 2m⋅12m=12^m \cdot \frac{1}{2^m} = 1. Therefore H2m+1≤H2m+1H_{2^{m+1}} \le H_{2^m} + 1.

Induction on mm. For m=0m = 0, H1=1≤1+0H_1 = 1 \le 1 + 0. If H2m≤1+mH_{2^m} \le 1 + m, then H2m+1≤1+m+1=1+(m+1)H_{2^{m+1}} \le 1 + m + 1 = 1 + (m+1).

Check

Python gives H2mH_{2^m} for m=0,…,8m = 0, \ldots, 8 as 1,1.5,2.083,2.718,3.381,4.058,4.744,5.433,6.1241, 1.5, 2.083, 2.718, 3.381, 4.058, 4.744, 5.433, 6.124. Each value lies between 1+m/21 + m/2 and 1+m1 + m. For m=1m = 1: 1+12=1.5≤1.5≤21 + \frac12 = 1.5 \le 1.5 \le 2.

Remarks

The two bounds together show that HnH_n grows like log⁡2n\log_2 n, up to a constant factor. Eq. (3) gives the sharper value ln⁡n+γ\ln n + \gamma.

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.