There's a theorem on my book which is stated as follows:
if $f(x)=f(-x)$ when $(0,\pi)$, then $$f(x)\sim a_0/2+ \sum_{n=1}^{\infty}a_n \cos(nx)$$ where $$a_n=2/\pi\int_{0}^{\pi}f(t)\cos(nt)dt$$
My solution is to consider $\cos(x)$ on $(-\pi,\pi)$ and then use the theorem directly.
But if I calculate $a_1=2/\pi\int_{0}^{\pi}\cos^2(t)dt=1 \neq 0$ so I must have a $\cos(x)$ in my series, should I consider an odd extension??
You don’t need an extension; just consider $\cos x$ on $[0,\pi]$ directly. Then
$$ \int_0^\pi\cos x\cos2nx=0\;, $$
and you obtain the desired result by evaluating the sine coefficients using
$$ \int_0^\pi\cos x\sin2nx=0\;. $$