Finding the orthogonal projection of a function onto a subspace in a Hilbert space How I can I find the distance $d(f,V)$ in $L^2 [0,1]$ where $f$ is the function $f(x)=x$ and $V$ is the space $\mathrm {span}\{x^{2n}\mid n∈ \mathbb N \}$?
I can not decompose $f$ into a sum of even and odd functions since $[0,1]$ is not symmetric. What other options can be used in order to minimize $||f-v||_2$?
 A: The orthogonal projection of $f$ onto $V$ is the unique element $v\in V$ such that
$$
                     (f-v)\perp V.
$$
The functions $\mathcal{B}=\{ 1,cos(\pi x),\cos(2\pi x),\cdots \}$ form an orthogonal basis of $L^2[0,1]$, which can be seen by extending $f$ to an even function on $[-1,1]$ and computing the Fourier series for $f$. The resulting series converges in $L^2[-1,1]$ to that even extension, which means that the series also converges in $L^2[0,1]$ to $f$ itself.
Every function $\cos(n\pi x)-1$ is in the closed linear span of positive even powers of $x$ and, hence, is in $V$. Therefore, the orthogonal projection $v$ of $f$ onto $V$ must satisfy
$$
         \langle f-v,\cos(n\pi x)-1\rangle=0,\;\; n=1,2,3,\cdots, \\
          \langle f-v,\cos(n\pi x)\rangle = \langle f-v,1\rangle.
$$
The right side $\langle f-v,1\rangle$ cannot be non-zero by Bessel's inequality applied to the orthogonal basis $\mathcal{B}$. Therefore it follows that $f-v=0$ because $\langle f-v,\cos(n\pi x)\rangle = 0$ must hold for all $n=0,1,2,\cdots$. Hence $v=f$. Because of this, it follows the orthogonal projection onto $V$ is the identity operator, and $V=L^2[0,1]$.
A: Use best approximation theorem in Hilbert space.  Since $V$ is a subspace so $d(f, V)=||f-v||$ where $v\in V$ ,  that is distance is attained.  And also $v$ is such that $f-v$ is perpendicular to the subspace $V$ . 
