Limits of functions and continuity
P85.limits-continuity.01 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: The real line: sequences, limits and completeness
Where next?
This module unlocks
P85.limits-continuity.01 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: The real line: sequences, limits and completeness
This module unlocks
A sequence has a limit when its terms settle on one number. The goal of this lesson is to ask the same question of a function: as its input closes in on a point, does its output settle? The answer gives the limit of a function, then continuity, the property of a curve you can draw without lifting the pen, and finally a theorem with a promise in it: a continuous curve that starts below zero and ends above it must cross zero somewhere. You need the real-line lesson's real numbers and their completeness, the limit of a sequence, bisection and nested intervals. An input where a function's output is 0 is a root of the function.
A function is a rule that gives one output for each input. We write f(x) for the output of the function f at the input x: if f(x) = x² + 1, then f(3) = 10. The inputs a function accepts are its domain; f(x) = 1/x, for example, accepts every real number except 0.
Now take a function that has a hole in it:
f(x) = (x² − 1) ÷ (x − 1)
At x = 1 the bottom is 0, so f(1) does not exist. Near 1, though, the function behaves perfectly well:
| x | 0.9 | 0.99 | 0.999 | 1.001 | 1.01 | 1.1 |
|---|---|---|---|---|---|---|
| f(x) | 1.9 | 1.99 | 1.999 | 2.001 | 2.01 | 2.1 |
From both sides the outputs close in on 2. The reason is short: x² − 1 is (x − 1)(x + 1), so for every x other than 1 the fraction cancels to x + 1. The function is the straight line y = x + 1 with a single point missing, and the missing point is where the line would be at height 2.
The real-line lesson made "closes in" precise for sequences. A function's limit borrows that definition:
The limit of f(x) as x tends to a is L when, for every sequence of inputs x₁, x₂, x₃, … that converges to a (with no term equal to a), the outputs f(x₁), f(x₂), f(x₃), … converge to L.
This is the limit of a function, written lim f(x) = L as x → a (read "as x tends to a"). The input is never allowed to be a, only to close in on it: the limit describes the approach, not the arrival. That is why the function above, which has no value at 1, still has a limit there, 2.
"Every sequence" is the demanding part. A limit has to be the same whichever way the inputs come in, from the left, from the right, or hopping from side to side.
Books often state the limit of a function without sequences, with two tolerances: for every tolerance ε > 0 on the output there is a closeness δ > 0 on the input (δ is the Greek letter delta) such that f(x) is within ε of L whenever x is within δ of a and x ≠ a. The two definitions are equivalent: each one holds exactly when the other does (stated here without proof). The sequence form is used here because it reuses what the real-line lesson proved about sequences.
Think of a light switch. Let H(x) be 0 for every x below 0 and 1 for x = 0 and above, a single step up. Close in on 0 with the inputs −0.1, −0.01, −0.001, … and the outputs are 0, 0, 0, …; close in with 0.1, 0.01, 0.001, … and they are 1, 1, 1, … . Two sequences of inputs that both converge to 0 give outputs with two different limits, so H has no limit at 0. It has a value there, H(0) = 1, but no limit.
A function f is a continuous function at a point a when three things hold at once:
In words, the output at a is exactly what the nearby outputs are heading for. A function continuous at every point of an interval is continuous on that interval, and its graph over the interval is one unbroken curve. A point where one of the three fails is a discontinuity:
Continuity also passes from simple functions to the ones built from them. The sum, difference and product of continuous functions are continuous, and so is a quotient wherever its bottom is not 0. The reason is that limits of sequences add and multiply: if aₙ → A and bₙ → B, then aₙ + bₙ → A + B and aₙbₙ → AB (stated here without proof; it follows from the definition with tolerances).
Here is the promise. Suppose f is continuous on the interval [a, b], f(a) is below 0 and f(b) is above 0. Then there is a number c between a and b with f(c) = 0: c is a root of f. This is the intermediate value theorem: a continuous curve that starts below the axis and ends above it has to cross the axis somewhere. (The same holds with the signs swapped, and for any target value between f(a) and f(b), not only 0.)
It sounds obvious, and that is the danger. It is false for the step H − 1/2, which is −1/2 at −1 and 1/2 at 1 and never 0: H jumps across. And it is false inside ℚ: the function x² − 2 is −1 at 1 and 2 at 2, and no fraction between them makes it 0, since √2 is not a fraction. So the proof has to use both continuity and completeness. It uses bisection.
Call a₀ = a and b₀ = b. Then f(a₀) is below 0 and f(b₀) is above 0: the interval [a₀, b₀] holds a sign change.
Step 4 is where ℚ fails, and step 5 is where the step function fails. Take either ingredient away and the theorem breaks, which is exactly what the two counterexamples showed.
The proof is also a recipe. The cubic f(x) = x³ − x − 1 is −1 at 1 and 5 at 2, so the theorem promises a root between them, and bisection closes in on it:
def f(x):
return x * x * x - x - 1
lo, hi = 1.0, 2.0
while hi - lo > 1e-6:
m = lo + (hi - lo) / 2
if f(m) < 0:
lo = m
else:
hi = m
print(lo, hi) # 1.3247175216674805 1.3247184753417969
Twenty halvings shrink the width from 1 to under a millionth, since 2²⁰ is more than a million. The computer finds where the root is; the theorem is what says there is one to find. Run bisection on the step H − 1/2 over [−1, 1] and it closes in just as confidently on 0, where there is a jump and no root at all. That is why the rungs ask you to justify a root before you hunt for it.
Physics leans on continuity every time it says that a body moving from one place to another passed through every place in between, and on the intermediate value theorem every time it solves an equation by closing in on a crossing.
Loading the exercise...
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Two rungs in your browser, in a little Python (Beginner Python teaches it): a bisection root-finder that refuses to search without a sign change, then the cases where the intermediate value theorem does and does not promise a root.
Loading exercise…
Loading exercise…
Loading your notes...