Let $f$ denote the periodic function, of period 2, where
$f(x) = \left\{ \begin{array}{ll} \cos(\pi x) & 0 < x < 1 \\ 0 & 1 < x < 2 \\ \end{array} \right. $
and where
$f(0) = \frac{1}{2} \quad \text{and} \quad f(1) = -\frac{1}{2}$
By referring to the correspondence
$cos(\pi x) $~$ \frac{8}{\pi} \sum_{n=1}^{\infty} \frac{n}{4n^2 - 1} \sin(2n\pi x)$
show that
$f(x) = \frac{1}{2} \cos(\pi x) + \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{n}{4n^2 - 1} \sin(2n\pi x)$
I am rather lost with this problem. Now, I can see that when $x = 0$ and $x = 1$, the $f(x)$ I am trying to prove resolves to the end point conditions $\frac{1}{2}$ and $- \frac{1}{2}$. I found it odd that $f(x)$ is effectively $ \frac{1}{2} \cos(\pi x) + \frac{1}{2} \cos(\pi x)$, but I don't know how to properly argue that for the boundary conditions to be satisfied, then $f(x)$ must be $\frac{1}{2} \cos(\pi x) + \frac{4}{\pi} \sum_{n=1}^{\infty} \frac{n}{4n^2 - 1} \sin(2n\pi x)$. I have attempted to solve for $a_n$ and $b_n$, where I changed the integration limits such that they corresponded to $0 < x < 1$ and $1 < x < 2$, but I wasn't able to come to any concrete resolutions for this problem.