Stone Weierstrass Theorem (Example)

This week we continue our discussion on the Stone Weierstrass Theorem with an example. This exercise is taken from Rudin's Principles of Mathematical Analysis (affectionately known as "Baby Rudin").

Rudin, PMA, Chapter 7 #20

If $f$ is continuous on $[0,1]$ and if $$\int_0^1f(x)x^n\;dx=0$$ for all $n=0,1,2,\ldots,$ prove that $f(x)=0$ on $[0,1]$.
 

Solution

We'll prove by contradiction. Suppose $f$ is not identically 0 on $[0,1]$. Then there is some $x_0\in[0,1]$ for which, without loss of generality, $f(x_0)$ is positive. Since $f$ is continuous, we can find an open interval $I\subset[0,1]$ containing $x_0$ such that $f$ is positive on all of $I$.

This implies that $$\int_0^1f(x)^2\;dx>0$$ (since $f(x)^2\geq0$ for all $x\in[0,1]$). Further, by the Extreme Value Theorem, we can choose a constant $M$ so that $\|f\|=\sup_{x\in[0,1]}\{|f(x)|\}\leq M$.

Now let $\epsilon>0$. By the Stone Weierstrass Theorem we know that the polynomials on $[0,1]$ are dense in $\mathscr{C}([0,1],\mathbb{R})$. Thus there exists a polynomial $p$ such that $$\|f-p\| < \epsilon/M.$$ We also know that $$\int_0^1p(x)f(x)\;dx=0.$$ This follows since we have assumed $\int_0^1x^nf(x)\;dx=0$ for all $n=0,1,2,\ldots$. By linearity of the integral, this implies $\int_0^1q(x)f(x)\;dx=0$ for any polynomial $q$, including the polynomial $p$ which uniformly approximates $f$.

Observe next that \begin{align*} \int_0^1f(x)^2\;dx&=\int_0^1f(x)(f(x)-p(x))\;dx\\ &\leq \int_0^1\|f\|\|f-p\|\;dx\\ &=\|f\|\|f-p\|\\ &< M\cdot\epsilon/M\\ &=\epsilon. \end{align*} Since $\epsilon>0$ was arbitrary, we conclude $\int_0^1f(x)^2\;dx=0$. But this contradicts the fact that $f$ is positive on the interval $I\subset[0,1]$! Hence we must have that $f(x)=0$ for all $x\in[0,1]$ as desired.