# Continuous Functions and Uniform Continuity: What It Means for δ Not to Depend on the Point

> From Bolzano-Weierstrass and nested intervals we prove that a continuous function on a closed bounded interval is bounded, attains its extrema and takes intermediate values, then define uniform continuity and prove the Heine-Cantor theorem.
> https://rikai.mugen-giken.com/en/mathematics/real-analysis/uniform-continuity

## 0. Key points

- In the definition of continuity, the $\delta$ chosen in response to $\varepsilon$ **may differ from point to point**. Removing this dependence on the point, so that a single $\delta$ works across the whole domain, gives the condition called **uniform continuity**. The only difference between the two is the order of the quantifiers $\forall a$ and $\exists \delta$, and that alone changes drastically which theorems hold.
- A continuous function on a closed bounded interval $[a,b]$ is bounded, and it actually attains a maximum and a minimum. The engine of the proof is the Bolzano-Weierstrass theorem, which in turn rests on the completeness of $\mathbb{R}$ (the continuity axiom).
- The intermediate value theorem can be proved by repeatedly bisecting the interval, that is, by **nested intervals**. The theorem is false over the rational field $\mathbb{Q}$, which makes it plain that what makes it true is completeness itself.
- **Heine-Cantor theorem**: a continuous function on a closed bounded interval is uniformly continuous. Boundedness is what lets us invoke Bolzano-Weierstrass, and closedness is what keeps limit points inside the domain; drop either one and a counterexample appears.
- Uniform continuity sends Cauchy sequences to Cauchy sequences. Consequently a uniformly continuous function on an open interval extends uniquely to a continuous function on the closed interval, and this is the foundation for arguments about Riemann integrability and uniform convergence.

## 1. Motivation: where "continuous" is not enough

In calculus, continuity is first handled through the intuition that "the graph is unbroken", and the ε-δ formulation is introduced as a device for writing that intuition down rigorously. In real analysis the roles are reversed. The definition itself becomes the object of study, and we separate what does and does not follow from it without leaning on intuition. The first hurdle is the subject of this article: uniformity.

Let us begin with a naive question. Suppose $f$ is continuous on an interval $I$. One is tempted to say that "at two sufficiently close points, the values of $f$ are also close". But what the definition of continuity guarantees is only this: **after fixing** a single point $a$, "for $x$ sufficiently close to $a$, $f(x)$ is close to $f(a)$". The threshold $\delta$ for "sufficiently close" is allowed to differ with $a$. If $\delta$ shrinks without bound as $a$ moves, then no common $\delta$ saying "this close is good enough throughout $I$" can be found.

Let us make this concrete. Consider $f(x) = 1/x$ on $I = (0,1]$. Near $a = 0.8$, keeping the values of $f$ within a range of $\varepsilon = 0.3$ permits a $\delta$ as large as about $0.155$. But near $a = 0.3$, for the same $\varepsilon = 0.3$ we can only take $\delta \approx 0.0248$. As $a$ moves towards $0$, the admissible $\delta$ collapses to $0$. Hence no $\delta$ works across all of $(0,1]$.

<Figure caption="For the same ε, the required δ changes with the location (1/x on the domain (0,1])">
<svg viewBox="0 0 640 344" width="100%" role="img" aria-label="Graph of the function 1/x, showing that the width δ in the x-direction corresponding to a band of height 2ε is narrow near x=0.3 and wide near x=0.8">
  <g stroke="currentColor" fill="none" stroke-width="1" opacity="0.5">
    <line x1="70" y1="300" x2="622" y2="300" />
    <line x1="70" y1="300" x2="70" y2="34" />
  </g>
  <rect x="218.6" y="142.6" width="26.8" height="26" fill="currentColor" opacity="0.16" />
  <rect x="418.3" y="232.8" width="167.4" height="26" fill="currentColor" opacity="0.16" />
  <polyline points="160,40 167,59 178,83 189,103 205,127 221,145 232,156 259,176 286,192 313,204 340,213 394,228 448,238 502,246 556,252 610,257" fill="none" stroke="var(--sl-color-accent)" stroke-width="2.5" stroke-linejoin="round" />
  <g stroke="currentColor" stroke-width="1" stroke-dasharray="4 3" opacity="0.6">
    <line x1="232" y1="155.6" x2="232" y2="300" />
    <line x1="502" y1="245.8" x2="502" y2="300" />
  </g>
  <g fill="var(--sl-color-accent)">
    <circle cx="232" cy="155.6" r="3.5" />
    <circle cx="502" cy="245.8" r="3.5" />
  </g>
  <g stroke="currentColor" stroke-width="1.6" opacity="0.85">
    <line x1="218.6" y1="312" x2="245.4" y2="312" />
    <line x1="218.6" y1="307" x2="218.6" y2="317" />
    <line x1="245.4" y1="307" x2="245.4" y2="317" />
    <line x1="418.3" y1="312" x2="585.7" y2="312" />
    <line x1="418.3" y1="307" x2="418.3" y2="317" />
    <line x1="585.7" y1="307" x2="585.7" y2="317" />
  </g>
  <g fill="currentColor" font-size="13">
    <text x="626" y="305">x</text>
    <text x="58" y="30" text-anchor="middle">y</text>
    <text x="232" y="334" text-anchor="middle">δ is narrow</text>
    <text x="502" y="334" text-anchor="middle">δ is wide</text>
    <text x="256" y="138">band of height 2ε</text>
    <text x="502" y="226" text-anchor="middle">band of height 2ε (same height)</text>
  </g>
</svg>
</Figure>

Historically, too, this distinction went unnoticed for a long time. In his 1821 *Cours d'analyse*, Cauchy asserted that the sum of a convergent series of continuous functions is again continuous. The claim admits counterexamples; the correct hypothesis is not pointwise but uniform convergence (<Ref to="mathematics/real-analysis/uniform-convergence#thm-continuity" text="continuity of a uniform limit" />). Around the same period, when Cauchy discussed the integrability of continuous functions, it has been pointed out that he tacitly used the independence of $\delta$ from the point, that is, uniform continuity. The distinction "uniform" only became a concept in its own right from the middle of the nineteenth century onwards, and the explicit formulation of uniform continuity, together with the statement that it holds automatically on a closed bounded interval, is usually credited to Heine's paper of 1872 (the essential argument is believed to go back to the lectures of Dirichlet and Weierstrass).

We shall therefore build the discussion in the following order. First we extract from the completeness of $\mathbb{R}$ the nested interval principle and the Bolzano-Weierstrass theorem, and use them to prove the basic theorems about continuous functions on a closed bounded interval (boundedness, the extreme value theorem, the intermediate value theorem). We then define uniform continuity and prove the Heine-Cantor theorem. At each proof we make explicit **where completeness was used**. This is the part that calculus tends to skip, and it is precisely the point of real analysis.

## 2. Preliminaries: two tools extracted from completeness

The only property of the real numbers we assume in this article is the following.

> **Continuity axiom (existence of suprema)**: a nonempty subset $A$ of $\mathbb{R}$ that is bounded above has a supremum $\sup A$; that is, among the upper bounds of $A$ there is a least one.

Two properties follow at once from the definition of the supremum, and we shall use both without further comment. Setting $M = \sup A$: (i) $x \le M$ for every $x \in A$; (ii) for every $\eta > 0$, $M - \eta$ is not an upper bound, so there exists $x \in A$ with $x > M - \eta$. Statement (ii) restates that $M$ is the **least** of the upper bounds.

We shall also use one fact about limits of sequences: **limits preserve order**. That is, if $x_n \to x$ and $x_n \le 0$ for all $n$, then $x \le 0$. Reason: if $x > 0$, then for $\varepsilon = x$ we would have $|x_n - x| < x$ for all sufficiently large $n$, hence $x_n > 0$, contradicting the hypothesis. The case $x_n \ge 0$ is analogous.

For the various equivalent forms of completeness (convergence of monotone bounded sequences, convergence of Cauchy sequences, existence of suprema), see [Completeness of the reals and Cauchy sequences](/en/mathematics/real-analysis/completeness-and-cauchy), in particular <Ref to="mathematics/real-analysis/completeness-and-cauchy#thm-supremum" text="existence of suprema" /> and <Ref to="mathematics/real-analysis/completeness-and-cauchy#thm-completeness" text="Cauchy's convergence criterion" />. Here we rebuild, from the continuity axiom, the two tools actually used in this article.

