Where does polynomials come from in Stone Weierstrass? It might be a silly question to ask but most versions of Stone Weierstrass theorem define polynomials inductively and shows that it converges to a particular function. To make the previous sentence meaningful, consider the following theorem

Define a sequence $(P_n)_{n=0}^\infty$ of polynomials recursively by the relations $P_0(t)=0$ and $P_{n+1}(t)=P_n(t)+1/2 [ t^2-P_n(t)^2]$. Then $P_n\to \mid t \mid $ uniformly on $[-1,1]$.

Now my question is where do these polynomials come from? Thanks for any help!
 A: In its most general version the Stone-Weierstrass theorem is a result about generating dense subalgebras of $C(X)$ = unitary algebra of continuous functions $f : X \to \mathbb{R}$ endowed with the compact-open topology (which is the topology of uniform convergence on all compact subsets of $X$). Note that if $X$ is compact, then $C(X)$ has the topology of uniform convergence.
Any subset $D \subset C(X)$ generates a smallest unitary subalgebra $A(D) \subset C(X)$. It is easy to see that $A(D)$ is the set of functions having the form $p(f_1,\dots,f_n)$, where $f_i \in D$ and $p$ ranges over all polynomials in $n \ge 1$ variables (all $n$ allowed).
This is the true origin of the polynomials in the Stone-Weierstrass theorem which says the following:
If $D$ separates points (which means that for any two distinct $x,x' \in X$ there exists $f \in D$ such that $f(x) \ne f(x')$), then $A(D)$ is dense in $C(X)$.
Now let $X = [-1,1]$. Then $D = \{ id \}$, $id(x) = x$, trivially separates points and $P(X) = A(D)$ is the set of all polynomials in the variable $x$. That $P(X)$ is dense in $C(X)$ is the "classical" Stone-Weierstrass theorem. One can certainly give a direct proof by constructing inductively a sequence of polynomials converging to a given $f \in C([-1,1])$, but in my opinion this is an unusual (though valid) approach.
Edited:
A key ingredient in the proof of the Stone-Weierstrass Theorem is the following result:
Let $A \subset C(X)$ be a unitary subalgebra. If $f \in A$, then $\lvert f \rvert \in \overline{A}$.
This is proved as follows (here we only consider compact $X$, but the argument can be generalized to arbitrary $X$).
For $f : X \to \mathbb{R}$ let $R = \sup_{x \in X} \lvert f(x) \rvert$. Then $f/R \in C(X)$ and $(f/R)(X) \subset [-1,1]$. If we can find a sequence of polynomials $p_n(t)$ such that $p_n(t) \to \lvert t \rvert$ uniformly on $[-1,1]$, then $p_n(f(x)/R) \to \lvert f(x)/R \rvert$ uniformly on $X$. Defining $f^*_n(x) = Rp_n(f(x)/R)$ we see that $f^*_n(x) \to  \lvert f(x) \rvert$ uniformly on $X$. But we have $f^*_n \in A$ because $f/R \in A$ and $p_n$ is a polynomial (recall that $A$ is a unitary algebra). Note that to conclude $p_n(f/R) \in A$ it is essential that $p_n$ is a polynomial.
So how to find these $p_n$? There are certainly many approaches. Not all of of them construct the $p_n$ recursively as in your question. An alternative is to construct polynomials $q_n(x)$ such that $q_n(x) \to \sqrt{x}$ uniformly on $[0,1]$. Then $p_n(x) = q_n(x^2)$ is a solution. But now it is known that
$$1 - \sqrt{1-y} = \sum_{i=1}^\infty \left\lvert \binom{\frac{1}{2}}{i} \right\rvert y^i$$
uniformly on $[0,1]$. Therefore $q_n(x) = 1 - \sum_{i=1}^n \left\lvert \binom{\frac{1}{2}}{i} \right\rvert (1-x)^i$ will do.
Conclusion:
Polynomials are essential to prove the Stone-Weierstrass theorem. The reason is that $A$ being a unitary subalgebra of $C(X)$ is equivalent to the following:
For all polynomials $p$ in $n \ge 1$ variables and all $f_1,\dots,f_n \in A$ one has $p(f_1,\dots,f_n) \in A$.
However, in the general formulation of the Stone-Weierstrass theorem this fact is not explicitly mentioned. But it is implicit in the assertion that $A(D)$ is dense in $C(X)$ because $A(D)$ is generated by polynomials.
