Skip to content

3. Continuity

Most functions you meet in nature have no sudden jumps: a falling stone does not teleport, a temperature does not leap from 10 to 30 degrees in no time. Chapter 2 gave us the language to say exactly what "no jumps" means: the limit at each point is simply the value there. In this chapter you will define continuity, sort the ways it can fail, and meet the two great theorems about continuous functions on a closed interval: the intermediate value theorem, which guarantees that equations have solutions (and gives the bisection method for finding them), and the extreme value theorem, which guarantees that optimisation problems have answers. You will end by proving that continuity survives composition and inversion.

In this chapter

You will learn:

  • the definition of continuity at a point and on an interval, in words and with epsilon and delta
  • why polynomials, rational functions, roots, sine and cosine are continuous
  • the four ways a function can be discontinuous: removable, jump, infinite and oscillating
  • the intermediate value theorem, its uses, and the bisection method with its error bound
  • the extreme value theorem, and why each of its hypotheses is needed
  • that compositions of continuous functions are continuous, and that the inverse of a continuous one-to-one function on an interval is continuous

You need: Chapter 2, especially the limit laws (2.2) and the epsilon-delta definition (2.5). Gentler version on the Topics shelf: Continuity.

Levels: 3.1 is intermediate; 3.2 and 3.3 are intermediate, with their proofs postponed to Chapter 18 (expert); 3.4 is advanced.

3.1 Continuous functions

The definition

Here is a question that sounds like a riddle. You set off up a hill at 8 in the morning and reach the top at noon. Is there a moment when you were at exactly half the height of the hill? Of course there is, you say: to get from the bottom to the top you must pass through every height in between. But that answer assumes something: that your height changes without jumps. Mathematics needs that assumption stated precisely, and then it can prove the "of course" (that is section 3.2). The assumption is continuity.

Definition. A function \(f\) is continuous at \(a\) if \(f\) is defined at \(a\) and

\(\lim_{x \to a} f(x) = f(a)\).

Unpacked, three things must be true: \(f(a)\) exists, the limit \(\lim_{x \to a} f(x)\) exists, and the two are equal. In words: the value at \(a\) is what the nearby values are heading towards. If you know \(f\) at all points near \(a\), you can predict \(f(a)\).

In epsilon-delta language (Chapter 2.5), and noticing that we no longer need to exclude \(x = a\) (at \(x = a\) the distance \(|f(x) - f(a)|\) is 0 anyway):

\(f\) is continuous at \(a\) if for every \(\varepsilon > 0\) there is a \(\delta > 0\) such that \(|x - a| < \delta\) (with \(x\) in the domain of \(f\)) implies \(|f(x) - f(a)| < \varepsilon\).

"Small changes in the input cause small changes in the output." That is the practical meaning of continuity, and it is why measurement works at all: if the area of a square plot depended discontinuously on its side, measuring the side to the nearest centimetre would tell you nothing about the area.

We say \(f\) is continuous on an open interval \((a, b)\) if it is continuous at every point of it, and continuous on a closed interval \([a, b]\) if in addition it is continuous from the right at \(a\) (\(\lim_{x \to a^+} f(x) = f(a)\)) and from the left at \(b\). A function continuous at every point of its domain is simply called continuous. Informally, a function continuous on an interval has a graph you can draw without lifting your pencil, but treat that picture with care: section 3.1's last examples show it can mislead.

The basic continuous functions

The limit laws of Chapter 2 do most of the work.

Theorem. If \(f\) and \(g\) are continuous at \(a\), so are \(f + g\), \(f - g\), \(cf\), \(fg\), and \(\frac fg\) provided \(g(a) \ne 0\).

Proof. Each follows from the matching limit law. For example, \(\lim_{x \to a} f(x)g(x) = \lim f \cdot \lim g = f(a)g(a)\). \(\square\)

Since constants and \(x\) itself are continuous, so is every polynomial (built from them by sums and products), and every rational function \(\frac{p(x)}{q(x)}\) is continuous at every point where \(q \ne 0\), which is to say on its whole domain. This is what Chapter 2.2 found: for these functions the limit is the value.

Sine and cosine are continuous everywhere. Proof. From Chapter 2.4, \(|\sin u| \le |u|\) for all \(u\) (for \(|u| < \frac\pi2\) by the picture, and for larger \(|u|\) because \(|\sin u| \le 1 < |u|\)). The sum-to-product formula gives

\[ |\sin x - \sin a| = 2\left|\cos\tfrac{x + a}2\right| \left|\sin\tfrac{x - a}2\right| \le 2 \cdot 1 \cdot \tfrac{|x - a|}2 = |x - a| . \]

So \(\delta = \varepsilon\) works at every \(a\). For cosine, \(|\cos x - \cos a| = 2\left|\sin \frac{x+a}2\right| \left|\sin\frac{x - a}2\right| \le |x - a|\) in the same way. \(\square\)

