Bisection: trapping a root
The question
Choose the interval to keep, then inspect what your choice guarantees.
- 1 SeeChoose which half to keep.
- 2 TryDecide when to stop.
- 3 ProveProve the midpoint error bound.
- 4 ApplySolve five root-finding problems.
Before you start · 3 quick checks on signs, midpoints, and continuity
Two ideas before you start
2 ideasA bracket records two signs
A line crosses the horizontal axis. Choose an interval to inspect its endpoint signs.
For a continuous function, opposite endpoint signs certify a root inside. The bracket stores a location guarantee, not an exact answer.
Exact definition
A root is an input \(r\) with \(f(r)=0\). A strict sign bracket is a closed interval \([a,b]\), with \(a\lt b\), on which \(f\) is continuous and \(f(a)\) and \(f(b)\) have opposite signs. Equivalently, their product is negative.
The intermediate value theorem guarantees at least one root inside. It does not guarantee a unique root or tell us which root a later search will retain. An endpoint with value zero is already a root and should be reported before starting a strict-bracket search.
Separate the input from the output
An input marker on the horizontal axis and its height on a parabola.
The input locates the marker along the axis. The function value is its height; its sign tells which side of the horizontal axis it occupies.
Exact definition
For an estimate \(x\), the residual is the output \(f(x)\). Its magnitude is \(|f(x)|\). The input error relative to a particular root \(r\) is \(|x-r|\). Keep their units separate: a time input might produce a temperature residual. Bisection evaluates outputs to make decisions about an interval of inputs.
Refresher: the facts used on this page
Numbers with opposite signs have a negative product. The midpoint of \([a,b]\) is \(m=(a+b)/2\). Its distance to either endpoint is half the interval length. Continuity means nearby inputs give outputs near the value at the point, with no missing value or jump there.
For a continuous function on a closed interval, every height between its endpoint values is attained. We use that result here; the linked intermediate value lesson proves it. A geometric sequence with a fixed ratio strictly between zero and one tends to zero, as in convergent sequences. Those facts apply to exact real numbers. Computed signs require separate care.
Keep a root inside
- Read the function values at the two endpoints and at the midpoint.
- Choose the half whose endpoints have opposite signs, or report an exact midpoint root.
- A correct choice unlocks the next step. A wrong choice leaves the current bracket available for another attempt.
| n | a | b | Width | Bound |
|---|
What is being checked?
The choice is checked from signs, without a stored decimal approximation to the root. When the midpoint is not a root, exactly one half has opposite endpoint signs. The other half might contain roots for a general continuous function, but its endpoint signs alone do not certify them.
Every accepted half becomes the next closed interval. The history records those decisions. A wrong click adds no row and consumes no halving. The activities use polynomials and dyadic inputs, evaluated with exact rational arithmetic. The picture uses decimal coordinates only for drawing.
After each round, compare the initial row with the last one. The two ordinary rounds reverse which endpoint has the negative sign. The final round tests the stopping branch: if the midpoint is an exact root, return it immediately. That event is recorded as a root discovery, not as a fictitious interval of half the old length.
Decide when to stop
A function evaluation and a location estimate answer different questions. Make a prediction before opening the stopping-rule explorer.
Use what you found above: budget the halvings
The explorer uses only the initial width and an input tolerance. Assume continuity, a valid initial sign bracket, exact arithmetic, and no exact root found early. Choose the smallest count that guarantees the requested midpoint accuracy. A larger count can also be accurate, but the goal asks you to avoid unnecessary evaluations.
Let \(W_0=b_0-a_0\) be the initial width. After \(n\) completed halvings, the retained interval has width \(W_n=W_0/2^n\). Report its midpoint \(m_n\). For a root \(r\) in that interval,
\[|m_n-r|\le\frac{W_0}{2^{n+1}}.\]The extra factor of two comes from reporting the center of the final interval. It is already present when no halving has been completed. To guarantee error at most \(\varepsilon\gt0\), use the smallest nonnegative integer satisfying this bound. Test equality carefully: “at most” accepts equality.
When a computer cannot take another step
The proof assumes exact function values. In floating-point arithmetic, a tiny nonzero value can round to zero, or cancellation can make its sign unreliable. A computed zero is therefore not automatically a certified mathematical root. If signs are uncertain, use more precision or an evaluation method that encloses the true value.
Compare signs directly rather than multiplying endpoint values: the product can overflow or underflow even when both values are usable. For finite same-sign endpoints, computing the midpoint as \(a+(b-a)/2\) avoids overflowing their sum. For finite endpoints of opposite signs, \((a+b)/2\) avoids overflowing their difference. These choices reduce overflow risk; they do not remove rounding.
If the rounded midpoint equals an endpoint, the interval cannot shrink by that update in the current format. Stop with a precision-limit status and the remaining bracket, or raise precision. Do not report that the requested tolerance was reached unless the bound actually meets it. An iteration cap is another stopping status, not a proof of accuracy.
Why the bracket is a certificate
Assume \(a_0\lt b_0\), a real-valued function continuous on \([a_0,b_0]\), and strictly opposite endpoint signs. Use exact arithmetic and exact sign evaluations. Stop if a tested midpoint is a root; otherwise retain the half with opposite endpoint signs.
Every retained interval contains a root. After \(n\ge0\) completed halvings its width is \(W_0/2^n\), and its midpoint has error at most \(W_0/2^{n+1}\) relative to any root still inside. If no midpoint ever hits a root, the nested intervals shrink to a single point \(c\), which is a root, and their midpoints converge to \(c\).
The single limiting point belongs to this run of the algorithm. It does not imply that the original function has only one root. The proof below treats the branch with no exact midpoint hit, so every retained width is positive.
Build the argument one line at a time. The width calculation uses a whole number \(n\ge1\); the initial case follows directly from the definition of \(W_0\).
Refresher: why there is one common point
The left endpoints form a nondecreasing sequence bounded above by the original right endpoint. Completeness of the real numbers gives their supremum \(c\). Every right endpoint bounds all left endpoints above, while each left endpoint is at most \(c\). Hence \(a_n\le c\le b_n\) for every retained interval.
The lengths tend to zero. Both endpoint distances from \(c\), and the midpoint distance, are bounded by the length, so all three sequences converge to \(c\). Any other common point would have a positive distance from \(c\), exceeding some later interval length. Continuity carries both endpoint sequences to the same output \(f(c)\). Their opposite signs force that output to be zero.
Use a bracket with a purpose
Each problem has hints and a worked solution. A completed halving means an interval update, and the reported estimate is the midpoint of the interval left after those updates. Exact answers accept decimals or fractions. The cooling model separates numerical error from physical model error.
Related: the intermediate value theorem proves existence, convergent sequences explains the limit, and floating point explains finite precision.
Further reading
- Richard L. Burden and J. Douglas Faires, Numerical Analysis, chapter 2, Solutions of Equations in One Variable.