= Solution
Take $Q_j$ nonzero of exact degree $j$, so $Q_0,\ldots,Q_n$ are an <orthogonal> <basis> of the <polynomials> of degree at most $n$. Their <orthogonal projection> is
$$
\boxed{p_n=\sum_{j=0}^n\frac{(f,Q_j)}{(Q_j,Q_j)}Q_j.}
$$
Indeed its residual is <orthogonal> to every such <polynomial>. For another <polynomial> $q=p_n+r$ of degree at most $n$, the squared error is
$$
\|f-q\|^2=\|f-p_n\|^2+\|r\|^2,
$$
since the cross term vanishes. It is uniquely minimized at $r=0$. The approximation need not have exact degree $n$ when the highest coefficient happens to vanish.
Back to article page