<s>[INST] Integrating the Fourier series to find the Fourier series of $\frac{1}{2}x^2$ 
The function $\phi(x) = x$ on the interval $[-l,l]$ has the Fourier series
  $$x = \frac{2 l}{\pi}\sum_{m=1}^{\infty}\frac{(-1)^{m+1}}{m}\sin\left(\frac{m\pi x}{l} \right) = \frac{2 l}{\pi}\left(\sin\left(\frac{\pi x}{l} \right) - \frac{1}{2}\sin\left(\frac{2\pi x}{l} \right) + \frac{1}{3}\sin\left(\frac{3\pi x}{l} \right) - \ldots \right)$$
  Integrate the series term-by-term to find the Fourier series for $\frac{1}{2}x^2$, up tp a constant of integration (which is then the $\frac{1}{2}A_0$ term in the cosine series). Find the $A_0$ using the standard formula to completely determine the series.

Attempted solution - We have 
\begin{align*}
&\sum_{m=1}^{\infty}\int_{0}^{l}\frac{2l}{\pi}\frac{(-1)^{m+1}}{m}\sin\left(\frac{m\pi x}{l}\right)dx\\
&= \frac{2l}{\pi}\sum_{m=1}^{\infty}\frac{(-1)^{m+1}}{m}\int_{0}^{l}\sin\left(\frac{m\pi x}{l}\right)dx\\
&= \frac{2l}{\pi}\sum_{m=1}^{\infty}\frac{(-1)^{m+1}}{m}\left[-\frac{l}{\pi m}\left(\cos\left(\frac{m\pi x}{l}\right)\Big|_0^l\right)\right]\\
&= -\frac{2 l^2}{\pi^2}\sum_{m=1}^{\infty} \frac{(-1)^{m+1}}{m^2}\left(\cos\left(\frac{m \pi l}{l}\right) - 1\right)\\
\end{align*}
I am not sure where to go from here, any suggestions are greatly appreciated.
 [/INST] You're trying to integrate $x$ to $x^2/2$, implying you want to use the indefinite operator $\int dx$, not a definite integration on a period. This gives you a series of cosines, viz. $$\frac{x^2}{2}=A-\frac{2l^2}{\pi^2}\sum_{m\ge 1}\frac{\left( -1\right)^{m+1}}{m^2}\cos\frac{m\pi x}{L}$$ for some constant $A$ obtainable by setting $x=0$, viz. $$A=\frac{2l^2}{\pi^2}\sum_{m\ge 1}\frac{\left( -1\right)^{m+1}}{m^2}=\frac{2l^2}{\pi^2}\eta\left( 2\right)=\frac{2l^2}{\pi^2}\frac{\pi^2}{12}=\frac{l^2}{6}.$$
</s>