Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Big Idea

Real-world problems often have multiple roots, and we need to find all of them reliably. This requires combining bracketing (to isolate roots) with fast solvers (to compute them accurately). Production solvers like MATLAB’s fzero and SciPy’s brentq use hybrid methods that get the best of both worlds.

The Challenge: Multiple Roots

So far we have studied methods that converge to one root:

In practice, a function can have many roots, and we need a systematic way to find them all.

Example 1 (Multiple Roots)

Consider f(x)=x36x2+11x6=(x1)(x2)(x3)f(x) = x^3 - 6x^2 + 11x - 6 = (x-1)(x-2)(x-3). There are three roots at x=1,2,3x = 1, 2, 3. Starting Newton’s method from x0=0x_0 = 0 converges to x=1x = 1. Starting from x0=2.5x_0 = 2.5 converges to x=3x = 3 (not the nearest root x=2x = 2). There is no single starting point that finds all three.

Bracketing

The first step is to isolate each root in its own interval. The simplest approach: evaluate ff on a grid and look for sign changes.

Algorithm 1 (Sign-Change Scanning)

Input: Function ff, interval [a,b][a, b], number of sample points NN

Output: List of brackets [ai,bi][a_i, b_i] with f(ai)f(bi)<0f(a_i)f(b_i) < 0

  1. Set h=(ba)/Nh = (b - a)/N

  2. for i=0,1,,N1i = 0, 1, \ldots, N-1:

  3. \qquad xi=a+ihx_i = a + ih, xi+1=a+(i+1)hx_{i+1} = a + (i+1)h

  4. \qquad if f(xi)f(xi+1)<0f(x_i) \cdot f(x_{i+1}) < 0: record bracket [xi,xi+1][x_i, x_{i+1}]

By the Intermediate Value Theorem, each bracket contains at least one root.

Remark 1 (Limitations of Sign-Change Scanning)

This approach can miss roots in two situations:

  1. Even-multiplicity roots (e.g., f(x)=x2f(x) = x^2): the function touches zero but does not change sign, so no bracket is detected.

  2. Closely spaced roots: if two roots are closer than the grid spacing hh, they may fall in the same interval. The sign change detects only one bracket, and bisection/Newton applied to that bracket may find only one of the two roots.

A finer grid reduces the chance of missing roots but increases the cost.

Source
<Figure size 800x400 with 1 Axes>

Finding All Roots

Once we have brackets, apply a fast solver to each one independently. This is the bracket-then-solve strategy.

Algorithm 2 (Find All Roots)

Input: Function ff, interval [a,b][a, b], grid size NN, tolerance ε\varepsilon

Output: List of all detected roots

  1. Scan: evaluate ff on a grid of N+1N+1 points in [a,b][a, b].

  2. Bracket: identify all intervals [xi,xi+1][x_i, x_{i+1}] where ff changes sign.

  3. Solve: apply Brent’s method (or Newton-bisection) to each bracket.

  4. Deduplicate: remove any roots that are within ε\varepsilon of each other.

Source
<Figure size 1000x400 with 1 Axes>
Roots found:
  x_0 = 0.0201690821,  f(x_0) = 0.00e+00
  x_1 = 0.6037981464,  f(x_1) = -1.25e-16
  x_2 = 1.2874784697,  f(x_2) = 3.92e-14
  x_3 = 1.8477141366,  f(x_3) = -5.55e-16
  x_4 = 2.5606764392,  f(x_4) = -3.19e-16
  x_5 = 3.0849105381,  f(x_5) = 6.59e-15
  x_6 = 3.8435849184,  f(x_6) = -1.49e-13
  x_7 = 4.3113522549,  f(x_7) = 4.36e-15
  x_8 = 5.1443525356,  f(x_8) = -1.80e-16
  x_9 = 5.5187146940,  f(x_9) = -5.80e-15
  x_10 = 6.4947954040,  f(x_10) = 6.25e-16
  x_11 = 6.6750973502,  f(x_11) = 2.78e-17

Hybrid Methods

No single method is perfect. Bisection is safe but slow. Newton is fast but can diverge. The most robust solvers combine both: maintain a bracket that always contains the root, but use faster steps when possible. Even these have limitations, as we will see.

Brent’s Method

Brent’s method (1973) combines three strategies:

  1. Bisection: always safe, always shrinks the bracket by half.

  2. Secant method: uses the two most recent points to extrapolate (no derivative needed, superlinear convergence).

  3. Inverse quadratic interpolation: fits a parabola through the three most recent points for even faster convergence.

At each step, Brent’s method tries the fastest option first (inverse quadratic interpolation), falls back to secant if that fails, and uses bisection as the last resort. The bracket is always maintained, so convergence is guaranteed.

This is what MATLAB’s fzero and SciPy’s brentq implement. The difference is that fzero(f, x0) can search for a bracket starting from a single guess, while brentq(f, a, b) requires the bracket up front.

Newton-Bisection Hybrid

An alternative is to maintain a bracket and use Newton steps when they stay inside the bracket, falling back to bisection otherwise. This is sometimes called safe Newton. It requires the derivative ff' but converges quadratically near the root while still guaranteeing convergence globally.

Brent’s method avoids requiring the derivative, which makes it more broadly applicable.

Deflation

Instead of bracketing all roots up front, deflation finds roots one at a time. After finding a root r1r_1, divide it out and solve the deflated problem.

For a polynomial f(x)f(x) with a known root r1r_1, define:

f1(x)=f(x)xr1f_1(x) = \frac{f(x)}{x - r_1}

The roots of f1f_1 are the remaining roots of ff. Apply any solver to f1f_1 to find the next root, then deflate again.

Remark 2 (Practical Considerations for Deflation)

Deflation is conceptually simple but requires some care.

  1. Approximate poles: if r1r_1 is only approximate, f1(x)=f(x)/(xr1)f_1(x) = f(x)/(x - r_1) has a near-pole that can cause large evaluation errors. A common mitigation is to polish the roots afterwards by running a few Newton iterations on the original (undeflated) function ff.

  2. Highly nonlinear near old roots: the singularity introduced by dividing out r1r_1 makes the deflated function very steep near the old root. Plain Newton’s method can struggle here, so damped or globalized solvers (such as the NLEQ-ERR method) may be needed.

  3. Error accumulation: each deflation step introduces errors that propagate to later roots. For high-degree polynomials this can be significant. Finding roots in order of increasing magnitude helps, since smaller roots tend to be computed more accurately relative to machine precision.

  4. Beyond polynomials: deflation also applies to other settings. For example, Farrell, Birkisson & Funke (2015) develop deflation techniques for nonlinear PDEs to systematically discover multiple solutions. The details of dividing out known solutions depend on the problem structure.

For scalar root-finding on a known interval, bracket-then-solve is often simpler. Deflation is most useful when roots are found sequentially and cannot be bracketed in advance.

Systems of Equations

For systems F(x)=0F(\mathbf{x}) = \mathbf{0}, bracketing no longer applies since there is no notion of sign change in multiple dimensions. The locality problem becomes much harder: Newton’s method still converges quadratically near a solution, but can diverge wildly from a poor initial guess.

Several techniques exist to make Newton’s method more robust for systems. Globalization strategies such as damped Newton and backtracking line searches restrict step sizes to prevent divergence. Quasi-Newton methods like Broyden’s method avoid computing the full Jacobian at every step, reducing cost from O(n3)\mathcal{O}(n^3) to O(n2)\mathcal{O}(n^2) per iteration. These ideas are developed in the Nonlinear Systems chapter.