<Lemma id="lem-nested-intervals" title="Nested interval principle">
Let $I_n = [a_n, b_n]$ (with $a_n \le b_n$, $n \in \mathbb{N} = \lbrace 1, 2, \ldots \rbrace$) be a sequence of closed intervals satisfying
$$
I_1 \supseteq I_2 \supseteq I_3 \supseteq \cdots, \qquad \lim_{n \to \infty} (b_n - a_n) = 0 .
$$
Then $\bigcap_{n=1}^{\infty} I_n$ consists of exactly one point. If that point is $c$, then $a_n \to c$ and $b_n \to c$.
</Lemma>

<Proof of="lem-nested-intervals">
First, the inclusion $I_{n+1} \subseteq I_n$ is equivalent to the inequalities $a_n \le a_{n+1} \le b_{n+1} \le b_n$. Hence $(a_n)$ is nondecreasing and $(b_n)$ is nonincreasing.

Next, $a_n \le b_m$ for all $m, n$. Indeed, putting $N = \max(m,n)$, monotonicity gives $a_n \le a_N \le b_N \le b_m$. Therefore the set $A = \lbrace a_n : n \in \mathbb{N} \rbrace$ is nonempty and has $b_1$ as an upper bound. By the continuity axiom, $c = \sup A$ exists.

By property (i) of the supremum, $a_n \le c$ for all $n$. Also, each $b_m$ is an upper bound of $A$, so since $c$ is the least upper bound, $c \le b_m$ for all $m$. Combining the two, $a_n \le c \le b_n$ for all $n$, that is, $c \in \bigcap_{n} I_n$.

Now uniqueness. If $c' \in \bigcap_n I_n$, then $c$ and $c'$ both lie in $[a_n, b_n]$, so $|c - c'| \le b_n - a_n$ for every $n$. By hypothesis the right-hand side tends to $0$, so $|c - c'| \le 0$, that is, $c' = c$.

Finally, convergence. From $0 \le c - a_n \le b_n - a_n \to 0$ the squeeze principle gives $a_n \to c$, and likewise $0 \le b_n - c \le b_n - a_n \to 0$ gives $b_n \to c$.
</Proof>

<Lemma id="lem-bolzano-weierstrass" title="Bolzano-Weierstrass theorem">
A bounded sequence of real numbers $(x_n)_{n \ge 1}$, that is, one for which there exists $M > 0$ with $|x_n| \le M$ for all $n$, has a convergent subsequence.
</Lemma>

<Proof of="lem-bolzano-weierstrass">
We repeatedly bisect an interval, producing a sequence of closed intervals that retains the property "contains infinitely many of the $x_n$".

Put $I_1 = [-M, M]$. By hypothesis $x_n \in I_1$ for all $n$, so infinitely many indices $n$ satisfy $x_n \in I_1$. Inductively, suppose $I_k = [\alpha_k, \beta_k]$ satisfies "infinitely many indices $n$ have $x_n \in I_k$". Splitting $I_k$ at the midpoint $m_k = (\alpha_k + \beta_k)/2$ into $[\alpha_k, m_k]$ and $[m_k, \beta_k]$, at least one half contains infinitely many of the $x_n$: for if both contained only finitely many, then their union $I_k$ would contain only finitely many, contradicting the inductive hypothesis. Let $I_{k+1}$ be a half containing infinitely many (the left one if both do).

In this way $I_1 \supseteq I_2 \supseteq \cdots$ and $\beta_k - \alpha_k = 2M/2^{k-1} \to 0$. By <Ref to="lem-nested-intervals" />, there is a $c$ with $\bigcap_k I_k = \lbrace c \rbrace$.

Now we construct the subsequence. Set $n_1 = 1$ (indeed $x_1 \in I_1$). Given $n_1 < n_2 < \cdots < n_{k-1}$, since $I_k$ contains infinitely many of the $x_n$, there is an index $n_k > n_{k-1}$ with $x_{n_k} \in I_k$. Then $x_{n_k}$ and $c$ both lie in $I_k$, so
$$
|x_{n_k} - c| \le \beta_k - \alpha_k = \frac{2M}{2^{k-1}} \xrightarrow[k \to \infty]{} 0 ,
$$
that is, $x_{n_k} \to c$.
</Proof>

<Aside type="note">
For the indices of a subsequence, $n_k \ge k$ always holds: $n_1 \ge 1$, and from $n_k > n_{k-1} \ge k-1$ induction gives $n_k \ge k$. We use this fact whenever a later proof appeals to "$n_k \to \infty$".
</Aside>

Let us summarise the dependencies among the theorems proved below. Note that everything starts from the continuity axiom.

<Figure caption="Dependencies among the theorems proved in this article">
<Mermaid code={`flowchart TD
  A["Continuity axiom for R: a nonempty set bounded above has a supremum"] --> B["Nested interval principle"]
  A --> C["Cauchy sequences converge (completeness)"]
  B --> D["Bolzano-Weierstrass theorem"]
  D --> E["Boundedness theorem"]
  E --> F["Extreme value theorem"]
  A --> F
  B --> G["Intermediate value theorem"]
  D --> H["Heine-Cantor theorem"]
  C --> I["Continuous extension of a uniformly continuous function"]
  H --> I`} />
</Figure>

## 3. Continuity revisited, and its sequential reformulation

<Definition id="def-continuity" title="Continuity">
Let $I \subseteq \mathbb{R}$, $f : I \to \mathbb{R}$ and $a \in I$. If
$$
\forall \varepsilon > 0,\ \exists \delta > 0,\ \forall x \in I,\quad |x - a| < \delta \implies |f(x) - f(a)| < \varepsilon
$$
holds, then $f$ is said to be **continuous** at $a$. If $f$ is continuous at every point of $I$, then $f$ is said to be continuous on $I$.
</Definition>

Note that the domain is made explicit by $\forall x \in I$. Even at an endpoint of $I = [a,b]$, points outside $I$ are never considered, so this definition means one-sided continuity there without any modification. For how to read the ε-δ formulation itself, see <Ref to="mathematics/calculus/limits-and-continuity#def-continuity" text="the definition of continuity at a point" /> in [Limits and continuity (ε-δ)](/en/mathematics/calculus/limits-and-continuity).

What matters in this definition is the order of the quantifiers. Since $\delta$ comes after $\varepsilon$, it may depend on $\varepsilon$; and since it sits inside a statement in which the point $a$ has been fixed, it may depend on $a$ as well. Writing $\delta = \delta(\varepsilon, a)$ is the accurate thing to do. On how the order of quantifiers changes the meaning of a statement, see also <Ref to="mathematics/foundations/sets-and-logic#rem-quantifier-order" text="the order of quantifiers" /> in [The grammar of mathematics: sets and logic](/en/mathematics/foundations/sets-and-logic).

In the proofs below we repeatedly use continuity translated into the language of sequences.

<Proposition id="prop-sequential-continuity" title="Sequential characterisation of continuity">
Let $I \subseteq \mathbb{R}$, $f : I \to \mathbb{R}$ and $a \in I$. The following two conditions are equivalent.

1. $f$ is continuous at $a$.
2. For every sequence $(x_n)$ in $I$, if $x_n \to a$ then $f(x_n) \to f(a)$.
</Proposition>

<Proof of="prop-sequential-continuity">
(1 ⟹ 2) Let $x_n \to a$ with $x_n \in I$, and let $\varepsilon > 0$ be arbitrary. By <Ref to="def-continuity" /> there is $\delta > 0$ such that $x \in I$ and $|x - a| < \delta$ imply $|f(x) - f(a)| < \varepsilon$. Since $x_n \to a$, for this $\delta$ there is $N$ such that $n \ge N$ implies $|x_n - a| < \delta$. As $x_n \in I$, we get $|f(x_n) - f(a)| < \varepsilon$ for $n \ge N$. Since $\varepsilon$ was arbitrary, $f(x_n) \to f(a)$.

