# Show that there exists a piecewise constant function $g$ such that $\sup_{x\in[0,1]} |f(x)−g(x)|\le \epsilon.$

Let $f:[0,1]\rightarrow \mathbb R$ satisfy $|f(x)−f(y)|\le |x−y|$ for all $x,y\in [0,1].$

Show that f is continuous and that for all $\epsilon>0$, there exists a piecewise constant function $g$ such that $\sup_{x\in[0,1]}|f(x)−g(x)|\le \epsilon.$

We can easily show that f is continuous. However, surely $f$ can be any function that satisfies $f'(x)\le1$ for all $x\in [0,1]$. I thought to show that for any $\epsilon>0, |f(x+\epsilon)-f(x)|\le\epsilon$ and $|f(x+\epsilon)-f(x)|\le\epsilon$ so set $g(y)=f(x)$ for $y\in [x-\epsilon,x+\epsilon]$ of course I will have to account for 'overlap', but just for now so I can see if what I'm doing makes any sense. However, this seems trivial, moreover, $g$ here is dependant on $\epsilon$, is this allowed?

Any help is appreciated.

Thank you

• You want $|f'(x)|\le 1,$ right? – zhw. Aug 21 '16 at 21:58

I think your idea is good, and I also think that $g$ is allowed to depend on $\epsilon$ because of the wording of the proposition. The proposition says

For every $\epsilon > 0$ there is some function $g$ such that...
If the wording were changed to
There is some function $g$ such that ... for every $\epsilon >0$
then you would have to find a $g$ which works for each $\epsilon>0$ simultaneously.

To solve this I would probably let $n = \lceil \frac{1}{\epsilon} \rceil$ so that $\frac{1}{n} < \epsilon$ and note that $$[0,1] = \{0\} \cup \bigcup_{i=1}^{n} \left(\frac{i-1}{n}, \frac{i}{n} \right]$$ Then we let $g(0) = f(0)$ and $g(x) = f\left(\frac{i}{n}\right)$ for $x \in \left(\frac{i-1}{n}, \frac{i}{n} \right]$ and we get \begin{align*} | f(x) - g(x) | & = \left| f(x) - f\left(\frac{i}{n}\right) \right| \text{ (for some appropriate } i) \\ & \leq \left| x - \frac{i}{n} \right| \\ & \leq \left| \frac{i-1}{n} - \frac{i}{n} \right| \\ & = \frac{1}{n} \\ & < \epsilon \end{align*}

While $f$ can be any function with $f'(x) \leq 1$ it is not necessarily differentiable, so $f'$ might not be defined on the whole interval, but that is no problem.

Besides this, you are completely right. You might classify it as a 'covering argument'. Try to split up the interval in small enough pieces.

It might seem trivial to you because it is not a tricky math problem to test your skills and rather a exercise that lays groundwork for - I assume - a much more complicated prove about integrals. So neither statement nor prove are very sophisticated, but important nonetheless.

edit: It says "for every $\epsilon$ there exists a $g$". So yes, $g$ might be different for every $\epsilon$ you choose.

• Ok, thanks a lot – Aka_aka_aka_ak Aug 21 '16 at 18:19