Calculus states that a continuous function on a closed interval has a maximum and takes every value in between. Both facts can fail on an open interval or on the rationals, and the reason is not the function but the set it lives on. This post first studies subsets of R\mathbb{R} — open, closed and compact sets — and then functions: the ε\varepsilon–δ\delta definition of a limit and of continuity, with fully worked δ\delta's, the Extreme Value Theorem, the Intermediate Value Theorem, and uniform continuity. It builds directly on the Axiom of Completeness (Real Analysis 00) and on Bolzano–Weierstrass and sequences (Real Analysis 01).

Series map: 00 The Real Numbers & Completeness → 01 Sequences & Series → 02 Topology of ℝ & Continuity (this post) → 03 Differentiation & Taylor's Theorem → 04 The Riemann Integral → 05 Uniform Convergence & Power Series.


Learning Outcome

  • Define open sets, limit points, closed sets and closure, and decide which of these a given set is.
  • Define compactness by sequences and by open covers, and prove one direction of the Heine–Borel Theorem.
  • State the ε\varepsilon–δ\delta definition of a functional limit and its sequential criterion, and use the criterion to prove that a limit does not exist.
  • Prove continuity from the definition, with an explicit δ\delta for f(x)=x2f(x) = x^2 at a point, and check it numerically.
  • Prove that continuous images of compact sets are compact, and deduce the Extreme Value Theorem.
  • Prove the Intermediate Value Theorem using the supremum.
  • Define uniform continuity, show that 1/x1/x and x2x^2 fail it on suitable domains, and prove that continuous functions on compact sets are uniformly continuous.
  • Describe the discontinuity sets of the Dirichlet and Thomae functions.

Chapter 1 — Open and closed sets

Terminology

  • ε\varepsilon-neighbourhood — Vε(a)=(a−ε,a+ε)V_\varepsilon(a) = (a - \varepsilon, a + \varepsilon).
  • Open set — O⊆RO \subseteq \mathbb{R} is open if for every a∈Oa \in O there is ε>0\varepsilon > 0 with Vε(a)⊆OV_\varepsilon(a) \subseteq O. Every point has some room around it inside the set.
  • Limit point of AA — a point xx (in AA or not) such that every Vε(x)V_\varepsilon(x) contains a point of AA other than xx.
  • Isolated point of AA — a point of AA that is not a limit point of AA.
  • Closed set — a set that contains all of its limit points.
  • Closure — A‾=A∪L\overline{A} = A \cup L, where LL is the set of limit points of AA.
  • Complement — Ac=R∖AA^c = \mathbb{R} \setminus A.

Examples of open sets

  • R\mathbb{R} and ∅\emptyset are open (the second vacuously).
  • Every open interval (a,b)(a, b) is open: for x∈(a,b)x \in (a,b) take ε=min⁡(x−a, b−x)\varepsilon = \min(x - a,\ b - x); then Vε(x)⊆(a,b)V_\varepsilon(x) \subseteq (a,b).
  • [0,1)[0, 1) is not open: no neighbourhood of 00 fits inside it.

Theorem. (i) Any union of open sets is open. (ii) A finite intersection of open sets is open.

Proof. (i) A point of the union lies in some OλO_\lambda, and a neighbourhood inside OλO_\lambda is inside the union. (ii) If a∈O1∩⋯∩ONa \in O_1 \cap \cdots \cap O_N, choose εi\varepsilon_i with Vεi(a)⊆OiV_{\varepsilon_i}(a) \subseteq O_i and take ε=min⁡iεi>0\varepsilon = \min_i \varepsilon_i > 0. ■\blacksquare

The word "finite" in (ii) matters: ⋂n=1∞(−1n,1n)={0}\bigcap_{n=1}^\infty \left(-\frac1n, \frac1n\right) = \{0\}, which is not open. With infinitely many εi\varepsilon_i the minimum can be 00.

Limit points and closed sets

Theorem. xx is a limit point of AA if and only if x=lim⁡anx = \lim a_n for some sequence (an)(a_n) in AA with an≠xa_n \ne x for all nn.

Proof. (⇒\Rightarrow) For each nn pick an∈V1/n(x)∩Aa_n \in V_{1/n}(x) \cap A with an≠xa_n \ne x; then ∣an−x∣<1/n→0\lvert a_n - x \rvert < 1/n \to 0. (⇐\Leftarrow) Given ε\varepsilon, the terms ana_n with nn large lie in Vε(x)V_\varepsilon(x), are in AA, and differ from xx. ■\blacksquare

So a set is closed exactly when it contains the limit of every convergent sequence of its points (constant sequences included, for points of AA itself).

Set Limit points Open? Closed?
[a,b][a, b] [a,b][a, b] no yes
(a,b)(a, b) [a,b][a, b] yes no
{1/n:n∈N}\{1/n : n \in \mathbb{N}\} {0}\{0\} no no (00 missing)
{0}∪{1/n:n∈N}\{0\} \cup \{1/n : n \in \mathbb{N}\} {0}\{0\} no yes
Z\mathbb{Z} none no yes (vacuously)
Q\mathbb{Q} R\mathbb{R} (density) no no
R\mathbb{R}, ∅\emptyset R\mathbb{R}, none yes yes

