<s>[INST] Just checking: sine series for $x^2$ Is the Fourier sine series for $x^2$ equal to $\sum {2\pi\over 2m+1}-{8\over (2m+1)^3\pi} \sin ((2m+1)x)$? (just want to check that those multiple steps of intergation by parts did not slip me up). Thanks.
 [/INST] The Fourier sine series is $x^2 = \sum_{n=1}^\infty a_n \sin( n x)$, where $a_n = \frac{2}{\pi} \int_0^\pi x^2 \sin( n x) \mathrm{d} x$. Now
$$
 \begin{eqnarray}
 \frac{\pi}{2} a_n &=& \left. (-\frac{x^2}{n} \cos(n x)) \right\vert_{0}^{\pi} + \int_0^\pi ( \frac{2}{n} x) \cos(n x) \mathrm{d} x \\
  &=& \left. (-\frac{x^2}{n} \cos(n x)) \right\vert_{0}^{\pi} + 
     \left. (\frac{2 x}{n^2} \sin(n x)) \right\vert_{0}^{\pi} - \int_0^\pi \frac{2}{n^2} \sin( n x) \mathrm{d} x \\
  &=& 
     \left.  \left( (-\frac{x^2}{n} \cos(n x)) + (\frac{2 x}{n^2} \sin(n x)) + \frac{2}{n^3} \cos(n x) \right) \right\vert_{0}^{\pi} \\
  &=& (-1)^n \left(\frac{2}{n^3} -\frac{\pi^2}{n} \right) - \frac{2}{n^3}
 \end{eqnarray}
$$
Thus
$$
  \begin{eqnarray}
  x^2 &=& \frac{2}{\pi} \sum_{n=1}^\infty \left( (-1)^n \left(\frac{2}{n^2} - \pi^2 \right) - \frac{2}{n^2} \right) \frac{\sin(n x)}{n} \\
    &=& \frac{2}{\pi} \sum_{n=1}^\infty \left( \pi^2 - \frac{4}{(2n-1)^2}\right) \frac{\sin((2n-1)x}{2n-1} -\pi \sum_{n=1}^\infty  \frac{\sin(2 n x)}{n} 
  \end{eqnarray}
$$
Where the last expression was arrived at by splitting summation over even and odd integers.
 Added: As robjohn pointed out in comments, the resulting series approximates odd function $\operatorname{sign}(x) x^2$ on interval $(-\pi, \pi)$. 


</s>