I have a function which is defined as $$f(x) = \begin{cases} \cos(x) & \text{for $|x| \leq \frac{\pi}{2}$} \\ 0 & \text{for $|x| \in ]\frac{\pi}{2},\pi[$} \end{cases} $$ and I want to show that the corresponding Fourier series is $$ \frac{1}{\pi} + \frac{\cos x}{2}+\frac{2}{\pi} \sum_{k=1}^\infty \frac{(-1)^{k-1}}{4k^2-1}\cos(2kx).$$
I know that $c_0 = \frac{1}{\pi}$ and that $c_1 = c_{-1} = \frac{1}{4}$. I have also been given $$ c_n = \begin{cases} 0 & \text{for $n$ odd, when $n \neq \pm 1$} \\ \frac{1}{\pi} \frac{(-1)^{k-1}}{4k^2-1} & \text{for $n=2k$, for $k \in \mathbb{Z} $} \end{cases}$$
So far, I have started by writing the series as $$ \frac{1}{\pi} + \frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{4k^2-1}e^{i2kx},$$ and used $e^{i2kx} = \cos(2kx)+i\sin(2kx)$ to obtain $$ \frac{1}{\pi} + \frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{4k^2-1}\left(\cos(2kx)+i\sin(2kx)\right) \\= \frac{1}{\pi}+\frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{4k^2-1}\cos(2kx) + \frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{4k^2-1}i\sin(2kx). $$ What I need to show from here is $\frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{4k^2-1}i\sin(2kx) = \frac{\cos x}{2}$, and I would have the series I'm trying to arrive at. Is this approach correct? If so, how can I compute this last sum? Thanks!