Find the orthogonal projection of a function on the set of $L^2$ functions whose integrals are $0$ 
Given $u\in L^2(0, 1)$, find its orthogonal projection on $V =\{v∈L^2(0,1):\int_0^1 v(x)\ dx=0\}$.

For Hilbert spaces it holds a theorem about projections on a closed convex set which states that given a subset $C$ of an Hilber space $H$, $u\in H$, $v\in C$, then $\langle u-v,g-v\rangle\le0,\ \forall\ g\in C$, and $v$ is the orthogonal projecition of $u$ in $C$.
$V$ is closed if every sequence $\{v_n\}\subset V$ converges to an element of $V$, i.e. if $\forall\ \phi(x)\in L^2(0,1):\lim_{n\to+\infty}\int_0^1v_n\phi=\int_0^1v\phi$ (weak convergence).
Take $\phi=\chi_{(0,1)}$, then $\int_0^1v_n\phi=\int_0^1v_n=0$ and $\lim_{n\to+\infty}\int_0^1v_n=\int_0^1v=0$. Then $V$ is closed.
$V$ is convex if every convex combination of two elements of $V$ is still an element of $V$, but I don't know how to check this.
Another theorem about Hilbert spaces says that every Hilbert space splits into the direct sum of any closed subspace and its orthogonal. Statement: given a Hilbert space $X$, a closed subspace $Y$ and the map $p$ which sends any element $x\in X$ to its closest element in $Y$, then $p$ is linear, continuous, and $x-p(x)$ is orthogonal to $Y$. Moreover, if $\{e_1,...,e_n\}$ is an orthonormal basis of $Y$, then $p(x)=\sum_1^n\langle x,e_i\rangle e_i$.
I read that examples of orthonormal basis for $L^2[0,1]$ are $\{e^{2πinx}\}$, for $n$ from $-\infty$ to $+\infty$, and the Legendre polynomials. But these two basis have infinite dimension and so cannot be used to compute $p(x)$, right?
Any hint on how to start the exercise?
 A: Note that
$$
     V = \left\{ f \in L^2 : \int_0^1 fdx = 0 \right\} = [\{ 1\}]^{\perp}.
$$
So $L^2=V\oplus [\{1\}]$. The orthogonal projection of $f$ onto $[\{1\}]$ is $\langle f,1\rangle 1$, and the orthogonal projection of $f$ onto $V$ is $f-\langle f,1\rangle 1$.
A: For each $u\in L^2\bigl((0,1)\bigr)$,$$u=\overbrace{u-\int_0^1u(x)\,\mathrm dx}^{\in V}+\overbrace{\int_0^1u(x)\,\mathrm dx}^{\in V^\perp}$$and therefore the projection that you're after is$$u-\int_0^1u(x)\,\mathrm dx.$$
A: You ask "Where do I start?" and the answer to that is to look at "But these two bases have infinite dimension and so cannot be used to compute $p(x)$, right?"  In a finite-dimensional vector space, there is only one way to add up linear combinations of basis vectors -- repeated two-vector addition.  But in infinite-dimensional vector spaces, there are multiple possibilities.  So, when you say, "I read that examples of orthonormal bases for $L^2[0, 1]$ are ...", you are implicitly referencing the definitions of linear combination (addition) used in the proofs that those two sets are bases.  So make sure you understand what those definitions are.  Within that context, an (infinite) basis of an infinite-dimensional vector space will act (much) like a finite-dimensional vector space.
After that, I note that $V = \{v: v \cdot 1 = 0 \}$ (where $1$ is the constant-1 function), and $1$ is a member of both orthonormal bases that you mention...
