# Thread: Moments of a function

1. ## Moments of a function

If $\displaystyle f\in\mathcal{C}[0,1]$ we call $\displaystyle \int_0^1 f(x)x^n dx$ a moment of $\displaystyle f$.

Problem: Prove that if $\displaystyle f,g\in\mathcal{C}[0,1]$ have the same moments (for $\displaystyle n=0,1,2,\cdots$) then the must be the same function.

Proof: Define the functional $\displaystyle J:\mathcal{C}[0,1]\to\mathbb{R}$ by $\displaystyle J[h]=\int_0^1 (f(x)-g(x))h(x)\text{ }dx$. We first prove that $\displaystyle J$ is continuous.

Lemma: $\displaystyle J[h]$ is continuous.
Proof: Note that if $\displaystyle \int_0^1 |f(x)-g(x)|dx=0$ we're done since the integral of a continuous non-negative function is zero only when the function is identically zero. Thus, we may assume that $\displaystyle \int_0^1 |f(x)-g(x)|dx\ne0$

Let $\displaystyle \varepsilon>0$ be given. Then choosing $\displaystyle h$ such that $\displaystyle \|h-h_0\|_{\infty}<\left(\int_0^1 |f(x)-g(x)|dx\right)^{-1}\varepsilon$ we see that

$\displaystyle \left|J[h_0]-J[h]\right|=\left|\int_0^1(f(x)-g(x))(h(x)-h_0(x))dx\right|$$\displaystyle \leqslant \int_0^1|f(x)-g(x)||h(x)-h_0(x)|dx$$\displaystyle <\varepsilon\left(\int_0^1|f(x)-g(x)|\right)^{-1}\int_0^1|f(x)-g(x)|dx=\varepsilon$

The conclusion follows. $\displaystyle \blacksquare$.

But notice by our assumption that $\displaystyle \int_0^1 f(x)x^n dx=\int_0^1 g(x)x^n dx$ for every $\displaystyle n\in\mathbb{N}\cup\{0\}$ or equivalently $\displaystyle J[x^n]=\int_0^1(f(x)-g(x))x^n dx=0$.

But, we in fact see that given any polynomial $\displaystyle p(x)=a_0+a_1x+\cdots a_n x^n$ that

