# Origin of coefficients of fourier series?

I was wondering how we derive these formulas, and why we have a separate formula for $a_0$? All I know from advanced engineering mathematics text book are following formulas but where do they come from?

$$a_0 = \frac{1}{2L} \int_{-L}^{L} f(x) dx,~~~~a_n = \frac{1}{L} \int_{-L}^{L} f(x) \cos{\frac{n\pi x}{L}}dx,~~~~b_n = \frac{1}{L} \int_{-L}^{L} f(x) \sin{\frac{n\pi x}{L}} dx$$

I found the proof somewhere on net!

for some function with some properties we have: $$\int _0 ^Tf(x)dx = \int_\alpha ^{\alpha + T}f(x)dx$$

and now we have(suppose that $L = \pi$): $$f(x) = a_0 + \sum _{n=1}^{\infty}(a_n\cos(nx) + b_n\sin(nx))$$

If we Integrate from $[-\pi, \pi]$ from above we have: $$\int_{-\pi}^{\pi}f(x)dx = \int_{-\pi}^{\pi}a_0 + \sum _{n=1}^{\infty}\int_{-\pi}^{\pi}(a_n\cos(nx) + b_n\sin(nx))$$ the sum goes to zero and finally we have: $$\int_{-\pi}^{\pi}f(x)dx = 2\pi a_0$$

for $a_n$ we multiply the general form with $\cos(nx)$ for $b_n$, $\sin(nx)$ comes to play, this method is due to Euler and is named Euler formulas, And also fourier him self did it this way!

• If you want to represent a function of period $2L$ in terms of the functions $x \mapsto 1, x \mapsto \cos(\frac{n \pi x}{L}), x \mapsto \sin(\frac{n \pi x}{L})$, then the coefficients are given by the above. – copper.hat Nov 1 '13 at 18:04
• It is what the textbook says too! – Hadi Amiri Nov 1 '13 at 18:22
• See here for starters. math.stackexchange.com/questions/364304/fourier-analysis/… – Ron Gordon Nov 1 '13 at 18:59
• @HadiAmiri : Unfortunately, some people define $a_0$ without the $2$ in the denominator. I don't know why, maybe they want the formula for $a_0$ to match that for $a_n$ for even positive $n$. I think is it more natural to include the $2$, for the reason copper.hat and Ahaan Rungta give. – Stefan Smith Nov 1 '13 at 23:43

Note that $a_0$ doesn't really have a separate formula:
If you plug in $n=0$ into $a_n$ you get the same integral.
For an intuition as to why these formula are what they are, say you wanted to calculate a Fourier series for $\cos(nx$). You know that all the coefficients except for $b_n$ must be zero. So how do you make that happen? You use the fact that: $$\int_{-\pi}^\pi \cos(nx)\cos(mx)dx=0 \ \ \bigg| \ \ m\neq n$$ $$\frac{1}{\pi}\int_{-\pi}^\pi \cos(nx)\cos(mx)dx=1 \ \ \bigg| \ \ m= n=0$$
Doing the same thing for $\sin$, you'll see that only way you can get the coefficients to be consistent with $f(x)=\cos(nx)$ or $f(x)=\sin(nx)$ is to choose the formula's you brought up.
copper.hat's comment is really an answer. If you want to represent a function of period $2L$ in terms of the functions $x \mapsto 1$, $x \mapsto \cos \left( \frac {n\pi x}{L} \right), x \mapsto \sin \left( \frac {n \pi x}{l} \right)$, then the coefficients are given by the above.