Fourier Series of $f(x) = 0$ from $(-\pi, 0)$, $x$ from $(0,\pi)$ I need to determine the fourier series of the following function, (using trig method, not complex) 
$$ f(x) = \begin{cases} 0 & \text{if } -\pi < x < 0, \\ 
x & \text{if } 0 < x < \pi \end{cases} $$
and then use it to show that $$\sum_{n=1}^{\infty} \frac{1}{(2n-1)^2} = \frac{\pi^2}{8}. $$

The Fourier coefficients are
$$
\begin{align}
   a_{0} & = \frac{1}{\pi}\int_{0}^{\pi}xdx = \frac{1}{\pi}\frac{\pi^{2}}{2}=\frac{\pi}{2},\\
   a_{n} & = \frac{1}{\pi}\int_{0}^{\pi}x\cos(nx)dx = \frac{1}{\pi}\left[\left.\frac{1}{n}\sin(nx)x\right|_{x=0}^{\pi}-\frac{1}{n}\int_{0}^{\pi}\sin nx\,dx\right] \\
    & = \frac{1}{\pi}\left[\left.\frac{1}{n^{2}}\cos nx \right|_{x=0}^{\pi}\right]
      = \frac{\cos(n\pi)-1}{\pi n^{2}}=\frac{(-1)^{n}-1}{\pi n^{2}} \\
   b_{n} & = \frac{1}{\pi}\int_{0}^{\pi}x\sin(nx) dx=
      \frac{1}{\pi}\left[\left.-\frac{1}{n}\cos(nx)x\right|_{x=0}^{\pi}+\frac{1}{n}\int_{0}^{\pi}\cos(nx)dx\right] \\
    & = \frac{1}{\pi}\left[-\frac{\pi}{n}\cos(n\pi)+\left.\frac{1}{n^{2}}\sin(nx)\right|_{x=0}^{\pi}\right]=-\frac{(-1)^{n}}{n}
\end{align}
$$
So the Fourier Series for $f$ converges pointwise to
$$
    \frac{f(x+0)+f(x-0)}{2}=\frac{\pi}{4}+\sum_{n=1}^{\infty}
\left(\frac{(-1)^{n}-1}{\pi n^{2}}\cos(nx)-\frac{(-1)^{n}}{n}\sin(nx)\right)
$$
At the endpoints of $[-\pi,\pi]$, the left and right limits at $x$ are interpreted in terms of the periodic extension of $f$, which gives $\{f(-\pi+0)+f(\pi-0)\}/2=\pi/2$. Evaluate at $x=\pi$:
$$
    \frac{\pi}{2}=\frac{f(\pi-0)+f(-\pi+0)}{2}=\frac{\pi}{4}+\sum_{n=1}^{\infty}\frac{(-1)^{n}-1}{\pi n^{2}}(-1)^{n}=\frac{\pi}{4}+\frac{2}{\pi}\sum_{k=1}^{\infty}\frac{1}{(2k-1)^{2}}.
$$
Solving for the sum,
$$
    \frac{\pi^{2}}{8} = \sum_{k=1}^{\infty}\frac{1}{(2k-1)^{2}}
$$
