# Unexpectedly uniformly continuous functions

The other day in a exam, I was given the following exercise:

Given $f : [0,1] \to \mathbb{R}$ continuous and such that $f(0) = 0, f(1) = 1$, let $g : \mathbb{R} \to \mathbb{R}$ be $g(x) = [x] + f(x - [x])$. Prove that $g$ is uniformly continuous.

I'm looking for more examples of this kind of exercise to practice with (i.e. functions with uniform continuity that are not as straightforward to prove that they are).

Any continuous function $f$ from a closed interval $[a, b]$ to $[a, b]$ is uniformly continuous. See https://en.wikipedia.org/wiki/Heine–Cantor_theorem.
If $f(a) = a$ and $f(b) = b$ then extending $f$ to a function $\Bbb{R} \to \Bbb{R}$ by taking $f(x) = x$ for $x \not\in [a, b]$ still gives a uniformly continuous function.
• The theorem can be applied: you prove $g$ is continuous on $[0, 1]$ and conclude that it is uniformly continuous on $[0, 1]$. Dec 2, 2015 at 1:06
• You are supposed to prove that it is uniformly continuous on $\mathbb{R}$, which is not compact. Dec 2, 2015 at 1:10