(2 ⟹ 1) We prove the contrapositive. If $f$ is not continuous at $a$, then by the negation of <Ref to="def-continuity" /> there is $\varepsilon_0 > 0$ such that for every $\delta > 0$ one can find $x \in I$ with $|x - a| < \delta$ and $|f(x) - f(a)| \ge \varepsilon_0$. For each $n$, substituting $\delta = 1/n$ produces a point $x_n$; then $|x_n - a| < 1/n \to 0$ gives $x_n \to a$, yet $|f(x_n) - f(a)| \ge \varepsilon_0$ for every $n$, so $f(x_n) \to f(a)$ fails. This is the negation of condition 2.
</Proof>

The value of this proposition is that it connects arguments about continuity with the Bolzano-Weierstrass theorem. In the raw ε-δ form no sequence appears, so <Ref to="lem-bolzano-weierstrass" /> cannot be applied. The proofs of the next three theorems all share the same skeleton: construct a sequence, extract a subsequence, and transfer to the side of $f$ by <Ref to="prop-sequential-continuity" />.

## 4. Continuous functions on a closed bounded interval: boundedness and the extreme value theorem

<Theorem id="thm-boundedness" title="Boundedness theorem">
Let $a < b$ and let $f : [a,b] \to \mathbb{R}$ be continuous on $[a,b]$. Then $f$ is bounded: there exists $M > 0$ such that $|f(x)| \le M$ for all $x \in [a,b]$.
</Theorem>

<Proof of="thm-boundedness">
We argue by contradiction. If $f$ is not bounded, then no $M > 0$ is a bound, so in particular for each $n \in \mathbb{N}$ we can choose $x_n \in [a,b]$ with $|f(x_n)| > n$.

Since $(x_n)$ lies in $[a,b]$, we have $|x_n| \le \max(|a|, |b|)$, so it is bounded. By <Ref to="lem-bolzano-weierstrass" /> there is a convergent subsequence $(x_{n_k})$; call its limit $c$. Since $a \le x_{n_k} \le b$ for all $k$, order preservation of limits (§2) gives $a \le c \le b$, that is, $c \in [a,b]$. **Here we used that the domain is closed.**

Since $f$ is continuous at $c \in [a,b]$, applying <Ref to="def-continuity" /> with $\varepsilon = 1$ gives $\delta > 0$ such that $x \in [a,b]$ and $|x - c| < \delta$ imply $|f(x) - f(c)| < 1$, and hence
$$
|f(x)| \le |f(x) - f(c)| + |f(c)| < |f(c)| + 1 .
$$
As $x_{n_k} \to c$, there is $K$ such that $k \ge K$ implies $|x_{n_k} - c| < \delta$, whence $|f(x_{n_k})| < |f(c)| + 1$.

On the other hand, by construction $|f(x_{n_k})| > n_k \ge k$. Choosing $k$ with $k \ge K$ and $k \ge |f(c)| + 1$, we obtain
$$
|f(c)| + 1 \le k \le n_k < |f(x_{n_k})| < |f(c)| + 1 ,
$$
a contradiction. Therefore $f$ is bounded.
</Proof>

<Theorem id="thm-extreme-value" title="Extreme value theorem (Weierstrass)">
Let $a < b$ and let $f : [a,b] \to \mathbb{R}$ be continuous on $[a,b]$. Then there exist $x_*, x^* \in [a,b]$ such that for all $x \in [a,b]$
$$
f(x_*) \le f(x) \le f(x^*) ,
$$
that is, $f$ attains a maximum value $f(x^*)$ and a minimum value $f(x_*)$ on $[a,b]$.
</Theorem>

<Proof of="thm-extreme-value">
Consider the range $S = f([a,b]) = \lbrace f(x) : x \in [a,b] \rbrace$. Since $a \in [a,b]$ we have $S \ne \emptyset$, and by <Ref to="thm-boundedness" /> the set $S$ is bounded above. Hence the continuity axiom gives $M = \sup S$. **This is the first place completeness is used.**

By property (ii) of the supremum, for each $n \in \mathbb{N}$ the number $M - 1/n$ is not an upper bound of $S$, so there is $x_n \in [a,b]$ with $f(x_n) > M - 1/n$. At the same time property (i) gives $f(x_n) \le M$. Therefore
$$
M - \frac{1}{n} < f(x_n) \le M ,
$$
and the squeeze principle yields $f(x_n) \to M$.

Since $(x_n) \subseteq [a,b]$ is bounded, <Ref to="lem-bolzano-weierstrass" /> provides a convergent subsequence $x_{n_k} \to x^*$. **This is the second place completeness is used.** Order preservation of limits gives $x^* \in [a,b]$ (again using that the domain is closed).

As $f$ is continuous at $x^*$, <Ref to="prop-sequential-continuity" /> gives $f(x_{n_k}) \to f(x^*)$. On the other hand $f(x_n) \to M$, so every subsequence has the same limit and $f(x_{n_k}) \to M$. Uniqueness of limits gives $f(x^*) = M$. Hence $f(x) \le M = f(x^*)$ for all $x \in [a,b]$, and the maximum is attained.

For the minimum, apply the above result to $g = -f$. This $g$ is continuous on $[a,b]$ (since $|g(x) - g(y)| = |f(x) - f(y)|$, the same $\delta$ as in <Ref to="def-continuity" /> works). Hence there is $x_* \in [a,b]$ with $g(x) \le g(x_*)$ for all $x \in [a,b]$, which says $-f(x) \le -f(x_*)$, that is, $f(x_*) \le f(x)$.
</Proof>

<Example id="ex-hypotheses-extreme" title="What breaks when the hypotheses are dropped one at a time">
In the extreme value theorem, all three of "bounded", "closed" and "continuous" are needed.

- **Drop boundedness**: $f(x) = x$ is continuous on $[0, \infty)$, but its range $[0,\infty)$ is not bounded above and there is no maximum. What breaks in the proof is that $(x_n)$ is no longer bounded, so <Ref to="lem-bolzano-weierstrass" /> is unavailable.
- **Drop closedness**: $f(x) = x$ is continuous and bounded on $(0,1)$, but $\sup f = 1$ is not attained as a value; indeed $f(x) = 1$ would force $x = 1 \notin (0,1)$. In the proof, the limit $x^*$ of the subsequence fails to belong to the domain.
- **Drop continuity**: the function $f : [0,1] \to \mathbb{R}$ defined by $f(0) = 0$ and $f(x) = 1/x$ for $0 < x \le 1$ is not bounded on $[0,1]$. The domain is closed and bounded, but $f$ is not continuous at $0$.
</Example>

## 5. The intermediate value theorem

The boundedness theorem and the extreme value theorem concerned the size of values. The next theorem asserts instead that no value in between is skipped. Its proof uses <Ref to="lem-nested-intervals" /> directly. The procedure of bisecting the interval and keeping the half where the sign changes is exactly the bisection method used in numerical root-finding.

<Theorem id="thm-ivt" title="Intermediate value theorem">
Let $a < b$ and let $f : [a,b] \to \mathbb{R}$ be continuous on $[a,b]$. Let $\gamma$ be a real number with
$$
\min\lbrace f(a), f(b) \rbrace < \gamma < \max\lbrace f(a), f(b) \rbrace .
$$
Then there exists $c \in (a,b)$ with $f(c) = \gamma$.
</Theorem>

<Proof of="thm-ivt">
First we reduce to the case $f(a) < \gamma < f(b)$. In the case $f(b) < \gamma < f(a)$, put $\tilde f = -f$ and $\tilde\gamma = -\gamma$; then $\tilde f$ is continuous with $\tilde f(a) = -f(a) < -\gamma = \tilde\gamma < -f(b) = \tilde f(b)$, and $\tilde f(c) = \tilde\gamma$ is equivalent to $f(c) = \gamma$.

So assume $f(a) < \gamma < f(b)$ and set $g(x) = f(x) - \gamma$. Then $g$ is continuous on $[a,b]$ (subtracting a constant lets us reuse the same $\delta$) and $g(a) < 0 < g(b)$. We construct $c$ with $g(c) = 0$.

Put $[a_1, b_1] = [a, b]$, so that $a_1 < b_1$ and $g(a_1) < 0 < g(b_1)$. Inductively, suppose $[a_n, b_n] \subseteq [a,b]$ has been constructed with $a_n < b_n$ and $g(a_n) < 0 < g(b_n)$, and take the midpoint $m_n = (a_n + b_n)/2$.

