The Bisection Method
Bracket a root, halve the interval repeatedly, and converge to a solution with guaranteed but linear reliability.
Problem
Bisection finds a root of a continuous function by starting with an interval where the function changes sign and repeatedly halving it, keeping the half that still brackets the sign change. It is slow but utterly reliable, guaranteed to converge whenever a sign change exists.
Method
If f(a) and f(b) have opposite signs, a root lies between them by the intermediate value theorem. Evaluate the midpoint m; replace whichever endpoint shares its sign. Each step halves the bracket, so the error is bounded and predictable.
f=lambda x:x**3-x-2 # root near 1.5214
a,b=1.0,2.0
for k in range(20):
m=(a+b)/2
if f(a)*f(m)<=0: b=m
else: a=m
print(k,round(m,6),'width',round(b-a,6))
print('root approx',round((a+b)/2,6))
Result
Starting from the bracket [1,2], the interval width halves every step, so after 20 iterations it is below 1e-6 and the midpoint approximates the root 1.52138 accurately. Bisection gains about one binary digit per iteration (linear convergence), slower than Newton's quadratic rate, but it needs no derivative and cannot diverge. It is often used to generate a good starting point before switching to a faster method.
- Guaranteed convergence makes bisection a safe fallback when faster methods might diverge.
- The error after k steps is at most the initial width divided by 2^k, known in advance.
- Hybrid solvers (Brent's method) combine bisection's safety with faster interpolation, as used in Kronos scalar root-finding.