Then \(\tan x = \frac{\sin x}{\cos x}\) is continuous wherever \(\cos x \ne 0\).

Square roots are continuous on \([0, \infty)\). Proof. At \(a > 0\), the conjugate trick of Chapter 2.5 gives \(|\sqrt x - \sqrt a| = \frac{|x - a|}{\sqrt x + \sqrt a} \le \frac{|x - a|}{\sqrt a}\), so \(\delta = \varepsilon\sqrt a\) works. At \(a = 0\) (continuity from the right), \(|\sqrt x - 0| < \varepsilon\) whenever \(0 \le x < \varepsilon^2\), so \(\delta = \varepsilon^2\) works. \(\square\)

The absolute value \(|x|\) is continuous everywhere: \(\big||x| - |a|\big| \le |x - a|\) (the reverse triangle inequality), so \(\delta = \varepsilon\) works.

Section 3.4 will add compositions and inverses, and Chapter 5 adds exponentials and logarithms. By the end, every function you can write with a formula is continuous wherever the formula makes sense.

Kinds of discontinuity

When continuity at \(a\) fails, it fails in one of a few recognisable ways.

removable a jump a infinite a oscillating a
  1. Removable. \(\lim_{x \to a} f(x)\) exists, but \(f(a)\) is undefined or different. The graph has a hole, and redefining one value repairs it. Example: \(f(x) = \frac{x^2 - 4}{x - 2}\) at \(a = 2\); the limit is 4, so setting \(f(2) = 4\) makes \(f\) continuous (it becomes \(x + 2\)). Another: \(\frac{\sin x}{x}\) at 0, repaired by giving it the value 1 there. The repaired function is called the continuous extension.
  2. Jump. Both one-sided limits exist but differ. Examples: \(\operatorname{sgn}(x)\) at 0; the floor function \(\lfloor x \rfloor\) at every whole number. No redefinition at one point can repair a jump.
  3. Infinite. At least one one-sided limit is \(\pm\infty\). Example: \(\frac1x\) and \(\frac1{x^2}\) at 0, \(\tan x\) at \(\frac\pi2\). (Strictly, \(\frac1x\) is not defined at 0, so it is not "discontinuous at 0" in the narrow sense: 0 is just not in its domain. \(\frac1x\) is a continuous function on its domain. What is true is that no value at 0 could make it continuous there.)
  4. Oscillating (often called essential). At least one one-sided limit fails to exist without being infinite. Example: \(\sin\frac1x\) at 0.

Worked example. Classify the discontinuities of \(f(x) = \frac{x^2 - x}{x^2 - 1}\).

Solution. The denominator \(x^2 - 1 = (x - 1)(x + 1)\) is 0 at \(x = \pm1\), and the numerator is \(x(x - 1)\). For \(x \ne \pm 1\), \(f(x) = \frac{x}{x + 1}\). At \(x = 1\) the limit is \(\frac12\): removable. At \(x = -1\) the numerator of the simplified form tends to \(-1\) and the denominator to 0: infinite. Check: \(f(1.001) = \frac{1.001}{2.001} \approx 0.50025\).

Worked example. For which \(c\) is

\[ f(x) = \begin{cases} cx + 1, & x \le 2, \\ x^2, & x > 2 \end{cases} \]

continuous?

Solution. Each piece is a polynomial, so the only question is \(x = 2\). The left limit (and value) is \(2c + 1\); the right limit is \(4\). They agree when \(2c + 1 = 4\), so \(c = \frac32\).

Stranger examples

The pencil picture suggests that continuity is about whole intervals. It is not: it is about each single point, and that allows some strange things.

Dirichlet's function is \(D(x) = 1\) if \(x\) is rational and \(D(x) = 0\) if \(x\) is irrational. Every interval, however short, contains both rational and irrational numbers (Chapter 18 proves this from the properties of the real numbers). So near any point \(D\) takes both values 0 and 1, and \(\lim_{x \to a} D(x)\) never exists. \(D\) is continuous nowhere.

Now multiply by \(x\): \(g(x) = x\,D(x)\), which is \(x\) at rationals and 0 at irrationals. At \(a = 0\), \(|g(x) - g(0)| = |x D(x)| \le |x|\), so \(\delta = \varepsilon\) works: \(g\) is continuous at 0. At any \(a \ne 0\), nearby values include some near \(a\) (at rationals) and some equal to 0 (at irrationals), so there is no limit. \(g\) is continuous at exactly one point. Try drawing that without lifting your pencil.

Exercise 12 goes further: a function continuous at every irrational number and discontinuous at every rational one.

3.2 The intermediate value theorem

Return to the hill. Your height \(h(t)\) is a continuous function of time on \([8, 12]\), with \(h(8) = 0\) (the bottom) and \(h(12) = H\) (the top). The claim is that \(h(t) = \frac H2\) for some \(t\). The general theorem:

