We recall that the Fourier Series of a function with period $2\pi$ is defined as
$$f(x)=a_0 +\sum_{n=1}^\infty a_n \cos(nx)+\sum_{n=1}^\infty b_n\sin(nx)$$
An amazing property of trigonometric functions is orthogonality which means that
$$ \frac{1}{\pi}\int_{-\pi}^\pi \cos(kx)dx=0$$
$$ \frac{1}{\pi}\int_{-\pi}^\pi \sin(kx)dx=0$$
$$\frac{1}{\pi}\int_{-\pi}^\pi \sin(nx)\cos(kx)dx=\frac{1}{\pi}\int_{-\pi}^\pi \sin(kx)\cos(nx)dx=0$$
If $n\ne k$
$$ \frac{1}{\pi}\int_{-\pi}^\pi \cos(nx)\cos(kx)dx=0$$
$$ \frac{1}{\pi}\int_{-\pi}^\pi \sin(nx)\sin(kx)dx=0$$
and if $n=k$
$$\frac{1}{\pi}\int_{-\pi}^\pi \cos(nx)\cos(nx)dx=1 $$
$$ \frac{1}{\pi}\int_{-\pi}^\pi \sin(nx)\sin(nx)dx=1$$
Where $n,k$ are integers greater than or equal to $0$.
Now let us integrate both sides of the Fourier Series such that
$$\frac{1}{\pi}\int_{-\pi}^\pi f(x)\cos(kx)dx=\frac{1}{\pi}\int_{-\pi}^\pi \left( a_0 +\sum_{n=1}^\infty a_n \cos(nx)+\sum_{n=1}^\infty b_n\sin(nx)\right)\cos(kx)dx=\frac{1}{\pi}\int_{-\pi}^\pi a_0\cos(kx)dx+\sum_{n=1}^\infty a_n\frac{1}{\pi}\int_{-\pi}^\pi \cos(nx)\cos(kx)dx+\sum_{n=1}^\infty b_n\frac{1}{\pi}\int_{-\pi}^\pi \sin(nx)\cos(kx)dx$$
We see from the previous identities that most of the integrals are wiped out leaving only
$$ \frac{1}{\pi} \int_{-\pi}^\pi f(x)\cos(kx)dx=\sum_{n=1}^\infty a_n\frac{1}{\pi}\int_{-\pi}^\pi \cos(nx)\cos(kx)dx$$
For the right hand side, because of orthogonality most of the terms of the series go to zero and the only term left is when $n=k$ so
$$ \frac{1}{\pi}\int_{-\pi}^\pi f(x)\cos(kx)dx=\sum_{n=1}^\infty a_n\frac{1}{\pi}\int_{-\pi}^\pi \cos(nx)\cos(kx)dx=a_k\frac{1}{\pi}\int_{-\pi}^\pi \cos(kx)\cos(kx)dx=a_k$$
So now we have a formula for the coefficients $a_n$. Then integrating both sides of the Fourier Series such
$$ \frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin(kx)dx=\frac{1}{\pi}\int_{-\pi}^\pi \left( a_0 +\sum_{n=1}^\infty a_n \cos(nx)+\sum_{n=1}^\infty b_n\sin(nx)\right)\sin(kx)dx=\sum_{n=1}^\infty b_n\frac{1}{\pi}\int_{-\pi}^\pi \sin(nx)\sin(kx)dx=b_k\frac{1}{\pi}\int_{-\pi}^\pi \sin(kx)\sin(kx)dx=b_k$$
Then finally integrating both sides from $-\pi$ to $\pi$ we get
$$\frac{1}{2\pi} \int_{-\pi}^\pi f(x)dx=\frac{1}{2\pi}\int_{-\pi}^\pi a_0 dx=a_0$$
Hopefully this gives you a sense of where the formulas for the Fourier Coefficients come from and you can make use of them for your problem. Also since $f(x)$ is made up of sines and cosines its period must be some multiple of $2\pi$ but since the only factor between $2$, $5$, and $8$ is $1$ then its period must be $2\pi$.