- If $g(m_n) = 0$, set $c = m_n$ and terminate the construction.
- If $g(m_n) > 0$, set $[a_{n+1}, b_{n+1}] = [a_n, m_n]$. Then $g(a_{n+1}) = g(a_n) < 0 < g(m_n) = g(b_{n+1})$.
- If $g(m_n) < 0$, set $[a_{n+1}, b_{n+1}] = [m_n, b_n]$. Then $g(a_{n+1}) = g(m_n) < 0 < g(b_n) = g(b_{n+1})$.

In every case $[a_{n+1}, b_{n+1}] \subseteq [a_n, b_n]$, $a_{n+1} < b_{n+1}$ and $g(a_{n+1}) < 0 < g(b_{n+1})$ are preserved, and the lengths satisfy
$$
b_n - a_n = \frac{b-a}{2^{n-1}} \xrightarrow[n\to\infty]{} 0 .
$$

If the construction terminates after finitely many steps, we obtain $c$ with $g(c) = 0$ directly. If it does not terminate, <Ref to="lem-nested-intervals" /> gives $c \in [a,b]$ with $\bigcap_n [a_n, b_n] = \lbrace c \rbrace$, and $a_n \to c$, $b_n \to c$. **The existence of this single point is a consequence of completeness.**

Since $g$ is continuous at $c$, <Ref to="prop-sequential-continuity" /> gives $g(a_n) \to g(c)$ and $g(b_n) \to g(c)$. As $g(a_n) < 0$ for all $n$, order preservation of limits gives $g(c) \le 0$; as $g(b_n) > 0$ for all $n$, likewise $g(c) \ge 0$. Hence $g(c) = 0$, that is, $f(c) = \gamma$.

Finally we check $c \in (a,b)$. We have $f(c) = \gamma$, while $f(a) < \gamma$ gives $f(c) \ne f(a)$ and $f(b) > \gamma$ gives $f(c) \ne f(b)$, so $c \ne a$ and $c \ne b$. Together with $c \in [a,b]$ this yields $c \in (a,b)$.
</Proof>

<Remark id="rem-rational-ivt" title="The intermediate value theorem is false over the rationals">
That the intermediate value theorem depends on completeness becomes clear when we try to state it using only rational numbers. Let $f : \mathbb{Q} \cap [0,2] \to \mathbb{Q}$ be $f(x) = x^2 - 2$. This $f$ is continuous in the ε-δ sense (viewing the domain as $\mathbb{Q} \cap [0,2]$), and $f(0) = -2 < 0 < 2 = f(2)$. Yet there is no rational $c$ with $f(c) = 0$, that is, with $c^2 = 2$. The domain looks "closed and bounded", but $\mathbb{Q}$ does not satisfy the continuity axiom, so <Ref to="lem-nested-intervals" /> is unavailable and the proof stalls. The intermediate value theorem is a theorem about continuity and, at the same time, a theorem about the completeness of the reals.
</Remark>

<Example id="ex-odd-polynomial" title="A real polynomial of odd degree has a real root">
Let $m \ge 0$ be an integer, let $c_0, \ldots, c_{2m} \in \mathbb{R}$ and set
$$
p(x) = x^{2m+1} + c_{2m}x^{2m} + \cdots + c_1 x + c_0 .
$$
We show that there is a real $c$ with $p(c) = 0$.

Put $R = 1 + \sum_{j=0}^{2m} |c_j|$, so that $R \ge 1$. Writing $q(x) = c_{2m}x^{2m} + \cdots + c_0$, for $|x| \ge R \ (\ge 1)$ we have $|x|^j \le |x|^{2m}$ ($0 \le j \le 2m$), whence
$$
|q(x)| \le \sum_{j=0}^{2m} |c_j|\,|x|^j \le \Bigl(\sum_{j=0}^{2m} |c_j|\Bigr) |x|^{2m} = (R-1)|x|^{2m} < R\,|x|^{2m} \le |x| \cdot |x|^{2m} = |x|^{2m+1} .
$$
The last inequality used $|x| \ge R$.

Consequently, at $x = R$,
$$
p(R) = R^{2m+1} + q(R) \ge R^{2m+1} - |q(R)| > R^{2m+1} - R^{2m+1} = 0,
$$
and at $x = -R$, since $(-R)^{2m+1} = -R^{2m+1}$,
$$
p(-R) = -R^{2m+1} + q(-R) \le -R^{2m+1} + |q(-R)| < -R^{2m+1} + R^{2m+1} = 0 .
$$
Being a polynomial, $p$ is continuous on $[-R, R]$, and $p(-R) < 0 < p(R)$. Applying <Ref to="thm-ivt" /> with $\gamma = 0$ gives $c \in (-R, R)$ with $p(c) = 0$.

For instance, for $p(x) = x^3 - 3x + 1$ we get $R = 1 + 0 + 3 + 1 = 5$, so there is a root in $(-5,5)$. We can localise it further: $p(0) = 1 > 0$ and $p(1) = 1 - 3 + 1 = -1 < 0$, so applying <Ref to="thm-ivt" /> on $[0,1]$ with $\gamma = 0$ places a root in $(0,1)$. Running the bisection from the proof, $p(0.5) = 0.125 - 1.5 + 1 = -0.375 < 0$, so the next interval is $(0, 0.5)$; then $p(0.25) = 0.015625 - 0.75 + 1 = 0.265625 > 0$, so the next is $(0.25, 0.5)$, and the intervals keep halving. This is precisely the sequence of intervals built in the proof of <Ref to="thm-ivt" />.
</Example>

## 6. Uniform continuity

### 6.1. The definition and the order of quantifiers

<Definition id="def-uniform-continuity" title="Uniform continuity">
Let $I \subseteq \mathbb{R}$ and $f : I \to \mathbb{R}$. If
$$
\forall \varepsilon > 0,\ \exists \delta > 0,\ \forall x, y \in I,\quad |x - y| < \delta \implies |f(x) - f(y)| < \varepsilon
$$
holds, then $f$ is said to be **uniformly continuous** on $I$.
</Definition>

Writing <Ref to="def-continuity" /> and <Ref to="def-uniform-continuity" /> side by side, the only difference is the order of the quantifiers.

$$
\begin{aligned}
\text{continuous} \quad&:\quad \forall \varepsilon > 0,\ \forall a \in I,\ \exists \delta > 0,\ \forall x \in I,\ \bigl(|x-a| < \delta \Rightarrow |f(x)-f(a)| < \varepsilon\bigr) \\[2pt]
\text{uniformly continuous} \quad&:\quad \forall \varepsilon > 0,\ \exists \delta > 0,\ \forall a \in I,\ \forall x \in I,\ \bigl(|x-a| < \delta \Rightarrow |f(x)-f(a)| < \varepsilon\bigr)
\end{aligned}
$$

In the former, $\exists \delta$ lies inside $\forall a$, so $\delta = \delta(\varepsilon, a)$; in the latter it lies outside, so $\delta = \delta(\varepsilon)$. "Uniform" means "usable uniformly (one and the same) across the points of $I$".

Note that uniform continuity is a property of the **pair** consisting of a function and its domain. Even functions given by the same formula can gain or lose uniform continuity when the domain changes (see <Ref to="ex-square" />). Whereas continuity is a local property at each point, uniform continuity is a global property that surveys the whole domain.

<Proposition id="prop-uniform-basics" title="Basic properties of uniform continuity">
Let $I \subseteq \mathbb{R}$ and $f : I \to \mathbb{R}$.

1. If $f$ is uniformly continuous on $I$, then $f$ is continuous on $I$.
2. The following two conditions are equivalent.
   - (a) $f$ is not uniformly continuous on $I$.
   - (b) There exist $\varepsilon_0 > 0$ and sequences $(x_n), (y_n)$ in $I$ with $\lim_{n\to\infty}(x_n - y_n) = 0$ and $|f(x_n) - f(y_n)| \ge \varepsilon_0$ for all $n$.
</Proposition>

<Proof of="prop-uniform-basics">
(1) Let $a \in I$ and $\varepsilon > 0$ be arbitrary. By <Ref to="def-uniform-continuity" /> there is $\delta > 0$ such that $x, y \in I$ with $|x-y| < \delta$ implies $|f(x)-f(y)| < \varepsilon$. Specialising to $y = a$, we get that $x \in I$ with $|x - a| < \delta$ implies $|f(x) - f(a)| < \varepsilon$. This is exactly the condition in <Ref to="def-continuity" />, so $f$ is continuous at $a$. As $a$ was arbitrary, $f$ is continuous on $I$.

