# If $B$ spans a dense subspace of a Hilbert space $H$, is it a basis for $H$?

In the proof that every separable Hilbert space has a countable orthonormal basis, this step seems to be regarded as obvious. But I am having a hard time understanding.

The general idea of the proof is that if Hilbert space $H$ contains a countable dense subset $D$, then there exists a countable basis $B$ of $\mathrm{span}(D)$. By Gram-Schmidt orthogonalisation, we can turn $B$ into a countable orthonormal linearly independent set $O$. Therefore $\mathbf{span(D)}$ has a countable orthonormal basis, namely $O$. How do we know that $H = \overline{\mathrm{span}(D)}$ has a countable orthonormal basis? I am either missing something, or "basis" is defined differently in Hilbert space theory!?

• From wikipedia: "If $V$ is a Hilbert space, an orthogonal basis is a total (having span dense in $V$) subset $B$ of $V$ such that elements in $B$ are nonzero and pairwise orthogonal." The definition of basis here is different than the algebraic version (Hamel basis); the former allows series (which is why denseness is enough) while the latter only involves finite combinations. – angryavian Aug 23 '16 at 19:03
• Thank you - this caused me a lot of confusion! – Stanley Aug 23 '16 at 19:39