<s>[INST] $S_n$ be the sum of areas of $y=\sin x, y=\sin {nx}$. Then $\lim_{n \to \infty}S_n=8/{\pi}$? Let $n$ be a natural number. Also let $S_n$ be the sum of the areas of the regions enclosed with the two curves $y=\sin x$ and $y=\sin {nx}$ in $0\le x\le \pi$. 
It's easy to find $S_2, S_3$. For smaller $n$, we can also use wolfram to find $S_n$. Then, I got interested in the problems for larger $n$.
After my observation, I reached the following expectation:
My expectation: $$\lim_{n \to \infty}S_n=\frac{8}{\pi}.$$
I've tried to prove this, but I don't have any good idea with a tedious calculation. Then, here is my question.
Question: Could you show me how to find $\lim_{n \to \infty}S_n$ ?
 [/INST] Since I wasted some time solving this last night, I might as well post it:
The integrand changes sign at the zeros, unless the zero is a double zero, so we need to find the zeros. For that, we bring it in a form where the zeros are more easily determined:
$$\sin (nx) - \sin x = 2\sin \frac{(n-1)x}{2}\cos \frac{(n+1)x}{2}.$$
The zeros of the sine factor in $[0,\,\pi]$ are
$$a_k = \frac{2k\pi}{n-1},\quad 0 \leqslant k \leqslant \frac{n-1}{2},$$
and the zeros of the cosine factor are
$$b_k = \frac{(2k+1)\pi}{n+1}, \quad 0 \leqslant k \leqslant \frac{n}{2}.$$
We find that
$$a_k \leqslant b_k \iff k \leqslant \frac{n-1}{4},$$
where equality holds on one side iff it holds on both. We always have $b_k < a_{k+1}$. For the larger $k$, we have $b_k < a_k < b_{k+1}$.
So writing $n = 4j + r, \; 1 \leqslant r \leqslant 4$, we have that $\sin (nx) - \sin x$ is


*

*positive on $(a_k, b_k)$, for $0 \leqslant k \leqslant j$,

*negative on $(b_k, a_{k+1})$, for $0 \leqslant k < j$,

*negative on $(b_j, b_{j+1})$,

*positive on $(b_k, a_k)$, for $j+1 \leqslant k \leqslant \frac{n-1}{2}$,

*negative on $(a_k, b_{k+1})$, for  $j+1 \leqslant k \leqslant \frac{n-1}{2}$.


Using $n a_k = 2k\pi + a_k$, $n b_k = (2k+1)\pi - b_k$, one finds
$$\begin{align}
\int_{a_k}^{b_k} \sin (nx) - \sin x\, dx &= \cos b_k - \cos a_k + \frac{\cos (na_k) - \cos (nb_k)}{n}\\
&= \cos b_k - \cos a_k + \frac{\cos a_k + \cos b_k}{n}\\
&= \left(1 + \frac1n\right)\cos b_k - \left(1 - \frac1n\right)\cos a_k
\end{align}$$
and similar expressions for the other intervals. Summing the integrals, we obtain
$$\begin{align}
\int_0^\pi \lvert \sin (nx) - \sin x\rvert\, dx &= \sum_{k=0}^j \left(\left(1+\frac1n\right)\cos b_k - \left(1-\frac1n\right)\cos a_k\right)\\
&\quad + \sum_{k=0}^{j-1} \left(\left(1+\frac1n\right)\cos b_k - \left(1-\frac1n\right)\cos a_{k+1}\right)\\
&\quad + \left(1+\frac1n\right)(\cos b_j - \cos b_{j+1})\\
&\quad + \sum_{k=j+1}^{2j+\lfloor r/2\rfloor-1} \left(\left(1-\frac1n\right)\cos a_k - \left(1+\frac1n\right)\cos b_k\right)\\
&\quad + \sum_{k=j+1}^{2j+\lfloor (r-1)/2\rfloor} \left(\left(1-\frac1n\right)\cos a_k - \left(1+\frac1n\right)\cos b_{k+1}\right)\\
&= \left(1+\frac1n\right)\left(\sum_{k=0}^j 2\cos b_k - \sum_{k=j+1}^{2j+\lfloor r/2\rfloor-1} 2\cos b_k -\delta(r)\cos b_{2j+(r+1)/2}\right)\\
&- \left(1-\frac1n\right)\left(\sum_{k=0}^j 2\cos a_k  - \sum_{k=j+1}^{2j+ \lfloor r/2\rfloor-1} 2\cos a_k - 1 - \delta(r)\cos a_{2j+(r-1)/2}\right)
\end{align}$$
where $\delta(r) = 0$ if $r$ is even, and $\delta(r) = 1$ for $r$ odd.
Using the summation formulae for sines and cosines of arithmetic progressions, we obtain
$$\begin{align}
\sum_{k=0}^j 2\cos a_k &= \frac{\sin \frac{(2j+1)\pi}{n-1} + \sin \frac{\pi}{n-1}}{\sin \frac{\pi}{n-1}}\\
\sum_{k=j+1}^{2j} 2\cos a_k &= \frac{\sin \frac{(4j+1)\pi}{n-1} - \sin \frac{(2j+1)\pi}{n-1}}{\sin \frac{\pi}{n-1}}\\
\sum_{k=0}^j 2\cos b_k &= \cot \frac{\pi}{n+1}\left(\sin \frac{(2j+1)\pi}{n+1}+\sin\frac{\pi}{n+1}\right) - \left(\cos \frac{(2j+1)\pi}{n+1} - \cos \frac{\pi}{n+1}\right)\\
\sum_{k=j+1}^{2j} 2\cos b_k &= \cot \frac{\pi}{n+1}\left(\sin\frac{(4j+1)\pi}{n+1} - \sin \frac{(2j+1)\pi}{n+1}\right) - \left(\cos \frac{(4j+1)\pi}{n+1} - \cos \frac{(2j+1)\pi}{n+1}\right)
\end{align}$$
Inserting that and adding the correction terms due to the summation bound not always being $2j$, the formula for $n = 4j+1$ reduces nicely to
$$2\left(1+\frac1n\right)\cot \frac{\pi}{n+1} - 2\left(1-\frac1n\right)\cot \frac{\pi}{n-1} = \frac{8}{\pi} + O\left(\frac1n\right).$$
The cases $r \in \{2,3,4\}$ don't reduce quite as nicely, you get an expression with more terms left, but the integral is still (because $\cot z$ and $\frac{1}{\sin z}$ are both $\frac1z + O(z)$, and all other terms are $O(1/n)$)
$$\frac{8}{\pi} + O\left(\frac1n\right).$$
</s>