I have a quick question about how to prove this claim. I read in another post here:Nonzero $f \in C([0, 1])$ for which $\int_0^1 f(x)x^n dx = 0$ for all $n$
which gives a solution using the Stone Weierstrass theorem. Before reading, I gave my own solution which seems correct to me but is not mentioned in this thread so I would like some confirmation.
Proof:
By Weierstrass, $\forall \epsilon>0$, there exists a polynomial $P(x)$ such that $|P(x)-f(x)|\leq \epsilon$ on $[0,1]$.
Now, $0\leq \int_{0}^{1} f(x)^2 dx\leq \int_{0}^{1} f(x)[P(x)+\epsilon]dx$
$=\int_{0}^{1} f(x)P(x) dx+\epsilon\int_{0}^{1} f(x) dx$
$=0+0$,
Where the last equality sign comes from the assumption that $\int{0}^{1} x^nf(x) dx=0$ and from the linearity of the integral.
Thanks in advance!