# Basic Analysis I & II: Introduction to Real Analysis, Volumes I & II

## Section3.4Uniform continuity

Note: 1.5–2 lectures (continuous extension can be optional)

### Subsection3.4.1Uniform continuity

We made a fuss of saying that the $$\delta$$ in the definition of continuity depended on the point $$c\text{.}$$ There are situations when it is advantageous to to be able to pick a $$\delta$$ independent of any point, and so we give a name to this concept.

#### Definition3.4.1.

Let $$S \subset \R\text{,}$$ and let $$f \colon S \to \R$$ be a function. Suppose for every $$\epsilon > 0$$ there exists a $$\delta > 0$$ such that whenever $$x, c \in S$$ and $$\abs{x-c} < \delta\text{,}$$ then $$\abs{f(x)-f(c)} < \epsilon\text{.}$$ Then we say $$f$$ is uniformly continuous.
A uniformly continuous function must be continuous. The only difference in the definitions is that in uniform continuity, for a given $$\epsilon > 0$$ we pick a $$\delta > 0$$ that works for all $$c \in S\text{.}$$ That is, $$\delta$$ can no longer depend on $$c\text{,}$$ it only depends on $$\epsilon\text{.}$$ The domain of definition of the function makes a difference now. A function that is not uniformly continuous on a larger set, may be uniformly continuous when restricted to a smaller set. Note that $$x$$ and $$c$$ are not treated any differently in this definition.

#### Example3.4.2.

$$f \colon [0,1] \to \R$$ defined by $$f(x) \coloneqq x^2$$ is uniformly continuous.
Proof: Note that $$0 \leq x,c \leq 1\text{.}$$ Then
\begin{equation*} \sabs{x^2-c^2} = \sabs{x+c}\sabs{x-c} \leq \bigl(\sabs{x}+\sabs{c}\bigr) \sabs{x-c} \leq (1+1)\sabs{x-c} . \end{equation*}
Therefore, given $$\epsilon > 0\text{,}$$ let $$\delta \coloneqq \nicefrac{\epsilon}{2}\text{.}$$ If $$\sabs{x-c} < \delta\text{,}$$ then $$\sabs{x^2-c^2} < \epsilon\text{.}$$
On the other hand, $$g \colon \R \to \R$$ defined by $$g(x) \coloneqq x^2$$ is not uniformly continuous.
Proof: Suppose it is uniformly continuous, then for every $$\epsilon > 0\text{,}$$ there would exist a $$\delta > 0$$ such that if $$\sabs{x-c} < \delta\text{,}$$ then $$\sabs{x^2 -c^2} < \epsilon\text{.}$$ Take $$x > 0$$ and let $$c \coloneqq x+\nicefrac{\delta}{2}\text{.}$$ Write
\begin{equation*} \epsilon > \sabs{x^2-c^2} = \sabs{x+c}\sabs{x-c} = (2x+\nicefrac{\delta}{2})\nicefrac{\delta}{2} \geq \delta x . \end{equation*}
Therefore, $$x < \nicefrac{\epsilon}{\delta}$$ for all $$x > 0\text{,}$$ which is a contradiction.

#### Example3.4.3.

The function $$f \colon (0,1) \to \R$$ defined by $$f(x) \coloneqq \nicefrac{1}{x}$$ is not uniformly continuous.
Proof: Given $$\epsilon > 0\text{,}$$ then $$\epsilon > \abs{\nicefrac{1}{x}-\nicefrac{1}{y}}$$ holds if and only if
\begin{equation*} \epsilon > \abs{\nicefrac{1}{x}-\nicefrac{1}{y}} = \frac{\abs{y-x}}{\abs{xy}} = \frac{\abs{y-x}}{xy} , \end{equation*}
or
\begin{equation*} \abs{x-y} < xy \epsilon . \end{equation*}
Suppose $$\epsilon < 1\text{,}$$ and we wish to see if a small $$\delta > 0$$ would work. If $$x \in (0,1)$$ and $$y = x+\nicefrac{\delta}{2} \in (0,1)\text{,}$$ then $$\abs{x-y} = \nicefrac{\delta}{2} < \delta\text{.}$$ We plug $$y$$ into the inequality above to get $$\nicefrac{\delta}{2} < x \bigl( x+\nicefrac{\delta}{2} \bigr) \epsilon < x\text{.}$$ If the definition of uniform continuity is satisfied, then the inequality $$\nicefrac{\delta}{2} < x$$ holds for all $$x > 0\text{.}$$ But then $$\delta \leq 0\text{.}$$ Therefore, no single $$\delta > 0$$ works for all points.
The examples show that if $$f$$ is defined on an interval that is either not closed or not bounded, then $$f$$ can be continuous, but not uniformly continuous. For a closed and bounded interval $$[a,b]\text{,}$$ we can, however, make the following statement.

