STATEMENT: Let $f(x)$ be a continuous function on $\mathbb{R}$ such that for any polynomial $P(x)$ we have
$$\int_\mathbb{R} f(x)P(x) \, dx=0$$
Show that $f(x)$ is identically zero.
QUESTION: This is an old prelim problem and I'm having trouble showing it. The usual problem restricts to a bounded domain $[a,b]$ from which we can apply stone weirstrass and some manipulation to get the desired result, but reducing to that case doesn't seem possible here, so does anyone have a suggestion on how to proceed? Some hints would be appreciated.
EDIT: Note that this is not a duplicate question. Does $\int_{\mathbb R} f(x)x^n dx = 0$ for $n=0,1,2,\ldots$ imply $f=0$ a.e.?. The other post does not assume that $f$ is continuous.