Prove orthornormal set is a basis 
Suppose that $\{u_n\}_{n=1}^\infty$ is an orthonormal subset of Hilbert space $\mathcal{H}$ and $\mathcal{S}$ is a dense subset of $\mathcal{H}$.
  Show $\{u_n\}_{n=1}^\infty$ is an orthonormal basis for $H$ if
  $||f||_\mathcal{H}^2 = \sum_{n=1}^\infty |\langle f\mid u_n\rangle|^2$ for all $f\in \mathcal{S}$

Attempt:
Let $h\in \mathcal{H}$ is arbitrary, and $f\in\mathcal{S}$ is close to $h$
By bessel's ineq, $\sum_n |\langle h, u_n\rangle |^2\leq ||h||^2$ but I can't seem to find a lower bound for $\sum_n |\langle h, u_n\rangle|^2$ using $f$
I'm not sure how to translate closeness between $f,h$ to closeness between $|\langle f,u_n\rangle|, |\langle h,u_n\rangle|$
 A: If $\{u_n\}_{n=1}^{\infty}$ is an orthonormal subset of a Hilbert space $H$, then Parseval's equality holds for some $x\in H$ iff $x$ is in the closed linear span $\mathcal{U}$ of $\{ u_n \}$. So, if a subspace $\mathcal{S}$ is contained in $\mathcal{U}$, then so its closure $\mathcal{S}^c$; and if $\mathcal{S}$ is dense, then Parseval's equality holds for all $x\in H$, which means $\{ u_n \}$ is an orthonormal basis.
A: The answer by DisintegratingByParts is perfectly fine, but maybe this is more elementary.
An orthonormal set is an orthonormal basis if it is spanning, i.e., its span is dense. Assume your sequence $(u_n)_{n\in \mathbb N}$ is not spanning, then there exists $y \neq 0$ in the orthogonal complement of the closure of the span of $(u_n)_{n\in \mathbb N}$. 
Let $(y_m)_{m\in \mathbb N}$ be a sequence in $S$ converging to $y$ (exists due to density) then you have that for every $\epsilon>0$ there exists $M\in \mathbb N$ such that for all $m \geq M$:
$$
\|y\|^2 -\epsilon \leq  \|y_m \|^2 =   \sum_{n\in \mathbb N} | \langle y_m, u_n \rangle|^2 \leq 2\sum_{n\in \mathbb N} | \langle y_m - y, u_n \rangle|^2 + 2\sum_{n\in \mathbb N} | \langle y, u_n \rangle|^2 \leq 2\|y_m - y\|^2 \to 0, \text{ for } m \to \infty,
$$
where the last estimate follows by the Bessel inequality and the orthogonality of $y$ on all $u_n$. Since $\epsilon$ was arbitrary, we get that $y = 0$. A contradiction. Hence $(u_n)_{n\in \mathbb N}$ is spanning and thus an orthonormal basis.