#### Proof.

We prove the statement by contrapositive. Suppose $$f$$ is not uniformly continuous. We will prove that there is some $$c \in [a,b]$$ where $$f$$ is not continuous. Let us negate the definition of uniformly continuous. There exists an $$\epsilon > 0$$ such that for every $$\delta > 0\text{,}$$ there exist points $$x, y$$ in $$[a,b]$$ with $$\abs{x-y} < \delta$$ and $$\abs{f(x)-f(y)} \geq \epsilon\text{.}$$
So for the $$\epsilon > 0$$ above, we find sequences $$\{ x_n \}_{n=1}^\infty$$ and $$\{ y_n \}_{n=1}^\infty$$ such that $$\abs{x_n-y_n} < \nicefrac{1}{n}$$ and such that $$\abs{f(x_n)-f(y_n)} \geq \epsilon\text{.}$$ By Bolzano–Weierstrass, there exists a convergent subsequence $$\{ x_{n_k} \}_{k=1}^\infty\text{.}$$ Let $$c \coloneqq \lim_{k\to\infty} x_{n_k}\text{.}$$ As $$a \leq x_{n_k} \leq b$$ for all $$k\text{,}$$ we have $$a \leq c \leq b\text{.}$$ Estimate
\begin{equation*} \sabs{y_{n_k} - c} = \sabs{y_{n_k} - x_{n_k} + x_{n_k} - c} \leq \sabs{y_{n_k} - x_{n_k}} + \sabs{x_{n_k}-c} < \nicefrac{1}{n_k} + \sabs{x_{n_k}-c} . \end{equation*}
As $$\nicefrac{1}{n_k}$$ and $$\abs{x_{n_k}-c}$$ both go to zero when $$k$$ goes to infinity, $$\{ y_{n_k} \}_{k=1}^\infty$$ converges and the limit is $$c\text{.}$$ We now show that $$f$$ is not continuous at $$c\text{.}$$ Estimate
\begin{equation*} \begin{split} \abs{f(x_{n_k}) - f(c)} & = \abs{f(x_{n_k}) - f(y_{n_k}) + f(y_{n_k}) - f(c)} \\ & \geq \abs{f(x_{n_k}) - f(y_{n_k})} - \abs{f(y_{n_k}) - f(c)} \\ & \geq \epsilon - \abs{f(y_{n_k})-f(c)} . \end{split} \end{equation*}
Or in other words,
\begin{equation*} \abs{f(x_{n_k})-f(c)} + \abs{f(y_{n_k})-f(c)} \geq \epsilon . \end{equation*}
At least one of the sequences $$\bigl\{ f(x_{n_k}) \bigr\}_{k=1}^\infty$$ or $$\bigl\{ f(y_{n_k}) \bigr\}_{k=1}^\infty$$ cannot converge to $$f(c)\text{,}$$ otherwise the left-hand side of the inequality would go to zero while the right-hand side is positive. Thus $$f$$ cannot be continuous at $$c\text{.}$$
As before, note what is key in the proof: We can apply Bolzano–Weierstrass because the interval $$[a,b]$$ is bounded, and the limit of the subsequence is back in $$[a,b]$$ because the interval is closed.

### Subsection3.4.2Continuous extension

Uniformly continuous functions on open intervals extend continuously to the endpoints. The key is the following lemma, which also has many other uses. It says that uniformly continuous functions preserve Cauchy sequences. The new issue here is that for a Cauchy sequence, the limit may not end up in the domain of the function.

#### Proof.

