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)$ 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)$$
 A: The point is that you can write $\sum_{k=1}^nsin(2k-1)x=\frac{cos(2nx)-1}{-2sinx}=\frac{sin^2(nx)}{sinx}$, so the integral is equal to $I=lim_{n\to\infty}\sum_{k=1}^n(\int_{0}^\pi(sin(2k-1)xdx-\frac{1}{k})=lim_{n\to\infty}\sum_{k=1}^n(\frac{2}{2k-1}-\frac{1}{k})$, then using $\sum_{k=1}^{n}\frac{1}{k}\sim log(n)+c$, $c$ is the Euler constant, so $I=lim_{n\to\infty}2[\sum_{k=1}^{2n}\frac{1}{k}-\sum_{k=1}^n\frac{1}{2k}]-\sum_{k=1}^n\frac{1}{k}=lim_{n\to\infty}(2log2n+2c-logn-c-logn-c)=2log2$. 
A: Let's suppose that $\ \displaystyle f(n):=\int_0^{\pi} \frac{\sin^2 n x}{\sin x} \ dx\ $ then :
\begin{align}
f(n+1)-f(n)&=\int_0^{\pi} \frac{\sin^2((n+1) x)-\sin^2(n x)}{\sin x} \ dx\\
&=\int_0^{\pi} \frac{\cos(2n x)-\cos(2(n+1) x)}{2\sin x} \ dx\\
&=\int_0^{\pi} \frac{\cos(2n x)(1-\cos(2x))+\sin(2nx)\sin(2x)}{2\sin x}dx\\ &=\int_0^{\pi} \frac{\cos(2n x)2\sin(x)^2)+\sin(2nx)2\sin(x)\cos(x)}{2\sin x} dx\\
&=\int_0^{\pi} \cos(2n x)\sin(x)+\sin(2nx)\cos(x)\;dx\\
&=\int_0^{\pi} \sin((2n+1) x)\;dx\\
&=\frac 2{2n+1} \\
\end{align}
So that your limit (as $\ (n+1)\to +\infty$) is the series :
$$f(0)+\sum_{n=0}^\infty \left(\frac 2{2n+1}-\frac 1{n+1}\right)=2\sum_{n=0}^\infty \left(\frac 1{2n+1}-\frac 1{2n+2}\right)=2\,\log(1+1)=\log(4)$$ 
(using the expansion of $\;\log(1+x)\,$ at $\,x=1$)
A: 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$.
