# Use Weierstrass Approximation to prove that $f(x)=0$. With questions on the detail.

Let $f$ be continuous on $[0,1]$ and suppose $\int_0^1f(x)x^ndx=0$ for all $n\in\mathbb{N}_0$. Prove that $f=0$.

*Let $\epsilon\geq 0$. By Weierstrass theorem, we can find a polynomial $p(x)$ such that $|p(x)-f(x)|<\epsilon$, $\forall x\in[0,1]$.

Since $\int_0^1 f(x)x^ndx=0$, then $\int_0^1 f(x)p(x)dx=0$ (Why is this true? Could someone help me with details of rewriting it in terms of a polynomial?)

Since $f$ is continuous on $[0,1]$, $f$ is bounded, so assume $|f(x)|\leq M$ on $[0,1]$.

$|\int_0^1 f(x)^2 dx|=|\int_0^1 f(x)(f(x)-p(x))dx|\leq M\times\epsilon\times(1-0)$ so by letting $\epsilon\rightarrow 0$, we can have $\int_0^1 f(x)^2dx=0$. By continuity of $f(x)^2$, we can conclude that $f(x)=0$ therefore.

Seems like as long as the interval is finite, not only we can apply Weierstrass theorem but also after applying that we can have $\int_a^bf(x)^2 dx=0$ for all $a,b\in\mathbb{R}$, right? What about negative domain?

• The first question follows from the linearity of the integral. Second question, yeah why not? The only thing that changes is the $1-0$ to $b-a$. – Robert Wolfe Aug 2 '17 at 23:13
• Since $\int_0^1 f(x)x^ndx=0$, then $\int_0^1 f(x)p(x)dx=0$ **(Why is this true? Could someone help me with details of rewriting it in terms of a polynomial?)**$\,\,$ Every polynomial is a linear combination of monomials. – zhw. Aug 2 '17 at 23:21

Any polynomial can be written as $p(x) = \displaystyle\sum_{i=0}^n a_ix^i$, where the $a_i$ are the respective coefficients, and $n$ is the degree of the polynomial if $a_n \neq 0$.
Now, if $f$ is as given in the question, $$\int_0^1 f(x)p(x) = \int_0^1 f(x) \left(\displaystyle\sum_{i=0}^n a_ix^i\right) = \int_{0}^1 \sum_{i=0}^n a_i f(x)x^i = \sum_{i=0}^n a_i\left(\int_0^1 f(x)x^i\right) = 0$$
As for the question of finite intervals, and intervals with negative end points, the theorem still holds true, because the Weierstrass theorem still holds true for these intervals. Depending on the proof you have seen for the Weierstrass theorem, you will be able to adapt the proof for the general case. For example, you can scale the Bernstein polynomials appropriately for a general interval, when it is given for $[0,1]$. The rest of this proof is as you have written.
Suppose diferent, then there exists $c \in [0,1]$ with $f(c) \not = 0$, suppose w ithout loss of generality $f(c) > 0$, by continuity, there exists $[a,b] \subset [0,1]$ with $c \in [a,b]$ such that $f(x) > 0$ in $[a,b]$. Take $P_{n}(x) = (1+(x-a)(b-x))^{n}$. Taking $x \in [0,a] \cup [b,1]$ we have $0 \leq P_{n}(x) \leq 1$. Now:
$|\int_{0}^{a} f(x)P_{n}(x)dx| \leq \int_0^a |f(x)| \leq \int_0^1 |f(x)|$ and $|\int_{b}^{1} f(x)P_{n}(x)dx| \leq \int_b^1 |f(x)| \leq \int_0^1 |f(x)|$. Also $(x-a)(b-x) \geq 0$ with $x \in [a, b]$ therefore for all $x \in [a,b]$ and $n \geq 1$ we have $P_{n} \geq 1+ n(x-a)(b-x)$. From this, follow: $\int_a^b f(x)P_{n}(x)dx \geq \int_a^b f(x)dx + n\int_a^bf(x)(x-a)(b-x)$, but as $\int_a^bf(x)(x-a)(b-x) \geq 0$ (by hypothesis $f(x) > 0$ in $[a, b]$). We have: $\lim_{n \to \infty} \int_a^b f(x)P_{n}(x)dx = \infty$. From this, there exist $n_{0}$ such that $\int_0^1 f(x)P_{n_{0}}(x)dx > 0$. Here you use the hypothesis, this integral must be 0.