Intermediate value theorem (IVT). Let \(f\) be continuous on the closed interval \([a, b]\), and let \(N\) be any number between \(f(a)\) and \(f(b)\). Then there is at least one \(c\) in \([a, b]\) with \(f(c) = N\).

c c c a b f(a) f(b) N

The theorem says there is a \(c\); it does not say where, and there may be several. It is an existence theorem.

Why it needs a proof, and why the proof is postponed

The IVT feels obvious, which makes it worth asking what it depends on. Here is a warning. Work only with rational numbers (fractions), and let \(f(x) = x^2 - 2\) on \([0, 2]\). Then \(f(0) = -2 < 0\) and \(f(2) = 2 > 0\), and \(f\) is a perfectly good continuous function. But there is no rational \(c\) with \(c^2 = 2\) (because \(\sqrt2\) is irrational). The graph crosses the axis at a "gap" in the rationals. So the IVT is not a consequence of continuity alone: it also needs the fact that the real number line has no gaps. That property, called completeness, is the subject of Chapter 18, which proves the IVT in section 18.6.

The idea of the proof, for \(f(a) < N < f(b)\): look at the set of points \(x\) in \([a, b]\) where \(f(x) < N\). Let \(c\) be the "rightmost edge" of that set, its least upper bound. Completeness guarantees that such an edge exists as a real number. Continuity then forbids \(f(c) < N\) (points just to the right of \(c\) would also be below \(N\), so \(c\) would not be the edge) and forbids \(f(c) > N\) (points just to the left would also be above \(N\), so the edge would be further left). So \(f(c) = N\).

Using the IVT

The most common use: to show an equation has a solution, find a sign change. If \(f\) is continuous on \([a, b]\) and \(f(a)\), \(f(b)\) have opposite signs, then \(f(c) = 0\) for some \(c\) between them (take \(N = 0\)).

Worked example. Show that \(x^3 + x - 1 = 0\) has a solution between 0 and 1.

Solution. \(f(x) = x^3 + x - 1\) is a polynomial, so continuous. \(f(0) = -1 < 0\) and \(f(1) = 1 > 0\). By the IVT there is \(c \in (0, 1)\) with \(f(c) = 0\). Moreover there is only one solution: \(x^3 + x\) is strictly increasing (a sum of two increasing functions), so it takes the value 1 at most once.

Worked example (square roots exist). For any \(s > 0\) there is a positive number whose square is \(s\).

Solution. \(f(x) = x^2\) is continuous on \([0, s + 1]\), with \(f(0) = 0 < s\) and \(f(s + 1) = s^2 + 2s + 1 > s\). By the IVT, \(c^2 = s\) for some \(c\). This is where \(\sqrt2\) comes from: the real numbers have it because they are complete.

Worked example (odd-degree polynomials). Every polynomial of odd degree has at least one real root.

Solution. Divide by the leading coefficient, so \(p(x) = x^n + c_{n-1}x^{n-1} + \cdots + c_0\) with \(n\) odd. For \(x \ne 0\), \(p(x) = x^n\left(1 + \frac{c_{n-1}}x + \cdots + \frac{c_0}{x^n}\right)\). The bracket tends to 1 as \(x \to \pm\infty\), so for \(|x|\) large it is positive, and \(p(x)\) has the sign of \(x^n\), which (as \(n\) is odd) is the sign of \(x\). So \(p(-R) < 0 < p(R)\) for some large \(R\), and the IVT gives a root in \([-R, R]\). Even degree is different: \(x^2 + 1\) has no real root.

Worked example (a fixed point). If \(f\) is continuous on \([0, 1]\) and all its values lie in \([0, 1]\), then \(f(c) = c\) for some \(c\).

Solution. Let \(g(x) = f(x) - x\). Then \(g(0) = f(0) \ge 0\) and \(g(1) = f(1) - 1 \le 0\). If either is zero we are done; otherwise \(g\) changes sign and the IVT gives \(g(c) = 0\). Such a \(c\) is a fixed point of \(f\). This is the one-dimensional case of Brouwer's fixed point theorem, which says the same for continuous maps of a disc or ball to itself.

Worked example (the two hikers). You climb a mountain path from 8 a.m. to 4 p.m. one day, and come down the same path from 8 a.m. to 4 p.m. the next, at whatever varying speeds. Is there a point on the path that you pass at the same time of day on both days?

Solution. Let \(u(t)\) be your distance along the path at time \(t\) on day one, and \(d(t)\) on day two. Both are continuous on \([8, 16]\). Let \(g(t) = u(t) - d(t)\). At 8 a.m., \(u = 0\) and \(d\) is the full length \(\ell\), so \(g(8) = -\ell < 0\); at 4 p.m., \(g(16) = \ell - 0 > 0\). So \(g(t) = 0\) at some time \(t\): yes. (Picture two hikers on the same day, one going up and one coming down: they must meet.)

Bisection