Let $$\epsilon > 0$$ be given. There is a $$\delta > 0$$ such that $$\abs{f(x)-f(y)} < \epsilon$$ whenever $$x,y \in S$$ and $$\abs{x-y} < \delta\text{.}$$ Find an $$M \in \N$$ such that for all $$n, k \geq M\text{,}$$ we have $$\abs{x_n-x_k} < \delta\text{.}$$ Then for all $$n, k \geq M\text{,}$$ we have $$\abs{f(x_n)-f(x_k)} < \epsilon\text{.}$$
An application of the lemma above is the following extension result. It says that a function on an open interval is uniformly continuous if and only if it can be extended to a continuous function on the closed interval.

#### Proof.

One direction is quick. If $$\widetilde{f}$$ is continuous, then it is uniformly continuous by Theorem 3.4.4. As $$f$$ is the restriction of $$\widetilde{f}$$ to $$(a,b)\text{,}$$ $$f$$ is also uniformly continuous (exercise).
Now suppose $$f$$ is uniformly continuous. We must first show that the limits $$L_a$$ and $$L_b$$ exist. Let us concentrate on $$L_a\text{.}$$ Take $$\{ x_n \}_{n=1}^\infty$$ in $$(a,b)$$ such that $$\lim_{n\to\infty} x_n = a\text{.}$$ The sequence $$\{ x_n \}_{n=1}^\infty$$ is Cauchy, so by Lemma 3.4.5 the sequence $$\bigl\{ f(x_n) \bigr\}_{n=1}^\infty$$ is Cauchy and thus convergent. Let $$L_1 \coloneqq \lim_{n\to\infty} f(x_n)\text{.}$$ Take another sequence $$\{ y_n \}_{n=1}^\infty$$ in $$(a,b)$$ such that $$\lim_{n\to\infty} y_n = a\text{.}$$ By the same reasoning we get $$L_2 \coloneqq \lim_{n\to\infty} f(y_n)\text{.}$$ If we show that $$L_1 = L_2\text{,}$$ then the limit $$L_a = \lim_{x\to a} f(x)$$ exists. Let $$\epsilon > 0$$ be given. Find $$\delta > 0$$ such that $$\abs{x-y} < \delta$$ implies $$\abs{f(x)-f(y)} < \nicefrac{\epsilon}{3}\text{.}$$ Find $$M \in \N$$ such that for $$n \geq M\text{,}$$ we have $$\abs{a-x_n} < \nicefrac{\delta}{2}\text{,}$$ $$\abs{a-y_n} < \nicefrac{\delta}{2}\text{,}$$ $$\abs{f(x_n)-L_1} < \nicefrac{\epsilon}{3}\text{,}$$ and $$\abs{f(y_n)-L_2} < \nicefrac{\epsilon}{3}\text{.}$$ Then for $$n \geq M\text{,}$$
\begin{equation*} \abs{x_n-y_n} = \abs{x_n-a+a-y_n} \leq \abs{x_n-a}+\abs{a-y_n} < \nicefrac{\delta}{2} + \nicefrac{\delta}{2} = \delta. \end{equation*}
So
\begin{equation*} \begin{split} \abs{L_1-L_2} &= \abs{L_1-f(x_n)+f(x_n)-f(y_n)+f(y_n)-L_2} \\ & \leq \abs{L_1-f(x_n)}+\abs{f(x_n)-f(y_n)}+\abs{f(y_n)-L_2} \\ & \leq \nicefrac{\epsilon}{3} + \nicefrac{\epsilon}{3} + \nicefrac{\epsilon}{3} = \epsilon . \end{split} \end{equation*}
Therefore, $$L_1 = L_2\text{.}$$ Thus $$L_a$$ exists. To show that $$L_b$$ exists is left as an exercise.
If $$L_a = \lim_{x\to a} f(x)$$ exists, then $$\lim_{x\to a} \widetilde{f}(x)$$ exists and equals $$L_a$$ (see Proposition 3.1.15). Similarly for $$L_b\text{.}$$ Hence $$\widetilde{f}$$ is continuous at $$a$$ and $$b\text{.}$$ And since $$f$$ is continuous at $$c \in (a,b)\text{,}$$ then $$\widetilde{f}$$ is continuous at $$c \in (a,b)$$ (Proposition 3.1.15 again).
A typical application of this proposition (together with Proposition 3.1.17) is the following. Suppose $$f \colon (-1,0) \cup (0,1) \to \R$$ is uniformly continuous, then $$\lim_{x\to 0} f(x)$$ exists and the function has a removable singularity, that is, we can extend the function to a continuous function on $$(-1,1)\text{.}$$

