Q:

Fourier series of a periodic odd function

Given $\ f(\theta)=\theta(\pi-\theta)$ is a $2\pi$-periodic odd function on $[0,\pi]$. Compute the Fourier coefficients of $f$, and show that $\ f(\theta)=\frac{8}{\pi} \sum_{\text{$k$ odd} \ \geq 1} \frac{\sin{k\theta}}{k^3}$.
My progress: By applying the formula to calculate the n-th Fourier coefficient, we have:
If $n\neq 0$, $\ \hat{f}(n)= \frac{1}{\pi}\int_{0}^{\pi} \theta(\pi-\theta)e^{-2in\theta}d\theta = \int_{0}^{\pi} \theta\ e^{-2in\theta}d\theta -\frac{1}{\pi}\int_{0}^{\pi} \theta^{2}e^{-2in\theta}d\theta$
Now, using integration by parts, together with the fact that $\ e^{-2in\pi}=1$, I ended up with the first integral $= -\frac{\pi}{2in}$, while the 2nd term (so including the term $\frac{-1}{\pi}$) = $\frac{-1}{2n^2} + \frac{\pi}{2in}$.  
For $n=0$, I got $\hat{f}(0)= \frac{\pi^2}{6}$. Combining these results, I don't understand how can $\ f(\theta) = \text{the RHS}$ as we are asked to show:P Can anyone please help me with this problem?
2nd progress: I tried calculating the integral above where the exponential in the integrand is $e^{-in\theta}$ (so, 2 is deleted). And I obtained $\ \hat{f}(n)=\frac{-e^{-in\pi}}{n^2}-\frac{1}{n^2}-\frac{2e^{-in\pi}}{n^3i\pi} + \frac{2}{n^3i\pi}$ = $\frac{(-1)^{n+1}}{n^2}-\frac{1}{n^2}-\frac{2(-1)^{n}}{n^3i\pi}+\frac{2}{n^3i\pi}.$ Still can't get the RHS(!?)
3rd progress: Finally, I was able to obtain the RHS!! But I am not quite satisfied with my solution, because I have to "borrow" a result which states that if $f$ is a $2\pi$-periodic odd function, then $\ f(\theta) = 2i\ \hat{f}(n)sin(nx)$ for every ODD $n$, and using the final result in 2nd progress, I finally got the RHS! I really want to see a solution using a purely algebraic manipulation, starting from my result for $\ \hat{f}(n)$ in 2nd progress, without using any sorts of extra result like I did.

A:

(We replace $\theta$ throughout by $x$.) Let's look at the full Fourier series of $f(x) = x(\pi-x)$ on $[-\pi,\pi]$ first, where $f$ is defined outside of this interval by periodicity, i.e., $f$ is of period $2\pi$ outside $[-\pi,\pi]$.  In this case $\displaystyle a_0 = \frac{1}{\pi}\,\int_{-\pi}^{\pi}\,x(\pi-x)\, dx = -\frac{2\pi^2}{3},$ where the first term (constant term) of the FS is given by $\displaystyle \frac{a_0}{2} = -\frac{\pi^2}{3}$.
Next the cosine terms are given by $\displaystyle a_n = \frac{1}{\pi}\,\int_{-\pi}^{\pi}\,x(\pi-x)\,\cos (nx)\, dx = \frac{4\,(-1)^{1+n}}{n^2} .$ Similarly, the Fourier sine coefficients are given by  $\displaystyle b_n = \frac{1}{\pi}\,\int_{-\pi}^{\pi}\,x(\pi-x)\,\sin (nx)\, dx =  \frac{2\pi (-1)^{n+1}}{n}.$ Hence the full FS of $f$ defined above is
$$f(x) \sim -\frac{\pi^2}{3} + \sum_{n=1}^\infty \left (\frac{4\,(-1)^{1+n}}{n^2}\,\cos(nx) + \frac{2\pi (-1)^{n+1}}{n}\,\sin (nx)\right),$$ for $x \in (-\pi,\pi)$ with ordinary convergence at all points of continuity. Thus, for example, setting $x=\pi/2$ we get the neat result $\displaystyle \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n^2} = \frac{\pi^2}{12}.$ So, this must be the correct representation.
Now for half-range expansions. In this case we are given $f(x)$ on only  {\it half the range}, i.e., $[0,\pi]$ here (instead of $[-\pi,\pi]$). But we are also told that it is $2\pi$-periodic. So the natural way to extend this function $f$ defined on $[0,\pi]$ to a periodic function of period $2\pi$ is to extend it to the left of $x=0$ by making either an even function (so you get only a cosine series) or an odd function (so you get only a sine series). To make $f$ into an even (resp. odd) function on $[-\pi,\pi]$ you redefine it by setting $f(x) = f(-x)$ (resp. $f(x) = - f(-x)$) for any $x \in [-\pi,0]$. In this case the Fourier coefficients are given by either
$\displaystyle b_n = \frac{2}{\pi}\int_0^\pi x(\pi-x) \sin(nx)\, dx $ which is the original required expression for a pure sine series, and 
$\displaystyle a_n = \frac{2}{\pi}\int_0^\pi x(\pi-x) \cos(nx)\, dx = -\frac{2}{n^2}(1+(-1)^n)$ with $\displaystyle a_0 = \frac{2}{\pi}\int_0^\pi x(\pi-x) \, dx = \frac{\pi^2}{6}$ for a pure cosine representation each series converging on $[0,\pi]$.

