Find the trigonometric polynomial $\displaystyle p(t) = a_1\cos t + a_2\cos 2t + ... + a_n\cos nt$ so that the integral $\displaystyle \int_0^{2\pi}\|t-p(t) \|^2dt$ is minimized, by defining a suitable inner product in the space of integrable functions on $\displaystyle [0, 2\pi]$, and interpret the integral as the distance $\displaystyle \| f - p\|$, where $\displaystyle f(t) = t$.

I have no idea how to solve this, but the answer is $\displaystyle a_n = \frac{1}{\pi}\int_0^{2\pi}t\cos(nt)dt = 0$ for all $\displaystyle n = 1,2,...,n$