$\newcommand{\d}{\,\mathrm{d}}\newcommand{\c}{\mathcal{C}}$I need to show the following:
Let $[a,b]$ be a compact interval in $\Bbb R$; for any two $f,g\in\c[a,b]$, $f=g$ on $[a,b]$ if and only if: $$\int_a^b x^nf(x)\d x=\int_a^b x^ng(x)\d x$$For all $n\in\Bbb N$.
This comes as an exercise after a proof of the Stone-Weierstrass and Weierstrass approximation theorems.
My strategy:
One direction is trivial. For the other, the space of all real polynomials on $[a,b]$ (hereafter denoted by some $p$) is dense in $\c[a,b]$, so by basic integral properties we obtain:
$$\int_a^bp(x)f(x)\d x=\int_a^bp(x)g(x)\d x$$
Since $[a,b]$ is a normal space, for all $t\in(a,b)$ I can choose for some small $h\in(0,\frac{1}{2}(b-t))$ so that $[a,t]$ and $[t+h,b]$ are two disjoint closed sets and there is a continuous $\varphi$ which is $1$ on the first set, $0$ on the second. There is some $p$ which can uniformly approximate $\varphi$ by $\epsilon$ for arbitrary positive $\epsilon$, whence:
$$\left|\int_a^b\varphi(x)f(x)\d x-\int_a^b\varphi(x)g(x)\d x\right|\lt\epsilon(b-a)\\\left|\int_a^tf(x)\d x-\int_a^tg(x)\d x\right|\lt\epsilon(b-a)+h(\|f\|+\|g\|)$$
$\epsilon$ and $h$ both may approach $0$ at any rate, and I can conclude then that:
$$\int_a^tf(x)\d x=\int_a^tg(x)\d x$$
For all $t\in(a,b)$. The fundamental theorem of calculus gives immediately then that $f(x)=g(x)$ for all $x\in(a,b)$, and I believe also for all $x\in[a,b]$ by continuous extension (not sure about this point).
- Is this right? I feel as if my conclusion from $\epsilon,h$ being arbitrarily small maybe isn't quite right.
- Can someone elaborate on whether or not the continuous extension idea holds?