Is a function that integrates to zero against all polynomials constant? Suppose $f := [0,\infty) \rightarrow \mathbb{R}$ satisfies $|f(x)| \leq e^{-x}$ for all $x \in (0,\infty)$, and also has the property that
$$
\int_0^{\infty} f(x) x^n dx = 0 \qquad \forall n \in \{0,1,2,3,...\}.
$$
Does it follow that $f$ is constant? If so, is this a standard theorem?
Many thanks for your help.
 A: For any real $s > 0$, the series for $e^{-sx}$ is an alternating series for $x > 0$, which gives an error bound in terms of the first neglected term:
$$
        e^{-x}\left|\sum_{n=0}^{N}(-1)^n\frac{(sx)^n}{n!}-e^{-sx}\right| \le e^{-x}\frac{(sx)^{N+1}}{(N+1)!}.
$$
Integrating the right side in $x$ over $[0,\infty)$ and applying integration by parts repeatedly gives
$$
    \int_{0}^{\infty}e^{-x}\frac{(sx)^{N+1}}{(N+1)!}dx = s^{N+1}\int_{0}^{\infty}e^{-x}dx \rightarrow 0 \mbox{ as } N\rightarrow\infty \mbox{ for } 0 < s < 1.
$$
Therefore, by your assumptions,
$$
       F(s)=\int_0^{\infty}f(x)e^{-sx}dx = \lim_{N\rightarrow\infty}\int_{0}^{\infty}f(x)\sum_{n=0}^{N}\frac{(-sx)^{n}}{n!}dx=0,\;\;\; 0 < s < 1.
$$
At this point you can invoke uniqueness theorems about the Laplace transform in order to conclude that $f$ is $0$ a.e... Or you can use Morera's Theorem to show that $F$ is holomorphic for $\Re s > -1$ because (a) it is continuous and (b) integrals over triangles in this right half plane give $0$. Then, because $F$ is holomorphic and vanishes on a non-zero interval of the positive real axis, the identity theorem implies that $F$ is identically $0$ for $\Re s > -1$. Using that, $F(ir)$ is $0$, which is the Fourier transform of $f$, and that proves $f$ is $0$ a.e. by the Plancherel identity for Fourier transforms.
A: Hints:


*

*$f$ is integrable (in fact $L^p$ for any $p\ge 1$).

*The set of compactly supported smooth functions $C_c^\infty$ is dense in $L^p$ for $1\le p < \infty$.

*Polynomials are dense in $C(K)$ for any compact set $K$. 


Could you approximate $\int |f|^2$?
