Derivation of fourier series equation No matter where I search, every time if there's an article about Fourier series derivation, the first step made by author is to present the following formula:
$$f(x) = \frac{a_0}{2}+\sum_{n=1}^\infty \left(a_n \cos(\frac{2\pi}{T}nx) + b_n \sin(\frac{2\pi}{T}nx)\right)$$
Then, given that formula, the coefficients $a_n$ and $b_n$ are derived. My question is, how did Fourier come up with this main equation? Was it just a lucky guess? It could have been, because there are various proofs showing that the formula is true.
Here the main equation just appears there without justification, just like formulas for even and odd cases below. It's really hard to call the article a derivation in my opinion.
 A: This answer is mostly for students who used an algebra approach. I don't know if Fourier himself thought up the series this way, but it is common today. I left a lot of steps out and mainly showed ideas that I struggled with when I first tried to motivate the Fourier Series. 
I'll start off by observing a trigonometric polynomial:
$T(x) = c_0 + c_1 \cos(x) + c_2 \cos(2x)+...+c_n \cos(n x) + d_1 \sin(x) + ... + d_n \sin(n x)$ 
where $c_n$ and $d_n$ are some non-zero value.
The goal is write the orthogonal basis, from there I can find the coefficients.
So, I need declare the inner product:
$<\textbf{f},\textbf{g}> = \int_0^{2\pi} f(x)g(x)dx$
Before I can obtain a orthogonal basis, I should first get the orthonormal basis by using the Gram–Schmidt process. Where $\|\textbf{g}_0\| = \|\textbf{g}_1\| =\|\textbf{g}_2\| = ... =\|\textbf{g}_n\| = 1$.
$\|\textbf{f}\|^2 = <\textbf{f}><\textbf{f}> = 2\pi$
Thus, $\|\textbf{f}\| = \sqrt{2\pi}$
and
$e_0 = \frac{\textbf{f}}{\|\textbf{f}\|}$
$\textbf{g}_0 = e_0 = \frac{1}{\sqrt{2\pi}}$
$\textbf{g}_1 = e_1 = \frac{1}{\sqrt{\pi}}\cos(x)$
...
$\textbf{g}_n = e_n = \frac{1}{\sqrt{\pi}}\cos(nx)$...
$\textbf{g}_{n+1} = e_{n+1} = \frac{1}{\sqrt{\pi}}\sin((n+1)x)$...
$\textbf{g}_{2n} = e_{2n} = \frac{1}{\sqrt{\pi}}\sin(nx)$
The orthogonal basis yields:
$a_0 = \frac{2}{\sqrt{2\pi}}<\textbf{f},\textbf{g}_0>$   (Use 2 because it makes generalizing the coefficients possible.)
$a_1 = \frac{1}{\sqrt{\pi}}<\textbf{f},\textbf{g}_1>$...
$a_n = \frac{1}{\sqrt{\pi}}<\textbf{f},\textbf{g}_n>$...
$b_n = \frac{1}{\sqrt{\pi}}<\textbf{f},\textbf{g}_{2n}>$
Now that everything is divided into sines and cosines I can get the coefficients:
$a_n = \frac{1}{\pi}\int_0^{2\pi} f(x)\cos(nx)dx $
and 
$b_n = \frac{1}{\pi}\int_0^{2\pi} f(x)\sin(nx)dx $
A: You will agree that the functions
$$x\mapsto\cos(\lambda x),\qquad \lambda>0,$$
and their translates are the "purest", "simplest", "most beautiful", etc., periodic functions you can think of. They are the solutions of the "super simple" ODE $$y''+\lambda^2\>y=0$$ for given $\lambda>0$.
Among all these functions solely the functions
$$x\mapsto\cos\left({2n\pi \over T}x\right)$$
and their translates have the prescribed period $T$. It follows that the most general functions that can be built linearly from such pure periodic functions of period $T$ are the functions specified in your question.
Herewith the following grand problem arises: Can every $T$-periodic function $g$ be written in this form, or will after the best conceivable approximation of $g$ by series of this type remain some "nonharmonic remainder"? That the latter is not the case is the essential content of the theory of Fourier series. 