The IVT says a root exists. Its idea also finds it. Suppose \(f\) is continuous and \(f(a)\), \(f(b)\) have opposite signs. Look at the midpoint \(m = \frac{a + b}2\). Either \(f(m) = 0\) (done), or \(f(m)\) has the opposite sign to one of \(f(a)\), \(f(b)\); keep the half where the sign changes. Repeat. This is the bisection method.

Each step halves the interval, and the root is always inside it. After \(n\) steps the interval has length \(\frac{b - a}{2^n}\), so its midpoint is within \(\frac{b - a}{2^{n+1}}\) of a root. That is a guaranteed error bound, which few methods can offer.

Worked example. Bisection for \(x^3 + x - 1\) on \([0, 1]\) (\(f(0) < 0 < f(1)\)):

step interval midpoint \(m\) \(f(m)\) keep
1 \([0, 1]\) 0.5 \(-0.375\) \([0.5, 1]\)
2 \([0.5, 1]\) 0.75 \(0.171875\) \([0.5, 0.75]\)
3 \([0.5, 0.75]\) 0.625 \(-0.130859\) \([0.625, 0.75]\)
4 \([0.625, 0.75]\) 0.6875 \(0.012451\) \([0.625, 0.6875]\)
5 \([0.625, 0.6875]\) 0.65625 \(-0.061127\) \([0.65625, 0.6875]\)
6 \([0.65625, 0.6875]\) 0.671875 \(-0.024830\) \([0.671875, 0.6875]\)
7 \([0.671875, 0.6875]\) 0.6796875 \(-0.006314\) \([0.6796875, 0.6875]\)
8 \([0.6796875, 0.6875]\) 0.68359375 \(0.003037\) \([0.6796875, 0.68359375]\)

After 8 steps the root lies in an interval of length \(\frac1{256} \approx 0.0039\). The true root is \(0.6823278\ldots\), and indeed it is inside. Check: \(0.6823278^3 + 0.6823278 - 1 \approx 0.0000000\).

How many steps for six decimal places on \([0, 1]\)? We need \(\frac1{2^n} < 10^{-6}\), that is \(2^n > 10^6\). Since \(2^{20} = 1\,048\,576\), twenty steps suffice. Each step gains one binary digit, a little under a third of a decimal digit. That is slow but completely reliable. Newton's method (Chapter 7) is much faster when it works, and bisection is the safety net when it does not.

Try it in Python.

def bisect(f, a, b, tol=1e-10):
    fa = f(a)
    while b - a > tol:
        m = (a + b) / 2
        fm = f(m)
        if fa * fm <= 0:
            b = m              # sign change in [a, m]
        else:
            a, fa = m, fm      # sign change in [m, b]
    return (a + b) / 2

print(bisect(lambda x: x**3 + x - 1, 0, 1))   # 0.6823278038...

History

Bernard Bolzano, a priest and mathematician in Prague, published in 1817 a paper whose title (translated) begins "Purely analytic proof of the theorem that between any two values which give results of opposite sign, there lies at least one real root of the equation". His point was exactly ours: the theorem had been accepted on geometric intuition, and he wanted a proof from the properties of numbers alone. Lacking a construction of the real numbers, he could not quite finish; the gap was filled when Dedekind, Cantor and others constructed the reals around 1872 (Chapter 18). Cauchy gave a proof by repeated subdivision, essentially bisection, in his Cours d'analyse (1821).

3.3 The extreme value theorem

Optimisation means finding the largest or smallest value of something: the largest area for a given fence, the shortest route, the cheapest design. Chapter 7 does this with derivatives. But there is a prior question: is there a largest value at all? The function \(f(x) = x\) on the open interval \((0, 1)\) takes values as close to 1 as you like, but never 1, so it has no largest value. Searching for its maximum would be a hunt for something that does not exist.

Extreme value theorem (EVT). If \(f\) is continuous on the closed interval \([a, b]\), then \(f\) attains a maximum and a minimum value there: there are points \(c\) and \(d\) in \([a, b]\) with

\(f(d) \le f(x) \le f(c)\) for all \(x\) in \([a, b]\).

The maximum value is \(f(c)\), attained at \(c\); similarly the minimum. Again this is an existence theorem: it does not say how to find \(c\) or \(d\).

Every hypothesis is needed

Break any one hypothesis and the conclusion can fail.

  • The interval must be closed. \(f(x) = x\) on \((0, 1)\): no maximum (values approach 1) and no minimum (values approach 0). Also \(f(x) = \frac1x\) on \((0, 1]\): unbounded above, so certainly no maximum.
  • The interval must be bounded. \(f(x) = x\) on \([0, \infty)\) has no maximum.
  • The function must be continuous. On \([0, 1]\) let \(f(x) = x\) for \(x < 1\) and \(f(1) = 0\). The values approach 1 but never reach it. One bad point is enough.

