# When is a vector space of polynomials dense in $C([0,1])$?

Weierstrass' theorem states, in particular, that the set of polynomials with real coefficients is dense (with the supremum norm) in the set of continuous function on $[0,1]$. Using the Stone-Weierstrass theorem, one can specialize further: the set of polynomials in which each monomial is of even degree (e.g., $x^6+3x^4+7$ is one, but $x^2+x$ is not) satisfied the conditions, and is once again dense in $C([0,1])$. Moving further, the algebra generated by $x^n$ and $1$ is again dense for the same reasons. But how sparse can the dense sets be? How important is the algebra condition?

Given a subset $S \subset \Bbb N$, when is the vector space $P_S$ generated by $\{x^n : n \in S\}$ dense in $C([0,1])$? In particular, what if $S$ is the odd positive integers (and 0)?

Of course, if S contains all the multiples of some $n$, $P_S$ is dense by the argument above; and if it's finite, $P_S$ is not dense. But I'm unable to see anything else.

This is answered by the Müntz–Szász theorem. Include $0$, then any sequence of positive integers such that the sum of their reciprocals diverges.
Another way to see that you can use $0$ together with the odd numbers is to take $g(x)=f(x)-f(0)$, then extend $g$ to an odd (continuous) function on $[-1,1]$, then use the Weierstrass approximation theorem to approximate $g$ with odd polynomials, then add $f(0)$.