Unit 10, lesson 123

Bisection and Newton’s Method

How to solve f(x) = 0 when no formula gives the root, with bisection as the slow method that cannot fail and Newton's method as the fast one that needs a good start.

  • Theory part 245
  • Practice part 246
  • Root Finding

The equation x2=2x^2 = 2 has a root that no finite decimal can write down, and an equation like cos⁡x=x\cos x = x has no formula for its root at all. Still, a calculator gives 2≈1.41421356\sqrt{2} \approx 1.41421356 instantly. Behind that number is an iteration, a rule that turns one guess into a better one. Here are the two classic rules, one that cannot fail once a root is trapped and one that is far faster when it works.

Key terms

Bracketing

Definition An interval [a,b][a, b] with a<ba < b brackets a root of ff if ff is continuous on [a,b][a, b] and f(a)f(a) and f(b)f(b) have opposite signs, that is

f(a) f(b)<0.f(a) \, f(b) < 0.

A bracketing method keeps a bracket at every step and shrinks it.

In plain words You have trapped the root between two numbers, one where ff is negative and one where it is positive.

Example For f(x)=x2−2f(x) = x^2 - 2 we have f(1)=−1<0f(1) = -1 < 0 and f(2)=2>0f(2) = 2 > 0, so [1,2][1, 2] brackets a root, namely 2\sqrt{2}.

Continuity and sign change

Definition This is the intermediate value theorem applied to roots. If ff is continuous on [a,b][a, b] and f(a) f(b)<0f(a) \, f(b) < 0, then there is at least one rr in (a,b)(a, b) with f(r)=0f(r) = 0. Without continuity the conclusion can fail, and a sign change can also come from a vertical asymptote rather than a root.

In plain words A continuous graph cannot get from below the axis to above it without crossing. Continuity is what makes a bracket trustworthy.

Example The function f(x)=1xf(x) = \frac{1}{x} has f(−1)=−1f(-1) = -1 and f(1)=1f(1) = 1, opposite signs, yet it has no root in [−1,1][-1, 1]. The theorem does not apply because ff is not continuous at 00. By contrast g(x)=cos⁡x−xg(x) = \cos x - x is continuous with

g(0)=1>0andg(1)=cos⁡1−1≈−0.46<0,g(0) = 1 > 0 \quad \text{and} \quad g(1) = \cos 1 - 1 \approx -0.46 < 0,

so gg has a root in (0,1)(0, 1).

Bisection and its error bound

Definition Let ff be continuous on [a,b][a, b] with f(a) f(b)<0f(a) \, f(b) < 0. The bisection method starts from the bracket [a0,b0]=[a,b][a_0, b_0] = [a, b]. At step nn it computes the midpoint cn=an+bn2c_n = \frac{a_n + b_n}{2}. If f(cn)=0f(c_n) = 0 it stops. Otherwise it keeps whichever half, [an,cn][a_n, c_n] or [cn,bn][c_n, b_n], still has a sign change, and calls it [an+1,bn+1][a_{n+1}, b_{n+1}]. The brackets are nested, the bracket [an,bn][a_n, b_n] has length b−a2n\frac{b - a}{2^n}, and there is a root rr of ff that lies in every bracket. Since cnc_n is the midpoint of a bracket containing rr,

∣cn−r∣≤b−a2n+1,n=0,1,2,…\lvert c_n - r \rvert \le \frac{b - a}{2^{n+1}}, \qquad n = 0, 1, 2, \dots

In plain words Each step cuts the bracket in half, so each step buys one more correct binary digit. It is slow but it is guaranteed, and you know the error in advance.

Example For f(x)=x2−2f(x) = x^2 - 2 on [1,2][1, 2] the first steps are these.

nnana_nbnb_ncnc_nsign of f(cn)f(c_n)
0011221.51.5++
11111.51.51.251.25−-
221.251.251.51.51.3751.375−-
331.3751.3751.51.51.43751.4375++
441.3751.3751.43751.43751.406251.40625−-

To guarantee ∣cn−2∣≤10−6\lvert c_n - \sqrt{2} \rvert \le 10^{-6} you need

