Which Fourier series formula is correct
I'm getting started on Fourier series but I'm confused over the formulae involved.
My lecturers notes, including Wikipedia state that, for the interval $(-\pi \le x \le \pi)$
$$a_0 = \frac1\pi \int \cdots $$
whereas videos on Youtube and other tutorials I've found seem to be using:
$$a_0 = \frac1{2\pi} \int \cdots $$
Which one am I supposed to use?
The trigonometric Fourier series of a function $f(x)$ defined on the interval $-\pi \leq x\leq \pi $ is $$ f(x)=C+\sum_{n=1}^{\infty }\left( a_{n}\cos nx+b_{n}\sin nx\right), \tag{1} $$ where the constant $C$ and the coefficients $a_n$ and $b_n$ are given by the following integrals: $$ \begin{eqnarray*} a_{n} &=&\frac{1}{\pi }\int_{-\pi }^{\pi }f(x)\cos nx\,dx,\qquad n=1,2,3,\ldots \\ b_{n} &=&\frac{1}{\pi }\int_{-\pi }^{\pi }f(x)\sin nx\,dx,\qquad n=1,2,3,\ldots \\ C &=&\frac{1}{2\pi }\int_{-\pi }^{\pi }f(x)\, dx. \end{eqnarray*}\tag{2} $$ The constant $C$ is the average value of the function $f(x)$ on the given interval. If we extend the $a_{n}$ formula to $n=0$, we get $$ a_{0}=\frac{1}{\pi }\int_{-\pi }^{\pi }f(x)\,dx=2C\Leftrightarrow C=\frac{ a_{0}}{2}.\tag{3} $$ With this definition of $a_0$ we have $$ f(x)=\frac{a_{0}}{2}+\sum_{n=1}^{\infty }\left( a_{n}\cos nx+b_{n}\sin nx\right)\tag{4} $$ On the other hand if we had defined $$ a_{0}=\frac{1}{2\pi }\int_{-\pi }^{\pi }f(x)\,dx\tag{3'} $$ then the expansion of $f(x)$ into a Fourier Series would be $$ f(x)=a_{0}+\sum_{n=1}^{\infty }\left( a_{n}\cos nx+b_{n}\sin nx\right)\tag{4'} $$
References: The definition $(3)$ is used in Angus Taylor's Advanced Calculus and Tom Apostol's Mathematical Analysis.
Fourier series for functions on $[-\pi,\pi]$, or, equivalently, $[0,2\pi]$, can be either $f(x)=a_0+\sum_{n=1,2,\ldots} (a_n\cos nx+b_n\sin nx)$ or the complex form $f(x)=\sum_{n\in {\bf Z}} c_n\,e^{inx}$. Either way, among other properties, the integral of $f$ against something else on $[0,2\pi]$ should be the same as the integral of the Fourier series against that same thing, and this device determines all the Fourier coefficients, by integrating against (constants and) sines and cosines or exponentials. Integrating against the constant function $1$ will pick out $a_0$, since constants integrate to $0$ against non-trivial sines and cosines or exponentials: $\int_0^{2\pi} f(x)\,1\,dx=\int_0^{2\pi} a_o\,1\,dx=2\pi\cdot a_o$. Thus, $a_o={1\over 2\pi}\int_0^{2\pi} f(x)\,dx$.
The $2$s and $\pi$s and other constants frequently get misplaced in discussions of Fourier series, so eternal vigilance is required. Double-checking as above is not hard, luckily.
When the Fourier series representation for a periodic function on $[-\pi,\pi]$ is given as $$ f(x)=a_0+\sum_{n=1}^\infty a_n\cos(nx)+\sum_{n=1}^\infty b_n\sin(nx) $$ then, for $n>0$, $$ \begin{align} a_0&=\frac1{2\pi}\int_{-\pi}^\pi f(x)\,\mathrm{d}x\\ a_n&=\frac1\pi\int_{-\pi}^\pi f(x)\cos(nx)\,\mathrm{d}x\\ b_n&=\frac1\pi\int_{-\pi}^\pi f(x)\sin(nx)\,\mathrm{d}x \end{align} $$ Perhaps the confusion is between the forms for $a_0$ and $a_n$ when $n>0$.