I want to find approximations ${\rm g}_{n}\left(x\right) \in T_{n}$ of $\,\,{\rm f}\left(x\right)$, so that the error $$ \left\vert\left\vert\,{\rm f} - {\rm g}_{n}\,\right\vert\right\vert^{2} = \int_{0}^{2\pi} \left[{\rm f}\left(x\right) - {\rm g}_{n}\left(x\right)\right]^{2}\,{\rm d}x $$ is minimal.
How to do that?
Here are my $f(x)$ functions:
a) $f(x) = x$,
b) $f(x) = (x-\pi)^2$
c) $f(x) =e^x$
d) $f(x) = \left\{ \begin{array}{l l l} 1, & 0 \leq x \leq \pi, \\ 0, & \pi < x \leq 2 \pi. \end{array} \right.$
Thank you very much guys =)
PS: $T_n$ is the vector space of the trigonometric polynomials with size $\leq n$