Q:

Fourier series of $f(x)=1$

$\displaystyle f(x)=\frac{a_{0}}{2}+\sum_{n=1}^\infty a_{n}\cos nx$, 
where $a_{n}=\frac{2}{\pi}\int_0^\pi f(t)\cos(nt) \ dt$, if $f$ is even.
But for $f(x)=1$, the left side goes to $0$. How can I get the Fourier series of $1$?

A:

Define the function periodically over $\;[-\pi,\pi]\;$ , so being the function even we get:
$$\begin{align*}&a_0=\frac2\pi\int\limits_0^\pi dx=2\\{}\\
&a_n=\frac2\pi\int\limits_0^\pi\cos nx\;dx=\left.\frac2{n\pi}\sin nx\right|_0^\pi=0\end{align*}$$
and the Fourier series we get is pretty boring:
$$f(x)=\frac{a_0}2+\sum_{n=1}^\infty a_n\cos nxdx=1$$

