# An example of non-closed subspace of a Hilbert space?

I am reading a book on Hilbert space.

It seems that the author assumes that a linear subspace of a Hilbert space can be non-closed.

I cannot think of an example. I am still used to the finite-dimensional case.

Can anyone give me an example?

Let $H = L^2([0,1])$ and let $P$ be the set of polynomials in $H$.
It is only possible with infinite dimensions. A good example of a Hilbert space is a set of real or complex sequences for which the sum of squares absolutely converges. The scalar product of two sequences $x=(x_n)$ and $y=(y_n)$ is
$$\sum_{n=0}^{\infty}x_n\overline{y_n}$$
Let's call $x$ finite if there is such $n$ that for each $i>n$ the following holds: $x_i=0$. The subspace of all finite sequences is then not closed. In fact, it is dense.