12n+1≤10−6,that is2n+1≥106.\frac{1}{2^{n+1}} \le 10^{-6}, \quad \text{that is} \quad 2^{n+1} \ge 10^6.

Since 219=5242882^{19} = 524288 and 220=10485762^{20} = 1048576, the first nn that works is n=19n = 19.

Newton iteration and the tangent construction

Definition Let ff be differentiable at the current guess xnx_n with f′(xn)≠0f'(x_n) \neq 0. The tangent line to the graph at (xn,f(xn))(x_n, f(x_n)) is y=f(xn)+f′(xn)(x−xn)y = f(x_n) + f'(x_n)(x - x_n). Setting y=0y = 0 and solving for xx gives the next guess

xn+1=xn−f(xn)f′(xn).x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}.

Newton’s method repeats this step from a starting value x0x_0.

In plain words Replace the curve by its tangent line, see where the line hits the axis, and use that point as the new guess. Near a root the curve and its tangent are almost the same, so the new guess is much better.

Example For f(x)=x2−2f(x) = x^2 - 2 the rule becomes

xn+1=xn−xn2−22xn.x_{n+1} = x_n - \frac{x_n^2 - 2}{2x_n}.

Starting at x0=1x_0 = 1 gives this table.

nnxnx_nxn−2x_n - \sqrt{2}
0011−0.414-0.414
111.51.58.6×10−28.6 \times 10^{-2}
221.416666…1.416666\ldots2.5×10−32.5 \times 10^{-3}
331.414215686…1.414215686\ldots2.1×10−62.1 \times 10^{-6}
441.414213562374…1.414213562374\ldots1.6×10−121.6 \times 10^{-12}

Four steps reach the accuracy that bisection needs about 40 steps for.

Initial guess

Definition The initial guess x0x_0 is the starting value of the iteration. Newton’s method has no bracket, so whether the iterates converge, and to which root, depends on x0x_0. A common practice is to locate a root roughly first, for example by a plot or a few bisection steps, and then start Newton’s method close to it.

In plain words Newton’s method is only as good as where you start. Start close and it flies, start far and it may wander off.

Example The function f(x)=arctan⁡xf(x) = \arctan x has the single root 00, and its Newton step is

xn+1=xn−(1+xn2)arctan⁡xn.x_{n+1} = x_n - (1 + x_n^2) \arctan x_n.

From x0=1x_0 = 1 the iterates are about −0.571-0.571, 0.1170.117, −0.001-0.001 and then essentially 00. From x0=1.5x_0 = 1.5 they are about −1.694-1.694, 2.3212.321, −5.114-5.114, 32.332.3, growing without bound.

Derivative zero

Definition The Newton step needs f′(xn)≠0f'(x_n) \neq 0. If f′(xn)=0f'(x_n) = 0 the tangent line is horizontal and, unless f(xn)=0f(x_n) = 0, never meets the axis, so xn+1x_{n+1} is undefined. If f′(xn)f'(x_n) is merely close to zero, the step f(xn)f′(xn)\frac{f(x_n)}{f'(x_n)} is huge and throws the next guess far away. At a root rr with f′(r)=0f'(r) = 0 (a multiple root) the method usually still converges from nearby starting values, but only linearly.

In plain words A flat tangent points nowhere useful. Avoid starting near a turning point of the graph.

Example For f(x)=x2−2f(x) = x^2 - 2 with x0=0x_0 = 0 we get f′(0)=0f'(0) = 0 and the formula would divide by zero. With x0=0.01x_0 = 0.01 the next guess is

x1=0.01−0.0001−20.02≈100.0,x_1 = 0.01 - \frac{0.0001 - 2}{0.02} \approx 100.0,

very far from 2\sqrt{2}.

Cycles and divergence

Definition Newton’s iterates need not converge. They can form a cycle, meaning that for some period p≥2p \ge 2 we have xn+p=xnx_{n+p} = x_n for all nn while the values are not all equal. They can also diverge, either with ∣xn∣→∞\lvert x_n \rvert \to \infty or by wandering without settling down.

In plain words The tangent can send you back and forth between the same two points forever, or keep pushing you farther away.

