TITLE: Why does a fourier series have a 1/2 in front of the a_0 coefficient
QUESTION [16 upvotes]: I am reading up on the fourier series, and I keep seeing it as being defined as:
$$
f(\theta)= \frac{1}{2}a_0 + \sum_{n=1}^{\infty}(a_n \cos(n\theta) + b_n \sin(n\theta))
$$
where
$$
a_n = \frac{1}{\pi}\int_{0}^{2\pi}\cos(n\theta)f(\theta)d\theta
$$
and 
$$
b_n = \frac{1}{\pi}\int_{0}^{2\pi}\sin(n\theta)f(\theta)d\theta
$$
I understand the derivation of the coefficients using trig integral identities, but I can't find a clear explanation of why $\frac{1}{2}$ is in front of $a_0$. Can anyone help show my why this is the case? Why can't we just have $a_0$ with no number in front of it. Thanks!
edit: corrected summation term

REPLY [8 votes]: Because
$$
\frac1\pi\int_0^{2\pi}\cos^2(n\theta)\,\mathrm{d}\theta=\left\{\begin{array}{}2&\text{if }n=0\\1&\text{if }n\ne0\end{array}\right.
$$
Also, the summation should start at $n=1$.

We have defined
$$
a_n=\frac1\pi\int_0^{2\pi}f(\theta)\cos(n\theta)\,\mathrm{d}\theta
$$
If we write
$$
g(\theta)=\sum_{n=0}^\infty a_n\cos(n\theta)+\sum_{n=1}^\infty b_n\sin(n\theta)
$$
then
$$
\frac1\pi\int_0^{2\pi}g(\theta)\cos(n\theta)\,\mathrm{d}\theta=\left\{\begin{array}{}\color{#C00000}{2}a_0&\text{if }n=0\\a_n&\text{if }n\ne0\end{array}\right.
$$
So we have to use $\frac12a_0$ to compensate.