A counterexample to theorem about orthogonal projection

Can someone give me an example of noncomplete inner product space $H$, its closed linear subspace of $H_0$ and element $x\in H$ such that there is no orthogonal projection of $x$ on $H_0$. In other words I need to construct a counterexample to theorem about orthogonal projection when inner product space is not complete.


As I did not succeed to come with an example by myself, I tried searching google books for "not complete" "orthogonal projection".

I found a counterexample in the book Linear Operator Theory in Engineering and Science By Arch W. Naylor, George R. Sell, pages 289 and 302. (BTW this was the first ever book on functional analysis I was reading as a student. Now I wish didn't stop somewhere halfway back then - it seems that it contains a lot of interesting things and I remember the style of the book as very readable.)

I will reproduce a brief version of their example below, but it is probably better if you have a look in the book. I've kept the notation from the book, so $X$ is the noncomplete space (your $H$) and $M$ is the subspace (your $H_0$).


Suppose that $H$ is any Hilbert space and $X$ is a dense subspace of $H$ that is not closed. Let $z\in H\setminus X$. We define $$M=\{y\in X; \langle y,z \rangle=0\}.$$ This set $M$ is a closed subspace of $H$.

Now choose $x_0\in X\setminus M$. We will show that $x_0$ has no orthogonal projection on $M$.

Suppose that $y_0\in M$ is the orthogonal projection of $x_0$. This means $y_0-x_0$ is orthogonal to $M$ and thus it is a scalar multiple of $z$. This would imply $z\in X$, a contradiction.


So now we only ask whether it is possible to find $H$, $M$, $z$, $x_0$ as above.

The choice from the book I mentioned is the following: $H=\ell_2$,
$X=$ the set of all sequences that have only finitely many nonzero terms
$z=(\frac1{k^2})_{k=0}^\infty$
$x_0$ can be chosen arbitrary such that $\langle x_0,z \rangle \ne 0$.


Let $H$ be the inner product space consisting of $\ell^2$-sequences with finite support, let $\lambda = 2^{-1/2}$ and put $$ z = \sum_{n=1}^\infty \;\lambda^n \,e_n \in \ell^2 \smallsetminus H $$ Then $\langle z, z \rangle = \sum_{n=1}^\infty \lambda^{2n} = \sum_{n=1}^{\infty} 2^{-n} = 1$.

The subspace $H_0 = \{y \in H\,:\,\langle z, y \rangle = 0\}$ is closed in $H$ because $\langle z, \cdot\rangle: H \to \mathbb{R}$ is continuous.

The projection of $x = e_1$ to $H_0$ should be $$ y = e_1 - \langle z,e_1\rangle\, z = e_1 - \lambda z = \lambda^2 e_1 - \sum_{n=2}^\infty \lambda^{n+1}e_n \in \ell^2 \smallsetminus H_0. $$ For $k \geq 2$ put $$ z_k = \sum_{n=2}^k \;\lambda^{n} \,e_n + \lambda^{k+1} \frac{1}{1-\lambda} e_{k+1} \in H_0. $$ Then $y_k = \lambda^2 e_1-\lambda z_k \in H_0$ because $$ \langle y_k, z\rangle =\lambda^2 - \sum_{n=2}^{k}\,\lambda^{2n+1}-\frac{\lambda^{2k+2}}{1+\lambda} = \lambda^2 - \lambda^2 \sum_{n=1}^\infty \lambda^{2n} = 0. $$ On the other hand, we have $y_k \to y$ in $\ell^2$, so $$ \|e_1 - y\| \leq d(e_1,H_0) \leq \lim_{k\to\infty} \|e_1-y_k\| = \|e_1-y\| $$ and we're done because $y \in \overline{H}_0$ in $\ell^2$ is the only point realizing $d(e_1,\overline{H}_0)$ in $\ell^2$, thus there can be no point in $H_0$ minimizing the distance to $e_1$ because $y \notin H_0$.