Continuity and the Intermediate Value Theorem
Learning Objectives
- State the three conditions that make a function continuous at a point, and use them to decide whether a given function is continuous there.
- Classify a discontinuity as removable, jump, infinite, or oscillating, and say which kind can be repaired by redefining a single value.
- Build continuous functions from known continuous pieces, and choose a parameter so that a piecewise function is continuous.
- State the Intermediate Value Theorem with all of its hypotheses, and show by example what goes wrong when each one is dropped.
- Explain why the theorem is the existence guarantee behind bisection search, and recognize inputs where a sign change does not guarantee a root.
Context & Motivation
The lesson guess-and-check-and-bisection-search solves equations that have no formula by halving an interval: keep a low and a high, test the midpoint, discard the half that cannot contain the answer. Its square-root loop works, and the lesson explains why it is fast. What it leaves open is a prior question: why is there an answer inside [low, high] at all? A program can halve an interval forever without ever being told that the thing it is hunting exists.
Calculus answers that question with the Intermediate Value Theorem. Roughly, a function whose graph has no breaks cannot go from negative to positive without passing through zero. The word "roughly" hides the whole difficulty, because "no breaks" has to become a precise, checkable property of . That property is continuity, and it is the first place in this discipline where a limit is used to define a property of a function rather than to compute a number.
Continuity also matters beyond bisection. Nearly every theorem about derivatives and integrals in the lessons ahead begins with the words "suppose is continuous on ", and the failures are instructive: a discontinuity is where numerical methods, optimizers and simulations tend to misbehave, because a small change in the input produces a large change in the output.
Core Theory
Continuity at a point
A function is continuous at when all three of the following hold:
- is defined.
- exists.
- .
In words: the value the function approaches (limits-intuition-and-the-formal-definition) is the value it actually takes. Equivalent form: as , so a tiny change in the input produces a tiny change in the output.
A function is continuous on an interval if it is continuous at every point of it. At the endpoints of a closed interval only the one-sided limit from inside the interval is required.
Continuity is built up from pieces. Polynomials, , and are continuous at every real number. Sums, differences, products and compositions of continuous functions are continuous, and a quotient is continuous wherever . These facts are the limit laws (limit-laws-and-indeterminate-forms) restated, which is why most continuity checks reduce to looking for a place where a denominator vanishes or a formula changes.
Kinds of discontinuity
When one of the three conditions fails, the way it fails has a name:
- Removable: at . The limit is , but is undefined.
- Jump: at . The one-sided limits are and , so the limit does not exist.
- Infinite: at . The function is unbounded near .
- Oscillating: at . The values keep swinging between and .
Only the removable kind can be repaired, by assigning the value of the limit. Defining turns into the continuous function .
A point where is not defined is a point where is not continuous, but that does not make a "broken" function: it is continuous at every point of its domain, which simply has a gap at . This distinction returns in the theorem below.
The Intermediate Value Theorem
Theorem. Let be continuous on the closed interval , and let be any number strictly between and . Then there is at least one in with .
The most used special case is : if is continuous on and and have opposite signs, then has a root in .
Each hypothesis earns its place, and the fastest way to see it is to remove it.
- Drop continuity. Let for and for , on . The endpoint values are and , yet never equals , or any other number in between.
- Drop the interval. has and , and is continuous at every point where it is defined, yet it has no root. The interval is not inside the domain, because is missing.
- Reverse the implication. The theorem does not say that a root forces a sign change. has a root at on although .
- Change the number system. The theorem relies on the real numbers having no gaps. On the rationals, is continuous, and , and there is still no rational root.
The conclusion is also weak in two ways worth stating. It says "at least one", not exactly one: has three roots on . And it says nothing about where is. It is a statement of existence, and finding is a separate job.
From the theorem to bisection
Suppose is continuous on and , have opposite signs. Let . If the search is over. Otherwise has the sign of exactly one endpoint, so one of the halves and again has endpoints of opposite signs. The theorem, applied to that half, guarantees a root inside it. Repeating the step gives intervals of width after steps, each containing a root.
This is the loop of guess-and-check-and-bisection-search. Its square-root search for is bisection on over . At the left end , at the right end (for it is ; for it is ). The test guess ** 2 < x is the sign of . A polynomial is continuous, so the theorem is what makes the invariant "a root is between low and high" true at every step. That lesson states the precondition as an ordered space where each check reveals a direction. The theorem gives a weaker and more general one: a sign change on an interval where is continuous, with no need for to be monotone.
Worked Examples
Example 1: choosing a parameter for continuity
Find so that
is continuous everywhere.
Each piece is a polynomial, hence continuous on its own region, so the only risk is at . The left piece gives , which is also the limit from the left. The limit from the right is . Condition 3 asks for , so .
Check with : both sides give , so the limit exists and equals . With any other the one-sided limits differ and has a jump at .
Example 2: solving by bisection
Let on . It is continuous (a difference of continuous functions), and . The theorem guarantees a root in . Bisection, keeping the half whose endpoints still have opposite signs:
textstep a b m f(m) keep 1 0.000000 1.000000 0.500000 +0.377583 right 2 0.500000 1.000000 0.750000 -0.018311 left 3 0.500000 0.750000 0.625000 +0.185963 right 4 0.625000 0.750000 0.687500 +0.085335 right 5 0.687500 0.750000 0.718750 +0.033879 right 6 0.718750 0.750000 0.734375 +0.007875 right 7 0.734375 0.750000 0.742188 -0.005196 left 8 0.734375 0.742188 0.738281 +0.001345 right
After eight steps the root lies in , an interval of width . The true root is , inside it, as the theorem requires. To pin the root down to width starting from width takes the smallest with , which is .
This function has no closed-form solution, which is exactly the situation in which the theorem and the algorithm earn their keep.
Example 3: a sign change that does not contain a root
Take on . The endpoint values are and , opposite signs, so the bisection loop starts without complaint. The midpoint sequence squeezes toward :
textstep interval after the step f(m) 1 [-1.0, 0.5] +2 5 [-0.0625, 0.03125] +32 10 [-0.00098, 0.00195] -1024 20 [-9.5e-07, 1.9e-06] -1048576
The interval shrinks as promised, but doubles at every step instead of shrinking. The loop is converging to the discontinuity, not to a root. A practical guard is to check, at the end, that at the final point is actually small. A sign change tells you a root exists only when the continuity hypothesis has been checked separately.
Common Misconceptions & Pitfalls
- "Continuous means you can draw the graph without lifting the pen." That picture is fair for a function on an interval, and it is how the theorem is usually remembered. It misleads on domains with gaps: is continuous at every point where it is defined, even though its graph comes in two pieces.
- "The theorem finds the root, or says it is unique." It only asserts that at least one exists in the open interval. Where, and how many, are separate questions. Bisection on over converges to and ignores the roots at and .
- "If there is no sign change, there is no root." on touches zero without changing sign, so bisection started there has nothing to work with. The theorem gives a sufficient condition, not a necessary one.
- "Any bracket with opposite signs makes bisection safe." Example 3 is the counter-example. Continuity on the whole bracket is part of the hypothesis, and bisection cannot check it.
- "On a computer, bisection halves forever." Real numbers can be halved indefinitely; doubles cannot. Applied to on in double precision, a loop with no zero test halves the interval 53 times before the midpoint equals an endpoint, leaving a width of about . With the zero test of the algorithm above, the run stops one step earlier, at step 52, where
cos(m) - mevaluates to exactly0.0, which is a rounding coincidence and not a proof that is the exact root. A loop that stops when the midpoint repeats an endpoint always ends. A loop that stops on interval width ends only if the tolerance is no smaller than the spacing of doubles near the root, about here, sowhile b - a > 1e-20never exits. A loop that demands below a very small tolerance may never get there, as the bisection lesson warns.
Summary
A function is continuous at when is defined, the limit at exists, and the two agree. Failures come in four kinds: removable, jump, infinite and oscillating, and only the first can be repaired by redefining one value. The Intermediate Value Theorem says that if is continuous on then takes every value between and at some point of the interval; with opposite signs at the ends it guarantees a root. Each hypothesis is needed: dropping continuity, using an interval with a gap, or leaving the real numbers breaks the conclusion, and the converse is false. Bisection is the theorem turned into an algorithm: each step keeps the half with a sign change, so the root stays trapped while the width falls like . The theorem guarantees existence, not uniqueness or location, and bisection cannot detect a discontinuity on its own. The next lesson, the-derivative-as-a-rate-of-change, uses the same limit machinery to ask how fast changes at a point.