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

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.

• You function is actually not defined at $x=0$. Apr 6 '19 at 5:14
• What would you suggest as a function that I could use? Apr 6 '19 at 5:16
• Why would you consider $\cos (1/x)$ in the first place? Apr 6 '19 at 5:17
• It was the first function I thought of that was continuous but not uniformly continuous. Apr 6 '19 at 5:18
• @TheoBendit $\frac1{x-1}$ is unbounded. Apr 6 '19 at 5:48

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$$ Take $$f(x)=\cos\left(\frac1{1-x}\right)$$. If it was uniformly continuous, then, for each $$\varepsilon>0$$, there would be some $$\delta>0$$ such that $$\lvert x-y\rvert<\delta\implies\bigl\lvert f(x)-f(y)\bigr\rvert<\varepsilon$$. But this is not true. Take $$\varepsilon=1$$. Since there are values of $$x$$ arbitrarily close to $$1$$ such that $$f(x)=1$$ and there are values of $$x$$ arbitrarily close to $$1$$ such that $$f(x)=-1$$, then, no matter how small $$\delta$$ is, you will always be able to find examples of numbers $$x,y\in[0,1)$$ such that $$\lvert x-y\rvert<\delta$$ and that $$\bigl\lvert f(x)-f(y)\bigr\rvert=2>\varepsilon$$