Calculating a function using orthogonal projection of vector on a subspace Let  $V$ be a closed subspace of $L^2[0,1]$ and $f,g \in L^2[0,1]$ be given by $f(x)=x,g(x)=x^2.$
If $V^{\perp}=span\{f\}$ and $Pg$ be the the orthogonal projection of $g$ on $V,$
then $(g-Pg)(x), x\in$ [0,1] is = ?


*

*$\frac{3}{4}x$

*$\frac{1}{4}x^2$

*$\frac{3}{4}x^2$

*$\frac{1}{4}x$


My thought:
First we have to find out $V$ and a orthonormal basis for it .Then using inner product on $L^2[0,1]$,I can calculate  the orthogonal projection. But I don't know how to find V using the given conditions or does there exist any simple  method to calculate orthogonal projection ? Please help.
Thanks.

By the Hilbert Projection Theorem, $g-Pg \in V^\perp$. Thus, $Pg=g-cf$ for some $c$.
$$0=\langle f,Pg \rangle=\langle f, g-cf \rangle = \int_0^1 x^3 \mathop{dx} + c \int_0^1 x^2 \mathop{dx} = \frac{1}{4} - \frac{c}{3}.$$
Thus, $c=3/4$, so $g-Pg=3f/4$.