(2) First we write out the negation of <Ref to="def-uniform-continuity" />:
$$
\exists \varepsilon_0 > 0,\ \forall \delta > 0,\ \exists x, y \in I,\quad |x-y| < \delta \ \text{and}\ |f(x)-f(y)| \ge \varepsilon_0 .
$$

(a) ⟹ (b): Fix this $\varepsilon_0$. For each $n \in \mathbb{N}$, substituting $\delta = 1/n$ produces $x_n, y_n \in I$ with $|x_n - y_n| < 1/n$ and $|f(x_n) - f(y_n)| \ge \varepsilon_0$. From $|x_n - y_n| < 1/n \to 0$ we get $x_n - y_n \to 0$.

(b) ⟹ (a): Suppose such $\varepsilon_0, (x_n), (y_n)$ exist and assume $f$ is uniformly continuous. For this $\varepsilon_0$, take $\delta > 0$ as in <Ref to="def-uniform-continuity" />. Since $x_n - y_n \to 0$, for all sufficiently large $n$ we have $|x_n - y_n| < \delta$, and since $x_n, y_n \in I$ we get $|f(x_n) - f(y_n)| < \varepsilon_0$. This contradicts the hypothesis that $|f(x_n)-f(y_n)| \ge \varepsilon_0$ for all $n$.
</Proof>

Condition (b) is a practical tool for showing that a function is not uniformly continuous: it suffices to exhibit one pair of sequences that come arbitrarily close together while the gap between their values refuses to shrink.

### 6.2. Functions that are not uniformly continuous

<Example id="ex-square" title="The squaring function: the domain decides the answer">
Consider $f(x) = x^2$.

**On $\mathbb{R}$ it is not uniformly continuous.** Take $x_n = n + \dfrac{1}{n}$ and $y_n = n$. Then
$$
x_n - y_n = \frac{1}{n} \to 0, \qquad f(x_n) - f(y_n) = \Bigl(n + \frac1n\Bigr)^2 - n^2 = 2 + \frac{1}{n^2} \ge 2 .
$$
With $\varepsilon_0 = 2$, condition (b) of <Ref to="prop-uniform-basics" /> holds, so $f$ is not uniformly continuous on $\mathbb{R}$. Intuitively, the slope $2x$ grows without bound, so the $\delta$ needed to maintain a given $\varepsilon$ collapses to $0$ as $x$ grows.

**On $[-R, R]$ it is uniformly continuous, for every $R > 0$.** For $x, y \in [-R,R]$,
$$
|x^2 - y^2| = |x+y|\,|x-y| \le (|x| + |y|)|x-y| \le 2R\,|x-y| ,
$$
so given $\varepsilon > 0$, taking $\delta = \varepsilon/(2R)$ makes $|x-y| < \delta$ imply $|x^2-y^2| \le 2R|x-y| < 2R \cdot \varepsilon/(2R) = \varepsilon$. This $\delta$ depends on neither $x$ nor $y$.
</Example>

<Example id="ex-reciprocal" title="1/x: a bounded domain need not give uniform continuity">
Consider $f(x) = 1/x$ on $I = (0,1]$. It is continuous on $I$: at each $a \in I$ it suffices to estimate $|1/x - 1/a| = |x-a|/(|x|a)$, and taking, for example, $\delta = \min(a/2,\ \varepsilon a^2/2)$, from $|x-a| < \delta$ we get $x > a/2$ and hence $|1/x - 1/a| < 2|x-a|/a^2 < \varepsilon$. Note how strongly this $\delta$ depends on $a$.

It is not, however, uniformly continuous. Taking $x_n = \dfrac{1}{n}$ and $y_n = \dfrac{1}{2n}$,
$$
|x_n - y_n| = \frac{1}{2n} \to 0, \qquad |f(x_n) - f(y_n)| = |n - 2n| = n \ge 1 ,
$$
so condition (b) of <Ref to="prop-uniform-basics" /> holds with $\varepsilon_0 = 1$.

The domain $(0,1]$ is bounded but not closed. This example shows that in the Heine-Cantor theorem of the next section, the hypothesis "closed" cannot be dropped.
</Example>

<Example id="ex-sin-square" title="Boundedness alone is not enough">
The function $f(x) = \sin(x^2)$ is continuous on $\mathbb{R}$ and bounded, with $|f(x)| \le 1$. Even so it is not uniformly continuous. Take
$$
x_n = \sqrt{2n\pi + \frac{\pi}{2}}, \qquad y_n = \sqrt{2n\pi} \qquad (n \in \mathbb{N}) .
$$
Rationalising the numerator,
$$
x_n - y_n = \frac{x_n^2 - y_n^2}{x_n + y_n} = \frac{\pi/2}{\sqrt{2n\pi + \pi/2} + \sqrt{2n\pi}} \xrightarrow[n\to\infty]{} 0
$$
(because the denominator diverges to $\infty$). On the other hand,
$$
f(x_n) = \sin\Bigl(2n\pi + \frac{\pi}{2}\Bigr) = 1, \qquad f(y_n) = \sin(2n\pi) = 0 ,
$$
so $|f(x_n) - f(y_n)| = 1$. Condition (b) of <Ref to="prop-uniform-basics" /> holds with $\varepsilon_0 = 1$, so $f$ is not uniformly continuous. The values of $f$ are bounded, but the oscillation grows ever faster, and that is what makes $\delta$ collapse.
</Example>

### 6.3. Lipschitz continuity and the modulus of continuity

<Definition id="def-lipschitz" title="Lipschitz continuity">
Let $I \subseteq \mathbb{R}$ and $f : I \to \mathbb{R}$. If there is a constant $L \ge 0$ such that
$$
|f(x) - f(y)| \le L\,|x - y|
$$
for all $x, y \in I$, then $f$ is said to be **Lipschitz continuous** on $I$, and $L$ is called a Lipschitz constant.
</Definition>

<Example id="ex-sqrt" title="The square root: uniformly continuous but not Lipschitz">
First, in general, Lipschitz continuity implies uniform continuity. If $L = 0$ then $f$ is constant and any $\delta$ works. If $L > 0$, then given $\varepsilon > 0$, taking $\delta = \varepsilon/L$ makes $|x-y| < \delta$ imply $|f(x)-f(y)| \le L|x-y| < L \cdot \varepsilon/L = \varepsilon$. This $\delta$ does not depend on $x$ or $y$.

The converse fails. Consider $f(x) = \sqrt{x}$ on $I = [0,\infty)$.

**Uniform continuity.** We show $|\sqrt{x} - \sqrt{y}| \le \sqrt{|x-y|}$ for all $x, y \ge 0$. By symmetry we may assume $x \ge y \ge 0$; then $\sqrt{xy} \ge \sqrt{y \cdot y} = y$, so
$$
(\sqrt{x} - \sqrt{y})^2 = x - 2\sqrt{xy} + y \le x - 2y + y = x - y .
$$
Since $x \ge y$ gives $\sqrt{x} - \sqrt{y} \ge 0$, the left-hand side is the square of a nonnegative number, and taking nonnegative square roots on both sides yields $\sqrt{x} - \sqrt{y} \le \sqrt{x-y}$. Hence, given $\varepsilon > 0$, taking $\delta = \varepsilon^2$ makes $|x - y| < \delta$ imply
$$
|\sqrt{x} - \sqrt{y}| \le \sqrt{|x-y|} < \sqrt{\varepsilon^2} = \varepsilon .
$$
This $\delta$ is independent of $x$ and $y$, so $f$ is uniformly continuous on $[0,\infty)$.

**Failure of Lipschitz continuity.** Suppose some $L \ge 0$ satisfies $|\sqrt x - \sqrt y| \le L|x-y|$ for all $x,y \ge 0$. Setting $y = 0$ gives $\sqrt{t} \le L t$ for all $t > 0$, that is, $L \ge 1/\sqrt{t}$. If $L = 0$, then $t = 1$ gives $1 \le 0$, a contradiction. If $L > 0$, substituting $t = 1/(2L)^2 > 0$ gives $1/\sqrt{t} = 2L > L$, so $L \ge 2L$, that is, $L \le 0$, again a contradiction. Hence no Lipschitz constant exists.

