13 Uniform Continuity
Uniform continuity was defined in the previous chapter: \(f : X \to Y\) is uniformly continuous if the \(\delta\) in the continuity condition can be chosen depending only on \(\varepsilon\), not on the point. The purpose of this chapter is to understand when uniform continuity holds, when it fails, and what it buys analytically.
13.1 Recap and first examples
Definition 13.1 (Uniform continuity) A map \(f : (X, d_X) \to (Y, d_Y)\) is uniformly continuous if for every \(\varepsilon > 0\) there exists \(\delta > 0\) such that \[ d_X(x, x') < \delta \implies d_Y(f(x), f(x')) < \varepsilon \quad \text{for all } x, x' \in X. \]
The quantifier order is the entire content: \(\forall \varepsilon\; \exists \delta\; \forall x, x'\), versus the pointwise \(\forall \varepsilon\; \forall x\; \exists \delta\). Uniform continuity is the stronger condition because \(\delta\) must work simultaneously at every point.
To show \(f\) is not uniformly continuous, it suffices to find \(\varepsilon > 0\) and sequences \((x_n), (x_n') \subset X\) with \(d_X(x_n, x_n') \to 0\) but \(d_Y(f(x_n), f(x_n')) \geq \varepsilon\) for all \(n\).
Example 13.1 (Examples)
Any Lipschitz map is uniformly continuous: \(\delta = \varepsilon/L\) works globally.
\(f(x) = x^2\) is uniformly continuous on \([0,M]\) for any \(M < \infty\) — it is continuous on a compact set — but not on all of \(\mathbb{R}\): take \(x_n = n + 1/n\) and \(x_n' = n\), so \(|x_n - x_n'| = 1/n \to 0\) but \(|x_n^2 - (x_n')^2| = |2 + 1/n^2| \to 2\).
\(f(x) = \sin(x^2)\) on \(\mathbb{R}\) is not uniformly continuous: the function oscillates with increasing frequency, so nearby points can give values near \(+1\) and \(-1\) simultaneously for large \(x\).
\(f(x) = \sqrt{x}\) on \([0, \infty)\) is uniformly continuous despite having unbounded domain. For \(x, x' \geq 0\): \[ |\sqrt{x} - \sqrt{x'}| = \frac{|x - x'|}{\sqrt{x} + \sqrt{x'}} \leq \sqrt{|x - x'|}, \] so \(\delta = \varepsilon^2\) works. This is an example of a uniformly continuous function that is not Lipschitz (the derivative blows up at \(0\)).
Exercise. Determine whether each of the following functions is uniformly continuous on the given domain.
- \(f(x) = \sqrt{x}\) on \((0,1]\).
- \(f(x) = x\sin(1/x)\) on \((0,1]\).
- \(f(x) = \sin(1/x)\) on \((0,1]\).
- \(f(x) = x^2 \sin(1/x)\) on \((0,1]\).
Uniformly continuous. The estimate \(|\sqrt{x} - \sqrt{x'}| \leq \sqrt{|x-x'|}\) from the example above applies on any subset of \([0,\infty)\).
Uniformly continuous. Extend \(f\) to \([0,1]\) by \(f(0) = 0\); then \(f\) is continuous on the compact set \([0,1]\), hence uniformly continuous by Heine–Cantor (below). Its restriction to \((0,1]\) is then uniformly continuous.
Not uniformly continuous. Take \(x_n = 1/(2\pi n)\) and \(x_n' = 1/((2n + 1/2)\pi)\); then \(x_n - x_n' \to 0\) but \(\sin(1/x_n) = 0\) and \(\sin(1/x_n') = 1\), so \(|f(x_n) - f(x_n')| = 1\) for all \(n\).
Uniformly continuous. For \(x, x' \in (0,1]\): \(|x^2 \sin(1/x) - (x')^2 \sin(1/x')| \leq |x^2 - (x')^2| + (x')^2|\sin(1/x) - \sin(1/x')|\). Since \(|x^2 - (x')^2| \leq 2|x - x'|\) and \((x')^2|\sin(1/x) - \sin(1/x')| \leq 2(x')^2 \leq 2\), this bound is too crude. Better: extend \(f\) to \([0,1]\) by \(f(0) = 0\); then \(f\) is continuous at \(0\) since \(|x^2 \sin(1/x)| \leq x^2 \to 0\), and continuous on \((0,1]\). So \(f\) extends continuously to \([0,1]\), hence is uniformly continuous there. \(\square\)
13.2 The Heine–Cantor theorem
The fundamental existence theorem for uniform continuity:
Theorem 13.1 (Heine–Cantor theorem) Let \(K\) be a compact metric space and \(f : K \to Y\) continuous. Then \(f\) is uniformly continuous.
Proof. Suppose \(f\) is not uniformly continuous. Then there exists \(\varepsilon > 0\) such that for every \(n \geq 1\) there exist \(x_n, x_n' \in K\) with \(d(x_n, x_n') < 1/n\) but \(d(f(x_n), f(x_n')) \geq \varepsilon\).
Since \(K\) is compact, the sequence \((x_n)\) has a convergent subsequence \(x_{n_k} \to p \in K\). Since \(d(x_{n_k}, x_{n_k}') < 1/n_k \to 0\), we also have \(x_{n_k}' \to p\).
By continuity of \(f\) at \(p\), both \(f(x_{n_k}) \to f(p)\) and \(f(x_{n_k}') \to f(p)\). Then \[ d(f(x_{n_k}), f(x_{n_k}')) \leq d(f(x_{n_k}), f(p)) + d(f(p), f(x_{n_k}')) \to 0, \] contradicting \(d(f(x_{n_k}), f(x_{n_k}')) \geq \varepsilon > 0\). \(\square\)
The proof is a compactness argument dressed up as a contradiction: any failure of uniform continuity produces a bad sequence, compactness extracts a convergent subsequence, and continuity destroys the badness.
13.3 Uniform continuity and Cauchy sequences
Uniform continuity interacts cleanly with Cauchy sequences, in a way that ordinary continuity does not.
Proposition 13.1 (Uniformly continuous maps preserve Cauchy sequences) Let \(f : X \to Y\) be uniformly continuous. If \((x_n)\) is Cauchy in \(X\), then \((f(x_n))\) is Cauchy in \(Y\).
Proof. Given \(\varepsilon > 0\), let \(\delta > 0\) be the modulus from uniform continuity. Since \((x_n)\) is Cauchy, there exists \(N\) with \(d_X(x_m, x_n) < \delta\) for all \(m, n \geq N\). Then \(d_Y(f(x_m), f(x_n)) < \varepsilon\) for all \(m, n \geq N\). \(\square\)
Ordinary continuity does not preserve Cauchy sequences. The function \(f(x) = 1/x\) on \((0,1)\) is continuous, and \((1/n)\) is Cauchy in \((0,1)\), but \((f(1/n)) = (n)\) is not Cauchy in \(\mathbb{R}\).
This is not an accident. The next theorem says that functions that send Cauchy sequences to non-Cauchy sequences are precisely those that fail to extend continuously to the completion.
13.4 Extension of uniformly continuous functions
Theorem 13.2 (Extension theorem) Let \(X\) be a metric space, \(Y\) a complete metric space, \(A \subset X\) dense, and \(f : A \to Y\) uniformly continuous. Then \(f\) extends uniquely to a uniformly continuous function \(\tilde{f} : X \to Y\).
Proof. Existence. For \(x \in X\), choose a sequence \((a_n) \subset A\) with \(a_n \to x\) (possible since \(A\) is dense). Since \(a_n\) is Cauchy in \(X\) and \(f\) is uniformly continuous, \((f(a_n))\) is Cauchy in \(Y\). Since \(Y\) is complete, \(f(a_n)\) converges; define \(\tilde{f}(x) := \lim_n f(a_n)\).
Well-defined. If \((a_n')\) is another sequence in \(A\) converging to \(x\), the interleaved sequence \(a_1, a_1', a_2, a_2', \ldots\) converges to \(x\), hence is Cauchy, hence its image under \(f\) is Cauchy, hence converges. Both subsequences \((f(a_n))\) and \((f(a_n'))\) converge to the same limit.
Extension. For \(x \in A\), the constant sequence \(a_n = x\) gives \(\tilde{f}(x) = f(x)\).
Uniformly continuous. Given \(\varepsilon > 0\), let \(\delta\) be the modulus for \(f\). For \(x, x' \in X\) with \(d(x,x') < \delta/2\), choose sequences \(a_n \to x\) and \(a_n' \to x'\) in \(A\). Then \(d(a_n, a_n') \leq d(a_n, x) + d(x, x') + d(x', a_n') < \delta\) eventually, so \(d(f(a_n), f(a_n')) < \varepsilon\) eventually. Taking limits: \(d(\tilde{f}(x), \tilde{f}(x')) \leq \varepsilon\).
Uniqueness. Any two continuous extensions agree on the dense subset \(A\), hence everywhere by continuity. \(\square\)
This theorem is used constantly. When a function is defined on \(\mathbb{Q}\) and one wants to extend it to \(\mathbb{R}\), or defined on a dense subspace of a function space, the extension theorem provides the extension — provided the function is uniformly continuous and the target is complete.
Without completeness of \(Y\), the Cauchy sequence \((f(a_n))\) may not converge, and the definition of \(\tilde{f}(x)\) breaks down. The function \(f : \mathbb{Q} \to \mathbb{Q}\) defined by \(f(q) = q\) is uniformly continuous, but it does not extend to a continuous function \(\mathbb{R} \to \mathbb{Q}\) — the target \(\mathbb{Q}\) is incomplete.
Exercise. Let \(f : \mathbb{Q} \to \mathbb{R}\) be uniformly continuous. Show that \(f\) extends uniquely to a continuous function \(\tilde{f} : \mathbb{R} \to \mathbb{R}\), and that \(\tilde{f}\) is uniformly continuous on every compact subset of \(\mathbb{R}\).
\(\mathbb{Q}\) is dense in \(\mathbb{R}\) and \(\mathbb{R}\) is complete, so the extension theorem applies directly to give a unique uniformly continuous \(\tilde{f} : \mathbb{R} \to \mathbb{R}\). On any compact \(K \subset \mathbb{R}\), the restriction \(\tilde{f}|_K\) is continuous on a compact set, hence uniformly continuous by Heine–Cantor. \(\square\)
13.5 Modulus of continuity
For quantitative purposes, it is useful to track how \(\delta\) depends on \(\varepsilon\).
Definition 13.2 (Modulus of continuity) The modulus of continuity of \(f : X \to Y\) is the function \(\omega : [0,\infty) \to [0,\infty)\) defined by \[ \omega(\delta) := \sup\{d_Y(f(x), f(x')) : d_X(x, x') \leq \delta\}. \] Then \(f\) is uniformly continuous iff \(\omega(\delta) \to 0\) as \(\delta \to 0\).
The modulus encodes the “rate” of uniform continuity. The two most common classes:
- \(f\) is Lipschitz iff \(\omega(\delta) \leq L\delta\) for some \(L\), i.e. \(\omega\) grows at most linearly.
- \(f\) is Hölder continuous with exponent \(\alpha \in (0,1]\) iff \(\omega(\delta) \leq C\delta^\alpha\) for some \(C\).
Every Hölder-continuous function is uniformly continuous. Lipschitz is Hölder with \(\alpha = 1\). The function \(\sqrt{x}\) on \([0,1]\) is Hölder with \(\alpha = 1/2\) (the earlier estimate \(|\sqrt{x} - \sqrt{x'}| \leq \sqrt{|x-x'|}\) is exactly the \(\alpha = 1/2\) Hölder condition) but not Lipschitz.
Exercise. Show that if \(f : [a,b] \to \mathbb{R}\) is differentiable with bounded derivative \(|f'| \leq M\), then \(f\) is Lipschitz with constant \(M\).
By the mean value theorem, for any \(x, x' \in [a,b]\): \[ |f(x) - f(x')| = |f'(c)| |x - x'| \leq M|x - x'| \] for some \(c\) between \(x\) and \(x'\). This is exactly the Lipschitz condition with constant \(M\). \(\square\)
The converse fails: \(f(x) = |x|\) is Lipschitz on \(\mathbb{R}\) with constant \(1\) but is not differentiable at \(0\).
13.6 Uniform continuity on non-compact domains
Not all uniformly continuous functions live on compact spaces. Some useful conditions:
Proposition 13.2 (Continuous functions on \(\mathbb{R}\) with vanishing oscillation) Let \(f : \mathbb{R} \to \mathbb{R}\) be continuous. If \(f(x) \to L\) as \(|x| \to \infty\) for some \(L \in \mathbb{R}\), then \(f\) is uniformly continuous.
Proof. Given \(\varepsilon > 0\), choose \(M\) such that \(|f(x) - L| < \varepsilon/2\) for \(|x| > M\). Then for \(|x|, |x'| > M\), \(|f(x) - f(x')| < \varepsilon\), so any \(\delta\) works in this region. On the compact set \([-M-1, M+1]\), \(f\) is uniformly continuous by Heine–Cantor with some \(\delta_0 > 0\). Taking \(\delta = \min(\delta_0, 1)\) and tracking the cases where \(x\) or \(x'\) crosses \(\pm M\) shows \(f\) is uniformly continuous on all of \(\mathbb{R}\). \(\square\)
Proposition 13.3 (Continuous periodic functions) Every continuous periodic function \(f : \mathbb{R} \to \mathbb{R}\) is uniformly continuous.
Proof. If \(f\) has period \(T > 0\), then \(f\) is determined by its values on \([0, T]\), which is compact. Formally: for any \(x, x'\), write \(x = nT + r\) and \(x' = mT + r'\) with \(r, r' \in [0,T)\). Uniform continuity of \(f|_{[0,T]}\) gives the result, since \(|f(x) - f(x')| = |f(r) - f(r')|\) and \(|r - r'|\) can be controlled in terms of \(|x - x'|\) modulo the period. \(\square\)
Exercise. Show that \(f(x) = \sin(x^2)\) is continuous but not uniformly continuous on \(\mathbb{R}\).
Continuity is clear since \(\sin\) and \(x^2\) are both continuous.
For non-uniform continuity, let \(x_n = \sqrt{2\pi n}\) and \(x_n' = \sqrt{2\pi n + \pi/2}\). Then \[ x_n' - x_n = \sqrt{2\pi n + \pi/2} - \sqrt{2\pi n} = \frac{\pi/2}{\sqrt{2\pi n + \pi/2} + \sqrt{2\pi n}} \sim \frac{\pi/2}{2\sqrt{2\pi n}} \to 0. \] But \(f(x_n) = \sin(2\pi n) = 0\) and \(f(x_n') = \sin(2\pi n + \pi/2) = 1\), so \(|f(x_n) - f(x_n')| = 1\) for all \(n\). \(\square\)
13.7 Failure of uniform continuity and incompleteness
There is a clean characterisation of when a continuous function on an open set fails to extend to the boundary — it is exactly when uniform continuity fails.
Proposition 13.4 (Uniform continuity and boundary extension) Let \((X, d)\) be a metric space, \(A \subset X\) an open subset, \(Y\) a complete metric space, and \(f : A \to Y\) continuous. Then \(f\) extends continuously to \(\overline{A}\) if and only if \(f\) is uniformly continuous on every bounded closed subset of \(A\) that approaches \(\partial A\).
More precisely: \(f\) extends continuously to a point \(p \in \partial A\) if and only if \(f(x_n)\) is Cauchy in \(Y\) for every sequence \((x_n) \subset A\) with \(x_n \to p\).
The “if” direction is the extension theorem in local form. The “only if” direction: if \(f\) extends continuously to \(p\), then any \(x_n \to p\) gives \(f(x_n) \to f(p)\), and every convergent sequence is Cauchy.
The canonical example is \(f(x) = 1/x\) on \((0,1)\). The sequence \(x_n = 1/n \to 0\) satisfies \(f(x_n) = n \to \infty\), which is not Cauchy — precisely because \(f\) cannot be extended continuously to \(0\). Uniform continuity fails near \(0\), and this failure is witnessed by the same sequence.
Exercise. Show that \(f : (0,1) \to \mathbb{R}\) defined by \(f(x) = \sin(1/x)\) does not extend continuously to \([0,1]\), and identify the obstruction in terms of Cauchy sequences.
Any extension would require \(\lim_{x \to 0^+} f(x)\) to exist. But the sequences \(x_n = 1/(2\pi n) \to 0\) and \(x_n' = 1/((4n+1)\pi/2) \to 0\) give \(f(x_n) = 0\) and \(f(x_n') = 1\), so no limit exists.
In terms of Cauchy sequences: \(x_n = 1/(2\pi n)\) is Cauchy (in fact convergent to \(0\)) in \((0,1)\), but \((f(x_n)) = (0, 0, 0, \ldots)\) is trivially Cauchy with limit \(0\). Meanwhile \(x_n'' = 1/((4n+1)\pi/2)\) is also Cauchy with the same limit \(0\), but \((f(x_n'')) = (1, 1, 1, \ldots)\), limit \(1\). Two Cauchy sequences in the domain with the same limit give sequences in \(Y\) with different limits — so the function value at \(0\) cannot be consistently defined. The obstruction is not that \((f(x_n))\) fails to be Cauchy for some particular sequence, but that different sequences approaching the boundary point give different Cauchy limits. \(\square\)