What the closed bounded interval provides is that you cannot "escape" through an endpoint that is missing or at infinity. Chapter 20 names the property: \([a, b]\) is compact.

Boundedness, then extremes

The proof (in Chapter 18, section 18.6) comes in two steps, and the first is a theorem in its own right.

Boundedness theorem. A continuous function on \([a, b]\) is bounded: there is a number \(K\) with \(|f(x)| \le K\) for all \(x\) in \([a, b]\).

The idea. If \(f\) were unbounded, then on one of the halves of \([a, b]\) it would still be unbounded; on one of the quarters inside that half, still unbounded; and so on. The nested intervals shrink to a single point \(p\) (by completeness). But \(f\) is continuous at \(p\), so \(f\) is bounded near \(p\) (Chapter 2.6's lemma), which contradicts unboundedness on the tiny intervals around \(p\). This is bisection again, used as a proof technique.

From boundedness to an attained maximum. The values \(f(x)\) have a least upper bound \(M\) (completeness again). If \(f\) never equalled \(M\), then \(\frac1{M - f(x)}\) would be continuous on \([a, b]\), hence bounded by the first step, but values of \(f\) come arbitrarily close to \(M\), which makes \(\frac1{M - f(x)}\) arbitrarily large. Contradiction, so \(f(c) = M\) for some \(c\).

Worked example. Explain why there is a point on the parabola \(y = x^2\), with \(0 \le x \le 2\), closest to the point \((3, 0)\).

Solution. The squared distance \(D(x) = (x - 3)^2 + x^4\) is a polynomial, hence continuous on the closed interval \([0, 2]\). By the EVT it attains a minimum. (Chapter 7 shows how to find it; here we only know it exists, which is the licence to go looking.) Restricting to a closed interval was the trick: on the whole parabola we would need a separate argument that far-away points are not closer.

Putting IVT and EVT together. If \(f\) is continuous on \([a, b]\) with minimum \(m\) and maximum \(M\), the IVT (applied between the points where \(m\) and \(M\) are attained) shows that \(f\) takes every value between \(m\) and \(M\). So the set of values of \(f\) on \([a, b]\) is exactly the closed interval \([m, M]\). A continuous function maps closed bounded intervals onto closed bounded intervals. This is a neat summary of both theorems.

3.4 Continuity of compositions and inverses

Level: advanced.

Compositions

Is \(\sqrt{1 + x^2}\) continuous? It is built by doing \(1 + x^2\) first, then taking the square root: it is a composition \(f(g(x))\), written \(f \circ g\), with \(g(x) = 1 + x^2\) and \(f(u) = \sqrt u\). Both pieces are continuous. The next theorem says that is enough. It is also the rule that lets you "move a limit inside a continuous function".

Theorem (limits through continuous functions). If \(\lim_{x \to a} g(x) = b\) and \(f\) is continuous at \(b\), then

\(\lim_{x \to a} f(g(x)) = f(b)\).

Proof. Let \(\varepsilon > 0\). Because \(f\) is continuous at \(b\), there is \(\eta > 0\) (eta, a second tolerance) such that \(|u - b| < \eta\) implies \(|f(u) - f(b)| < \varepsilon\). Now use the limit of \(g\) with the tolerance \(\eta\): there is \(\delta > 0\) such that \(0 < |x - a| < \delta\) implies \(|g(x) - b| < \eta\). Chain the two: for \(0 < |x - a| < \delta\), \(|g(x) - b| < \eta\), so \(|f(g(x)) - f(b)| < \varepsilon\). \(\square\)

The proof is a relay: \(f\) tells \(g\) how close it must get to \(b\), and \(g\) tells \(x\) how close it must get to \(a\).

Corollary. If \(g\) is continuous at \(a\) and \(f\) is continuous at \(g(a)\), then \(f \circ g\) is continuous at \(a\). (Take \(b = g(a)\).) \(\square\)

So \(\sqrt{1 + x^2}\), \(\sin(x^2)\), \(|\sin x|\), \(\cos(\sin x)\) and \(\frac{1}{1 + \sqrt{x^2 + 3}}\) are all continuous everywhere.

Worked example. \(\lim_{x \to 0} \sqrt{4 + \sin x} = \sqrt{4 + 0} = 2\), because \(4 + \sin x \to 4\) and the square root is continuous at 4.

Worked example. \(\lim_{x \to 0} \cos\left(\frac{\pi \sin x}{x}\right)\). The inside tends to \(\pi \cdot 1 = \pi\) (Chapter 2.4), and cosine is continuous, so the limit is \(\cos \pi = -1\).

Why \(f\) must be continuous, not merely have a limit. Let \(g(x) = 0\) for every \(x\), and let \(f(u) = 1\) for \(u \ne 0\) with \(f(0) = 0\). Then \(\lim_{x \to 0} g(x) = 0\) and \(\lim_{u \to 0} f(u) = 1\). But \(f(g(x)) = f(0) = 0\) for every \(x\), so \(\lim_{x \to 0} f(g(x)) = 0\), not 1. The inner function sat exactly on the bad point of \(f\). Continuity of \(f\) at \(b\) is precisely what rules this out.

Inverse functions

A function \(f\) is one-to-one (or injective) if different inputs give different outputs. Then it can be run backwards: the inverse function \(f^{-1}\) takes each output \(y\) back to the one input \(x\) with \(f(x) = y\). Its graph is the graph of \(f\) reflected in the line \(y = x\) (the algebra book's Chapter 6 explains why). Since reflecting a curve drawn without lifting the pencil gives another such curve, we expect: the inverse of a continuous one-to-one function is continuous. On an interval that is true, and the proof is a good example of how the IVT is used inside analysis.

A function is strictly increasing on an interval if \(x < y\) implies \(f(x) < f(y)\), strictly decreasing if it implies \(f(x) > f(y)\), and strictly monotone if it is one or the other. A strictly monotone function is clearly one-to-one. The first theorem says that for continuous functions on intervals, the converse holds.

Theorem A. If \(f\) is continuous and one-to-one on an interval \(I\), then \(f\) is strictly monotone on \(I\).

Proof. If \(I\) has fewer than two points there is nothing to prove. Otherwise fix two points \(a < b\) in \(I\); since \(f(a) \ne f(b)\), suppose \(f(a) < f(b)\) (the other case is the mirror image and gives "decreasing"). We show \(f\) is strictly increasing: take any \(x' < y'\) in \(I\); we must show \(f(x') < f(y')\).

Slide the pair \((a, b)\) continuously to the pair \((x', y')\): for \(s\) in \([0, 1]\) let

\[ x(s) = (1 - s)a + s x', \qquad y(s) = (1 - s)b + s y' . \]

Both are in \(I\) (an interval contains every point between two of its points), and \(x(s) < y(s)\) for every \(s\), because \((1 - s)(b - a) + s(y' - x') > 0\). Let \(h(s) = f(y(s)) - f(x(s))\). Then \(h\) is continuous on \([0, 1]\) (a difference of compositions of continuous functions), and \(h(s) \ne 0\) for every \(s\), since \(f\) is one-to-one and \(x(s) \ne y(s)\). Now \(h(0) = f(b) - f(a) > 0\). If \(h(1)\) were negative, the IVT would give some \(s\) with \(h(s) = 0\), which is impossible. So \(h(1) = f(y') - f(x') > 0\). \(\square\)

Theorem B. Let \(g\) be strictly increasing on an interval \(J\), and suppose its set of values \(g(J)\) is also an interval. Then \(g\) is continuous on \(J\).

Proof. Take \(y_0\) in \(J\) and let \(x_0 = g(y_0)\). Let \(\varepsilon > 0\); we may assume \(\varepsilon\) is small (a \(\delta\) that works for a small tolerance works for every larger one). Suppose first that \(x_0\) is not an endpoint of the interval \(g(J)\), and take \(\varepsilon\) so small that \(x_0 - \varepsilon\) and \(x_0 + \varepsilon\) both lie in \(g(J)\). Then there are points \(y_1, y_2\) in \(J\) with \(g(y_1) = x_0 - \varepsilon\) and \(g(y_2) = x_0 + \varepsilon\), and since \(g\) is increasing, \(y_1 < y_0 < y_2\). Let \(\delta = \min(y_0 - y_1, y_2 - y_0) > 0\). If \(y\) is in \(J\) and \(|y - y_0| < \delta\), then \(y_1 < y < y_2\), so \(x_0 - \varepsilon = g(y_1) < g(y) < g(y_2) = x_0 + \varepsilon\). That is continuity at \(y_0\). If \(x_0\) is the left endpoint of \(g(J)\), then \(y_0\) is the smallest point of \(J\), and only the right-hand half of the argument is needed (use \(y_2\)); similarly at the right endpoint. \(\square\)

The hypothesis that \(g(J)\) is an interval is what rules out jumps: a jump in an increasing function would leave a gap in its set of values.

Theorem (continuity of inverses). Let \(f\) be continuous and one-to-one on an interval \(I\). Then \(f(I)\) is an interval, and \(f^{-1}: f(I) \to I\) is continuous.

Proof. By Theorem A, \(f\) is strictly monotone; say increasing (otherwise use \(-f\)). By the IVT, \(f(I)\) contains every number between any two of its values, so it is an interval. The inverse \(f^{-1}\) is strictly increasing too (if \(u < v\) but \(f^{-1}(u) \ge f^{-1}(v)\), applying the increasing \(f\) would give \(u \ge v\)). Its set of values is \(I\), an interval. Theorem B, applied to \(g = f^{-1}\) on \(J = f(I)\), says \(f^{-1}\) is continuous. \(\square\)

Worked examples.

  • \(n\)th roots. For a whole number \(n \ge 1\), \(f(x) = x^n\) is continuous and strictly increasing on \([0, \infty)\), and its set of values is \([0, \infty)\) (by the IVT and \(x^n \ge x\) for \(x \ge 1\)). So the inverse \(\sqrt[n]x\) exists and is continuous on \([0, \infty)\). For odd \(n\), the same works on the whole line.
  • Arcsine. \(\sin x\) is continuous and strictly increasing on \(\left[-\frac\pi2, \frac\pi2\right]\), with values \([-1, 1]\). Its inverse \(\arcsin: [-1, 1] \to \left[-\frac\pi2, \frac\pi2\right]\) is continuous. Similarly \(\arccos\) on \([-1, 1]\) and \(\arctan\) on the whole line (inverting \(\tan\) on \(\left(-\frac\pi2, \frac\pi2\right)\)).
  • Logarithms (preview). Chapter 5 defines \(e^x\), shows it is continuous and strictly increasing with values \((0, \infty)\), and gets the continuity of \(\ln x\) from this theorem with no extra work.

The interval matters. On a domain with a gap, a continuous one-to-one function can have a discontinuous inverse: let \(f(x) = x\) on \([0, 1)\) and \(f(x) = x - 1\) on \([2, 3]\). It is continuous and one-to-one, with values \([0, 2]\). Its inverse jumps from near 1 to 2 at \(y = 1\).

Check yourself

1. Where is \(f(x) = \dfrac{x^2 - 4}{x - 2}\) discontinuous, of what kind, and how can it be repaired?

Only at \(x = 2\), where it is undefined. For \(x \ne 2\), \(f(x) = x + 2\), so \(\lim_{x \to 2} f(x) = 4\): a removable discontinuity. Defining \(f(2) = 4\) gives the continuous function \(x + 2\).

2. Find \(k\) so that \(f(x) = kx^2\) for \(x \le 1\) and \(f(x) = 3 - x\) for \(x > 1\) is continuous.

At \(x = 1\) the left value is \(k\) and the right limit is \(2\). So \(k = 2\). Every other point is fine because each piece is a polynomial.

3. Classify the discontinuities of \(\frac1{x^2 - 1}\), \(\lfloor x \rfloor\) and \(x \sin\frac1x\).

\(\frac1{x^2 - 1}\): infinite at \(x = \pm1\) (vertical asymptotes). \(\lfloor x \rfloor\): a jump of size 1 at every whole number, continuous elsewhere. \(x \sin\frac1x\): undefined at 0, but \(|x\sin\frac1x| \le |x| \to 0\), so the limit is 0 and the discontinuity is removable (define the value 0). Unlike \(\sin\frac1x\), the oscillation is damped.

4. Show that \(x^5 - x - 1 = 0\) has a root in \([1, 2]\), and do three steps of bisection.

\(f(1) = -1 < 0\), \(f(2) = 32 - 3 = 29 > 0\), and \(f\) is continuous, so there is a root. \(f(1.5) \approx 5.09 > 0\), keep \([1, 1.5]\); \(f(1.25) \approx 0.80 > 0\), keep \([1, 1.25]\); \(f(1.125) \approx -0.323 < 0\), keep \([1.125, 1.25]\). The root (\(1.16730\ldots\)) is in the final interval.

5. Show that \(\cos x = x\) has a solution, and say roughly where.

Let \(g(x) = \cos x - x\), continuous. \(g(0) = 1 > 0\) and \(g(\frac\pi2) = -\frac\pi2 < 0\), so a solution lies in \((0, \frac\pi2)\). Further: \(g(0.7) \approx 0.065 > 0\) and \(g(0.8) \approx -0.103 < 0\), so it is in \((0.7, 0.8)\). (It is \(0.739085\ldots\), and it is unique since \(g\) is strictly decreasing there.)

6. How many bisection steps on an interval of length 3 guarantee that the midpoint is within \(10^{-4}\) of a root?

After \(n\) steps the midpoint is within \(\frac{3}{2^{n+1}}\) of a root. We need \(2^{n+1} > 30\,000\). Since \(2^{14} = 16\,384\) and \(2^{15} = 32\,768\), \(n + 1 = 15\), so \(n = 14\) steps.

7. For each of these, say whether a maximum is guaranteed, and why: \(x^2\) on \([-1, 2]\); \(x^2\) on \((-1, 2)\); \(\frac1x\) on \([1, 5]\); \(\tan x\) on \([0, \frac\pi2)\).

\(x^2\) on \([-1, 2]\): yes, by the EVT (max 4 at \(x = 2\)). \(x^2\) on \((-1, 2)\): not guaranteed, and in fact none: values approach 4 but \(x = 2\) is excluded. \(\frac1x\) on \([1, 5]\): yes, continuous on a closed bounded interval (max 1 at \(x = 1\)). \(\tan x\) on \([0, \frac\pi2)\): no, it is unbounded as \(x \to \frac\pi2^-\).

8. A continuous function \(f\) on \([0, 1]\) has \(f(0) = f(1)\). Show there is \(c\) in \([0, \tfrac12]\) with \(f(c) = f(c + \tfrac12)\).

Let \(g(x) = f(x + \tfrac12) - f(x)\) on \([0, \tfrac12]\), continuous. Then \(g(0) + g(\tfrac12) = f(\tfrac12) - f(0) + f(1) - f(\tfrac12) = f(1) - f(0) = 0\). So \(g(0)\) and \(g(\tfrac12)\) are opposite in sign or both zero; either way the IVT (or the zero itself) gives \(c\) with \(g(c) = 0\). (A walker who ends where she started has two moments half her walk apart at the same height.)

9. Let \(T(\theta)\) be the temperature at longitude \(\theta\) on a planet's equator (Earth, or Mars), a continuous function with \(T(\theta + 2\pi) = T(\theta)\). Show that two opposite points of the equator have the same temperature.

Let \(g(\theta) = T(\theta) - T(\theta + \pi)\). Then \(g(\theta + \pi) = T(\theta + \pi) - T(\theta + 2\pi) = -g(\theta)\). So \(g(0)\) and \(g(\pi)\) are negatives of each other: one is \(\ge 0\) and the other \(\le 0\). By the IVT on \([0, \pi]\), \(g(c) = 0\) for some \(c\), meaning \(T(c) = T(c + \pi)\). (This is the one-dimensional case of the Borsuk-Ulam theorem.)

10. Using the composition theorem, find \(\lim_{x \to 1} \sin\left(\dfrac{\pi(x^2 - 1)}{2(x - 1)}\right)\).

The inside is \(\frac{\pi(x + 1)}{2}\) for \(x \ne 1\), which tends to \(\pi\). Sine is continuous at \(\pi\), so the limit is \(\sin \pi = 0\).

11. Explain why \(f(x) = x^3 + x\) has a continuous inverse on the whole real line, and find \(f^{-1}(2)\) and \(f^{-1}(10)\).

\(f\) is continuous and strictly increasing (sum of two increasing functions), so one-to-one. Its values go to \(\pm\infty\) as \(x \to \pm\infty\), so by the IVT its set of values is all of \(\mathbb R\). By the theorem on inverses, \(f^{-1}\) is continuous on \(\mathbb R\). \(f(1) = 2\) and \(f(2) = 10\), so \(f^{-1}(2) = 1\) and \(f^{-1}(10) = 2\).

12. Thomae's function: \(t(x) = \frac1q\) if \(x = \frac pq\) in lowest terms with \(q \ge 1\), and \(t(x) = 0\) if \(x\) is irrational. Show \(t\) is continuous at every irrational and discontinuous at every rational.

At a rational \(a = \frac pq\), \(t(a) = \frac1q > 0\), but every interval around \(a\) contains irrationals, where \(t = 0\). So with \(\varepsilon = \frac1q\) no \(\delta\) works: discontinuous. At an irrational \(a\), \(t(a) = 0\). Let \(\varepsilon > 0\) and pick a whole number \(Q\) with \(\frac1Q < \varepsilon\). In the interval \((a - 1, a + 1)\) there are only finitely many fractions \(\frac pq\) with \(q \le Q\) (for each \(q\), at most \(2q + 1\) of them). None equals \(a\), so one of them is closest to \(a\); let \(\delta\) be its distance from \(a\) (or \(\delta = 1\) if there are none). For \(|x - a| < \delta\), \(x\) is either irrational (\(t(x) = 0\)) or a fraction with denominator \(q > Q\) (\(t(x) = \frac1q < \frac1Q < \varepsilon\)). So \(|t(x) - 0| < \varepsilon\): continuous.

What you learned

  • \(f\) is continuous at \(a\) when \(\lim_{x \to a} f(x) = f(a)\): small changes of input give small changes of output.
  • Polynomials, rational functions (on their domains), roots, \(|x|\), sine and cosine are continuous, and sums, products, quotients, compositions and inverses of continuous functions are continuous where defined.
  • Discontinuities are removable, jumps, infinite or oscillating; continuity is a property of each point, and can hold at a single point only.
  • The intermediate value theorem: a continuous function on \([a, b]\) takes every value between \(f(a)\) and \(f(b)\). It depends on the completeness of the real numbers and powers the bisection method, whose error after \(n\) steps is at most \(\frac{b - a}{2^{n+1}}\).
  • The extreme value theorem: a continuous function on a closed bounded interval attains a maximum and a minimum; drop any hypothesis and it can fail.
  • A continuous one-to-one function on an interval is strictly monotone, and its inverse is continuous.

Next: Chapter 4 defines the derivative as the limit of slopes, proves that differentiable functions are continuous, and derives the sum, product, quotient and power rules.

Further reading