Let $f:[-1,1] \to \mathbb{R}$ be continuous on $[-1,1]$.
Assume $\displaystyle \int_{-1}^{1}f(x)x^ndx = 0$ for $n = 0,1,2,...$
Then show $f(x)=0, \ \forall x \in [-1,1]$
I would like to use Weierstrass Approximation Theorem (WAT) to prove this. Here is my incomplete attempt:
$f$ is continuous on $[-1,1]$ so by WAT $\exists$ a sequence polynomials $p_1, p_2, p_3,...,p_n,...$ s.t.
$\displaystyle \lim_{n \to \infty} |p_n - f| = 0$, so $\displaystyle \lim_{n \to \infty} \int_{-1}^{1}|f-p_n| = 0$.
Now, I would like to show $\int_{-1}^{1} f^2 = 0$ and from there I would like to conclude that $f=0$. So, \begin{align} \int_{-1}^{1} (f(x))^2 dx & = \int_{-1}^{1} f(x)f(x) \\ & = \int_{-1}^{1} \left[ f(x)f(x)-f(x)p_n(x)+f(x)p_n(x) \right] dx \\ & = \int_{-1}^{1} f(x) (f(x) - p_n(x)) dx + \int_{-1}^{1}f(x) p_n(x)dx \end{align}
$\int_{-1}^{1} f(x) p_n(x) dx = 0$ by the hypothesis since $\int_{-1}^{1} f(x) x^n dx = 0$ for all $n \in \mathbb{N}$.
So that leaves me to show,
$\int_{-1}^{1}f(x)(f(x)-p_n(x)) = 0$. I know $\lim_{n \to \infty}|f-p_n|=0$, but I am not clear how I can use this to show the integral is $0$. First of all, we are working with a fixed $n$, and second of all the limit of absolute difference is $0$.
Should I start the proof with limits and show the integral is arbitrarily small?
Thanks.
\begin{align*} \int_{-1}^{1}|f(x)||f(x)-p_{n}(x)|dx&\leq\sup_{x\in[-1,1]}|f(x)-p_{n}(x)|\int_{-1}^{1}|f(x)|dx\\ &=K\sup_{x\in[-1,1]}|f(x)-p_{n}(x)|, \end{align*} where $K$ is the integral, which is a finite number, now the supremum can be made arbitrarily small by Weierstrass theorem.