### Subsection3.4.3Lipschitz continuous functions

#### Definition3.4.7.

A function $$f \colon S \to \R$$ is Lipschitz continuous 1 , if there exists a $$K \in \R\text{,}$$ such that
\begin{equation*} \abs{f(x)-f(y)} \leq K \abs{x-y} \qquad \text{for all } x \text{ and } y \text{ in } S. \end{equation*}
A large class of functions is Lipschitz continuous. Be careful, just as for uniformly continuous functions, the domain of definition of the function is important. See the examples below and the exercises. First, we justify the use of the word continuous.

#### Proof.

Let $$f \colon S \to \R$$ be a function and let $$K$$ be a constant such that $$\abs{f(x)-f(y)} \leq K \abs{x-y}$$ for all $$x, y$$ in $$S\text{.}$$ Let $$\epsilon > 0$$ be given. Take $$\delta \coloneqq \nicefrac{\epsilon}{K}\text{.}$$ For all $$x$$ and $$y$$ in $$S$$ such that $$\abs{x-y} < \delta\text{,}$$
\begin{equation*} \abs{f(x)-f(y)} \leq K \abs{x-y} < K \delta = K \frac{\epsilon}{K} = \epsilon . \end{equation*}
Therefore, $$f$$ is uniformly continuous.
We interpret Lipschitz continuity geometrically. Let $$f$$ be a Lipschitz continuous function with some constant $$K\text{.}$$ We rewrite the inequality to say that for $$x \not=y\text{,}$$ we have
\begin{equation*} \abs{\frac{f(x)-f(y)}{x-y}} \leq K . \end{equation*}
The quantity $$\frac{f(x)-f(y)}{x-y}$$ is the slope of the line between the points $$\bigl(x,f(x)\bigr)$$ and $$\bigl(y,f(y)\bigr)\text{,}$$ that is, a secant line. Therefore, $$f$$ is Lipschitz continuous if and only if every line that intersects the graph of $$f$$ in at least two distinct points has slope in absolute value less than or equal to $$K\text{.}$$ See Figure 3.9.

#### Example3.4.9.

The functions $$\sin(x)$$ and $$\cos(x)$$ are Lipschitz continuous. In Example 3.2.6 we have seen the following two inequalities.
\begin{equation*} \abs{\sin(x)-\sin(y)} \leq \abs{x-y} \qquad \text{and} \qquad \abs{\cos(x)-\cos(y)} \leq \abs{x-y} . \end{equation*}
Hence sine and cosine are Lipschitz continuous with $$K=1\text{.}$$

#### Example3.4.10.

The function $$f \colon [1,\infty) \to \R$$ defined by $$f(x) \coloneqq \sqrt{x}$$ is Lipschitz continuous. Proof:
\begin{equation*} \abs{\sqrt{x}-\sqrt{y}} = \abs{\frac{x-y}{\sqrt{x}+\sqrt{y}}} = \frac{\abs{x-y}}{\sqrt{x}+\sqrt{y}} . \end{equation*}
As $$x \geq 1$$ and $$y \geq 1\text{,}$$ we see that $$\frac{1}{\sqrt{x}+\sqrt{y}} \leq \frac{1}{2}\text{.}$$ Therefore,
\begin{equation*} \abs{\sqrt{x}-\sqrt{y}} = \abs{\frac{x-y}{\sqrt{x}+\sqrt{y}}} \leq \frac{1}{2} \abs{x-y}. \end{equation*}
On the other hand, $$g \colon [0,\infty) \to \R$$ defined by $$g(x) \coloneqq \sqrt{x}$$ is not Lipschitz continuous. Proof: Suppose for all $$x,y \in [0,\infty)\text{,}$$
\begin{equation*} \abs{\sqrt{x}-\sqrt{y}} \leq K \abs{x-y} , \end{equation*}
for some $$K\text{.}$$ Set $$y=0$$ to obtain $$\sqrt{x} \leq K x\text{.}$$ If $$K > 0\text{,}$$ then for $$x > 0$$ we get $$\nicefrac{1}{K} \leq \sqrt{x}$$ or $$\nicefrac{1}{K^2} \leq x\text{.}$$ This cannot possibly be true for all $$x > 0\text{.}$$ Thus no such $$K > 0$$ exists and $$g$$ is not Lipschitz continuous. See Figure 3.10 and note how secant lines would be more and more vertical as we get closer to $$x=0\text{.}$$

