If $f'$ is bounded, then $f$ is uniformly continuous

Let $f\colon(a,b) \to \mathbb R$ be differentiable and suppose that there exists an $M>0$ such that $|f'(x)| \leq M$ for all $x$ in $(a,b)$. Prove that $f$ is uniformly continuous.


Expanding on Azreal's hint: The Mean Value Theorem implies that for any distinct $x$, $y$ in $(a,b)$ we have $$\tag{1} \biggl|{f(x)-f(y)\over x-y}\biggr|\le M. $$

Keep in mind what you need to show:

Given $\epsilon>0$, there is a $\delta>0$ such that $$ |f(x)-f(y)|\lt \epsilon\quad\text{whenever}\quad |x-y|\lt\delta. $$

Can you see how to use $(1)$ to find the required $\delta$?


Let us choose some $\epsilon>0$. We need to prove the existence of $\delta>0$ such that if $|x-x'|<\delta$ then $|f(x)-f(x')|<\epsilon$. Let us now write Lagrange's theorem on closed interval $[x,x']$:

$$\left|\frac{f(x)-f(x')}{x-x'}\right|=|f'(c)|\leq M ,\qquad c\in(x,x').$$

Therefore, $ |f(x)-f(x')|\leq M|x-x'|$. Now, demanding $M|x-x'|<\epsilon$, we'll get $|x-x'|<\frac{\epsilon}{M}$.

So, for $\delta=\frac{\epsilon}{M}$ we'll get that:

$$|x-x'|<\delta\Longrightarrow|f(x)-f(x')|<\epsilon$$

(Notice that our $\delta$ value does not depend on $x$ and $x'$.)


Hint: Use the mean value theorem.