$\displaystyle J[p(x)]=\int_0^1(f(x)-g(x))p(x)dx=\int_0^1(f(x)-g(x))(a_0+\cdots+a_n x^n)dx=$$\displaystyle a_0\int_0^1(f(x)-g(x))x^0+a_1\int_0^1(f(x)-g(x))x+\cdots+a_n\int_0^1(f(x)-g(x))x^n=0+\cdots+0=0 And since by Weirstrass's theorem we have that the polynomials are dense in \displaystyle \mathcal{C}[0,1] we have that \displaystyle J[h] agrees with the zero function on a dense subset of it's domain. It follows that \displaystyle J[h]=0 for every \displaystyle h. The conclusion follows from this. \displaystyle \blacksquare Does that look right? I feel like I made this way harder than it need be. 2. Oops...I just realized that I didn't need to prove that the functional itself was continuous. Oh well...it's late. 3. If anyone is interested, now that I'm awake there is a much more clean way to say this. Proof: Define, the functional \displaystyle J:\mathcal{C}[0,1]\to\mathbb{R} by \displaystyle h(x)\mapsto \int_0^1(f(x)-g(x))h(x) dx. Using the same rational as above we may conclude that \displaystyle J is continuous. Also, it is apparent that \displaystyle J is functional and by our conditions we have that \displaystyle J[x^n]=0,\text{ }n=0,1,\cdots. Thus, let \displaystyle p(x)\in \mathcal{C}[0,1] be a polynomial, then \displaystyle J[p(x)]=J\left[a_0+\cdots+a_n x^n\right]=\sum_{k=0}^{n}a_k J[x^k]=\sum_{k=1}^{0}0=0. It follows that if \displaystyle \mathbb{P} is the set of all polynomials in \displaystyle \mathcal{C}[0,1] that \displaystyle J^{-1}(\{0\})\supseteq \mathbb{P}. But, it follows from Weierstrass's approximation theorem that \displaystyle \mathbb{P} is dense. And since \displaystyle J^{-1}(\{0\}) is closed we have that \displaystyle X\supseteq J^{-1}(\{0\})=\overline{J^{-1}(\{0\})}\supseteq\overline{\mathbb{P}}=X. It follows that \displaystyle J[h]=0. In particular \displaystyle J[f(x)-g(x)]=\int_0^1(f(x)-g(x))^2dx=0 and thus by prior remarks the conclusion follows. 4. Originally Posted by Drexel28 If \displaystyle f\in\mathcal{C}[0,1] we call \displaystyle \int_0^1 f(x)x^n dx a moment of \displaystyle f. Problem: Prove that if \displaystyle f,g\in\mathcal{C}[0,1] have the same moments (for \displaystyle n=0,1,2,\cdots) then the must be the same function. Proof: Define the functional \displaystyle J:\mathcal{C}[0,1]\to\mathbb{R} by \displaystyle J[h]=\int_0^1 (f(x)-g(x))h(x)\text{ }dx. We first prove that \displaystyle J is continuous. Lemma: \displaystyle J[h] is continuous. Proof: Note that if \displaystyle \int_0^1 |f(x)-g(x)|dx=0 we're done since the integral of a continuous non-negative function is zero only when the function is identically zero. Thus, we may assume that \displaystyle \int_0^1 |f(x)-g(x)|dx\ne0 Let \displaystyle \varepsilon>0 be given. Then choosing \displaystyle h such that \displaystyle \|h-h_0\|_{\infty}<\left(\int_0^1 |f(x)-g(x)|dx\right)^{-1}\varepsilon we see that \displaystyle \left|J[h_0]-J[h]\right|=\left|\int_0^1(f(x)-g(x))(h(x)-h_0(x))dx\right|$$\displaystyle \leqslant \int_0^1|f(x)-g(x)||h(x)-h_0(x)|dx$$\displaystyle <\varepsilon\left(\int_0^1|f(x)-g(x)|\right)^{-1}\int_0^1|f(x)-g(x)|dx=\varepsilon The conclusion follows. \displaystyle \blacksquare. But notice by our assumption that \displaystyle \int_0^1 f(x)x^n dx=\int_0^1 g(x)x^n dx for every \displaystyle n\in\mathbb{N}\cup\{0\} or equivalently \displaystyle J[x^n]=\int_0^1(f(x)-g(x))x^n dx=0. But, we in fact see that given any polynomial \displaystyle p(x)=a_0+a_1x+\cdots a_n x^n that \displaystyle J[p(x)]=\int_0^1(f(x)-g(x))p(x)dx=\int_0^1(f(x)-g(x))(a_0+\cdots+a_n x^n)dx=$$\displaystyle a_0\int_0^1(f(x)-g(x))x^0+a_1\int_0^1(f(x)-g(x))x+\cdots+a_n\int_0^1(f(x)-g(x))x^n=0+\cdots+0=0$

And since by Weirstrass's theorem we have that the polynomials are dense in $\displaystyle \mathcal{C}[0,1]$ we have that $\displaystyle J[h]$ agrees with the zero function on a dense subset of it's domain. It follows that $\displaystyle J[h]=0$ for every $\displaystyle h$. The conclusion follows from this. $\displaystyle \blacksquare$

Does that look right? I feel like I made this way harder than it need be.
As you noted, this is a rather trivial generalization of the fundamental lemma of calculus of variations. A more interesting (and surprising) one is this: If $\displaystyle f(x)\in C[a,b]$ and $\displaystyle \int_{a}^{b} f(x)g^{(n)} (x)dx=0$ for all $\displaystyle g\in C_0^{\infty } [a,b]$ then $\displaystyle f$ is a polynomial of degree at most $\displaystyle n-1$. Try to prove it!

5. Originally Posted by Jose27
As you noted, this is a rather trivial generalization of the fundamental lemma of calculus of variations. A more interesting (and surprising) one is this: If $\displaystyle f(x)\in C[a,b]$ and $\displaystyle \int_{a}^{b} f(x)g^{(n)} (x)dx=0$ for all $\displaystyle g\in C_0^{\infty } [a,b]$ then $\displaystyle f$ is a polynomial of degree at most $\displaystyle n-1$. Try to prove it!
What is $\displaystyle \mathcal{C}^{\infty}_{\color{red}{0}}[a,b]$?

6. Originally Posted by Drexel28
What is $\displaystyle \mathcal{C}^{\infty}_{\color{red}{0}}[a,b]$?
It's the space of smooth functions with compact support in $\displaystyle [a,b]$, ie.$\displaystyle C_0^{\infty } [a,b]:= \{ f\in C^{\infty }[a,b] : f^{(k)}(a)=f^{(k)}(b)=0 \ \mbox{for all} \ k\geq 0 \}$.