Let $f$ be a continuous function on $[a,b]$ such that $\int_a^bx^nf(x)dx=0$ for all nonnegative integer $n$. Prove that $f(x)=0$ for all $x\in[a,b]$.
The equation tells us that $\int_a^bp(x)f(x)dx=0$ for all polynomials $p$. I was thinking to choose a nonzero polynomial $p$ such that $p(x)f(x)\ge0$ for all $x\in[a,b]$. However this is apparently impossible if $f$ has infinitely many roots. Then I tried to make $p(x)f(x)$ very large in some interval, and very small in the other intervals. Again this does not seem to work if the roots of $f$ is dense in $[a,b]$.
Edit: Okay, so I now know that the roots of $f$ cannot be dense in $[a,b]$ (otherwise $f$ is constant and we're done). Now $f$ is positive (wlog) in some interval $[c,d]$. I want $p(x)$ to be a polynomial such that $p(x)f(x)$ is very large in $[c,d]$ and very small elsewhere. I'm definitely sure that such a polynomial exists, but don't know how to prove it. Can my idea be finished?