Solution (source code)

= Solution

The moments are $\int_0^1x^{j+2}\,dx=1/(j+3)$. The <Gram-Schmidt process> first gives the constant $\phi_0=\sqrt3$. Removing the constant component of $x$ gives $r_1=x-3/4$, with squared norm $1/80$, hence $\phi_1=4\sqrt5(x-3/4)$.

For the quadratic, imposing orthogonality of $r_2=x^2+ax+b$ to one and $x$ gives $1/5+a/4+b/3=0$ and $1/6+a/5+b/4=0$. Thus $r_2=x^2-4x/3+2/5$, whose squared norm is $1/1575$. Taking positive leading coefficients, the first three <orthonormal polynomials> are
$$
\boxed{\phi_0=\sqrt3,\qquad\phi_1=\sqrt5(4x-3),\qquad\phi_2=\sqrt7(15x^2-20x+6).}
$$