Where do the coefficient equations for Fourier series come from? I don't see where the equations come from like:
$$a_0= \frac{1}{2L} \int_{-L}^L f(x)~dx$$
And like wise for $a_n$ and $b_n$.
Also where does the general formula for a Fourier series come from?
If anyone could give me a brief intuitive reason as to these I would be extremely grateful. Thanks.
 A: I'll do a particular case, you'll get the idea: write $$f(x) = \frac{a_0}{2} + \sum_{n \geq 1}a_n\cos(nx)+b_n\sin(nx),$$ and assume uniform convergence, so we can do computations. You can prove that: $$\int_{-\pi}^\pi\sin(nx)\sin(mx)\,{\rm d}x = \int_{-\pi}^\pi \cos(nx)\cos(mx)\,{\rm d}x = \pi\delta_{nm}$$ and $$\int_{-\pi}^\pi\sin(nx)\cos(mx)\,{\rm d}x = 0.$$ With this information: multiplying both sides of the first equation up there by $\cos(mx)$ and integrating from $-\pi$ to $\pi$ we get:  $$\int_{-\pi}^\pi f(x)\cos(mx)\,{\rm d}x = \\=\frac{a_0}{2}\int_{-\pi}^\pi\cos(mx)\,{\rm d}x + \sum_{n \geq 1}a_n\int_{-\pi}^\pi\cos(nx)\cos(mx)\,{\rm d}x+b_n\int_{-\pi}^\pi\sin(nx)\cos(mx)\,{\rm d}x,$$ and so $$\int_{-\pi}^\pi f(x)\cos(mx)\,{\rm d}x = \pi a_m \implies a_n = \frac{1}{\pi}\int_{-\pi}^\pi f(x)\cos(nx)\,{\rm d}x,$$ if $m > 1$. If $m = 0$ you do a separate analysis and actually get the same result. Repeating this with $\sin(mx)$ instead of $\cos(mx)$ you get: $$b_m = \frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin(nx)\,{\rm d}x.$$
In general, you'll have: $$f(x) = \sum_{n \geq 0}c_n\phi_n,$$ and an inner product, with $\langle \phi_n, \phi_m\rangle = \delta_{nm}$. You'll find $c_n$ by applying $\langle \cdot,\cdot\rangle$ in both sides of the above expression, just like I did above (the inner product was $\langle f,g\rangle = \int_{-\pi}^\pi f(x)g(x)\,{\rm d}x$).