What makes this example interesting is that the slope of the graph blows up to $\infty$ near the origin, and yet uniform continuity survives.
</Example>

<Remark id="rem-modulus" title="Restating things through the modulus of continuity">
For $f : I \to \mathbb{R}$, the function of $\delta > 0$ given by
$$
\omega_f(\delta) = \sup \bigl\lbrace |f(x)-f(y)| : x, y \in I,\ |x-y| \le \delta \bigr\rbrace \in [0, +\infty]
$$
is called the **modulus of continuity** of $f$. It is nondecreasing, and
$$
f \ \text{is uniformly continuous on} \ I \iff \lim_{\delta \to 0+} \omega_f(\delta) = 0 .
$$

(⟸) Given $\varepsilon > 0$, choose $\delta > 0$ with $\omega_f(\delta) < \varepsilon$; then for $x,y \in I$ with $|x-y| < \delta$ we have $|f(x)-f(y)| \le \omega_f(\delta) < \varepsilon$.

(⟹) Given $\varepsilon > 0$, apply <Ref to="def-uniform-continuity" /> with $\varepsilon/2$ to obtain $\delta > 0$. For all $x,y \in I$ with $|x-y| \le \delta/2 < \delta$ we have $|f(x)-f(y)| < \varepsilon/2$, so taking the supremum gives $\omega_f(\delta/2) \le \varepsilon/2 < \varepsilon$. By monotonicity of $\omega_f$, we get $\omega_f(\eta) < \varepsilon$ for $0 < \eta \le \delta/2$.

Note that <Ref to="def-lipschitz" /> corresponds to $\omega_f(\delta) \le L\delta$, while $\sqrt{x}$ in <Ref to="ex-sqrt" /> corresponds to $\omega_f(\delta) = \sqrt{\delta}$. The rate at which the modulus of continuity tends to $0$ measures the "strength" of uniform continuity.
</Remark>

## 7. The Heine-Cantor theorem

<Theorem id="thm-heine-cantor" title="Heine-Cantor theorem">
Let $a < b$ and let $f : [a,b] \to \mathbb{R}$ be continuous on $[a,b]$. Then $f$ is uniformly continuous on $[a,b]$.
</Theorem>

<Proof of="thm-heine-cantor">
We argue by contradiction. If $f$ is not uniformly continuous on $[a,b]$, then by condition (b) of <Ref to="prop-uniform-basics" /> there are $\varepsilon_0 > 0$ and sequences $(x_n), (y_n)$ in $[a,b]$ with
$$
x_n - y_n \to 0, \qquad |f(x_n) - f(y_n)| \ge \varepsilon_0 \ \ (\forall n) .
$$

Since $(x_n)$ lies in $[a,b]$, it is bounded. **Here we use that the domain is bounded**, and applying <Ref to="lem-bolzano-weierstrass" /> gives a convergent subsequence $x_{n_k} \to c$. As $a \le x_{n_k} \le b$ for all $k$, order preservation of limits gives $c \in [a,b]$. **Here we used that the domain is closed.** It is precisely because $c$ belongs to $[a,b]$ that $f$ is defined at $c$ and continuous there.

Next, $(y_{n_k})$ also converges to $c$. Indeed, the triangle inequality gives
$$
|y_{n_k} - c| \le |y_{n_k} - x_{n_k}| + |x_{n_k} - c| ,
$$
where the first term on the right is a subsequence of $x_n - y_n \to 0$ and hence tends to $0$, and the second also tends to $0$.

Since $f$ is continuous at $c$, applying <Ref to="prop-sequential-continuity" /> to the two sequences gives
$$
f(x_{n_k}) \to f(c), \qquad f(y_{n_k}) \to f(c) ,
$$
and therefore
$$
|f(x_{n_k}) - f(y_{n_k})| \le |f(x_{n_k}) - f(c)| + |f(c) - f(y_{n_k})| \xrightarrow[k\to\infty]{} 0 .
$$
Hence $|f(x_{n_k}) - f(y_{n_k})| < \varepsilon_0$ for all sufficiently large $k$, contradicting the assumption that $|f(x_n) - f(y_n)| \ge \varepsilon_0$ for all $n$.

Therefore $f$ is uniformly continuous on $[a,b]$.
</Proof>

This theorem justifies the operation of "gathering the pointwise $\delta$'s into a single common $\delta$". The infimum of infinitely many values $\delta(\varepsilon, a)$ can in general be $0$ (this is exactly the situation in <Ref to="ex-reciprocal" />). What guarantees that it is not $0$ is that the domain is closed and bounded, and ultimately the completeness of $\mathbb{R}$. The following table summarises the roles of the hypotheses.

| Statement | Where completeness is used | If boundedness is dropped | If closedness is dropped |
|---|---|---|---|
| Boundedness theorem | Bolzano-Weierstrass theorem | $f(x)=x$ on $[0,\infty)$ is a counterexample | $f(x)=1/x$ on $(0,1]$ is a counterexample |
| Extreme value theorem | Existence of suprema and Bolzano-Weierstrass | $f(x)=x$ on $[0,\infty)$ is a counterexample | $f(x)=x$ on $(0,1)$ is a counterexample |
| Intermediate value theorem | Nested interval principle | still holds on unbounded intervals | still holds on open intervals (but false over $\mathbb{Q}$) |
| Heine-Cantor theorem | Bolzano-Weierstrass theorem | $f(x)=x^2$ on $\mathbb{R}$ is a counterexample | $f(x)=1/x$ on $(0,1]$ is a counterexample |

The payoff of uniform continuity is on full display in the next corollary. The key is that a uniformly continuous map **sends Cauchy sequences to Cauchy sequences**. Mere continuity does not do this: for $f(x) = 1/x$ on $(0,1]$ and $x_n = 1/n$, the sequence $(x_n)$ is convergent and hence Cauchy, but $(f(x_n)) = (n)$ is not Cauchy.

<Corollary id="cor-uniform-extension" title="Continuous extension of a uniformly continuous function">
Let $-\infty < a < b < \infty$ and let $f : (a,b) \to \mathbb{R}$ be uniformly continuous on $(a,b)$. Then there is exactly one continuous function $\tilde f : [a,b] \to \mathbb{R}$ whose restriction to $(a,b)$ equals $f$. Moreover this $\tilde f$ is uniformly continuous on $[a,b]$.
</Corollary>

<Proof of="cor-uniform-extension">
**Defining the values at the endpoints.** Put $x_n = a + \dfrac{b-a}{n+1} \in (a,b)$, so that $x_n \to a$. A convergent sequence is Cauchy, so $(x_n)$ is Cauchy. We show that $(f(x_n))$ is Cauchy too. Given $\varepsilon > 0$, take $\delta > 0$ as in <Ref to="def-uniform-continuity" />, and from the Cauchy property of $(x_n)$ take $N$ corresponding to this $\delta$; then for $m, n \ge N$ we have $|x_m - x_n| < \delta$ and hence $|f(x_m) - f(x_n)| < \varepsilon$. **This is where uniform continuity is essential** (since $\delta$ does not depend on the point, it can be used regardless of where $x_m$ and $x_n$ lie).

By completeness of $\mathbb{R}$ (<Ref to="mathematics/real-analysis/completeness-and-cauchy#thm-completeness" text="Cauchy sequences converge" />), the limit $\alpha = \lim_n f(x_n)$ exists. **This is where completeness is used.**

