Let $P^3$ have the inner product given by evaluation at $- 7, -1, 1$ and $7$. Let $p_0(t) = 3, p_1(t) = t$ and $q(t) = \frac{t^2-25}{24}$ with this inner product. To find the best approximation to $p(t) = t^3$ by polynomials in span of $\{p_0,p_1,q\}$.
I have done this far...:
Note that $\{p_0,p_1,q\}$ is an orthogonal set.
The inner product is $\langle p,q\rangle = p(−7)q(−7)+p(-1)q(-1)+p(1)q(1)+p(7)q(7)$.
Thus $\langle p,p_0\rangle = 3[-7^3-1^3+1^3+7^3] = 0$ and $\langle p,q\rangle = -7^3+1^3-1^3+7^3 = 0$. Finally $\langle p,p_1\rangle = 7^4+1^4+1^4+7^4=2 \times7^4+2$.
The difficulty of this problem lies in that $p_0,p_1$ and $q$ do not form an orthogonal basis. However, since $p_0,q$ are even functions and $p$ is an odd function, we have $\operatorname{span}\{p_1,p\}\perp\operatorname{span}\{p_0,q\}$ with respect to the given inner product. Hence the best approximation to $p$ in $\operatorname{span}\{p_0,p_1,q\}$ is simply the orthogonal projection of $p$ onto $\operatorname{span}\{p_1\}$, i.e. $$ \frac{\langle p,p_1\rangle}{\langle p_1,p_1\rangle}p_1. $$