The first part of the problem is to obtain the fourier cosine series of period $2\pi$ Which represents $f$ on the domain $0\leq x\leq \pi$ where $$f(x)=\pi-2x,0\leq x \leq \frac{\pi}{2}$$ and $$f(x)=0,\frac{\pi}{2}\leq x\leq\pi$$ My attempt:
The Fourier cosine series is given by $$f(x)=\frac{a_0}{2}+\sum_{n=0}^{\infty}a_n\cos(nx)$$ where $$a_0=\frac{1}{2\pi}\int_{0}^{\pi}f(x)dx$$ $$a_n=\frac{1}{\pi}\int_{0}^{\pi}f(x)\cos(nx)dx$$
i calculated that $a_0=0$ and $$a_n=\frac{2}{\pi^2*n}$$ if $n$ is even and $0$ if n is odd. therefore my fourier cosine series was $$f(x)=\sum_{n=0}^{\infty}\frac{2}{\pi^2*n}\cos(nx)$$ is this correct?
Part (b) is that by letting $x=\frac{\pi}{2}$ in the fourier series obtained evaluate the series $$\sum_{n=1}^{\infty}\frac{1}{n^2}(1-\cos(\frac{n\pi}{2}))\cos(\frac{n\pi}{2})=-\frac{2}{2^2}-\frac{2}{6^2}-\frac{2}{10^2}-...$$ but i dont really know what to do, i was thinking that i would just write the series given equal to the series calculated substituting x in? i ended up getting something like $$\frac{2\cos^{-1}(\frac{-2n}{\pi^2}-1)}{n}=\pi$$ but this cant be right surely.?
There are some mistakes in the OP. First, since $f(x)=0$ for $x\in[\pi/2,\pi]$ the Fourier coefficients are
$$a_n=\begin{cases}\frac2\pi\int_0^{\pi/2}(\pi-2x)\cos(nx)\,dx=\frac{4(1-\cos(n\pi/2))}{n^2\pi}&,n\ne 0\\\\ \frac\pi2&,n=0\tag 1 \end{cases}$$
Then, we have from $(1)$
$$\begin{align} \pi-2x&= \frac\pi4 +\frac4\pi\sum_{n=1}^\infty \frac{(1-\cos(n\pi/2))}{n^2}\,\cos(nx)\tag 2 \end{align}$$
Letting $x=\pi/2$ in $(2)$ yields
$$0= \frac{\pi}{4}+\frac4\pi \sum_{n=1}^\infty \frac{(1-\cos(n\pi/2))\cos(n\pi/2)}{n^2}$$
from which we deduce that
$$\sum_{n=1}^\infty \frac{(1-\cos(n\pi/2))\cos(n\pi/2)}{n^2}=-\frac{\pi^2}{16}$$