The idea: three ways to solve f(x) = 0
A root of f is an x with f(x) = 0. For most functions there is no formula for it, so we guess and improve the guess, step by step. The page runs three classic methods on the same function, f(x) = x³ − 2x − 5 (the example Newton himself used; its root is r ≈ 2.0945514815), one lane each, in lockstep: one Step is one iteration of every method still running. They differ in what they ask of f:
- Bisection only looks at the sign of f.
- Newton's method uses the value f(x) and the slope f′(x).
- The secant method uses two values and the slope of the line between them.
Bisection: halve the bracket
Start with a bracket [a, b] where f(a) and f(b) have opposite signs. A continuous function must cross zero in between. Evaluate f at the midpoint m = (a + b)/2 and keep the half where the sign still changes. The bracket halves every step, so after n steps the root is known to within (b − a)/2n+1. That is a guarantee, not a hope. It costs one evaluation of f per step.
Newton: follow the tangent
From a guess xn, draw the tangent to the curve and follow it to the axis: xn+1 = xn − f(xn) / f′(xn). Near the root a smooth curve looks like its tangent, so the guess lands very close. Each step needs both f and f′. The Newton's method page shows one step at a time in more detail.
Secant: a line through the last two points
The secant method replaces the tangent by the line through the last two points (xn−1, f(xn−1)) and (xn, f(xn)): xn+1 = xn − f(xn)·(xn − xn−1) / (f(xn) − f(xn−1)). The slope of that line is a difference quotient, the same one that becomes f′ in the limit definition of the derivative. No derivative is needed, and each step costs only one new value of f.
How fast: order of convergence
Write en for the error after step n. Near a simple root the three methods shrink it in very different ways:
| method | next error | order | correct digits per step |
|---|---|---|---|
| bisection | e/2 | 1 (linear) | +0.3 every step |
| Newton | ≈ C·e² | 2 (quadratic) | about doubles |
| secant | ≈ C·e·eprev | 1.618 (superlinear) | multiplied by about 1.6 |
The 1.618 is the golden ratio φ: the secant's new error is the product of the last two, so the exponents grow like Fibonacci numbers. On x³ − 2x − 5 the errors are (Demo: race on x³ − 2x − 5):
| step | bisection bound | Newton from 2 | secant from 2, 3 |
|---|---|---|---|
| 0 | 5.0e−1 | 9.5e−2 | 9.1e−1 |
| 1 | 2.5e−1 | 5.4e−3 | 3.6e−2 |
| 2 | 1.3e−1 | 1.7e−5 | 1.3e−2 |
| 3 | 6.3e−2 | 1.6e−10 ✓ | 2.7e−4 |
| 4 | 3.1e−2 | 2.1e−6 | |
| 5 | 1.6e−2 | 3.1e−10 ✓ | |
| 26 | 7.5e−9 ✓ |
Steps are not the whole cost
A Newton step evaluates f and f′; a secant step evaluates f once. When f′ costs about as much as f, the fair comparison is per evaluation. Two evaluations of Newton square the error (order 2 per 2 evaluations, about 1.41 per evaluation); one evaluation of secant raises it to the power 1.618. So secant is often the cheaper method. From x₀ = 3 both need 5 steps, but secant uses 7 evaluations and Newton 10. (Demo: steps vs work)
When they go wrong
- Flat tangent. At x₀ = 0.8, f′ is only 0.08, so Newton's first tangent is almost flat and throws x₁ to −75.3. It needs 15 steps to come back; secant, whose first line is not flat, needs 6. (Demo: flat tangent)
- Bad start. For arctan x from x₀ = 2, every Newton step overshoots further: 2, −3.54, 13.95, −279, 1.2·10⁵, … and it diverges. Secant from 2 and 3 runs off as well. Bisection on [−2, 3] cannot fail: 28 halvings to reach 1e−8. (Demo: bad start)
- Double root. For (x − 1)² the curve only touches the axis. f never changes sign, so bisection cannot even start. And since f′(1) = 0 as well, Newton loses its speed and only halves the error: 27 steps. Secant needs 39 steps, though with 41 evaluations to Newton's 54. (Demo: double root)
Which one to pick
| bisection | Newton | secant | |
|---|---|---|---|
| needs | a sign change [a, b] | f and f′, one start | f, two starts |
| speed | slow, steady | fastest per step | fast, often cheapest per evaluation |
| can fail? | no, once bracketed | yes: flat tangent, cycles, divergence | yes: flat line, divergence |
| double root | cannot start | linear | linear, slower |
| pick it when | safety matters more than speed | f′ is cheap and the start is good | f′ is unknown or expensive |
In practice libraries combine them. Brent's method (used by scipy.optimize.brentq)
keeps a bracket like bisection but takes a secant or inverse-quadratic step whenever that step stays inside it, so it
is as safe as bisection and usually as fast as secant.
See also Newton's method on its own, with its 2-cycle and the Babylonian square root, and limits and continuity: bisection works because a continuous function cannot jump over zero (the intermediate value theorem).
What the page leaves out
Only real functions of one variable are shown. The error is exact here because the page knows the root; a real solver stops on |xn+1 − xn| or |f(xn)| and can be fooled. Left out are regula falsi (false position), Brent's and Ridders' methods, Halley's cubic method, Newton in several variables (a Jacobian system per step), modified Newton for multiple roots, and rounding error near the root, where f(x) is mostly noise.