Root-Finding Methods, Explained
After reading this you will be able to solve f(x) = 0 by hand with bisection, Newton's method and the secant method, predict how fast each one closes in, and recognize the starting points where Newton spins its wheels.
What root-finding does and one hook example
Most equations you meet in practice have no closed-form solution. You cannot write down the exact x that satisfies x = \cos x, and the same is true for the interest rate that makes a loan balance zero, or the temperature at which two gas equations agree. What you can do is rearrange any such problem into the shape f(x) = 0 and then hunt for the x that lands on the axis.
Take f(x) = x^2 - 2. Its positive root is \sqrt{2} = 1.41421356. No algebra produces that decimal directly, but a root-finder reaches it fast. Bisection needs about 20 halvings to pin it to 6 digits. Newton's method needs 4 steps from a start of 1. That gap in effort is the whole story of this page: the methods all find the same root, but they crawl, leap and split the difference at very different speeds, and they fail in different ways.
When to use each method, and when not to
The three classic methods trade robustness against speed.
- Bisection
- You start with two points a and b where f(a) and f(b) have opposite signs. A continuous function must cross zero somewhere between them. Halve the interval, keep the half that still straddles zero, repeat. It cannot diverge. It just needs a sign change and patience.
- Newton's method
- You need the derivative f'(x) and a starting guess. Each step follows the tangent line down to the axis. Near a simple root it doubles the number of correct digits per step. Far from a root, or near a flat spot, it can overshoot wildly or loop forever.
- Secant method
- Like Newton, but it estimates the slope from the last two points instead of computing a derivative. No calculus required. It converges almost as fast as Newton (rate \approx 1.618) and shares Newton's fragility from a bad start.
Use bisection when you need a guaranteed answer and can afford the steps, or to safely bracket a root before switching to a faster method. Use Newton when you have a cheap derivative and a decent guess. Use the secant method when the derivative is expensive or unavailable. Real solvers often combine them: Brent's method brackets like bisection but accelerates with secant steps.
The formulas and the intuition behind them
Bisection tracks a bracket [a, b] and tests the midpoint:
Here c is the new candidate. If f(a) and f(c) have opposite signs, the root lies in [a, c], so b becomes c. Otherwise the root is in [c, b], so a becomes c. The bracket width halves every step, which is why bisection gains exactly one bit of accuracy per iteration.
Newton's method draws the tangent at the current guess and reads off where that line hits zero:
Here x_n is the current guess, f(x_n) is the function value, and f'(x_n) is the slope there. The ratio f(x_n)/f'(x_n) is the horizontal distance from your point to where the tangent crosses the axis. Subtract it and you land at that crossing.
The secant method replaces the exact slope with the slope of the chord through the last two points:
The fraction is the reciprocal of the estimated slope. As the two points close in, that estimate approaches the true derivative, so the secant method starts to behave like Newton's method without ever computing f'.
Convergence order measures how error at one step relates to the next. Bisection has order 1 (error scales by a constant 0.5). Newton has order 2 (new error \approx old error squared). The secant method has order \approx 1.618, the golden ratio, sitting neatly between them.
Reproducing the demo: solving x squared minus 2
Run the demo with the default function f(x) = x^2 - 2. The exact root is \sqrt{2} = 1.41421356. Newton uses f'(x) = 2x and starts at x_0 = 1.
- Step 1: x_1 = 1 - \frac{1^2 - 2}{2 \cdot 1} = 1 - \frac{-1}{2} = 1.5. Error
0.08579. - Step 2: x_2 = 1.5 - \frac{1.5^2 - 2}{2 \cdot 1.5} = 1.5 - \frac{0.25}{3} = 1.41667. Error
0.002453. - Step 3: x_3 = 1.41667 - \frac{0.006944}{2.83333} = 1.41422. Error
0.000002123. - Step 4: x_4 = 1.41421356. Error below
0.0000000001.
Watch the digits double: from 1 correct digit, to 3, to 6, to 12. Now compare bisection on the same problem, starting from the bracket [1, 2] where f(1) = -1 and f(2) = 2.
| Step | Bisection c | Bisection error | Newton x_n | Newton error |
|---|---|---|---|---|
| 1 | 1.5 | 0.08579 | 1.5 | 0.08579 |
| 2 | 1.25 | 0.1642 | 1.41667 | 0.002453 |
| 3 | 1.375 | 0.03921 | 1.41422 | 0.000002123 |
| 4 | 1.4375 | 0.02329 | 1.41421 | 1.6e-12 |
| 10 | 1.41406 | 0.0001526 | converged | converged |
| 20 | 1.41421 | 1.5e-7 | converged | converged |
Bisection needs 20 steps to reach the accuracy Newton hit at step 3. The bisection error does not fall smoothly, because the midpoint can land on either side of the root, but the bracket width falls by exactly half each time: 1, 0.5, 0.25, 0.125, and so on.
The trap: when Newton cycles forever
Newton's speed comes with no safety net. Try f(x) = x^3 - 2x + 2 from the start x_0 = 0. Its derivative is f'(x) = 3x^2 - 2.
- x_1 = 0 - \frac{0 - 0 + 2}{-2} = 1.
- x_2 = 1 - \frac{1 - 2 + 2}{3 - 2} = 1 - 1 = 0.
- x_3 = 0 again, and the sequence loops
0, 1, 0, 1, ...forever.
The tangent at 0 sends you to 1, and the tangent at 1 sends you back to 0. The real root is near x = -1.769, but Newton never sees it from this start. Bisection with a bracket like [-2, -1] finds that root without drama, because f(-2) = -2 and f(-1) = 3 straddle zero. This is the tradeoff in one picture: the fast method fails silently, the slow method never does.
Reading and interpreting the results
Three numbers tell you what is happening each step. The iterate is your current guess. The residual f(x_n) measures how far the function is from zero. The error is the distance to the true root, which you only know in test problems like \sqrt{2}.
In real work you cannot see the error, so you watch the residual and the step size |x_{n+1} - x_n|. When both drop below your tolerance, stop. A healthy Newton run shows the residual shrinking roughly as its own square: 0.25, then 0.007, then 0.00005. If instead the residual stalls or bounces, your start is in trouble, or the root is not simple. At a double root, where f and f' both vanish, Newton slows to linear convergence and merely halves the error per step, the same rate as bisection.
Common mistakes
Never trust Newton or the secant method to converge without a bracket check. If the residual is not shrinking after a few steps, stop and fall back to bisection. A silent infinite loop or an iterate that flies to 10^{15} is a real outcome, not a rare edge case.
The most frequent errors are practical. Choosing a bracket where f(a) and f(b) have the same sign breaks bisection's guarantee: there may be zero roots inside, or two, and halving can miss both. Dividing by a near-zero derivative in Newton produces a giant step; guard against |f'(x_n)| being tiny. In the secant method, if f(x_n) and f(x_{n-1}) are nearly equal, the denominator shrinks and the step blows up. And a tolerance set on the residual alone can lie near a flat root: a tiny f(x) does not always mean x is close to the root, so check the step size too.
Related tools
Newton's method becomes a fractal when you feed it complex starting points: the Newton Fractal colours each start by the root it reaches, and the trap you saw here shows up as tangled basin boundaries. For the broader world of iterated maps and their sudden collapse into chaos, see the Logistic Map Bifurcation. If you want to compare numerical methods on differential equations rather than roots, race Euler vs Runge-Kutta, and view an equation as a field of slopes in the Slope Field Explorer. For a probabilistic cousin that finds answers by sampling instead of iterating, try the Monte Carlo Playground.
Frequently asked questions
Why does bisection need so many steps compared to Newton?
Bisection gains one bit per step, so reaching n bits of accuracy takes about n steps. To match Newton's 12 correct digits you need roughly 40 bits, meaning about 40 halvings. Newton reaches the same accuracy in 4 steps because each step squares the error, doubling the digit count.
Can Newton's method converge to the wrong root?
Yes. If your function has several roots, the tangent path can carry you to a root far from your start, or to none at all. Starting at 0 on x^3 - 2x + 2 cycles instead of finding the only real root near -1.769. Bracketing the root you actually want removes the ambiguity.
Why is the secant method's convergence rate the golden ratio?
The error at step n+1 is proportional to the product of the two previous errors. That recurrence, e_{n+1} \approx C \cdot e_n \cdot e_{n-1}, has a power-law solution whose exponent solves p^2 = p + 1. That equation's positive root is 1.618, the golden ratio.
Do I always need the derivative for Newton's method?
You need it, but you can approximate it. The secant method does exactly that by using a finite difference of the last two points. If you can afford one extra function evaluation per step, a numerical derivative also works, at the cost of accuracy near the root.
What happens at a double root?
At a root where both f and f' are zero, Newton loses its quadratic speed and converges linearly, halving the error per step like bisection. For f(x) = (x-1)^2 starting at 2, the iterates are 1.5, 1.25, 1.125, closing in at a steady factor of 0.5 instead of squaring.