Real analysis polynomial approximation proof Let be $f:[a,b] \rightarrow \Bbb{R} $ continous with $\int_a ^b f(x)p(x)dx = 0$,  $\forall p(x)$ polynomial.
Using Stone-Weiestrass theorem, show that:
$f(x)=0,\ \forall x\in [a,b]$.
First, I'll asume this refers to 
Theorem (Weiestrass Aproximation)
$\forall f \in \mathscr C[a,b], \exists$ $\{p_n\}_\Bbb N$ shuch that
$\{p_n\}_\Bbb N$ converges to $f(x), \forall x\in [a,b]$
but still, I can't find a way to prove it.
 A: Easy facts: 1. If $g_n \to g$ uniformly on $[a,b]$ and $f$ is bounded on $[a,b],$ then $g_nf\to gf$ uniformly on $[a,b].$ 2. If $f_n$ is a sequence of Riemann integrable functions on $[a,b],$ and $f_n \to f$ uniformly on $[a,b],$ then $f$ is Riemann integrable on $[a,b]$ and $\int_a^b f_n \to \int_a^b f.$
In our problem, Weierstrass shows (we don't need Stone here, with all due respect), there is a sequence of polynomials $p_n$ such that $p_n\to f$ uniformly on $[a,b].$ Thus by the above, $p_nf \to f^2$ uniformly on $[a,b].$ Therefore $\int_a^b fp_n\to \int_a^b f^2.$ Since each $\int_a^b fp_n = 0,$ we have $\int_a^bf^2 = 0.$ The continuity of $f$ then implies $f\equiv 0.$
A: Sketch: suppose $f$ is not identically zero and $p$ is a polynomial which is uniformly close to $f$. It is still a polynomial, so 
$$\int_a^b f(x) p(x) dx = 0$$
by assumption. We can "add and subtract" to rewrite this same integral in terms of the small quantity $f-p$:
$$\int_a^b f(x) p(x) dx = \int_a^b p(x)^2 dx + \int_a^b (f(x)-p(x)) p(x).$$
Now that second term on the right side of the last equation goes to zero as $p \to f$, while the first term instead converges to $\int_a^b f(x)^2 dx > 0$. Thus the left side is zero while the right side is positive, which is a contradiction.
Sprinkle epsilons as needed and you have a rigorous proof.
A: Let $\varepsilon > 0$. Choose a polynomial $p$ such that for all $x \in [a,b]$, $|p(x) - f(x)|<\varepsilon$.
Then
\begin{align*}
\varepsilon^2(b-a) &≥ \int_a^b(f(x)-p(x))^2dx\\
&= \int_a^bf(x)^2dx+\int_a^bp(x)^2dx-2\int_a^bf(x)p(x)dx\\
&= \int_a^bf(x)^2dx+\int_a^bp(x)^2dx\\
&≥ \int_a^bf(x)^2dx ≥ 0\\
\end{align*}
This means $\int_a^bf(x)^2dx = 0$, but if $f(x)$ was non-zero somewhere but also continuous you know that $\int_a^bf(x)^2dx > 0$. Hence $f(x) = 0$ for all $x \in [a, b]$.
