TITLE: Compute $\lim_{n\to\infty} \left(\int_0^{\pi} \frac{\sin^2 n x}{\sin x} \ dx-\sum_{k=1}^n \frac{1}{k}\right)$
QUESTION [19 upvotes]: Compute the limit 
$$\lim_{n\to\infty} \left(\int_0^{\pi} \frac{\sin^2 n x}{\sin x} \ dx-\sum_{k=1}^n \frac{1}{k}\right)$$

REPLY [10 votes]: Lemma: $\int_{0}^{\pi} e^{(2n+1)ix} dx = \frac{-2}{i}(2n+1)$.
Now let $t=e^{ix}$. We'll simplify the integrand:
$$\frac{\sin^2(nx)}{\sin x} = (\frac{t^{n}-t^{-n}}{2i})^2 (\frac{t-t^{-1}}{2i})^{-1}$$
$$=\frac{i}{-2} \frac{t^{2n+1}+t^{1-2n}-2t}{t^2-1} = \frac{i}{-2} t \frac{t^{2n}-1}{t^2-1}(1-t^{-2n})$$
$$=\frac{i}{-2} \sum_{i=0}^{n-1} (t^{2i+1} - t^{2(i-n)+1})$$
Now, by applying the lemma, we find that the integral is 
$$\frac{i}{-2}\frac{-2}{i} \sum_{i=0}^{n-1} \frac{1}{2i+1} - \frac{1}{2(i-n)+1}=$$
$$=2 \sum_{i=0}^{n-1} \frac{1}{2i+1} =2(H_{2n}-\frac{1}{2}H_n)$$
So the limit in question is $\lim_{n \to \infty} 2(H_{2n}-\frac{1}{2}H_n) - H_{n} = \lim 2H_{2n}-2H_{n}$. Now we can either use $H_{n} \sim \log n + \gamma + O(n^{-1})$ or compare $H_{2n}-H_{n}$ to the integral $\int_{n}^{2n} \frac{dt}{t} = \ln 2$ to conclude that the limit is $\ln 4$.