What bisection does and why it always works
The bisection method finds a root of f(x) = 0 by repeatedly halving an interval known to contain one. You start with a bracket [a, b] on which f changes sign, evaluate f at the midpoint, and discard whichever half does not contain the sign change. The bracket halves, and you repeat.
Its guarantee comes from the Intermediate Value Theorem: a continuous function that is negative at one end of an interval and positive at the other must be zero somewhere between. Since each step preserves the sign change, the bracket always contains a root, and its width falls to zero geometrically. This is the only elementary root-finder that cannot fail — no divergence, no oscillation, no dependence on a good starting guess, and no derivative required.
The price is speed. Each iteration buys exactly one bit of the answer, so reaching double-precision accuracy from a bracket of width 1 takes about 50 iterations, where Newton's method would take five. In exchange you get something Newton cannot offer: a hard error bound, known in advance, that holds no matter how badly behaved the function is between the sample points.
In practice bisection is used as a safety net rather than as a primary method. Production root-finders such as Brent's method attempt a fast interpolation step and fall back to bisection whenever that step would leave the bracket. You get near-Newton speed with the bisection guarantee, which is the best of both.
The algorithm, and predicting its cost
One iteration is three lines. Compute c = (a + b)/2. Evaluate f(c). If f(a) and f(c) have opposite signs, the root is in the left half, so set b = c; otherwise it is in the right half, so set a = c and remember f(c) as the new f(a). Note what is not in that description: the size of f(c) plays no part. Only its sign matters, which is why bisection is indifferent to how steep or flat the function is.
After n iterations the bracket has width (b₀ − a₀)/2ⁿ, and the midpoint is within half of that of the true root. Setting the width below a tolerance and solving gives n ≥ log₂((b₀ − a₀)/tol). This calculator computes that number before running, so you can see the cost in advance — and confirm it against the iteration count afterwards. For a bracket of width 1 and a tolerance of 10⁻⁶, log₂(10⁶) = 19.93, so 20 iterations, every time, for every function.
Convergence is linear with ratio exactly 1/2: the error is halved each step, never better and never worse. Newton's method is quadratic, doubling the number of correct digits per step when it converges at all, and the secant method has order about 1.618. Bisection's constant, guaranteed factor of two is its whole character.
Two implementation details matter. The midpoint is computed as (a + b)/2, which is safe here because the bracket lies well inside the double range; in general a + (b − a)/2 is preferred to avoid overflow. And the sign test uses f(a)·f(c) < 0 rather than comparing signs after rounding, which keeps the test exact even when the values are very small.
Worked example: x³ − x − 2 = 0 on [1, 2]
This cubic is the default. Its root is 1.5213797068…, obtainable in closed form by Cardano's formula, so every digit can be checked.
- Verify the bracket. f(1) = 1 − 1 − 2 = −2 and f(2) = 8 − 2 − 2 = 4. Opposite signs, so a root lies in (1, 2).
- Iteration 1. c = 1.5, f(1.5) = 3.375 − 1.5 − 2 = −0.125. Negative, the same sign as f(1), so the root is to the right: the bracket becomes [1.5, 2], width 0.5.
- Iteration 2. c = 1.75, f(1.75) = 5.359375 − 1.75 − 2 = 1.609375. Positive, so the root is to the left: bracket [1.5, 1.75], width 0.25.
- Iteration 3. c = 1.625, f(1.625) = 4.291015625 − 1.625 − 2 = 0.666015625. Positive: bracket [1.5, 1.625], width 0.125.
- Iteration 4. c = 1.5625, f(1.5625) = 3.814697265625 − 1.5625 − 2 = 0.252197265625. Positive: bracket [1.5, 1.5625], width 0.0625.
- Iteration 5. c = 1.53125, f(1.53125) = 3.590576171875 − 1.53125 − 2 = 0.059326171875. Positive: bracket [1.5, 1.53125], width 0.03125.
After five iterations the bracket is [1.5, 1.53125], which contains the true root 1.52138 as it must, and the midpoint 1.515625 is within 0.015625 of it — the actual error is 0.00576, comfortably inside the bound. The width has gone 1 → 0.5 → 0.25 → 0.125 → 0.0625 → 0.03125, exactly halving each time, which is the one thing about bisection you never have to check.
To reach a tolerance of 10⁻⁶ you need log₂(1/10⁻⁶) = 19.93, so 20 iterations. Run the calculator and confirm the count: it does not depend on the function, only on the width of the starting bracket and on the tolerance. Halving the tolerance always adds exactly one iteration.
Reading the results
The error bound is the honest headline. The final bracket width tells you the root lies inside an interval of that size, so the reported midpoint is within half of it. This is a guarantee, not an estimate, provided f is continuous on the bracket — the one hypothesis the method needs and the one it cannot check for you.
Compare the iteration count against the prediction. They should match exactly. A shorter run means the midpoint landed exactly on a root, which does happen for functions with rational roots and dyadic brackets. A longer run is impossible; a run that stops at the cap without reaching the tolerance is reported as such, and means either the cap is too low or the tolerance is finer than double precision can represent near your bracket.
Do not read f at the root estimate as a measure of accuracy. Bisection controls the error in x and says nothing about the residual in f. For a steep function a tiny error in x gives a large f; for a flat one an enormous error in x gives a tiny f. If what you need is a small residual, iterate further and watch f(c) rather than the width.
Finally, check the chart. It plots f across your original bracket, and you should see exactly one crossing. Two crossings mean the bracket contains more than one root and bisection will converge to one of them without telling you which — or, if there are an even number, the endpoints share a sign and the method refuses to start at all. Three or more sign changes call for splitting the interval and running the calculator on each piece.
Reference: iterations required, by bracket width and tolerance
| Bracket width | tol = 10⁻³ | tol = 10⁻⁶ | tol = 10⁻⁹ | tol = 10⁻¹² |
|---|---|---|---|---|
| 0.1 | 7 | 17 | 27 | 37 |
| 1 | 10 | 20 | 30 | 40 |
| 10 | 14 | 24 | 34 | 44 |
| 100 | 17 | 27 | 37 | 47 |
| 1000 | 20 | 30 | 40 | 50 |
Every column step of three decimal places costs about ten iterations, because log₂(1000) ≈ 9.97. Every tenfold widening of the bracket costs about 3.3 more. Bisection is remarkably insensitive to a bad initial bracket — a bracket a thousand times too wide costs only ten extra iterations.
Pitfalls and limitations
- No sign change, no method. Bisection needs f(a)·f(b) < 0. A double root such as (x − 1)² touches zero without crossing, so no bracket exists and bisection cannot find it.
- An even number of roots in the bracket looks identical to none. Both give the same sign at the endpoints. Plot the function before trusting a refusal.
- A sign change is not always a root. 1/(x − 1) changes sign across x = 1 because of a pole, and bisection will converge happily to the pole. The method assumes continuity and cannot verify it.
- The residual is not the error. A small f(c) does not imply a small error in x, nor the reverse. Only the bracket width bounds the error in x.
- A tolerance below machine spacing never converges. Near x = 1 the gap between adjacent doubles is about 2 × 10⁻¹⁶; asking for less than that will run to the iteration cap.
- It is slow by design. One bit per iteration. If you have a derivative and a decent starting guess, Newton's method will get there in a fraction of the evaluations.
- It finds one root, not all of them. Which one depends on the bracket. To find several, isolate each in its own bracket first.
How to find a bracket in the first place
Scan. Evaluate f on a grid across the region of interest and look for consecutive points with opposite signs; each such pair is a bracket. That is exactly how the critical points calculator locates the zeros of a derivative before classifying them. A grid can miss a pair of roots closer together than its spacing, so refine the grid where the function comes near zero without crossing. For a polynomial, the Cauchy bound 1 + max|aₖ/aₙ| tells you a finite interval that must contain every real root, so the scan need never be unbounded.
Bisection among the root-finders
Newton's method uses the tangent line at the current guess and converges quadratically, doubling the correct digits per step — but it needs a derivative, and it can diverge, cycle, or shoot off to infinity from a bad start. The secant method replaces the derivative with a finite difference between the last two iterates, giving order 1.618 with no derivative required, and inherits Newton's fragility. The regula falsi method keeps a bracket like bisection but interpolates, which is usually faster and occasionally much slower when one endpoint sticks.
Brent's method is what production libraries actually use. It keeps a bracket at all times, attempts inverse quadratic interpolation, and falls back to bisection whenever the interpolated point would leave the bracket or the interval is not shrinking fast enough. The result is superlinear convergence with the bisection guarantee, which is why it is the default in most numerical software.
Root-finding connects to the rest of calculus in both directions. Solving f'(x) = 0 is a root-finding problem, which is how optimisation reduces to this page — see the critical points calculator for the polynomial case, where the derivative is exact. Finding the intersection of two curves is root-finding on their difference, which is how you set the limits for an area or volume integral in the disk and washer calculator or a Riemann sum.
And when a derivative is needed but not available analytically, the finite differences on the numerical derivative calculator supply one — turning Newton's method into the secant method in all but name, and reintroducing exactly the step-size trade-off that page describes. Bisection's appeal is that it sidesteps all of that: no derivative, no step size, no starting guess, no failure mode.
