I would like to know when is a sequence of real numbers the Fourier coefficients of some $L^2([a,b])$ function for a fixed orthonormal basis $e_n$ of $L^2([a,b])$.
I know a sufficient condition: Let $a_n$ be a sequence of real numbers. If $\sum\limits_{i=1}^\infty a_i e_i(.)$ converges uniformly, and denoting $f$ its limit, then $a_n$ are the Fourier coefficients of $f$.
But is this condition also necessary ? If not, what is a sufficent and necessary condition for $a_n$ to be Fourier coefficients for the basis $e_n$ ? In other words, under what sufficent and necessary condition on $a_n$, there exists $f \in L^2([a,b])$ such that $a_n$ are the Fourier coefficients of $f$ for the basis $e_n$ ?
Edit: Being a Fourier coefficient of $f$ for the basis $e_n$ means $a_n=\int_a^b f(x) e_n(x) \, dx$
The condition is also necessary because you have an orthonormal set. If $\{a_n\}\in\ell^2(\mathbb N)$, then by the orthonormality $$ \left\|\sum_{j=n}^ma_je_j\right\|^2=\sum_{j=n}^m|a_j|^2. $$ So the convergence of $\sum_j|a_j|^2$ guarantees that the sequence of partial sums of $\sum_ja_je_j$ is Cauchy, and so it is convergent to an $f$ as $L^2$ is complete.
Now you have, since the inner product is continuous, $$ \langle f,e_m\rangle=\langle \sum_na_ne_n,e_m\rangle=\lim_{k\to\infty}\langle \sum_{n=1}^ka_ne_n,e_m\rangle=a_m. $$ That the inner product is continuous is a direct consequence of the Cauchy-Schwarz inequality.