For every finite set of integers $J\subset\mathbb{Z},$ let us define the linear space $E_J=\text{span}\{e_n:n\in J\},$ where $e_n(t)=e^{int}.$
Let $f:\mathbb{T}\to \mathbb{R}$ be Riemann-integrable function, and $g\in E_J$ a function such that
$$||f-g||_{L_2}=\inf\{||f-h||_{L_2}:h\in E_J\}$$
$(a)$ Prove $g=\sum_{n\in J}\hat f(n)e_n,$ where $\hat f(n)$ is the $n-$th Fourier coefficient.
$(b)$ Find $a,b,c\in \mathbb{R}$ for which the following minimum occurs:
$$\min_{a,b,c}\int_{-\pi}^{\pi} \big | \ |t|-ae^{2it}-be^{3it}-ce^{10it} \ \big |^2dt$$
My thoughts:
$g$ is a trigonometric polynomial, and we know that the trigonometric polynomial, which best approximates a function is it's Fourier series in $L_2.$
I tried to use that combined with what's given of $g$, but got stuck.
As for $(b)$, using what was proved in $(a),$ I think $a=\hat f(2), b = \hat f(3), c = \hat f (10),$ for $f=|t|,$ but not sure.
Any help is appreciated.
Let $f$ be as stated, and suppose $g = \sum_{n\in J}\langle f,e_n\rangle e_n$. Then $$ (f-g)\perp e_n,\;\;\; n\in J. $$ In particular, $\langle f-g,h\rangle =0$ for all $h \in E_J$, which gives $(f-g)\perp E_J$ and $$ \|f-h\|^2 = \|(f-g)+(g-h)\|^2 = \|f-g\|^2+\|g-h\|^2. $$ Hence, $$ \|f-h\|^2 \ge \|f-g\|^2,\;\;\; h\in E_J, $$ with equality iff $\|g-h\|=0$ or $g=h$. This proves (a).
Part (b) requires finding a,b,c such that $$ \int_{-\pi}^{\pi}\{ |t|-ae^{2it}-be^{3it}-ce^{10it} \} e^{-2it}dt =0 \\ \int_{-\pi}^{\pi}\{ |t|-ae^{2it}-be^{3it}-ce^{10it} \} e^{-3it}dt =0 \\ \int_{-\pi}^{\pi}\{ |t|-ae^{2it}-be^{3it}-ce^{10it} \} e^{-10it}dt =0 $$ This is a system of 3 equations in the 3 unknowns $a,b,c$.