# Finding Fourier series by evaluating sum of infinite series

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!

Using the definition of the Fourier series, we have $$f(x)=c_0 + \sum_{n=-\infty}^\infty c_n e^{i 2\pi nx}$$ Using the information given, we can decompose this sum into $$f(x)=c_0+c_1e^{i2 \pi x}+c_{-1}e^{-i2 \pi x}+\sum_{n \ odd, \ n\ne\pm1} c_n e^{i 2 \pi nx}+\sum_{n \ even} c_n e^{i 2 \pi nx}=1/\pi \ + c_1e^{i2 \pi x}+c_{-1}e^{-i2 \pi x}+\sum_{n \ even} c_n e^{i 2 \pi nx}$$ Noticing that $c_n=c_{-n}$, we can further simplify the equation into $$f(x)= 1/\pi \ + c_1(e^{i2 \pi x}+e^{-i2 \pi x}) \ + \ \sum_{n \ even, \ n > 0} c_n(e^{i2 \pi nx}+e^{-i2 \pi nx})$$ With the identity $e^{i2 \pi nx}+e^{-i2 \pi nx}=2 \ cos(nx)$ and plugging the formulas for $c_1$ and $c_n$, we can get the desired Fourier series.