**Independence of the choice of sequence.** Let $(x_n')$ be another sequence in $(a,b)$ with $x_n' \to a$. The interlaced sequence $z_1 = x_1, z_2 = x_1', z_3 = x_2, z_4 = x_2', \ldots$ also converges to $a$ (given $\varepsilon > 0$, if $|x_k - a| < \varepsilon$ and $|x_k' - a| < \varepsilon$ hold for $k \ge K$, then $|z_n - a| < \varepsilon$ for $n \ge 2K-1$). By the same argument as above, $(f(z_n))$ converges, and its subsequences $(f(x_n))$ and $(f(x_n'))$ share the same limit. Hence $\lim_n f(x_n') = \alpha$.

So we define $\tilde f(a) = \alpha$. Similarly we define $\tilde f(b) = \beta$ at $b$, and we set $\tilde f(x) = f(x)$ for $x \in (a,b)$.

**Uniform continuity of $\tilde f$.** For each $x \in [a,b]$ we can choose a sequence $(x_n)$ in $(a,b)$ with $x_n \to x$ and $f(x_n) \to \tilde f(x)$. For $x = a$ and $x = b$ the construction above supplies one; for $x \in (a,b)$ the constant sequence $x_n = x$ will do.

Take $\varepsilon > 0$ and take $\delta > 0$ as in <Ref to="def-uniform-continuity" />. Let $x, y \in [a,b]$ satisfy $|x - y| < \delta$, and take sequences $(x_n), (y_n)$ as above. Since $|x_n - y_n| \to |x-y| < \delta$, for all sufficiently large $n$ we have $|x_n - y_n| < \delta$ and hence $|f(x_n) - f(y_n)| < \varepsilon$. Letting $n \to \infty$ (the absolute value is continuous) gives
$$
|\tilde f(x) - \tilde f(y)| \le \varepsilon .
$$
We have thus shown that "to every $\varepsilon > 0$ there corresponds $\delta > 0$ such that $|x-y| < \delta$ implies $|\tilde f(x) - \tilde f(y)| \le \varepsilon$". Applying this with $\varepsilon/2$ gives $|\tilde f(x) - \tilde f(y)| \le \varepsilon/2 < \varepsilon$, so $\tilde f$ is uniformly continuous on $[a,b]$. In particular it is continuous, by part 1 of <Ref to="prop-uniform-basics" />.

**Uniqueness.** Suppose $\hat f$ is also continuous on $[a,b]$ and agrees with $f$ on $(a,b)$. Taking $x_n \to a$ with $x_n \in (a,b)$, <Ref to="prop-sequential-continuity" /> gives $\hat f(a) = \lim_n \hat f(x_n) = \lim_n f(x_n) = \alpha = \tilde f(a)$. The same holds at $b$, and on $(a,b)$ the two agree by definition, so $\hat f = \tilde f$.
</Proof>

<Remark id="rem-riemann" title="Where uniform continuity gets used">
Uniform continuity shows up in situations where one needs $\delta$ not to depend on the point.

- **Riemann integrability.** If $f$ is continuous on $[a,b]$, then by <Ref to="thm-heine-cantor" /> it is uniformly continuous, so given $\varepsilon > 0$ we may take the corresponding $\delta$ and choose a partition $\Delta$ of mesh less than $\delta$; then the oscillation of $f$ on each subinterval is at most $\varepsilon$. Hence the difference between the upper and lower integrals is at most $\varepsilon(b-a)$, and since $\varepsilon$ is arbitrary, $f$ is integrable. The key point is that the same $\varepsilon$ works on **all** subintervals of the partition, which pointwise continuity alone cannot supply. This argument is recorded as <Ref to="mathematics/calculus/integration-and-ftc#thm-continuous-integrable" text="integrability of continuous functions" />; for details see [The fundamental theorem of calculus and the definite integral](/mathematics/calculus/integration-and-ftc).
- **Limits of sequences of functions.** Uniform continuity is the notion of making points uniform within a single function; the corresponding notion of "making $n$ uniform" for a sequence of functions $(f_n)$ is uniform convergence. The two have similar shapes, and this is exactly where Cauchy conflated them. See <Ref to="mathematics/real-analysis/uniform-convergence#def-uniform" text="the definition of uniform convergence" /> and the rest of [Sequences of functions and uniform convergence](/mathematics/real-analysis/uniform-convergence).
- **Extension from a dense subset.** <Ref to="cor-uniform-extension" /> generalises to the statement that a uniformly continuous map into a complete metric space extends uniquely to the closure of its domain. In functional analysis this principle is used to extend a bounded linear operator from a dense subspace to the whole space.
</Remark>

## 8. Exercises

<Exercise id="exr-sum-product" difficulty="Easy">
Let $I \subseteq \mathbb{R}$ and let $f, g : I \to \mathbb{R}$ both be uniformly continuous on $I$.

1. Show that $f + g$ is uniformly continuous on $I$.
2. When $I = \mathbb{R}$, give a counterexample showing that $fg$ need not be uniformly continuous.

<Solution>
**1.** Take $\varepsilon > 0$. Apply the uniform continuity of $f$ with $\varepsilon/2$ to get $\delta_1 > 0$, apply the uniform continuity of $g$ with $\varepsilon/2$ to get $\delta_2 > 0$, and put $\delta = \min(\delta_1, \delta_2) > 0$. If $x, y \in I$ satisfy $|x-y| < \delta$, then $|x-y| < \delta_1$ and $|x-y| < \delta_2$, so
$$
|(f+g)(x) - (f+g)(y)| \le |f(x)-f(y)| + |g(x)-g(y)| < \frac{\varepsilon}{2} + \frac{\varepsilon}{2} = \varepsilon .
$$
Since $\delta$ does not depend on $x$ or $y$, <Ref to="def-uniform-continuity" /> is satisfied.

**2.** Take $f(x) = g(x) = x$. Since $|f(x)-f(y)| = |x-y|$, taking $\delta = \varepsilon$ shows uniform continuity. But $(fg)(x) = x^2$ is not uniformly continuous on $\mathbb{R}$ by <Ref to="ex-square" />. Hence a product of uniformly continuous functions need not be uniformly continuous.

(A sufficient condition for the product to be uniformly continuous is that $f$ and $g$ both be bounded, as one sees by splitting $|f(x)g(x) - f(y)g(y)| \le |f(x)||g(x)-g(y)| + |g(y)||f(x)-f(y)|$.)
</Solution>
</Exercise>

<Exercise id="exr-periodic" difficulty="Standard">
Let $f : \mathbb{R} \to \mathbb{R}$ be continuous and suppose that for some $T > 0$ we have $f(x+T) = f(x)$ for all $x \in \mathbb{R}$ (a periodic function of period $T$). Show that $f$ is uniformly continuous on $\mathbb{R}$.

<Solution>
First, periodicity gives $f(x + kT) = f(x)$ for every integer $k$ and every $x$ (for $k \ge 0$ by applying $f(x+T)=f(x)$ $k$ times, and for $k < 0$ from $f(x) = f((x - |k|T) + |k|T) = f(x-|k|T)$).

Since $f$ is continuous on the closed bounded interval $[-T, 2T]$, by <Ref to="thm-heine-cantor" /> it is uniformly continuous there. Given $\varepsilon > 0$, take $\delta' > 0$ from uniform continuity on $[-T,2T]$ and put $\delta = \min(\delta', T) > 0$.

Let $x, y \in \mathbb{R}$ satisfy $|x - y| < \delta$. Put $k = \lfloor x/T \rfloor$, so that $x' = x - kT \in [0, T)$. Setting $y' = y - kT$, we have $|x' - y'| = |x - y| < \delta \le T$, so $y'$ lies in the open interval $(x' - T,\ x' + T)$. Since $x' \ge 0$ gives $x' - T \ge -T$ and $x' < T$ gives $x' + T < 2T$, we obtain
$$
-T \le x' - T < y' < x' + T < 2T ,
$$
so $y' \in (-T, 2T)$. Hence $x', y' \in [-T, 2T]$ and $|x' - y'| < \delta \le \delta'$, so $|f(x') - f(y')| < \varepsilon$.

By periodicity $f(x) = f(x' + kT) = f(x')$ and $f(y) = f(y' + kT) = f(y')$, so $|f(x) - f(y)| < \varepsilon$. Since $\delta$ does not depend on $x$ or $y$, $f$ is uniformly continuous on $\mathbb{R}$.

(Example: $\sin x$ and $\cos x$ are uniformly continuous on $\mathbb{R}$. By contrast $\sin(x^2)$ from <Ref to="ex-sin-square" /> is not periodic, so this argument does not apply.)
</Solution>
</Exercise>

<Exercise id="exr-limit-at-infinity" difficulty="Hard">
Let $f : [0,\infty) \to \mathbb{R}$ be continuous and suppose the limit $\displaystyle\lim_{x \to \infty} f(x) = L \in \mathbb{R}$ exists. Show that $f$ is uniformly continuous on $[0,\infty)$.

<Solution>
Take $\varepsilon > 0$.

**Estimate far out.** By the definition of the limit there is $R > 0$ such that $x \ge R$ implies $|f(x) - L| < \varepsilon/2$. Hence for $x, y \ge R$,
$$
|f(x) - f(y)| \le |f(x) - L| + |L - f(y)| < \frac{\varepsilon}{2} + \frac{\varepsilon}{2} = \varepsilon .
$$
This estimate needs no $\delta$ at all.

