If you don't mind, please consider the eigenvalue problem $$ (1-x^2)u''+ \lambda u=0 \ \ \ \forall x\in (-1,1), $$ $$ u(\pm 1) = 0. $$ Observe that for suitable values of $\lambda$, the ODE resembles a Gegenbauer differential equation (on the boundary of the typical parameter range) that yields an orthonormal basis of polynomials in an inner product space with singular weight, $$ (f,g) = \int_{-1}^1 \frac{f(s)g(s)}{1-s^2}ds .$$ An orthogonal polynomial basis (w.r.t. the above inner product) can be calculated without difficulty (from approximation of regular Gegenbauer polynomials or otherwise). Denote the basis of polynomials (of order n) by $\phi_n$ for $n\in\mathbb{Z}$ with $n\geq 2$. Note that order 0 and 1 polynomials are exculded due to the boundary conditions ... and normalisation from the singular weight).
Now the question ... In general, for what $f:[-1,1]\to\mathbb{R}$ does $$ \left|\left| f - \sum_{n=2}^\infty (f,\phi_n)\phi_n \right|\right| = 0 $$ hold (where the norm is that induced by the inner product space)?
I suppose I don't mind if the question is restricted to $f\in C^2([-1,1])$ since ultimately I care about this case.
Helpful references are also appreciated.