Piecewise linear function close to continuous function

A continuous function $\phi$ on $[a,b]$ is called piecewise linear provided there is a partition $a=x_0<x_1<\ldots<x_n=b$ of $[a,b]$ for which $\phi$ is linear on each interval $[x_i,x_{i+1}]$. Let $f$ be a continuous function on $[a,b]$ and $\epsilon$ a positive number. Show that there is a piecewise linear function $\phi$ on $[a,b]$ with $|f(x)-\phi(x)|<\epsilon$ for all $x\in[a,b]$.

I want to construct $\phi$ bit-by-bit starting from the left at $a$. I consider the set $C=\{c\mid$the linear function $\phi$ from connecting $f(a)$ and $f(c)$ satisfies $|f(x)-\phi(x)|<\epsilon$ for all $x\in[a,c]\}$. This set contains $a$ and also some interval close to it (since $f$ is continuous we can find $\delta$ such that $|f(a+y)-f(a)|<\epsilon/2$ for all $0<y<\delta$. Consider its least upper bound, and choose something slightly less than it. But I have no way to know why this process will eventually cover the entire interval $[a,b]$.

• Such a function is uniformly continuous, by compactness of $[a,b]$,.This will help you. Jun 27, 2013 at 5:11
• Ok that solves it indeed... uniform continuity is so powerful here. Jun 27, 2013 at 5:17

1 Answer

As julien hinted, the function is uniformly continuous by compactness of $[a,b]$. This means there exists $\delta$ such that $|x-y|<\delta$ implies $|f(x)-f(y)|<\epsilon/2$. Define $\phi(x)=f(x)$ for $x=a,a+\frac{\delta}{2},a+2\frac{\delta}{2},\ldots$. Then "connect the dots" to make $\phi$ piecewise linear.