Consider the function $f:(-\pi,\pi)\to\mathbb{R}$ be defined as $x \mapsto (\pi+x)(\pi-x)$
Compute the fourier series of $f$
So far, I've worked out $a_o$ by: \begin{equation} a_o = \frac{1}{\pi} \int^{\pi}_{-\pi} (\pi^2-x^2) \ dx \end{equation} \begin{equation} =\frac{4}{3}\pi^2 \end{equation}
And I got stuck working out $a_n$ \begin{equation} \int^{\pi}_{-\pi} (\pi^2-x^2)\cos nx \ dx \end{equation} \begin{equation} = \int^{\pi}_{-\pi} \left\lbrace \left[ (\pi^2-x^2) \frac{1}{n} \sin nx\right]^\pi_{-\pi} - \frac{1}{n} \int^{\pi}_{-\pi} (\pi^2-x^2)\sin nx \ \right \rbrace dx \end{equation}
I'm stuck on integrating the $ \int^{\pi}_{-\pi} (\pi^2-x^2)\sin nx \ dx$ par
a quick answer, hope this helps:
using integration by parts you obtain: \begin{align} \int x^2\sin(nx)dx&=\frac{2x\sin nx}{n^2}-\frac{(n^2x^2-2)\cos nx}{n^3}\\ \int x^2\cos(nx)dx&=\frac{2x\cos nx}{n^2}+\frac{(n^2x^2-2)\sin nx}{n^3}\\ \end{align}