Example Take f(x)=x3−2x+2f(x) = x^3 - 2x + 2, so f′(x)=3x2−2f'(x) = 3x^2 - 2. From x0=0x_0 = 0,

x1=0−2−2=1,x2=1−11=0,x_1 = 0 - \frac{2}{-2} = 1, \qquad x_2 = 1 - \frac{1}{1} = 0,

so the iterates cycle 0,1,0,1,…0, 1, 0, 1, \dots and never approach the real root near −1.77-1.77. For divergence take f(x)=x3f(x) = \sqrt[3]{x}, where the step simplifies to xn+1=xn−3xn=−2xnx_{n+1} = x_n - 3x_n = -2x_n. Every nonzero start doubles in size and flips sign at each step.

Local convergence conditions

Definition Suppose f′′f'' is continuous on an open interval containing a root rr, with f(r)=0f(r) = 0 and f′(r)≠0f'(r) \neq 0. Choose δ>0\delta > 0 so small that J=[r−δ,r+δ]J = [r - \delta, r + \delta] lies in that interval, f′f' has no zero on JJ, and

Cδ<1,where C=max⁡J∣f′′∣2min⁡J∣f′∣.C \delta < 1, \qquad \text{where } C = \frac{\max_{J} \lvert f'' \rvert}{2 \min_{J} \lvert f' \rvert}.

Such a δ\delta always exists, because CC stays bounded as δ\delta shrinks. Then for every x0x_0 in JJ the Newton iterates are defined, stay in JJ, converge to rr, and satisfy

∣xn+1−r∣≤C∣xn−r∣2.\lvert x_{n+1} - r \rvert \le C \lvert x_n - r \rvert^2.

This is called quadratic convergence. The estimate comes from Taylor’s formula, which gives

xn+1−r=f′′(ξn)2f′(xn)(xn−r)2x_{n+1} - r = \frac{f''(\xi_n)}{2 f'(x_n)} (x_n - r)^2

for some ξn\xi_n between xnx_n and rr. The condition Cδ<1C\delta < 1 makes each error at most CδC\delta times the previous one, so the iterates never leave JJ. The word local matters. The theorem promises nothing for starting values far from rr.

In plain words Close enough to a simple root, the error gets squared at each step, so the number of correct digits roughly doubles every time.

Example In the 2\sqrt{2} table the errors go 2.5×10−32.5 \times 10^{-3}, then 2.1×10−62.1 \times 10^{-6}, then 1.6×10−121.6 \times 10^{-12}. Each is about 0.350.35 times the square of the previous one, which fits

C≈f′′(r)2f′(r)=22⋅22≈0.354.C \approx \frac{f''(r)}{2f'(r)} = \frac{2}{2 \cdot 2\sqrt{2}} \approx 0.354.

Check yourself

  1. How many bisection steps on [0,1][0, 1] guarantee that the midpoint is within 10−310^{-3} of a root?
Show the answer

You need 12n+1≤10−3\frac{1}{2^{n+1}} \le 10^{-3}, so 2n+1≥10002^{n+1} \ge 1000. Since 210=10242^{10} = 1024, the smallest choice is n+1=10n + 1 = 10, that is n=9n = 9.

  1. Write the Newton step for f(x)=x3−5f(x) = x^3 - 5 and do one step from x0=2x_0 = 2.
Show the answer

The step is

xn+1=xn−xn3−53xn2.x_{n+1} = x_n - \frac{x_n^3 - 5}{3x_n^2}.

From x0=2x_0 = 2 it gives x1=2−312=1.75x_1 = 2 - \frac{3}{12} = 1.75. The true root is 53≈1.70998\sqrt[3]{5} \approx 1.70998.

  1. Why does Newton’s method fail for f(x)=x2+1f(x) = x^2 + 1 from any real starting value?
Show the answer

The function has no real root, since x2+1≥1x^2 + 1 \ge 1. The iterates can never converge to a real number rr with f(r)=0f(r) = 0. They jump around, and from x0=0x_0 = 0 the step is not even defined because f′(0)=0f'(0) = 0.

How this lesson connects

It also uses iteration and errors.