I am working on a problem where I found an orthonormal basis of polynomials that span the vector space V of polynomials $\vec p$ of degree at most 2.
But part(b) of the problem asks to use part(a) to solve the minimization problem
$$\min_{p\in V} \int_{-1}^1 (p(x)-x^3)^2dx$$
So, I know that I want to minimize $(p(x) - x^3)$. So perhaps, I can compute the orthogonal projection of $x^3$ onto the space $V$. This orthogonal projection of $x^3$ onto $V$ will be of minimum norm, which gives us what we want.
However, how can I actually compute this when $x^3$ is not even a vector in $V$?
I had thought of using my orthonormal basis, computing a orthogonal projection matrix, and then applying the matrix to $x^3$ to get some result. This wouldn't make sense, unfortunately ...
So how can I proceed?
Thanks,
The general answer, for a subspace $V$ with an orthonormal basis$(u_i)_{1\le i\le n}$, is $$p(x)=x-\sum_{i=1}^n\langle x,u_i\rangle u_i.$$