Let $P$ be any polynomial such that $\int_a^b P(x)x^n \, dx =0$ for all $n\in\mathbb N$, prove that $P=0$. I've been thinking for 1 hour and don't have any clue yet. Please help me, thank you.
If $P$ is a real polynomial, then by linearity, $$\int_a^b P(x)^2 dx = 0$$
The result follows since $P(x)^2 \ge 0$ is continuous, so $P(x)^2 = 0$ and $P(x) = 0$ on $[a,b]$.
Since nonzero polynomials have finitely many roots (but this is $0$ everywhere in $[a,b]$), $P(x) = 0$ for all $x$.