Recognition of an orthonormal complete set in an Hilbert Space I recently came across this exercise:
Let $u_n:[0,1]\to \mathbb R$ be the sequence of functions defined by:
$$(u_n):=\text{sign }(\sin(2^n\pi x)),\qquad n=0,1,2,\dots$$
a)Prove that this set of functions is an orthonormal system in $L^2([0,1])$.
b)Is this set of functions a complete orthonormal system in $L^2([0,1])$?
This was the exercise. Nothing special I agree, but it happened that a few time ago I answered this topic Link. Two question on orthonormal basis in less than a week are too much to stand for my mind, so the question naturally arose:

Is it possible to find general criteria (similar to the one in the link) to recognize an orthonormal basis or at least could you gently give me some references/proofs of similar/related topics?

I'm not looking for answers of the type: $\langle (u_n)_{n\in\mathbb N}\rangle^{\perp}=0,$ there is no orthonormal set in which $(u_n)_n$ is properly contained and stuff like this, but something less known or, how can I say, a condition easy to verify, more practical than the theoretic definitions. Thanks in advance for your replies.
BTW: if anybody wants to try the exercise, he will be welcomed.
 A: As far as I know, in general you just have to do the calculations and show that what you have is an orthonormal system, and then show that it generates. Now, for example, if you can show that you can approximate any continuous function by these functions then you're all set, because continuous functions are dense in $L^p[0,1]$. You could also show that they approximate all step functions, which are also dense in $L^p[0,1]$. It's a lot easier to reduce the problem to some dense subset.
In this case, I'll prove that these functions do not form a basis:
First of all, let's see exactly what $u_n$ is. We know that for $y\geq 0$, $\sin(y)$ is greater than or equal to zero when $y\in[0,\pi]\cup[2\pi,3\pi]\cup[4\pi,5\pi]\cup\cdots$. If we put $y=2^n\pi x$, we obtain that $\sin(2^n\pi x)$ is greater than or equal to zero when $x\in[0,\frac{1}{2^n}]\cup[\frac{2}{2^n},\frac{3}{2^n}]\cup[\frac{4}{2^n},\frac{5}{2^n}]\cup\cdots$.
In other words, we have that 
$$u_n=\left\{\begin{array}{ll}-1&x\in\left(\frac{1}{2^n},\frac{2}{2^n}\right)\cup\left(\frac{3}{2^n},\frac{4}{2^n}\right)\cup\cdots\\
0&x\in\left\{\frac{k}{2^n}:k\in\mathbb{N}\right\}\\
1&x\in\left(0,\frac{1}{2^n}\right)\cup\left(\frac{2}{2^n},\frac{3}{2^n}\right)\cup\cdots\end{array}\right.$$
Let's see that this is an orthonormal system: Let $m$ and $n$ be two natural numbers, and let's suppose that $m>n$. We can see that
$$\left[0,\frac{1}{2^n}\right]=\left[0,\frac{1}{2^m}\right]\cup\left[\frac{1}{2^m},\frac{2}{2^m}\right]\cup\cdots\cup\left[\frac{2^{m-n}-1}{2^m},\frac{}{}\right].$$
We then have that
$$\int_0^1u_mu_ndx=\int_0^{1/2^n}u_mdx-\int_{1/2^n}^{2/2^n}u_mdx+\cdots-\int_{(2^n-1)/2^n}^1u_mdx$$
$$=\sum_{k=0}^n(-1)^k\int_{k/2^n}^{(k+1)/2^n}u_mdx.$$
Now, since we can divide each interval $[\frac{k}{2^n},\frac{k+1}{2^n}]$ into intervals of the form $[\frac{r}{2^m},\frac{r+1}{2^m}]$, and since $u_m$ integrates zero of the union of two consecutive intervals of this type, we have then that each of the summands is zero, and thus we obtain that the initial integral is zero.
It is easy to see that each $u_n$ has norm 1, since $u_m^2=1$ almost everywhere. 
To see if they form an orthonormal basis, we have to see that any function in $L^2[0,1]$ can be approximated by $\mbox{span}(u_n)_{n\in\mathbb{N}}$.
A: Regarding point b
Consider the space of piecewise constant functions in the intervals $ [0,\frac{1}{4}]$, $ [\frac{1}{4},\frac{1}{2}]$, $ [\frac{1}{2},\frac{3}{4}]$, $ [\frac{3}{4},1]$.
This space is orthogonal to all $u_n$, for $n>2$. On the other hand these functions cannot be spanned by the vectors $u_0$, $u_1$, $u_2$, on the basis of dimensionality.
Regarding the general question, here is a criterion valid for reproducing kernel Hilbert spaces:
Let $e_n(x)$, be an orthonormal basis of functions in a reproducing kernel Hilbet space with kernel $k(x,y)$, then:
$\sum_n e_n(x) e_n(y) = k(x,y)$.
(under pointwise convergence). Please see a proof in the following exposition by: V.I. Paulsen (theorem 3.4).