The last example $$g$$ is a function that is uniformly continuous but not Lipschitz continuous. To see that $$\sqrt{x}$$ is uniformly continuous as a function on $$[0,\infty)\text{,}$$ note that it is uniformly continuous when restricted to $$[0,1]$$ by Theorem 3.4.4. It is also Lipschitz (and so uniformly continuous) when restricted to $$[1,\infty)\text{.}$$ It is not hard (exercise) to show that this means that $$\sqrt{x}$$ is a uniformly continuous function on $$[0,\infty)\text{.}$$

### Subsection3.4.4Exercises

#### Exercise3.4.1.

Let $$f \colon S \to \R$$ be uniformly continuous. Let $$A \subset S\text{.}$$ Then the restriction $$f|_A$$ is uniformly continuous.

#### Exercise3.4.2.

Let $$f \colon (a,b) \to \R$$ be a uniformly continuous function. Finish the proof of Proposition 3.4.6 by showing that the limit $$\lim\limits_{x \to b} f(x)$$ exists.

#### Exercise3.4.3.

Show that $$f \colon (c,\infty) \to \R$$ for some $$c > 0$$ and defined by $$f(x) \coloneqq \nicefrac{1}{x}$$ is Lipschitz continuous.

#### Exercise3.4.4.

Show that $$f \colon (0,\infty) \to \R$$ defined by $$f(x) \coloneqq \nicefrac{1}{x}$$ is not Lipschitz continuous.

#### Exercise3.4.5.

Let $$A, B$$ be intervals. Let $$f \colon A \to \R$$ and $$g \colon B \to \R$$ be uniformly continuous functions such that $$f(x) = g(x)$$ for $$x \in A \cap B\text{.}$$ Define the function $$h \colon A \cup B \to \R$$ by $$h(x) \coloneqq f(x)$$ if $$x \in A$$ and $$h(x) \coloneqq g(x)$$ if $$x \in B \setminus A\text{.}$$
1. Prove that if $$A \cap B \not= \emptyset\text{,}$$ then $$h$$ is uniformly continuous.
2. Find an example where $$A \cap B = \emptyset$$ and $$h$$ is not even continuous.

#### Exercise3.4.6.

(Challenging)   Let $$f \colon \R \to \R$$ be a polynomial of degree $$d \geq 2\text{.}$$ Show that $$f$$ is not Lipschitz continuous.

#### Exercise3.4.7.

Let $$f \colon (0,1) \to \R$$ be a bounded continuous function. Show that the function $$g(x) \coloneqq x(1-x)f(x)$$ is uniformly continuous.

#### Exercise3.4.8.

Show that $$f \colon (0,\infty) \to \R$$ defined by $$f(x) \coloneqq \sin (\nicefrac{1}{x})$$ is not uniformly continuous.

#### Exercise3.4.9.

(Challenging)   Let $$f \colon \Q \to \R$$ be a uniformly continuous function. Show that there exists a uniformly continuous function $$\widetilde{f} \colon \R \to \R$$ such that $$f(x) = \widetilde{f}(x)$$ for all $$x \in \Q\text{.}$$

#### Exercise3.4.10.

1. Find a continuous $$f \colon (0,1) \to \R$$ and a sequence $$\{ x_n \}_{n=1}^\infty$$ in $$(0,1)$$ that is Cauchy, but such that $$\bigl\{ f(x_n) \bigr\}_{n=1}^\infty$$ is not Cauchy.
2. Prove that if $$f \colon \R \to \R$$ is continuous, and $$\{ x_n \}_{n=1}^\infty$$ is Cauchy, then $$\bigl\{ f(x_n) \bigr\}_{n=1}^\infty$$ is Cauchy.

#### Exercise3.4.11.

