I am trying to check over some work that was done in class by my professor and I am stuck on one part where my answer does not match his answer:
We were given the space $L^2(-1,1)$ where $M=$span$\{1,x,x^2,x^3,x^4,\dots\}$ where $g_0=1, g_1=x,$ etc.
For the Gramm-Schmidt Process to replace the vectors with mutually orthogonal vectors: $$f_0=g_0$$ $$f_1=g_1-\hat{g}_1=g_1-\bigg(\displaystyle\frac{\langle g_1,f_0\rangle}{\langle f_0,f_0\rangle} \cdot f_0\bigg)$$
Note: $\langle g_1,f_0\rangle = \displaystyle\int_{-1}^{1} (g_1 \cdot f_0)\, dx,$ etc.
So,
$$f_0=g_0=1$$ $$f_1=g_1-\hat{g}_1 = x$$
For $f_2$: $$f_2=g_2-\hat{g}_2 = g_2 -\bigg(\displaystyle\frac{\langle g_2,f_1\rangle}{\langle f_1,f_1\rangle} \cdot f_1 + \frac{\langle g_2, f_0\rangle}{\langle f_0,f_0\rangle}\cdot f_0\bigg)$$ $$= x^2 - (0\cdot x + \displaystyle\frac{\frac{2}{3}}{0} \cdot 1)$$
The given solution for $f_2$ that was given to me was $x^2-\frac{1}{3}$.
Is there an error in my calculations?
Note that
$$\frac{\langle g_2, f_0\rangle}{\langle f_0,f_0\rangle}=\frac{\frac23}{2}=\frac13$$