Let f be a continuous function on [0, 1].The moments of f can refer to the quantities $\int_0^1x^nf(x)dx$ for n = 0,1,2... . Prove that two continuous functions defined on [0, 1] are identical if they have the same sequence of moments.
I know we have to use Weierstrass Approximation Theorem. But I don't know use it on this problem.
As a lemma, suppose that $f$ is continuous and that $$\int_0^1 x^nf(x)\,dx = 0$$ for all $n\in\mathbb N$. We'll show that $$\int_0^1 f(x)^2\,dx = 0$$ which, of course, implies that $f$ is identically zero on $[0,1]$ since, otherwise, the above integral would be positive.
Then, given two functions $f$ and $g$ with identical moments, we can apply the above lemma to $f-g$ to see that $f$ and $g$ are equal.
To prove the lemma, let $\varepsilon>0$, let $M$ denote the maximum of $f$ on $[0,1]$, and, by the Weierstrass Approximation Theorem, choose a polynomial $p(x)$ such that $|f(x)-p(x)|<\varepsilon/M$ for every $x\in[0,1]$. Then, by linearity of the integral, $$\int_0^1 f(x)p(x)\,dx = 0.$$ Thus, \begin{align} \left|\int_0^1 f(x)^2\,dx\right| &= \left|\int_0^1 \left(f(x)^2-f(x)p(x)\right)\,dx\right| \\ &\leq \int_0^1 \left|f(x)^2-f(x)p(x)\right|\,dx \\ &= \int_0^1 |f(x)|\left|f(x)-p(x)\right|\,dx \leq M\frac{\varepsilon}{M}=\varepsilon \end{align} Since $\varepsilon>0$ was arbitrary, it follows that $$\int_0^1 f(x)^2\,dx = 0.$$