Theorem. A set is open if and only if its complement is closed. Consequently, finite unions and arbitrary intersections of closed sets are closed (De Morgan's laws).

Proof of one direction. Let OO be open and let xx be a limit point of OcO^c. If x∈Ox \in O, some Vε(x)⊆OV_\varepsilon(x) \subseteq O contains no point of OcO^c, contradicting that xx is a limit point of OcO^c. So x∈Ocx \in O^c, and OcO^c is closed. ■\blacksquare

The closure A‾\overline{A} is the smallest closed set containing AA; for example Q‾=R\overline{\mathbb{Q}} = \mathbb{R} and (a,b)‾=[a,b]\overline{(a,b)} = [a,b].

Watch out: "closed" is not the opposite of "open". A set can be both (R\mathbb{R}, ∅\emptyset — the only two such subsets of R\mathbb{R}) or neither ([0,1)[0,1), Q\mathbb{Q}).


Chapter 2 — Compact and connected sets

Terminology

  • Compact (sequential definition) — KK is compact if every sequence in KK has a subsequence that converges to a limit in KK.
  • Open cover of AA — a collection of open sets {Oλ}\{O_\lambda\} whose union contains AA. A finite subcover is a finite subcollection that still covers AA.
  • Compact (cover definition) — every open cover of KK has a finite subcover.
  • Bounded set — ∣x∣≤M\lvert x \rvert \le M for all xx in the set, for some MM.

Heine–Borel

Theorem (Heine–Borel). For K⊆RK \subseteq \mathbb{R} the following are equivalent:
(i) KK is compact (sequential definition);
(ii) KK is closed and bounded;
(iii) every open cover of KK has a finite subcover.

Proof of (ii) ⇒ (i). Let (xn)(x_n) be a sequence in KK. It is bounded because KK is, so by Bolzano–Weierstrass (Real Analysis 01) it has a convergent subsequence xnk→xx_{n_k} \to x. Either xx equals infinitely many of the xnkx_{n_k}, so x∈Kx \in K, or it is a limit point of KK, and then x∈Kx \in K because KK is closed. ■\blacksquare

Proof of (i) ⇒ (ii). If KK were unbounded, choose xn∈Kx_n \in K with ∣xn∣>n\lvert x_n \rvert > n; no subsequence is bounded, so none converges. If KK were not closed, some limit point x∉Kx \notin K is the limit of a sequence in KK; every subsequence also tends to x∉Kx \notin K. ■\blacksquare

The equivalence with (iii) takes more work; see Abbott Section 3.3 and Rudin Theorems 2.40–2.41.

Nested compact sets. If K1⊇K2⊇K3⊇⋯K_1 \supseteq K_2 \supseteq K_3 \supseteq \cdots are nonempty compact sets, then ⋂nKn≠∅\bigcap_n K_n \ne \emptyset. (Pick xn∈Knx_n \in K_n. The sequence lies in K1K_1, so a subsequence converges to some x∈K1x \in K_1. For each fixed mm, the terms with nk≥mn_k \ge m lie in the closed set KmK_m, so x∈Kmx \in K_m.) This generalizes the Nested Interval Property of Real Analysis 00 from intervals to any compact sets.

Examples. [0,1][0,1] and the Cantor set (an intersection of closed sets, inside [0,1][0,1]) are compact. (0,1)(0,1) is not: the sequence 1/n1/n has every subsequence tending to 0∉(0,1)0 \notin (0,1). Equivalently, the open cover {(1/n,1):n≥2}\{(1/n, 1) : n \ge 2\} of (0,1)(0,1) has no finite subcover, since the union of finitely many of these sets is (1/N,1)(1/N, 1) for the largest NN used, which misses (0,1/N](0, 1/N]. R\mathbb{R} is closed but not bounded, so not compact.

Trick: use the sequential definition when you have a sequence in hand (most proofs in this post). Use the cover definition to pass from "local" information at each point to a "global" statement with finitely many pieces.

Connected sets

Two nonempty sets A,BA, B are separated if A‾∩B=∅\overline{A} \cap B = \emptyset and A∩B‾=∅A \cap \overline{B} = \emptyset. A set is connected if it is not a union of two separated sets.

Theorem. A set E⊆RE \subseteq \mathbb{R} is connected if and only if it is an interval: whenever a<c<ba < c < b with a,b∈Ea, b \in E, also c∈Ec \in E.

Q\mathbb{Q} is not connected: Q={r<2}∪{r>2}\mathbb{Q} = \{r < \sqrt2\} \cup \{r > \sqrt2\} splits it into two separated pieces. This gap is exactly why the Intermediate Value Theorem fails for functions on Q\mathbb{Q}.


Chapter 3 — Limits of functions

Terminology

  • Functional limit — let f:A→Rf : A \to \mathbb{R} and let cc be a limit point of AA. Then lim⁡x→cf(x)=L\lim_{x \to c} f(x) = L means: for every ε>0\varepsilon > 0 there is δ>0\delta > 0 such that for all x∈Ax \in A with 0<∣x−c∣<δ0 < \lvert x - c \rvert < \delta, ∣f(x)−L∣<ε\lvert f(x) - L \rvert < \varepsilon.
  • The condition 0<∣x−c∣0 < \lvert x - c \rvert means the value f(c)f(c) (if it exists) plays no role in the limit.

A first example

Claim. lim⁡x→2(3x+1)=7\lim_{x \to 2} (3x + 1) = 7.

Proof. ∣(3x+1)−7∣=3∣x−2∣\lvert (3x + 1) - 7 \rvert = 3 \lvert x - 2 \rvert. Given ε>0\varepsilon > 0, let δ=ε/3\delta = \varepsilon / 3. If 0<∣x−2∣<δ0 < \lvert x - 2 \rvert < \delta then ∣(3x+1)−7∣<3δ=ε\lvert (3x+1) - 7 \rvert < 3\delta = \varepsilon. ■\blacksquare

For a linear function, δ\delta is simply ε\varepsilon divided by the slope. Nonlinear functions need one extra step (Chapter 4).

The sequential criterion

Theorem. lim⁡x→cf(x)=L\lim_{x \to c} f(x) = L if and only if for every sequence (xn)(x_n) in AA with xn≠cx_n \ne c and xn→cx_n \to c, the sequence f(xn)→Lf(x_n) \to L.

Proof of (⇒). Let ε>0\varepsilon > 0 and take the δ\delta from the definition. Since xn→cx_n \to c, there is NN with ∣xn−c∣<δ\lvert x_n - c \rvert < \delta for n≥Nn \ge N, and xn≠cx_n \ne c. So ∣f(xn)−L∣<ε\lvert f(x_n) - L \rvert < \varepsilon for n≥Nn \ge N. ■\blacksquare

Proof of (⇐). Suppose the limit is not LL. Negating the definition (Real Analysis 00): there is ε0>0\varepsilon_0 > 0 such that for every δ>0\delta > 0 some x∈Ax \in A has 0<∣x−c∣<δ0 < \lvert x - c \rvert < \delta and ∣f(x)−L∣≥ε0\lvert f(x) - L \rvert \ge \varepsilon_0. Apply this with δ=1/n\delta = 1/n for each nn to get xn≠cx_n \ne c with ∣xn−c∣<1/n\lvert x_n - c \rvert < 1/n, so xn→cx_n \to c, but ∣f(xn)−L∣≥ε0\lvert f(x_n) - L \rvert \ge \varepsilon_0 for all nn, so f(xn)↛Lf(x_n) \not\to L. ■\blacksquare

The same pattern — negate the ε\varepsilon–δ\delta statement, then use δ=1/n\delta = 1/n to build a sequence — proves the sequential criteria for continuity and for uniform continuity below.

Corollary (divergence criterion). If two sequences xn→cx_n \to c and yn→cy_n \to c (terms ≠c\ne c) have f(xn)f(x_n) and f(yn)f(y_n) tending to different limits, then lim⁡x→cf(x)\lim_{x \to c} f(x) does not exist.

Example. f(x)=sin⁡(1/x)f(x) = \sin(1/x) at c=0c = 0. Take xn=12nπx_n = \frac{1}{2n\pi} and yn=12nπ+π/2y_n = \frac{1}{2n\pi + \pi/2}. Both tend to 00, but sin⁡(1/xn)=sin⁡(2nπ)=0\sin(1/x_n) = \sin(2n\pi) = 0 and sin⁡(1/yn)=sin⁡(2nπ+π/2)=1\sin(1/y_n) = \sin(2n\pi + \pi/2) = 1 for every nn. The limit does not exist: the graph oscillates between −1-1 and 11 infinitely often near 00.


Chapter 4 — Continuity

Terminology

  • Removable discontinuity at cc — lim⁡x→cf(x)\lim_{x \to c} f(x) exists but differs from f(c)f(c) (or f(c)f(c) is undefined).
  • Jump discontinuity — the one-sided limits lim⁡x→c−f(x)\lim_{x \to c^-} f(x) and lim⁡x→c+f(x)\lim_{x \to c^+} f(x) both exist but are different.
  • Essential discontinuity — at least one one-sided limit does not exist, as for sin⁡(1/x)\sin(1/x) at 00.
  • Lipschitz function — there is K≥0K \ge 0 with ∣f(x)−f(y)∣≤K∣x−y∣\lvert f(x) - f(y) \rvert \le K \lvert x - y \rvert for all x,yx, y in the domain.

Definition

f:A→Rf : A \to \mathbb{R} is continuous at c∈Ac \in A if for every ε>0\varepsilon > 0 there is δ>0\delta > 0 such that for all x∈Ax \in A with ∣x−c∣<δ\lvert x - c \rvert < \delta, ∣f(x)−f(c)∣<ε\lvert f(x) - f(c) \rvert < \varepsilon. It is continuous on AA if it is continuous at every point of AA.

Equivalently (sequential criterion): ff is continuous at cc if and only if xn→cx_n \to c with xn∈Ax_n \in A implies f(xn)→f(c)f(x_n) \to f(c). If cc is a limit point of AA, this is the same as lim⁡x→cf(x)=f(c)\lim_{x \to c} f(x) = f(c). At an isolated point of AA every function is continuous.

Worked example: a delta for x squared at c = 3

Claim. f(x)=x2f(x) = x^2 is continuous at c=3c = 3.

Scratch work. Factor: ∣x2−9∣=∣x−3∣ ∣x+3∣\lvert x^2 - 9 \rvert = \lvert x - 3 \rvert \, \lvert x + 3 \rvert. The factor ∣x−3∣\lvert x - 3 \rvert is what δ\delta controls; the factor ∣x+3∣\lvert x + 3 \rvert must be bounded. Agree in advance that δ≤1\delta \le 1. Then ∣x−3∣<1\lvert x - 3 \rvert < 1 gives 2<x<42 < x < 4, so ∣x+3∣<7\lvert x + 3 \rvert < 7, and

∣x2−9∣<7∣x−3∣.\lvert x^2 - 9 \rvert < 7 \lvert x - 3 \rvert.

This is less than ε\varepsilon when ∣x−3∣<ε/7\lvert x - 3 \rvert < \varepsilon / 7.

Proof. Let ε>0\varepsilon > 0 and set δ=min⁡(1,ε7)\delta = \min\left(1, \frac{\varepsilon}{7}\right). If ∣x−3∣<δ\lvert x - 3 \rvert < \delta, then ∣x−3∣<1\lvert x - 3 \rvert < 1, so ∣x+3∣<7\lvert x + 3 \rvert < 7, and ∣x2−9∣<7⋅ε7=ε\lvert x^2 - 9 \rvert < 7 \cdot \frac{\varepsilon}{7} = \varepsilon. ■\blacksquare

Checking with numbers. For ε=1\varepsilon = 1 the rule gives δ=min⁡(1,1/7)=1/7≈0.1429\delta = \min(1, 1/7) = 1/7 \approx 0.1429. The worst case is at the right end, x=3+17x = 3 + \tfrac17: x2−9=67+149=4349≈0.878<1x^2 - 9 = \tfrac67 + \tfrac{1}{49} = \tfrac{43}{49} \approx 0.878 < 1. At the left end, 9−(3−17)2=4149≈0.837<19 - (3 - \tfrac17)^2 = \tfrac{41}{49} \approx 0.837 < 1. The largest δ\delta that works is 10−3≈0.1623\sqrt{10} - 3 \approx 0.1623; the proof's δ\delta is a little smaller, which is fine — any δ\delta that works is enough.

ε\varepsilon δ=min⁡(1,ε/7)\delta = \min(1, \varepsilon/7) worst ∣x2−9∣\lvert x^2 - 9\rvert at x=3+δx = 3 + \delta largest valid δ\delta
11 1/7≈0.14291/7 \approx 0.1429 43/49≈0.877643/49 \approx 0.8776 10−3≈0.1623\sqrt{10} - 3 \approx 0.1623
0.10.1 1/70≈0.014291/70 \approx 0.01429 421/4900≈0.08592421/4900 \approx 0.08592 9.1−3≈0.01662\sqrt{9.1} - 3 \approx 0.01662

Trick: the "δ=min⁡(1,… )\delta = \min(1, \dots)" move is the standard way to handle a nonlinear factor: first restrict xx to a fixed interval around cc to bound the awkward factor by a constant, then divide ε\varepsilon by that constant.

Building continuous functions

Algebraic Continuity Theorem. If ff and gg are continuous at cc, so are kfkf, f+gf + g, fgfg, and f/gf/g (if g(c)≠0g(c) \ne 0).

Proof. Use the sequential criterion: if xn→cx_n \to c then f(xn)→f(c)f(x_n) \to f(c) and g(xn)→g(c)g(x_n) \to g(c), and the Algebraic Limit Theorem (Real Analysis 01) does the rest. ■\blacksquare

Since f(x)=xf(x) = x and constants are continuous, every polynomial is continuous on R\mathbb{R}, and every rational function is continuous wherever its denominator is not zero.

Composition. If gg is continuous at cc and ff is continuous at g(c)g(c), then f∘gf \circ g is continuous at cc.

Proof. Let ε>0\varepsilon > 0. Choose η>0\eta > 0 with ∣y−g(c)∣<η⇒∣f(y)−f(g(c))∣<ε\lvert y - g(c) \rvert < \eta \Rightarrow \lvert f(y) - f(g(c)) \rvert < \varepsilon. Then choose δ>0\delta > 0 with ∣x−c∣<δ⇒∣g(x)−g(c)∣<η\lvert x - c \rvert < \delta \Rightarrow \lvert g(x) - g(c) \rvert < \eta. Chaining, ∣x−c∣<δ⇒∣f(g(x))−f(g(c))∣<ε\lvert x - c \rvert < \delta \Rightarrow \lvert f(g(x)) - f(g(c)) \rvert < \varepsilon. ■\blacksquare

So 1+x2\sqrt{1 + x^2}, sin⁡(x3)\sin(x^3) and ecos⁡xe^{\cos x} are continuous (given that the square root, sine, cosine and exponential functions are continuous on their domains).


Chapter 5 — Continuous functions on compact sets and intervals

Compactness is preserved

Theorem. If f:K→Rf : K \to \mathbb{R} is continuous and KK is compact, then f(K)={f(x):x∈K}f(K) = \{f(x) : x \in K\} is compact.

Proof. Let (yn)(y_n) be a sequence in f(K)f(K); write yn=f(xn)y_n = f(x_n) with xn∈Kx_n \in K. By compactness a subsequence xnk→x∈Kx_{n_k} \to x \in K. By continuity ynk=f(xnk)→f(x)∈f(K)y_{n_k} = f(x_{n_k}) \to f(x) \in f(K). So every sequence in f(K)f(K) has a subsequence converging in f(K)f(K). ■\blacksquare

The Extreme Value Theorem

Theorem (EVT). If f:K→Rf : K \to \mathbb{R} is continuous and KK is compact and nonempty, then ff attains a maximum and a minimum: there are x0,x1∈Kx_0, x_1 \in K with f(x0)≤f(x)≤f(x1)f(x_0) \le f(x) \le f(x_1) for all x∈Kx \in K.

Proof. f(K)f(K) is compact, hence bounded, so s=sup⁡f(K)s = \sup f(K) exists (Axiom of Completeness). By the ε\varepsilon-characterization, for each nn there is yn∈f(K)y_n \in f(K) with s−1/n<yn≤ss - 1/n < y_n \le s, so yn→sy_n \to s. Since f(K)f(K) is closed, s∈f(K)s \in f(K): s=f(x1)s = f(x_1) for some x1∈Kx_1 \in K. The minimum is the same argument with inf⁡\inf. ■\blacksquare

Every hypothesis is needed:

Function and domain What fails Max attained?
f(x)=xf(x) = x on (0,1)(0, 1) domain not closed no (sup⁡=1\sup = 1 not reached)
f(x)=xf(x) = x on [0,∞)[0, \infty) domain not bounded no (unbounded)
f(x)=1/xf(x) = 1/x on (0,1](0, 1] domain not closed no (unbounded)
f(0)=0f(0) = 0, f(x)=1−xf(x) = 1 - x on (0,1](0, 1] ff not continuous at 00 no (sup⁡=1\sup = 1 not reached)

The Intermediate Value Theorem

Theorem (IVT). Let f:[a,b]→Rf : [a, b] \to \mathbb{R} be continuous, and let LL be a number strictly between f(a)f(a) and f(b)f(b). Then there is c∈(a,b)c \in (a, b) with f(c)=Lf(c) = L.

Proof (via the supremum). Replacing ff by f−Lf - L (and by −f-f if needed), assume f(a)<0<f(b)f(a) < 0 < f(b) and find cc with f(c)=0f(c) = 0. Let

S={x∈[a,b]:f(x)<0}.S = \{x \in [a, b] : f(x) < 0\}.

SS contains aa and is bounded above by bb, so c=sup⁡Sc = \sup S exists, and a≤c≤ba \le c \le b.

f(c)>0f(c) > 0 is impossible. By continuity there is δ>0\delta > 0 with f(x)>0f(x) > 0 for x∈(c−δ,c]x \in (c - \delta, c] (take ε=f(c)\varepsilon = f(c)). Then no point of SS lies in (c−δ,c](c - \delta, c], and none lies above cc, so c−δc - \delta is an upper bound of SS smaller than cc. Contradiction.

f(c)<0f(c) < 0 is impossible. Then c≠bc \ne b since f(b)>0f(b) > 0, and by continuity f(x)<0f(x) < 0 on [c,c+δ)[c, c + \delta) for some δ>0\delta > 0 (small enough that c+δ≤bc + \delta \le b). So c+δ/2∈Sc + \delta/2 \in S, contradicting that cc is an upper bound.

Hence f(c)=0f(c) = 0, and c≠a,bc \ne a, b since f(a)<0<f(b)f(a) < 0 < f(b). ■\blacksquare

A second proof: f([a,b])f([a,b]) is connected (continuous images of connected sets are connected), hence an interval by the theorem in Chapter 2, so it contains every value between f(a)f(a) and f(b)f(b). A third uses bisection and the Nested Interval Property — which is also an algorithm.

Worked example. p(x)=x3+x−1p(x) = x^3 + x - 1 has a root in (0,1)(0,1), since p(0)=−1<0<1=p(1)p(0) = -1 < 0 < 1 = p(1). Bisection narrows it:

interval midpoint mm p(m)p(m) keep
[0,1][0, 1] 0.50.5 −0.375-0.375 [0.5,1][0.5, 1]
[0.5,1][0.5, 1] 0.750.75 0.1718750.171875 [0.5,0.75][0.5, 0.75]
[0.5,0.75][0.5, 0.75] 0.6250.625 ≈−0.1309\approx -0.1309 [0.625,0.75][0.625, 0.75]
[0.625,0.75][0.625, 0.75] 0.68750.6875 ≈0.01245\approx 0.01245 [0.625,0.6875][0.625, 0.6875]

The root is ≈0.6823\approx 0.6823. (It is the only real root: p′(x)=3x2+1>0p'(x) = 3x^2 + 1 > 0, so pp is strictly increasing.)

Common pitfall: the IVT says nothing about functions on sets with gaps. On Q∩[0,2]\mathbb{Q} \cap [0, 2], the continuous function g(x)=x2−2g(x) = x^2 - 2 is negative at 00 and positive at 22 but has no rational zero.


Chapter 6 — Uniform continuity

Definition

f:A→Rf : A \to \mathbb{R} is uniformly continuous on AA if for every ε>0\varepsilon > 0 there is δ>0\delta > 0 such that for all x,y∈Ax, y \in A with ∣x−y∣<δ\lvert x - y \rvert < \delta, ∣f(x)−f(y)∣<ε\lvert f(x) - f(y) \rvert < \varepsilon.

Compare the quantifiers:

  • continuous on AA: ∀c  ∀ε  ∃δ  ∀x\forall c\ \ \forall \varepsilon\ \ \exists \delta\ \ \forall x — δ\delta may depend on ε\varepsilon and on cc;
  • uniformly continuous: ∀ε  ∃δ  ∀c  ∀x\forall \varepsilon\ \ \exists \delta\ \ \forall c\ \ \forall x — one δ\delta works at every point.

The example of 1/x

Take f(x)=1/xf(x) = 1/x on (0,1](0, 1] and ε=1\varepsilon = 1. At a point cc, the largest δ\delta that works is decided on the left side, where the graph is steeper:

1c−δ−1c=δc(c−δ)=ε⟺δ=εc21+εc.\frac{1}{c - \delta} - \frac{1}{c} = \frac{\delta}{c(c - \delta)} = \varepsilon \quad\Longleftrightarrow\quad \delta = \frac{\varepsilon c^2}{1 + \varepsilon c}.

point cc 11 1/21/2 1/41/4 1/101/10
largest δ\delta for ε=1\varepsilon = 1 1/21/2 1/6≈0.1671/6 \approx 0.167 1/20=0.051/20 = 0.05 1/110≈0.009091/110 \approx 0.00909

At each point a δ\delta exists, so 1/x1/x is continuous on (0,1](0,1]. But the best δ\delta tends to 00 as c→0c \to 0, so no single δ\delta serves every point: 1/x1/x is not uniformly continuous on (0,1](0,1]. The domain is bounded but not closed, and the missing point 00 is exactly where things go wrong.

Two panels. Left: the graph of x squared near 3 with the epsilon band from 8 to 10 around f(3) equals 9 and the delta window of width one seventh on each side of 3, showing the graph stays inside the box. Right: the graph of 1 over x for x between 0 and 1, with epsilon equal to 1 and the largest working delta at c equal to 1, one half and one quarter shrinking from one half to one sixth to one twentieth, so no single delta works near 0

Proving a function is not uniformly continuous

Sequential criterion. ff is not uniformly continuous on AA if and only if there are ε0>0\varepsilon_0 > 0 and sequences (xn),(yn)(x_n), (y_n) in AA with ∣xn−yn∣→0\lvert x_n - y_n \rvert \to 0 but ∣f(xn)−f(yn)∣≥ε0\lvert f(x_n) - f(y_n) \rvert \ge \varepsilon_0 for all nn.

  • 1/x1/x on (0,1](0,1]: xn=1n+1x_n = \frac{1}{n+1}, yn=1n+2y_n = \frac{1}{n+2}. Then ∣xn−yn∣=1(n+1)(n+2)→0\lvert x_n - y_n \rvert = \frac{1}{(n+1)(n+2)} \to 0 but ∣f(xn)−f(yn)∣=1\lvert f(x_n) - f(y_n) \rvert = 1.
  • x2x^2 on R\mathbb{R}: xn=nx_n = n, yn=n+1ny_n = n + \frac1n. Then ∣xn−yn∣=1n→0\lvert x_n - y_n \rvert = \frac1n \to 0 but ∣yn2−xn2∣=2+1n2≥2\lvert y_n^2 - x_n^2 \rvert = 2 + \frac{1}{n^2} \ge 2. The graph gets steeper without bound.
  • sin⁡(1/x)\sin(1/x) on (0,1)(0,1): xn=12nπx_n = \frac{1}{2n\pi}, yn=12nπ+π/2y_n = \frac{1}{2n\pi + \pi/2} from Chapter 3. Their distance tends to 00 and the values differ by 11. This function is bounded and continuous on (0,1)(0,1), yet not uniformly continuous.

On a bounded interval, x2x^2 is uniformly continuous: on [−M,M][-M, M], ∣x2−y2∣=∣x+y∣∣x−y∣≤2M∣x−y∣\lvert x^2 - y^2 \rvert = \lvert x + y \rvert \lvert x - y \rvert \le 2M \lvert x - y \rvert, so δ=ε/(2M)\delta = \varepsilon / (2M) works everywhere. More generally, a Lipschitz function (∣f(x)−f(y)∣≤K∣x−y∣\lvert f(x) - f(y) \rvert \le K \lvert x - y \rvert for all x,yx, y) is uniformly continuous with δ=ε/K\delta = \varepsilon / K.

Compact domains fix everything

Theorem. A continuous function on a compact set KK is uniformly continuous on KK.

Proof. Suppose not. By the sequential criterion there are ε0>0\varepsilon_0 > 0 and xn,yn∈Kx_n, y_n \in K with ∣xn−yn∣→0\lvert x_n - y_n \rvert \to 0 and ∣f(xn)−f(yn)∣≥ε0\lvert f(x_n) - f(y_n) \rvert \ge \varepsilon_0. By compactness a subsequence xnk→x∈Kx_{n_k} \to x \in K. Then

∣ynk−x∣≤∣ynk−xnk∣+∣xnk−x∣→0,\lvert y_{n_k} - x \rvert \le \lvert y_{n_k} - x_{n_k} \rvert + \lvert x_{n_k} - x \rvert \to 0,

so ynk→xy_{n_k} \to x too. By continuity at xx, both f(xnk)f(x_{n_k}) and f(ynk)f(y_{n_k}) tend to f(x)f(x), so ∣f(xnk)−f(ynk)∣→0\lvert f(x_{n_k}) - f(y_{n_k}) \rvert \to 0. This contradicts ∣f(xnk)−f(ynk)∣≥ε0\lvert f(x_{n_k}) - f(y_{n_k}) \rvert \ge \varepsilon_0. ■\blacksquare

This theorem is the reason the Riemann integral of a continuous function on [a,b][a, b] exists (Real Analysis 04): one δ\delta for the whole interval controls every subinterval of a partition at once.

Watch out: "continuous on (0,1)(0,1) and bounded" does not give uniform continuity (sin⁡(1/x)\sin(1/x)), and neither does "continuous on a closed set" (x2x^2 on R\mathbb{R}). The hypothesis is closed and bounded.


Chapter 7 — How discontinuous can a function be?

Dirichlet's function g(x)=1g(x) = 1 for x∈Qx \in \mathbb{Q} and g(x)=0g(x) = 0 for x∉Qx \notin \mathbb{Q} is discontinuous at every point. Given cc, the density of Q\mathbb{Q} and of the irrationals (Real Analysis 00) gives a sequence of rationals xn→cx_n \to c and a sequence of irrationals yn→cy_n \to c, with g(xn)=1g(x_n) = 1 and g(yn)=0g(y_n) = 0; they cannot both tend to g(c)g(c).

A function continuous at exactly one point. h(x)=x g(x)h(x) = x \, g(x) (equal to xx on Q\mathbb{Q} and 00 elsewhere) is continuous at 00, since ∣h(x)∣≤∣x∣\lvert h(x) \rvert \le \lvert x \rvert (take δ=ε\delta = \varepsilon), and discontinuous at every c≠0c \ne 0 by the same two-sequence argument.

Thomae's function.

t(x)={1x=0,1/qx=p/q in lowest terms, q≥1,0x∉Q.t(x) = \begin{cases} 1 & x = 0, \\ 1/q & x = p/q \text{ in lowest terms, } q \ge 1, \\ 0 & x \notin \mathbb{Q}. \end{cases}

  • Discontinuous at every rational c=p/qc = p/q: t(c)=1/q>0t(c) = 1/q > 0, but irrationals yn→cy_n \to c have t(yn)=0t(y_n) = 0.
  • Continuous at every irrational cc: given ε>0\varepsilon > 0, choose q0q_0 with 1/q0<ε1/q_0 < \varepsilon. In the interval (c−1,c+1)(c - 1, c + 1) only finitely many rationals have denominator q<q0q < q_0, and none equals cc. Choose δ>0\delta > 0 so small that Vδ(c)V_\delta(c) avoids all of them. Every x∈Vδ(c)x \in V_\delta(c) is then irrational (t(x)=0t(x) = 0) or has denominator ≥q0\ge q_0 (t(x)≤1/q0<εt(x) \le 1/q_0 < \varepsilon). So ∣t(x)−t(c)∣<ε\lvert t(x) - t(c) \rvert < \varepsilon.

So Thomae's function is continuous exactly on the irrationals. The reverse is impossible: no function f:R→Rf : \mathbb{R} \to \mathbb{R} is continuous exactly on Q\mathbb{Q}. The proof uses the Baire Category Theorem (Abbott Sections 3.5 and 4.6).

Function Continuous at Discontinuous at
polynomials all of R\mathbb{R} nowhere
x↦sin⁡(1/x)x \mapsto \sin(1/x), 0↦00 \mapsto 0 x≠0x \ne 0 00 (no limit)
Dirichlet gg nowhere all of R\mathbb{R}
x g(x)x \, g(x) 00 only x≠0x \ne 0
Thomae tt irrationals rationals

Practice Exercises

1. Is A={1+1/n:n∈N}∪{1}A = \{1 + 1/n : n \in \mathbb{N}\} \cup \{1\} open, closed, compact? Find its limit points.

Solution

The only limit point is 11, which is in AA, so AA is closed. It is bounded (inside [1,2][1, 2]), so it is compact by Heine–Borel. It is not open: no neighbourhood of 22 lies in AA.

2. Show directly from the cover definition that [0,∞)[0, \infty) is not compact.

Solution

The sets On=(−1,n)O_n = (-1, n), n∈Nn \in \mathbb{N}, are open and cover [0,∞)[0,\infty). A finite subcollection has union (−1,N)(-1, N) for the largest index NN used, which misses NN. So there is no finite subcover.

3. Prove from the definition that f(x)=5x−2f(x) = 5x - 2 is continuous at every cc, and that lim⁡x→1x2−1x−1=2\lim_{x \to 1} \frac{x^2 - 1}{x - 1} = 2.

Solution

∣f(x)−f(c)∣=5∣x−c∣\lvert f(x) - f(c) \rvert = 5 \lvert x - c \rvert, so δ=ε/5\delta = \varepsilon / 5 works. For the limit: for x≠1x \ne 1, x2−1x−1=x+1\frac{x^2 - 1}{x - 1} = x + 1, and ∣(x+1)−2∣=∣x−1∣\lvert (x + 1) - 2 \rvert = \lvert x - 1 \rvert, so δ=ε\delta = \varepsilon works. The value at x=1x = 1 is undefined, which does not matter for the limit.

4. Prove that f(x)=x2f(x) = x^2 is continuous at c=−2c = -2. Give δ\delta as a formula in ε\varepsilon and check it for ε=0.5\varepsilon = 0.5.

Solution

∣x2−4∣=∣x+2∣∣x−2∣\lvert x^2 - 4 \rvert = \lvert x + 2 \rvert \lvert x - 2 \rvert. If ∣x+2∣<1\lvert x + 2 \rvert < 1 then −3<x<−1-3 < x < -1, so ∣x−2∣<5\lvert x - 2 \rvert < 5. Take δ=min⁡(1,ε/5)\delta = \min(1, \varepsilon/5). For ε=0.5\varepsilon = 0.5, δ=0.1\delta = 0.1; the worst case is x=−2.1x = -2.1: x2−4=0.41<0.5x^2 - 4 = 0.41 < 0.5 (and at x=−1.9x = -1.9: 4−3.61=0.394 - 3.61 = 0.39).

5. Show that f(x)=xf(x) = \sqrt{x} is uniformly continuous on [0,∞)[0, \infty). (Hint: split into [0,1][0, 1] and [1,∞)[1, \infty), or show ∣x−y∣≤∣x−y∣\lvert \sqrt{x} - \sqrt{y} \rvert \le \sqrt{\lvert x - y \rvert}.)

Solution

For 0≤y≤x0 \le y \le x: (x−y)2≤(x−y)(x+y)=x−y(\sqrt{x} - \sqrt{y})^2 \le (\sqrt{x} - \sqrt{y})(\sqrt{x} + \sqrt{y}) = x - y, so ∣x−y∣≤∣x−y∣\lvert \sqrt{x} - \sqrt{y} \rvert \le \sqrt{\lvert x - y \rvert}. Given ε\varepsilon, δ=ε2\delta = \varepsilon^2 works for all x,y≥0x, y \ge 0.

6. Show that every polynomial of odd degree has a real root.

Solution

Let p(x)=anxn+⋯+a0p(x) = a_n x^n + \cdots + a_0 with nn odd and an>0a_n > 0 (else use −p-p). Then p(x)/xn→an>0p(x) / x^n \to a_n > 0 as x→±∞x \to \pm\infty, so p(x)>0p(x) > 0 for large positive xx and, since xn<0x^n < 0 for x<0x < 0, p(x)<0p(x) < 0 for large negative xx. Pick such points a<ba < b and apply the IVT on [a,b][a, b].

7. Let f:[0,1]→[0,1]f : [0, 1] \to [0, 1] be continuous. Prove that ff has a fixed point: some cc with f(c)=cf(c) = c.

Solution

Let g(x)=f(x)−xg(x) = f(x) - x, continuous on [0,1][0,1]. Then g(0)=f(0)≥0g(0) = f(0) \ge 0 and g(1)=f(1)−1≤0g(1) = f(1) - 1 \le 0. If either is 00 you are done; otherwise g(0)>0>g(1)g(0) > 0 > g(1) and the IVT gives c∈(0,1)c \in (0, 1) with g(c)=0g(c) = 0.


Cheat-sheet

Concept Definition or statement Standard example
Open every point has a VεV_\varepsilon inside (a,b)(a,b); not [0,1)[0,1)
Closed contains all limit points [a,b][a,b], Z\mathbb{Z}; not Q\mathbb{Q}
Open vs closed OO open iff OcO^c closed R\mathbb{R}, ∅\emptyset are both
Compact every sequence has a subsequence converging in KK [a,b][a,b], Cantor set
Heine–Borel compact iff closed and bounded iff finite subcovers (0,1)(0,1) fails
Functional limit 0<∣x−c∣<δ0 < \lvert x - c\rvert < \delta gives ∣f(x)−L∣<ε\lvert f(x) - L\rvert < \varepsilon sin⁡(1/x)\sin(1/x) at 00: none
Continuity ∣x−c∣<δ\lvert x - c\rvert < \delta gives ∣f(x)−f(c)∣<ε\lvert f(x) - f(c)\rvert < \varepsilon x2x^2 at 33: δ=min⁡(1,ε/7)\delta = \min(1, \varepsilon/7)
EVT continuous on compact: max and min attained fails for xx on (0,1)(0,1)
IVT continuous on [a,b][a,b] takes all values between root of x3+x−1x^3 + x - 1 near 0.68230.6823
Uniform continuity one δ\delta for all points 1/x1/x on (0,1](0,1] fails
Compact ⇒ UC continuous on compact is uniformly continuous x2x^2 on [−M,M][-M, M]
Thomae continuous exactly on the irrationals Dirichlet: nowhere

What's next

Real Analysis 03 defines the derivative as a functional limit and proves the theorems that make calculus work, such as the Mean Value Theorem (whose proof needs the Extreme Value Theorem from this post) and Taylor's theorem with remainder.


References

  • Stephen Abbott, Understanding Analysis, 2nd edition, Springer, 2015 — Chapter 3 (basic topology of R\mathbb{R}) and Chapter 4 (functional limits and continuity; Section 4.6 on sets of discontinuity).
  • Walter Rudin, Principles of Mathematical Analysis, 3rd edition, McGraw-Hill, 1976 — Chapter 2 (basic topology) and Chapter 4 (continuity).
  • Robert G. Bartle and Donald R. Sherbert, Introduction to Real Analysis, 4th edition, Wiley, 2011 — Chapters 4–5 and 11.
  • Terence Tao, Analysis I, 4th edition, Springer, 2022 — Chapter 9 (continuous functions on R\mathbb{R}).
  • Michael Spivak, Calculus, 4th edition, Publish or Perish, 2008 — Chapters 5–8 (limits, continuity, the three hard theorems).
  • MIT OpenCourseWare, 18.100A Real Analysis, Fall 2020 (Casey Rodriguez), lecture notes: https://ocw.mit.edu/courses/18-100a-real-analysis-fall-2020/

Note: this post is in progress. Planned additions: the proof that sequential compactness implies the open-cover property; perfect sets and the Baire Category Theorem; monotone functions and their (countable) sets of jump discontinuities.