Proving that $\lim_{n \to \infty} \int_0^1 f(x) \sin(nx) \, dx = 0$ if $f : \mathbb R \to \mathbb R$ is continuous Specifically I would like to know how one can justify the following equality
$$\begin{align}
&2 \int_0^1 f(x) \sin(nx) \, dx \\
= &\int_0^\frac{\pi}{n}f(x)\sin(nx) \, dx - \int_1^{1+\frac{\pi}n} f(x)\sin(nx) \, dx + \int_0^1 \left(f(x)-f\left(x-\frac {\pi}n \right) \right) \sin(nx) \, dx
\end{align}
$$
knowing that (as $\sin(nx)$ has a period of $\frac{2\pi}n$)
$$
\int_0^1 f(x) \sin(nx) \, dx = -\int_{\frac{\pi}n}^{1+\frac{\pi}n} f\left(x-\frac {\pi}n \right)  \sin(nx) \, dx
$$
for all continuous functions $f: \mathbb R \to \mathbb R$?
The equality in question is taken from page 1 of this PDF file and is used to prove that 
$$
\lim_{n \to \infty} \int_0^1 f(x) \sin(nx) \, dx = 0
$$
if $f : \mathbb R \to \mathbb R$ is continuous.
I am already aware of the Riemann Lebesgue Lemma, but I wanted to understand precisely the justification of the equality in question. The remainder of the proof follows easily for me.
 A: The equality is incorrect.
Let $f(x) = x$.  Then we get
$$\begin{align}2 \int_0^1 x \sin nx \, dx &= \frac{2 \sin n}{n^2}-\frac{\cos n}{n} \\ &\neq \frac{2 \sin n}{n^2} +\frac{2\pi}{n^2} - \frac{2 \cos n}{n} - \frac{2 \pi \cos n}{n^2}\\ &=  \int_0^{\pi/n} x \sin nx \, dx - \int_{1}^{1 + \pi/n} x \sin nx \, dx + \int_0^1 [x - (x -\pi/n)] \sin nx \, dx\end{align}$$
The correct result is
$$\begin{align} 2 \int_0^1 f(x) \sin nx \, dx  &= \int_0^\frac{\pi}{n}f\left(x-\frac {\pi}n \right)\sin(nx) \, dx - \int_1^{1+\frac{\pi}n} f\left(x-\frac {\pi}n \right)\sin(nx) \, dx \\ &+ \int_0^1 \left(f(x)-f\left(x-\frac {\pi}n \right) \right) \sin(nx) \, dx \end{align}
$$
This follows easily by splitting the integral over $[\pi/n, 1+\pi/n]$ on the RHS of the first line of the solution in the attached PDF into integrals  over $[\pi/n,1]$ and $[1,1 + \pi/n]$ and then adding and subtracting the integral over $[0,\pi/n]$.
A: By Heine-Cantor, $f$ is uniformly continuous.
Fix $\varepsilon > 0$. Let $\delta > 0$ such that $|x-y| < \delta \implies |f(x) -f(y)| < \varepsilon$. Let $N \in \Bbb N$ such that $\frac {2 \pi} N < \delta$. For any $n > N$:
$$\begin{array}{cl}
&\displaystyle \left| \int_0^1 f(x) \sin(nx) \ \mathrm dx \right| \\
\le& \displaystyle \sum_{k=0}^m \left| \int_{2\pi k/n}^{2\pi (k+1)/n} f(x) \sin(nx) \ \mathrm dx \right| + \frac{2\pi}n M \\
\le& \displaystyle \sum_{k=0}^m \frac{2\pi \varepsilon}n + \frac{2\pi}n M \\
\le& \varepsilon + \dfrac{2\pi}n M
\end{array}$$
where $m = \left\lfloor\dfrac{n}{2\pi}\right\rfloor - 1$.
Now use standard tricks in analysis.
