TITLE: Uniformly approximating a function and its derivative using polynomials
QUESTION [6 upvotes]: I'm struggling either proving or disproving the following statement:

Let $K\subset \mathbb{R}$ be compact, and $S = \mathrm{span}\{p_k, k = 0, 1, \ldots\}$, where $p_k$'s are polynomials over $K$. If $S$ is dense in $C^1(K)$ with respect to sup-norm, then for any $f\in C^1(K)$, there exists $\{g_n\} \subset S$ such that $g_n$ uniformly approximates $f$ with $f'$ uniformly approximated by $g_n'$.

This statement seems to be true, although $S$ is only a subset of all polynomials over $K$. If the statement appears false, is there any prior assumption that makes it true? Any reference or direct answer would greatly help me.

REPLY [9 votes]: The span of $\{x^{2k}\colon k=0,1,2,\dots\}$ is dense in $C([0,1])$. But all their derivatives vanish at $0$.

REPLY [3 votes]: Any prior assumption that makes it true. A   simple case where your statement is true is the case of   an interval $K\subset\mathbb{R}_+ $, and $(p_k)_{k\ge0}$ are monomials, $p_k(x)=x^{n_k}$, of degrees $0=n_0<n_1<\dots$. For in this case,   by the Müntz-Szász Theorem,  the  $(p_k)_{k\ge0}$ span a dense subspace in $C^0(I)$, if and only if their derivatives $(p'_k)_{k\ge0}$ do (this of course because $\sum_{k=1}^\infty\frac{1}{n_k}=+\infty$ if and only if $\sum_{k=2}^\infty\frac{1}{n_k-1}=+\infty$).
If by the assumption $S$ is uniformly dense in $C^1(I)$, it is also uniformly dense in $C^0(I)$, therefore the span of the $(p'_k)_{k\ge0}$ is also uniformly dense in $C^0(I)$. Hence, for any $f\in C^1(K)$ there is a sequence $g_n\in S$ such that $g_n'$ converges uniformly to $f'$; since $S$ contains the constants, we can assume $g_n$ converges to $g$ at least on a pont of $K$, but then also $g_n$ converges uniformly to $f $ by the theorem of limit under the sign of derivative.