Consider $$C[-1,1]=\text{space of continuous functions defined on} \ [-1,1]$$ equipped with inner product $$<f(x),g(x)>=\int^1_{-1}f(x)g(x)dx.$$ Orthogonally project $f(x)=\vert{x}\vert$ onto the subspace of $C[-1,1]$ consisting of polynomials of degree $\leq$ 3.
Here's what I did.
$\text{proj}_{(1)}(\vert{x}\vert)+\text{proj}_{(x)}(\vert{x}\vert)+\text{proj}_{(x^2)}(\vert{x}\vert)+\text{proj}_{(x^3)}(\vert{x}\vert)=\frac{<1,\vert{x}\vert>}{<1,1>}+\frac{<x,\vert{x}\vert>x}{<x,x>}+\frac{<x^2,\vert{x}\vert>x^2}{<x^2,x^2>}+\frac{<x^3,\vert{x}\vert>x^3}{<x^3,x^3>}$
$\ $ $\ $$\ $ $\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$\ $$=\frac{1}{2}+\frac{5x^2}{4}$
But the answer given is $\frac{15x^2}{16}+\frac{3}{16}$
Where did I go wrong?
The problem is that the formula you're using assumes the basis to be orthogonal, which it is not. For an orthogonal list $B = (e_1, \ldots, e_k)$ spanning a space $W$, $$\operatorname{proj}_W(x) = \sum_{i=1}^k \operatorname{proj}_{e_i} x,$$ but equality doesn't hold if $B$ is not orthogonal.
As a concrete example, consider $e_1 = (1, 0, 0)$ and $e_2 = (1, 1, 0)$, spanning the $x$-$y$ plane in $\Bbb{R}^3$. The projection of $x = (1, 1, 1)$ onto this plane is $(1, 1, 0)$. But, \begin{align*} \operatorname{proj}_{e_1}(1, 1, 1) &= \frac{(1, 1, 1) \cdot (1, 0, 0)}{(1, 0, 0) \cdot (1, 0, 0)} (1, 0, 0) = (1, 0, 0) \\ \operatorname{proj}_{e_2}(1, 1, 1) &= \frac{(1, 1, 1) \cdot (1, 1, 0)}{(1, 1, 0) \cdot (1, 1, 0)} (1, 0, 0) = (1, 1, 0), \end{align*} but these vectors do not sum to the projection $(1, 1, 0)$.
To correct your method, apply Gram-Schmidt to the basis $(1, x, x^2, x^3)$, and perform the same computations with the orthonormal basis (I don't envy your job).