I am studying by myself Fourier analysis and have encountered the following problem:
We are trying to approximate a function by a finite sum of sines and cosines with general constant coeficients:
$$f(x) \cong \Sigma_{k=0}^N (A_kcos(kx)) + B_ksin(kx)$$
Define the square approximated error by:
$$E = \int_{-\pi}^{\pi}[f(x)-\Sigma_{k=0}^{N}(A_kcos(kx)+B_ksin(kx))]^2dx$$
Prove that the minimal error is given when we choose $A_k$ as the Fourier coefficient $a_k$ and $B_k$ as the Fourier coefficient $b_k$.
I tried proving this by induction on $N$ but only $N=0$ worked.. I would like to find a minimum point by differentiating but I am not sure how to do that here..
Any help?
You get in general if $v_1,…,v_N$ is an orthogonal set of vectors, that the minimum of $$ \Bigl\|u-\sum_{k=1}^N c_kv_k\Bigr\|^2=\|u\|^2-2\sum_{k=1}^N c_k\langle u,v_k\rangle+\sum_{k=1}^N c_k^2\|v_k\|^2 $$ is attained at the Fourier coefficients $$ c_k=\frac{\langle u,v_k\rangle}{\|v_k\|^2} $$ which you can either prove via the zeros of the gradient or by completing the squares. $$ \Bigl\|u-\sum_{k=1}^N c_kv_k\Bigr\|^2=\|u\|^2-\sum_{k=1}^N\frac{\langle u,v_k\rangle^2}{\|v_k\|^2}+\sum_{k=1}^N \frac1{\|v_k\|^2}\Bigl(c_k\|v_k\|^2-\langle u,v_k\rangle\Bigr)^2 $$