Fourier series formula and the average value My textbook states the following:

$ f(x) = \dfrac{a_0}{2} + \sum_{n = 1}^{\infty} \left( a_n\cos(nx) + b_n\sin(nx) \right) \forall x \in [-\pi,\pi]$.
Since $ \int_{-\pi}^{\pi} \cos(nx) dx = 0 $ and $\int_{-\pi}^{\pi} \sin(nx) dx = 0$ $\forall n \in \mathbb{Z^+}$, we have
  $\int_{-\pi}^{\pi} f(x) dx = a_n\pi \implies a_0 = \dfrac{1}{\pi} \int_{-\pi}^{\pi} f(x) dx$.
It is worth noticing that $a_0 = \dfrac{1}{\pi} \int_{-\pi}^{\pi} f(x)
dx$ shows that the constant term $\dfrac{a_0}{2}$ in $ f(x) = \dfrac{a_0}{2} + \sum_{n = 1}^{\infty} \left( a_n\cos(nx) + b_n\sin(nx) \right)$ is simply the average value of $f(x)$ over the interval.


I don't understand how $a_0 = \dfrac{1}{\pi} \int_{-\pi}^{\pi} f(x)
dx$ shows that the constant term $\dfrac{a_0}{2}$ in $ f(x) = \dfrac{a_0}{2} + \sum_{n = 1}^{\infty} \left( a_n\cos(nx) + b_n\sin(nx) \right)$ is the average value of $f(x)$ over the interval.
I understand that average = $\dfrac{1}{b - a} \int^b_af(x)dx$. In this case, $f_{avg}(x) = \dfrac{a_0}{4\pi} \int^{\pi}_{-\pi}1dx = \dfrac{a_0}{4\pi} \cdot 2\pi = \dfrac{a_0}{2} \implies \dfrac{a_0}{2} = f_{avg}(x)$. But how does $a_0 = \dfrac{1}{\pi} \int_{-\pi}^{\pi} f(x)
dx$ show that the constant term $\dfrac{a_0}{2}$ in $ f(x) = \dfrac{a_0}{2} + \sum_{n = 1}^{\infty} \left( a_n\cos(nx) + b_n\sin(nx) \right)$ is the average value of $f(x)$ over the interval?
I would greatly appreciate it if people could please take the time to clarify this claim and help me understand it.
 A: You forgot a + in the Fourier series expression, and the sum begins at $n = 1$
$$ \forall x \in [-\pi,\pi],\ f(x) = \dfrac{a_0}{2} + \sum_{n = 1}^{\infty} \left( a_n\cos(nx) + b_n\sin(nx) \right)$$
Then, when you compute the integral $\int_{-\pi}^{\pi} f(x) dx$ the integrals of the sines and cosines vanish (since $n \geq 1$ and you are integrating over an interval of size $2\pi$) and you are left with $2\pi \frac{a_0}{2}$. 
Then $$\frac{1}{\pi}\int_{-\pi}^{\pi} f(x) dx = a_0$$
And $$f_{avg}=\frac{1}{2\pi}\int_{-\pi}^{\pi} f(x) dx = \frac{a_0}{2}$$
A: I've spent some time trying to devise a proof, and I think I have succeeded. All feedback is welcome.
The hypothesis is that $a_0 = \dfrac{1}{\pi} \int_{-\pi}^{\pi} f(x) dx$ shows that the constant term $\dfrac{a_0}{2}$ in $f(x) = \dfrac{a_0}{2} + \sum^{\infty}_{n = 1} \left( a_n \cos(nx) + b_n \sin(nx) \right) \forall x \in [-\pi, \pi]$ is the average value of $f(x)$ over the integral. 
We know that the average value of a function over an interval is $\dfrac{1}{b - a} \int_a^b f(x) dx$. 
$\therefore f_{avg}(x) = \dfrac{1}{\pi - (-\pi)} \int^{\pi}_{-\pi} \left( \dfrac{a_0}{2} + \sum^{\infty}_{n = 1} \left( a_n \cos(nx) + b_n \sin(nx) \right) \right) dx = \dfrac{1}{2\pi} \int_{-\pi}^{\pi} \dfrac{a_0}{2} dx = \dfrac{1}{4\pi} \int^{\pi}_{-\pi} a_0 dx = \left[ \dfrac{a_0x}{4\pi}\right]^\pi_{-\pi} = \dfrac{a_0}{2}$
$\therefore \dfrac{1}{\pi - (-\pi)} \int^{\pi}_{-\pi} f(x) dx = f_{avg}(x) = \dfrac{a_0}{2}$
$\implies \dfrac{1}{\pi} \int^{\pi}_{-\pi} f(x) dx = a_0$ $Q.E.D.$
