Orthogonal Projections 
Consider the real inner product space $$C([-1,1]) = \{ f : [-1,1] \rightarrow \mathbb{R} : f \text{ is continuous } \}$$ with its usual inner product $$\langle f,g\rangle=\int_{-1}^{1} f(t) g(t) \, dt.$$ Find the orthogonal projection of $f=|t|$ onto the subspace $W = \text{Span}(\{1,t,t^2\})$.

This is a question on the practice final for my linear algebra class. I've been able to do orthogonal projections when they are real vectors onto a plane, but am confused how to go about this one. 
I know $f(\textbf{-t})=f(\textbf{t})=\textbf{t}$. 
Isn't $\textbf{t}$ already in $W$?
Am I missing something here?
 A: Let $p = proj_{W} f$, then by Gram-Schmidt an orthogonal basis is 
$$\{ 1, t, t^2 -1/3\}$$
Thus without normalizing $$p =  \left < 1, |t| \right >1/2 + \left <t, |t| \right > \frac{t}{2/3} + \left <t^2 -1/3,|t| \right>\frac{(t^2 - 1/3)}{8/45}.$$
The integration needed are
$$\int_{-1}^{1} |t| dt = 2 \left(\frac{1}{2}(1)(1) \right) = 1 \quad \text{area of triangle.}$$
$$\int_{-1}^{1} t|t| dt = 0 \quad \text{odd integrand.}$$
\begin{align}
\int_{-1}^{1} t^2|t| dt &= \int_{-1}^{0} t^2(-t) dt+  \int_{0}^{1} t^2(t) dt\\
&= \frac{1}{4} + \frac{1}{4}\\
&= \frac{1}{2}.
\end{align}
or use the fact that the integrand is even, and $|t| = t$ for $t \in [0,1]$ to evaluate $$2\int_{0}^{1}t^3 dt = \frac{1}{2}.$$
The rest follows from some simple rules of integration. 
A: The orthogonal projection of $|t|$ onto the linear space spanned by $\{ 1,t,t^{2}\}$ is the unique polynomial $p(t)=a+bt+ct^{2}$ such that
$$
                 (|t|-p,1)=(|t|-p,t)=(|t|-p,t^{2})=0.
$$
That's the simplest definition of orthogonal projection. So you need to solve for $a$, $b$, $c$ such that
$$
\begin{align}
        0 & =\int_{-1}^{1}(|t|-a-bt-ct^{2})\,dt = 1-2a-2c/3, \\
        0 & =\int_{-1}^{1}(|t|-a-bt-ct^{2})t\,dt = -2b/3, \\
        0 & =\int_{-1}^{1}(|t|-a-bt-ct^{2})t^{2}\,dt = 1-2a/3-2c/5 .
\end{align}
$$
The equations are fairly straightforward, provided I didn't mess up one or more integration terms. Note: the odd terms integrate to $0$, which includes the integrals of $bt$, $|t|t$, $-at$, $-ct^{3}$, $bt^{3}$.
