# proof of Weierstrass approximation theorem

To simplify the notation, assume that the function is defined on the interval $[0,1]$. This involves no loss of generality because if $f$ is defined on some other interval, one can make a linear change of variable which maps the domain of $f$ to $[0,1]$.

## The case $f(x)=1-\sqrt{1-x}$

Let us start by demonstrating a few special cases of the theorem, starting with the case $f(x)=1-\sqrt{1-x}$. In this case, we can use the ancient Babylonian method of computing square roots to construct polynomial  approximations. Define the polynomials $P_{0},P_{1},P_{2},\ldots$ recursively as

 $P_{0}(x)=0$
 $P_{n+1}(x)={1\over 2}\left(P_{n}(x)^{2}+x\right)$

It is an obvious consequence of this definition that, if $0\leq x\leq 1$ then $0\leq P_{n}(x)\leq 1$ for all $n$. It is equally obvious that each $P_{n}$ is a monotonically increasing function on the interval $[0,1]$. By subtracting the recursion from itself, cancelling, and factoring, we obtain the relation

 $P_{n+2}(x)-P_{n+1}(x)={1\over 2}(P_{n+1}(x)+P_{n}(x))(P_{n+1}(x)-P_{n}(x))$

From this relation, we conclude that $P_{n+1}(x)\geq P_{n}(x)$ for all $n$ and all $x$ in $[0,1]$. This implies that $\lim_{n\to\infty}P_{n}(x)$ exists for all $x$ in $[0,1]$. Taking the limit of both sides of the recursion that defines $P_{n}$ and simplifying, one sees that $\lim_{n\to\infty}P_{n}(x)=1-\sqrt{1-x}$. The relation also implies that $P_{n+1}(x)-P_{n}(x)$ is also a monotonically increasing function of $x$ in the interval $[0,1]$ for all $n$. Therefore,

 $P_{n+1}(x)-P_{n}(x)\leq P_{n+1}(1)-P_{n}(1)$

Summing over $n$ and cancelling, one sees that

 $P_{m}(x)-P_{n}(x)\leq P_{m}(1)-P_{n}(1)$

whenever $m>n$. Taking the limit as $m$ approaches infinity, one concludes that

 $1-\sqrt{1-x}-P_{n}(x)\leq 1-P_{n}(1)$

Since the $P_{n}$’s converge, for any $\epsilon>0$, there exists an $n$ such that $1-P_{n}(1)<\epsilon$. For this value of $n$, $|f(x)-P_{n}(x)|<\epsilon$, so the Weierstrass approximation theorem  holds in this case.

## The case $f(x)=|x-c|$

Next consider the special case $f(x)=|x-c|$, where $0\leq c\leq 1$. A little algebra shows that

 $\sqrt{(x-c)^{2}+\epsilon^{2}/4}-|x-c|\leq\epsilon/2$

By the case of the approximation theorem already proven, there exists a polynomial $P$ such that

 $|\sqrt{(x-c)^{2}+\epsilon^{2}/4}-P(x)|<\epsilon/2$

when $x\in[0,1]$. Combining the last two inequalities  and applying the triangle inequality    , one sees that $|f(x)-P(x)|<\epsilon$, so the Weierstrass approximation theorem holds in the case $f(x)=|x-c|$.

## The case of piecewise linear functions

A corollary of the result just proven is the Weierstrass appriximation theorem for piecewise linear functions. Any piecewise linear function $\phi$ can be expressed as

 $\phi(x)=b+\sum_{m=0}^{N}a_{m}|x-c_{m}|$

for suitable constants $a_{0},\ldots,a_{N},b,c_{0},\ldots,c_{N}$. By the result just proven, there exist polynomials $P_{0},\ldots,P_{N}$ such that

 $\left|a_{m}|x-c_{m}|-P_{m}\right|<\epsilon/N$

By the triangle inequality,

 $\left|\phi(x)-b-\sum_{m=0}^{N}P_{m}\right|<\epsilon$

## The general proof

Having succeeded in proving all these special cases, we now have the courage to attack the general theorem. In light of the case just proven, it suffices to show that if $f$ is continuous  on [0,1] then for all $\epsilon>0$ there exists a piecewise-linear function $\phi$ such that for all $x$ in $[0,1]$, $|f(x)-\phi(x)|<\epsilon/2$. For, if such a function exists, then there also exists a polynomial $P$ such that $|\phi(x)-P(x)|<\epsilon/2$, but then $|f(x)-P(x)|<\epsilon$.

Since the interval $[0,1]$ is compact  , $f$ is uniformly continuous  . Hence, for all $\epsilon>0$ there exists an integer $N$ such that $|f(x)-f(y)|<\epsilon/2$ whenever $|x-y|\leq 1/N$.

Define $\phi$ by the following two conditions: If $m$ is an integer between $0$ and $N$, $\phi(m/N)=f(m/N)$. On any interval $[m/N,(m+1)/N]$, $\phi$ is linear.

For every point $x$ in the interval $[0,1]$, there exists an integer $m$ such that $x$ lies in the subinterval $[m/N,(m+1)/M$. Since a linear function is bounded   by its values at the endpoints, $\phi(x)$ lies between $\phi(m/N)=f(m/N)$ and $\phi((m+1)/N)=f((m+1)/N)$. Since $|f(m/N)-f((m+1)/N)|\leq\epsilon/2$, it follows that $|f(m/N)-\phi(x)|\leq\epsilon/2$. Because $|x-m/N|\leq 1/N$, it is also true that $|f(m/N)-f(x)|\leq\epsilon/2$. Hence, by the triangle inequality, $|f(x)-\phi(x)|<\epsilon$.

Title proof of Weierstrass approximation theorem ProofOfWeierstrassApproximationTheorem 2013-03-22 14:34:58 2013-03-22 14:34:58 rspuzio (6075) rspuzio (6075) 9 rspuzio (6075) Proof msc 41A10