TITLE: How to prove that $\,\,f\equiv 0,$ without using Weierstrass theorem?
QUESTION [11 upvotes]: Let $\,f:[0,1] \to \mathbb{R}$ continuous. Show that: 

If
  $$\int_0 ^1 x^k f(x)\, dx=0,$$
  for all $k\in\mathbb N$, then $f\equiv 0$.

I know that it can be proved using Weierstrass Theorem, but I'd like to know whether it is possible to avoid using it?

REPLY [9 votes]: Summary. In what follows, we show that, if $f(x_0)=2a>0$, for some $x_0\in [0,1]$, then  $\int_0^1 f(x)\,M\mathrm{e}^{-M^2 x^2}dx>\pi a$, for sufficiently large $M$, and next approximate $M\mathrm{e}^{-M^2 x^2}$ by polynomials and obtain that for a suitable polynomial $p_N(x)$
approximating the power series of $M\mathrm{e}^{-M^2 x^2}$, we have that $\int_0^1 f(x)\,p_n(x)\,dx>\pi a/2$, which is a contradiction.
Proof. Assume that $f(x_0)\ne 0$, for some $x_0\in [0,1]$, and without loss of generality, that $f(x_0)>0$ and $x_0\in(0,1)$. Then there is an $\varepsilon>0$, such that:
$$
x\in [x_0-\varepsilon,x_0+\varepsilon]\quad\Longrightarrow\quad f(x)\ge \frac{f(x_0)}{2}=a>0.
$$
Now, take $h_M(x)=M\exp(-M^2x^2)$. Then $\int_{\mathbb R}h_M=\pi$, and for every $\delta>0$,
$$
\lim_{M\to\infty} \int_{\lvert x\rvert>\delta}h_M(x)\,dx=0.
$$
We have
$$
\int_0^1 f(x)\,h_M(x-x_0)\,dx =\int_{x_0-\varepsilon}^{x_0+\varepsilon}f(x)\,h_M(x-x_0)\,dx+\int_{\lvert x-x_0\rvert>\varepsilon}f(x)\,h_M(x-x_0)\,dx.
$$ 
Now
$$
\int_{x_0-\varepsilon}^{x_0+\varepsilon}f(x)\,h_M(x-x_0)\,dx\ge a\int_{x_0-\varepsilon}^{x_0+\varepsilon}h_M(x-x_0)\,dx\to a\pi,
$$
as $M\to \infty$, while
$$
\int_{x_0-\varepsilon}^{x_0+\varepsilon}f(x)\,h_M(x-x_0)\,dx\ge \sup_{x\in []0,1]}|f(x)|\int_{|x|\ge \varepsilon}h(x)\,dx\to 0
$$
as $M\to \infty$. Therefore
$$
\liminf_{M\to\infty}\int_0^1 f(x)\,h_M(x-x_0)\,dx\ge a\pi.
$$
In particular, for some $M_0>0$, 
$$
\int_0^1 f(x)\,h_{M_0}(x-x_0)\,dx\ge \frac{a\pi}{2}
$$
But $h_{M_0}(x-x_0)$ can be approximated in $[0,1]$ by polynomials. Simply using Taylor expansion we get
$$
M_0\exp(-M^2_0x^2)=\sum_{n=0}^\infty 
\frac{-(1)^nM^{2n+1}_0x^{2n}}{n!}
=\sum_{n=0}^N \frac{-(1)^nM^{2n+1}_0x^{2n}}{n!}+R_N(x),
$$
where
$$
\lvert R_N(x)\rvert=\frac{M^{2N+1}_0}{(N+1)!}\to 0,
$$
as $N\to\infty$, that means
$$
\lim_{N\to\infty}\sup_{x\in[0,1]} \lvert M_0\exp(-M^2_0x^2)-p_N(x)\rvert=0,
$$
where $\displaystyle p_N(x)=\sum_{n=0}^N \frac{-(1)^nM^{2n+1}_0x^{2n}}{n!}$, and hence
$$
\lim_{N\to\infty}\int_0^1 f(x)\,p_N(x)\,dx=
\int_0^1 f(x)\,h_{M_0}(x-x_0)\,dx\ge \frac{a\pi}{2},
$$
which contradicts the fact that $\int_0^1 f(x)\,p(x)\,dx=0$, for every polynomial $p$.
Note. The idea above is based on the fact that, if 
$d_m(x)=M\mathrm{e}^{-M^2x^2}$ and $f$ continuous and bounded in $\mathbb R$, then
$$
\lim_{M\to\infty}\int_{\mathbb R}d_M(x) f(x)\,dx=f(0).
$$