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.
Three panels with the curve x cubed minus 2x minus 5. Bisection: the bracket from 2 to 3 and its midpoint 2.5, where f is positive, so the new bracket is 2 to 2.5. Newton: the tangent at x0 = 3, slope 25, crosses the axis at x1 = 2.36. Secant: the line through the points at 2 and 3 crosses the axis at 2.06
One step of each method from the ends of [2, 3]: the bracket halves, while the tangent and the secant line each point straight at the next guess.

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:

methodnext errorordercorrect digits per step
bisectione/21 (linear)+0.3 every step
Newton≈ C·e²2 (quadratic)about doubles
secant≈ C·e·eprev1.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):

stepbisection boundNewton from 2secant from 2, 3
05.0e−19.5e−29.1e−1
12.5e−15.4e−33.6e−2
21.3e−11.7e−51.3e−2
36.3e−21.6e−10 ✓2.7e−4
43.1e−22.1e−6
51.6e−23.1e−10 ✓
267.5e−9 ✓
Log-scale chart of error against step for x cubed minus 2x minus 5. Bisection's bound falls along a straight line and crosses 1e-8 at step 26. Newton's error falls ever more steeply and crosses at step 3. Secant's error falls a little slower than Newton's and crosses at step 5
On a log scale bisection is a straight line; Newton and secant bend down ever more steeply, Newton the fastest.

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

bisectionNewtonsecant
needsa sign change [a, b]f and f′, one startf, two starts
speedslow, steadyfastest per stepfast, often cheapest per evaluation
can fail?no, once bracketedyes: flat tangent, cycles, divergenceyes: flat line, divergence
double rootcannot startlinearlinear, slower
pick it whensafety matters more than speedf′ is cheap and the start is goodf′ 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.