Develop $x\sin(x)$ into a specific series I have to find a series that in $0\leq x\leq \pi$: $$x\sin(x) = \sum_{n=0}^{\infty} a_n\sin(2nx)  $$
It seems to be impossible because on $x=\pi/2$  we get $ \pi/2 = 0$. However I tried to do it (as part of another exercise which apparentelly I'm on the wrong path), just as we do in classical Fourier: 
$$\int_{0}^{\pi} x\sin(x)\cdot\sin(2mx) dx = \sum_{n=0}^{\infty}a_n\int_{0}^{\pi} \sin(2nx)\cdot\sin(2mx) dx$$
I could solve it and find that $$a_n = \dfrac{-16n}{\pi(2n-1)^2 (2n+1)^2}$$ which is of course a wrong solution. 
At what stage I was wrong? Is it somehow possible to develop a series (even without $\pi/2$)?
 A: Hint:
As I said in the comments already, it is important to realize that fourier theory does not give you pointwise convergence of the series, only L2-convergence. Therefore it is not a contradction that the fourier series at $x = \pi/2$ does not agree with the function. Note that the functions $\sin(2nx)$, $n \in \mathbb{N}$ are not an orthonormal basis of $L^{2}(0,\pi)$, wich means that 
$$\int_{0}^{\pi} x\sin(x)\cdot\sin(2mx) dx = \sum_{n=0}^{\infty}a_n\int_{0}^{\pi} \sin(2nx)\cdot\sin(2mx) dx$$
does not imply
$$a_{n} = \int_{0}^{\pi} x\sin(x)\sin(2nx)\; dx.$$
Now, to solve the problem: Use classical fourier theory to find coeffcients $a_{n}, n\in\mathbb{Z}$ such that $$\frac{x}{2}\sin\left(\frac{x}{2}\right) = \sum_{n\in\mathbb{Z}} \hat a_{n} \sin(nx)\quad \text{in} \; L^2(0,2\pi).$$ You can then easily find coefficients $a_{n}$ for $n\in \mathbb{N}$ such that $$\frac{x}{2}\sin\left(\frac{x}{2}\right) = \sum_{n=0}^{\infty}  a_{n} \sin(nx), \quad \text{in}\; L^{2}(0,2\pi)$$ holds.
Now, for $N \in \mathbb{N}$ we can substitute $ u = x/2$ to obtain
$$\int_{0}^{2\pi}\left|\frac{x}{2}\sin\left(\frac{x}{2}\right) - \sum_{n=0}^{N} a_{n} \sin(nx) \right|^2\;dx = 2\int_{0}^{\pi} \left|u\sin\left(u\right) - \sum_{n=0}^{N} a_{n} \sin(2nu) \right|^2\;du $$
For $N \to \infty$, the left hand side goes to $0$, so the right hand side must go to $0$ as well and we see that the coefficents $a_{n}$ solve the problem.
A: Let us first find Fourier series with complex coefficients. If
\begin{equation}
f(x) = \sum_{\nu = -\infty}^{\infty} \alpha_\nu e^{i\nu x}
\end{equation}
then
\begin{equation}
\alpha_\nu = \frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-i\nu x}dx
\end{equation}
For $f(x) = x\sin x$,
\begin{equation}
\alpha_\nu = \frac{1}{4\pi i}\left(\int_{-\pi}^\pi xe^{i(1 - \nu)x}dx - \int_{-\pi}^\pi xe^{-i(1 + \nu)x}dx\right)
\end{equation}
If $\nu = \pm 1$, $\alpha_\nu = 0$. For $\nu \ne \pm 1$,
\begin{equation}
\alpha_\nu = \frac{i\nu\cos(\pi\nu)}{\nu^2 - 1}
\end{equation}
If $f$ is expanded as
\begin{equation}
f(x) = \frac{a_0}{2} + \sum_{\nu = 1}\left(a_\nu\cos(\nu x) + b_\nu\sin(\nu x)\right)
\end{equation}
Then $2a_\nu = \alpha_\nu + \alpha_{-\nu}$ and $2b_\nu = i(\alpha_\nu + \alpha_{-\nu})$. Thus $a_\nu = 0$ and 
\begin{equation}
b_\nu = -\frac{2\nu}{\nu^2 - 1}\cos(\pi\nu) \text{ if } \nu > 1
\end{equation}
Additionally, $b_0, b_1 = 0$. Therefore,
\begin{equation}
x\sin x = -\sum_{\nu = 2}^\infty \frac{2\nu}{\nu^2 - 1}\cos(\pi\nu)\sin(\nu x)
\end{equation}
A: We can develop $x \sin(x)$ into a series for $0 \leq x \leq \pi$
$$ x \sin(x) = 1-\sum_{n=1}^{\infty} \frac{2 }{4n^2-1}\cos \left( 2n x \right)-\sum_{n=1}^{\infty}\frac{16\ n}{\pi \left( 16n^4-8n^2+1 \right)}\sin \left(2nx\right) $$