Prove:
1. If $$f \colon S \to \R$$ and $$g \colon S \to \R$$ are uniformly continuous, then $$h \colon S \to \R$$ given by $$h(x) \coloneqq f(x) + g(x)$$ is uniformly continuous.
2. If $$f \colon S \to \R$$ is uniformly continuous and $$a \in \R\text{,}$$ then $$h \colon S \to \R$$ given by $$h(x) \coloneqq a f(x)$$ is uniformly continuous.

#### Exercise3.4.12.

Prove:
1. If $$f \colon S \to \R$$ and $$g \colon S \to \R$$ are Lipschitz, then $$h \colon S \to \R$$ given by $$h(x) \coloneqq f(x) + g(x)$$ is Lipschitz.
2. If $$f \colon S \to \R$$ is Lipschitz and $$a \in \R\text{,}$$ then $$h \colon S \to \R$$ given by $$h(x) \coloneqq a f(x)$$ is Lipschitz.

#### Exercise3.4.13.

1. If $$f \colon [0,1] \to \R$$ is given by $$f(x) \coloneqq x^m$$ for an integer $$m \geq 0\text{,}$$ show $$f$$ is Lipschitz and find the best (the smallest) Lipschitz constant $$K$$ (depending on $$m$$ of course). Hint: $$(x-y)(x^{m-1} + x^{m-2}y + x^{m-3}y^2 + \cdots + x y^{m-2} + y^{m-1}) = x^m - y^m\text{.}$$
2. Using the previous exercise, show that if $$f \colon [0,1] \to \R$$ is a polynomial, that is, $$f(x) \coloneqq a_m x^m + a_{m-1} x^{m-1} + \cdots + a_0\text{,}$$ then $$f$$ is Lipschitz.

#### Exercise3.4.14.

Suppose for $$f \colon [0,1] \to \R\text{,}$$ we have $$\abs{f(x)-f(y)} \leq K \abs{x-y}$$ for all $$x,y$$ in $$[0,1]\text{,}$$ and $$f(0) = f(1) = 0\text{.}$$ Prove that $$\abs{f(x)} \leq \nicefrac{K}{2}$$ for all $$x \in [0,1]\text{.}$$ Further show by example that $$\nicefrac{K}{2}$$ is the best possible, that is, there exists such a continuous function for which $$\abs{f(x)} = \nicefrac{K}{2}$$ for some $$x \in [0,1]\text{.}$$

#### Exercise3.4.15.

Suppose $$f \colon \R \to \R$$ is continuous and periodic with period $$P > 0\text{.}$$ That is, $$f(x+P) = f(x)$$ for all $$x \in \R\text{.}$$ Show that $$f$$ is uniformly continuous.

#### Exercise3.4.16.

Suppose $$f \colon S \to \R$$ and $$g \colon [0,\infty) \to [0,\infty)$$ are functions, $$g$$ is continuous at $$0\text{,}$$ $$g(0) = 0\text{,}$$ and whenever $$x$$ and $$y$$ are in $$S\text{,}$$ we have $$\abs{f(x)-f(y)} \leq g\bigl(\abs{x-y}\bigr)\text{.}$$ Prove that $$f$$ is uniformly continuous.

#### Exercise3.4.17.

Suppose $$f \colon [a,b] \to \R$$ is a function such that for every $$c \in [a,b]$$ there is a $$K_c > 0$$ and an $$\epsilon_c > 0$$ for which $$\abs{f(x)-f(y)} \leq K_c \abs{x-y}$$ for all $$x$$ and $$y$$ in $$(c-\epsilon_c,c+\epsilon_c) \cap [a,b]\text{.}$$ In other words, $$f$$ is “locally Lipschitz.”
1. Prove that there exists a single $$K > 0$$ such that $$\abs{f(x)-f(y)} \leq K \abs{x-y}$$ for all $$x,y$$ in $$[a,b]\text{.}$$
2. Find a counterexample to the above if the interval is open, that is, find an $$f \colon (a,b) \to \R$$ that is locally Lipschitz, but not Lipschitz.
Named after the German mathematician Rudolf Otto Sigismund Lipschitz (1832–1903).
For a higher quality printout use the PDF versions: https://www.jirka.org/ra/realanal.pdf or https://www.jirka.org/ra/realanal2.pdf