Find the polynomial p(x) which minimizes the distance
Presumably means the set of cubic polynomials?
Step 1 is to find an orthonormal basis for , with respect to the inner product given by . You do this by starting with the natural basis and applying the Gram–Schmidt process.
After you have done that, the rest is easy, because p(x) will be given by the formula .