**Estimate nearby.** Since $f$ is continuous on the closed bounded interval $[0, R+1]$, by <Ref to="thm-heine-cantor" /> it is uniformly continuous there. Take $\delta_0 > 0$ corresponding to $\varepsilon$, and put $\delta = \min(\delta_0, 1) > 0$.

**Gluing.** Let $x, y \in [0,\infty)$ satisfy $|x-y| < \delta$. By symmetry we may assume $x \le y$.

- If $y \le R+1$: then $0 \le x \le y \le R+1$, so $x, y \in [0, R+1]$, and $|x-y| < \delta \le \delta_0$ gives $|f(x)-f(y)| < \varepsilon$.
- If $y > R+1$: then $x > y - \delta \ge y - 1 > R$, so $x > R$ and $y > R+1 > R$. Hence the estimate far out gives $|f(x)-f(y)| < \varepsilon$.

In both cases $|f(x)-f(y)| < \varepsilon$, and since $\delta$ does not depend on $x$ or $y$, $f$ is uniformly continuous on $[0,\infty)$.

(From this result we see, for instance, that $f(x) = \dfrac{1}{1+x}$ and $f(x) = \dfrac{\sin x}{1+x}$ are uniformly continuous on $[0,\infty)$; the latter because it converges to $0$ as $x \to \infty$.)
</Solution>
</Exercise>

<Exercise id="exr-antipode" difficulty="Standard">
Let $f : \mathbb{R} \to \mathbb{R}$ be continuous with period $2\pi$. Show that there is a real number $c$ with $f(c + \pi) = f(c)$. (Reading $f$ as the temperature along the equator, this says that there is a pair of antipodal points with equal temperature.)

<Solution>
Put $g(x) = f(x + \pi) - f(x)$. The map $x \mapsto f(x+\pi)$ is continuous, being the composition of a continuous function with a translation, and $g$, a difference of continuous functions, is continuous on $\mathbb{R}$.

Using the periodicity $f(x + 2\pi) = f(x)$,
$$
g(0) = f(\pi) - f(0), \qquad g(\pi) = f(2\pi) - f(\pi) = f(0) - f(\pi) = -g(0) .
$$

If $g(0) = 0$, then $c = 0$ is what we want. So suppose $g(0) \ne 0$. Then $g(0)$ and $g(\pi) = -g(0)$ have opposite signs, so
$$
\min\lbrace g(0), g(\pi) \rbrace < 0 < \max\lbrace g(0), g(\pi) \rbrace .
$$
Since $g$ is continuous on $[0,\pi]$, applying <Ref to="thm-ivt" /> with $\gamma = 0$ gives $c \in (0,\pi)$ with $g(c) = 0$. And $g(c) = 0$ means $f(c+\pi) = f(c)$.
</Solution>
</Exercise>

## References

- Takagi Teiji, *Kaiseki Gairon* (Introduction to Analysis), 3rd revised ed., Iwanami Shoten, 1961 (in Japanese) — Chapter 1 (the real numbers and the basic properties of continuous functions). A classical account deriving the intermediate value theorem and the extreme value theorem from the continuity of the reals.
- Sugiura Mitsuo, *Kaiseki Nyūmon I* (Introduction to Analysis I), University of Tokyo Press, 1980 (in Japanese) — Chapter I (continuous functions, uniform continuity). The roles of the hypotheses and the counterexamples are treated with care.
- W. Rudin, *Principles of Mathematical Analysis*, 3rd ed., McGraw-Hill, 1976 — Chapter 4 (Continuity). The standard reference treating uniform continuity in the language of compactness.
- S. Abbott, *Understanding Analysis*, 2nd ed., Springer, 2015 — Chapter 4 (Functional Limits and Continuity). An introductory text with a detailed motivation for why uniform continuity is needed.
- E. Heine, "Die Elemente der Functionenlehre", *Journal für die reine und angewandte Mathematik* 74 (1872), 172–188. The paper in which uniform continuity was formulated explicitly.
- B. Bolzano, *Rein analytischer Beweis des Lehrsatzes, dass zwischen je zwey Werthen, die ein entgegengesetztes Resultat gewähren, wenigstens eine reelle Wurzel der Gleichung liege*, Prague, 1817. One of the earliest attempts at an analytic proof of the intermediate value theorem.

## Appendix: An alternative proof in the language of coverings

**The Heine-Borel covering theorem.** A closed bounded interval has another important property. If $[a,b]$ is covered by a family $\mathcal{U}$ of open intervals, that is, $[a,b] \subseteq \bigcup_{U \in \mathcal{U}} U$, then finitely many $U_1, \ldots, U_N$ can be selected from $\mathcal{U}$ with $[a,b] \subseteq U_1 \cup \cdots \cup U_N$. This is the Heine-Borel covering theorem, and like <Ref to="lem-bolzano-weierstrass" /> used in this article, it is derived from the completeness of the reals.

**A proof of Heine-Cantor by coverings.** Granting this theorem, <Ref to="thm-heine-cantor" /> can be proved directly, without contradiction. Let $f$ be continuous on $[a,b]$ and take $\varepsilon > 0$. Since $f$ is continuous at each point $x \in [a,b]$, applying <Ref to="def-continuity" /> with $\varepsilon/2$ gives $\delta_x > 0$ such that $y \in [a,b]$ with $|y - x| < \delta_x$ implies $|f(y) - f(x)| < \varepsilon/2$. The family of open intervals
$$
\mathcal{U} = \Bigl\lbrace\, U_x = \Bigl(x - \frac{\delta_x}{2},\ x + \frac{\delta_x}{2}\Bigr) \ :\ x \in [a,b] \,\Bigr\rbrace
$$
covers $[a,b]$ (each $x$ belongs to $U_x$). By the covering theorem there are finitely many points $x_1, \ldots, x_N \in [a,b]$ with $[a,b] \subseteq U_{x_1} \cup \cdots \cup U_{x_N}$. Put
$$
\delta = \min_{1 \le i \le N} \frac{\delta_{x_i}}{2} > 0 ,
$$
noting that this is positive because it is the minimum of finitely many positive numbers. **The conclusion of the covering theorem, that the family can be reduced to finitely many sets, is what guarantees here that $\delta$ does not collapse to $0$.**

Let $y, z \in [a,b]$ satisfy $|y - z| < \delta$. Choose $i$ with $y \in U_{x_i}$; then $|y - x_i| < \delta_{x_i}/2 < \delta_{x_i}$. Also
$$
|z - x_i| \le |z - y| + |y - x_i| < \delta + \frac{\delta_{x_i}}{2} \le \frac{\delta_{x_i}}{2} + \frac{\delta_{x_i}}{2} = \delta_{x_i}
$$
(using $\delta \le \delta_{x_i}/2$). Hence, by the choice of $\delta_{x_i}$, we have $|f(y) - f(x_i)| < \varepsilon/2$ and $|f(z) - f(x_i)| < \varepsilon/2$, so
$$
|f(y) - f(z)| \le |f(y) - f(x_i)| + |f(x_i) - f(z)| < \varepsilon .
$$
Since $\delta$ does not depend on $y$ or $z$, the function $f$ is uniformly continuous.

**Towards compactness.** Comparing the two proofs, one sees that the argument by sequences (sequential compactness) and the argument by coverings (compactness) are two faces of the same property of closed bounded intervals. For subsets of $\mathbb{R}^n$, being closed and bounded, being sequentially compact, and having the property that every open cover admits a finite subcover are all equivalent (the Heine-Borel theorem). In a general metric space the last two remain equivalent, while "closed and bounded" becomes a strictly weaker condition. The results proved in this article, <Ref to="thm-boundedness" />, <Ref to="thm-extreme-value" /> and <Ref to="thm-heine-cantor" />, are all consequences of the compactness of $[a,b]$, and they generalise in that form to metric and topological spaces. Only <Ref to="thm-ivt" /> is of a different character: it is a consequence of the connectedness of $[a,b]$, since a continuous map sends connected sets to connected sets and the connected subsets of $\mathbb{R}$ are precisely the intervals. In either case the starting point was the completeness of the reals, and the arguments begun there lead directly into the theory of function spaces.
