# Thread: Moments of a function

1. ## Moments of a function

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

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

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

Lemma: $J[h]$ is continuous.
Proof: Note that if $\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 $\int_0^1 |f(x)-g(x)|dx\ne0$

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

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

The conclusion follows. $\blacksquare$.

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

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

$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=$ $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 $\mathcal{C}[0,1]$ we have that $J[h]$ agrees with the zero function on a dense subset of it's domain. It follows that $J[h]=0$ for every $h$. The conclusion follows from this. $\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 $J:\mathcal{C}[0,1]\to\mathbb{R}$ by $h(x)\mapsto \int_0^1(f(x)-g(x))h(x) dx$.

Using the same rational as above we may conclude that $J$ is continuous.

Also, it is apparent that $J$ is functional and by our conditions we have that $J[x^n]=0,\text{ }n=0,1,\cdots$.

Thus, let $p(x)\in \mathcal{C}[0,1]$ be a polynomial, then $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 $\mathbb{P}$ is the set of all polynomials in $\mathcal{C}[0,1]$ that $J^{-1}(\{0\})\supseteq \mathbb{P}$. But, it follows from Weierstrass's approximation theorem that $\mathbb{P}$ is dense. And since $J^{-1}(\{0\})$ is closed we have that $X\supseteq J^{-1}(\{0\})=\overline{J^{-1}(\{0\})}\supseteq\overline{\mathbb{P}}=X$. It follows that $J[h]=0$. In particular $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 $f\in\mathcal{C}[0,1]$ we call $\int_0^1 f(x)x^n dx$ a moment of $f$.

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

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

Lemma: $J[h]$ is continuous.
Proof: Note that if $\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 $\int_0^1 |f(x)-g(x)|dx\ne0$

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

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

The conclusion follows. $\blacksquare$.

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

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

$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=$ $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 $\mathcal{C}[0,1]$ we have that $J[h]$ agrees with the zero function on a dense subset of it's domain. It follows that $J[h]=0$ for every $h$. The conclusion follows from this. $\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 $f(x)\in C[a,b]$ and $\int_{a}^{b} f(x)g^{(n)} (x)dx=0$ for all $g\in C_0^{\infty } [a,b]$ then $f$ is a polynomial of degree at most $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 $f(x)\in C[a,b]$ and $\int_{a}^{b} f(x)g^{(n)} (x)dx=0$ for all $g\in C_0^{\infty } [a,b]$ then $f$ is a polynomial of degree at most $n-1$. Try to prove it!
What is $\mathcal{C}^{\infty}_{\color{red}{0}}[a,b]$?

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