I know that $C_{c}^{\infty}{([a,b])}$ is dense in $L^2([a,b])$.
Some common/standard orthonormal bases for $L^2([a,b])$ are the Fourier basis and the exponential basis ${(e^{inx} ,\forall n\in \mathbb{Z})}$. All elements of both of these bases are smooth functions (not with compact support however).
It is my understanding that since we have an orthonormal basis, these functions have to be dense in $L^2([a,b])$. I don't think that the converse holds though (dense set of functions does not imply an ONB). I am struggling a little bit with the intuition behind this.
Here is my question: are there any additional criteria that will turn a dense set of functions into an ONB in $L^2([a,b])$? Would smooth, periodic functions be sufficient? Any help would be appreciated!