If $f, g\in \mathcal{C}([a,b],\mathbb{R})$ and $$\int^b_af(x)\,x^k \, dx=\int^b_ag(x)\,x^k \, dx, \text{ for all } k \in \mathbb{N}$$ Prove that $f=g$.
I'm trying to prove this but I don't know how to proceed. Any suggestions?
If $f, g\in \mathcal{C}([a,b],\mathbb{R})$ and $$\int^b_af(x)\,x^k \, dx=\int^b_ag(x)\,x^k \, dx, \text{ for all } k \in \mathbb{N}$$ Prove that $f=g$.
I'm trying to prove this but I don't know how to proceed. Any suggestions?
Let $h:= f-g$. The hypothesis states that $ \int h p = 0$ for any polynomial $p$.
To begin, we apply Stone-Weierstrass to get that the polynomials are uniformly dense in $\mathcal{C}([a,b],\mathbb{R})$.
In particular, for $\epsilon >0$, we can find a polynomial $p$ such that $ \| h-p \|_\infty < \varepsilon $.
Thus, $$ \left| \int h^2 \right| \leq \left| \int h p \right| + \left| \int h (h-p) \right| \leq \varepsilon \left| \int h \right|. $$
Since $h$ is continuous, $| \int h | < \infty $ and hence $ \int h^2 = 0$.
But for any continuous function, this is precisely $h=0$ or $f=g$.
$\int_a ^{b} xf(x) x^{k} dx=\int_a ^{b} xf(x) x^{k} dx$ for $k \geq 0$. Hence, by standard Weierstarss approximation $xf(x)=xg(x)$ for all x which gives what you want.
Maybe an overkill. One knows by tweaking Stone-Weierstrass that polynomials are dense in $C[a, b] $ with $\Vert \cdot \Vert_2$ norm. Let $\mathcal P$ be the set of all polynomials. What you have written is equivalent to $$<f-g, p>=\int_a^b (f(x) - g(x) ) p(x) = 0$$ for every polynomial $p\in \mathcal P$. Hence $f(x)-g(x) $ is in the annihilator of $\mathcal P$, namely $\mathcal {P} ^\perp$ and since $\mathcal P$ is dense we get $f(x) - g(x) \in \mathcal {P} ^\perp=\{0\} $. Hence $f=g$.
Edit/Remark. the same idea also works if $0\notin\mathbb{N}$. That proof is left to the reader.