[Math] Give an example of a function that is bounded and continuous on the interval [0, 1) but not uniformly continuous on this interval.

continuityexamples-counterexamplesreal-analysisuniform-continuity

My thoughts was to take $f(x) =\cos(\frac 1x) $ for all $ x \in [0,1)$ as I know this function is continous from $[0,1)$ and is definitely not uniformly continuous as it oscilates non-uniformly. My trouble is with the proof.

To prove continuity would I:

Fix $x_0 \in [0,1), \epsilon>0.$ We will show that there exists $\delta>0$ such that if $|x-x_0|<\delta$ then $|\cos(\frac 1x) -\cos(\frac 1{x_0})|<\epsilon$

Now I am stuck as to how I could simplify $|\cos(\frac 1x) -\cos(\frac 1{x_0})|$ or what $\delta$ to choose. Any help would be appreciated.

Best Answer

Here's some intuition:

The Heine-Cantor theorem tells us that any function between two metric spaces that is continuous on a compact set is also uniformly continuous on that set (see here for discussion). Next, if $f:X \rightarrow Y$ is a uniformly continuous function, it is easy to show that the restriction of $f$ to any subset of $X$ is itself uniformly continuous*. Therefore, because $[0,1]$ is compact, the functions $[0,1) \to \mathbb{R}$ that are continuous but not uniformly continuous are those functions that cannot be extended to $[0,1]$ in a continuous fashion.

For example, consider the function $f:[0,1) \to \mathbb{R}$ defined such that $f(x) = x$. We can extend $f$ to $[0,1]$ by defining $f(1) = 1$, and this extension is a continuous function over a compact set (hence it is uniformly continuous). So the restriction of this extension to $[0,1)$—i.e. the original function—is necessarily also uniformly continuous per (*) above.

How can we find a continuous function on $[0,1)$ that cannot be continuously extended to $[0,1]$? There are two ways:

$\qquad \bullet \quad$ Construct $f$ so that $\displaystyle \lim_{x \rightarrow 1} f(x) = \pm \infty$

$\qquad \bullet \quad$ Construct $f$ so that $\displaystyle \lim_{x \to 1} f(x)$ does not exist

Note that if $\displaystyle \lim_{x \to 1} f(x)$ exists, taking $f(1)$ to be that limit yields a continuous extension. Indeed, $\displaystyle \lim_{x \to c} f(x) = f(c)$ is literally one of the definitions for continuity at the point $x=c$.

The first bullet is ruled out by the stipulation that $f$ be bounded, so moving on to the second bullet, we need to make sure $\displaystyle \lim_{x \to 1} f(x)$ does not exist. One way of doing this (the only way I believe) is to have $f$ oscillate infinitely rapidly with non-vanishing amplitude as $x \to 1$. It looks like this is what you were trying to exploit, and what José Carlos Santos did (+1) in his answer (see graph below): $\displaystyle f(x) = \cos \left(\frac{1}{1-x} \right)$.

Generalizing his epsilon-delta argument, you can see that this condition is not only necessary, but also sufficient.

$\qquad \qquad \qquad \qquad$ enter image description here