When Newton-Raphson Fails

A flat tangent has nowhere to send the guess.

A guess at a stationary point

Newton-Raphson replaces the curve by its tangent at the guess and moves to where the tangent meets the x-axis. That needs the tangent to meet the axis.

Take f(x) = x² − 2 again, whose roots are ±√2, and guess x₀ = 0, the bottom of the curve. A point where the gradient is zero is a stationary point, and its tangent is horizontal. Here f(0) = −2, so the tangent is the line y = −2. It runs parallel to the x-axis and never reaches it, so there is no next guess.

xytangent

The gold curve is y = x² − 2. Its tangent at the bottom, x₀ = 0, is the dashed horizontal line y = −2, which never meets the x-axis, although the curve crosses it twice.

The formula divides by zero

The formula says the same thing. xₙ₊₁ = xₙ − f(xₙ)/f'(xₙ), and f'(x) = 2x, so f'(0) = 0. The step would be f(0)/f'(0) = −2/0, and nothing can be divided by zero, so x₁ has no value.

This is not because the curve has no root, and not because the guess is a root: f(0) = −2, not 0. The trouble is only where the guess was made. Any start other than 0 works for this curve.

A nearly flat tangent

A tangent that is almost horizontal does meet the axis, but a long way off. The step f/f' is the height divided by the gradient, and dividing by a small gradient gives a large step.

Take f(x) = x³ − 3x, whose positive root is √3 ≈ 1.732, and whose gradient f'(x) = 3x² − 3 is zero at x = 1. Guess x₀ = 1.1, just past that stationary point. Then f(1.1) = 1.331 − 3.3 = −1.969 and f'(1.1) = 3 × 1.21 − 3 = 0.63, so the step is 1.969/0.63 = 3.125 and x₁ = 1.1 + 3.125 = 4.225. The guess was 0.63 from the root, and the next one is 2.49 from it.

xytangent

The gold curve is y = x³ − 3x, which crosses the x-axis at √3 ≈ 1.732. Its tangent at x₀ = 1.1, dashed, has gradient only 0.63, so it reaches the axis at x₁ = 4.225, much further from the root than the guess.

It may come back, slowly

From 4.225 the method does return: the next guesses are 2.984, 2.241, 1.865, 1.745 and 1.7322, and only then 1.73205. Six steps were spent recovering from one bad tangent. From x₀ = 1.5, where the curve is steeper, the guesses are 1.8, 1.7357 and 1.73206, three steps for the same accuracy.

The flatter the tangent, the worse the throw. From x₀ = 1.01 the gradient is 0.06, and x₁ = 34.17.

Going round in a cycle

The method can also go round in a loop. Take f(x) = x³ − 2x + 2, with f'(x) = 3x² − 2, and start at x₀ = 0. Then f(0) = 2 and f'(0) = −2, so x₁ = 0 − 2/(−2) = 1.

From x₁ = 1: f(1) = 1 − 2 + 2 = 1 and f'(1) = 3 − 2 = 1, so x₂ = 1 − 1/1 = 0, which is where it began. The guesses run 0, 1, 0, 1 forever and never reach the root.

The tangent at 0 is y = 2 − 2x, which meets the axis at 1. The tangent at 1 is y = x, which meets the axis at 0. Each tangent points to the other start. The only root of this cubic is near −1.7693, on the far side of a hump, and neither tangent leads there.

xytangent at 0tangent at 1
root

The curve is y = x³ − 2x + 2. The gold straight line, its tangent at x₀ = 0, meets the x-axis at 1, and the dashed line, its tangent at x₁ = 1, meets it back at 0. The root, near −1.7693, is never reached from either.

A better start

The same cubic is easy from the right start. f(−2) = −8 + 4 + 2 = −2 and f(−1) = −1 + 2 + 2 = 3 have opposite signs, so the root lies between −2 and −1. From x₀ = −2: f'(−2) = 10, so x₁ = −2 − (−2)/10 = −1.8, then x₂ = −1.76995 and x₃ = −1.76929. Three steps give the root to 5 decimal places.

root−2−112x₀ = −2 · 4 stepsx₄ = −1.769steps

x₄ = −1.769 to three places: from a start in the root's basin, Newton converges in a few steps

Start at x₀ = 0 and take four steps

Newton-Raphson on y = x³ − 2x + 2, from x₀ = −2: the tangents close in on the root. Drag x₀ to 0 and the four steps go 1, 0, 1, 0; drag it toward −0.82 or 0.82, where the curve is flat, and the next guess is thrown far away.

The wrong root

Even when the guesses settle, they may settle on a root nobody wanted. The method finds the root the tangent at the start points to. x³ − 3x has roots −√3, 0 and √3; a start at 0.5 gives f(0.5) = −1.375 and f'(0.5) = −2.25, so x₁ = 0.5 − 0.611 = −0.111, heading for 0, not for √3. And a root of the equation may make no sense in the problem, such as a negative time or a depth deeper than the object.

Choosing a start

Find an interval where f changes sign, so that a root is known to be inside it. Find where f' = 0, and start well away from those points, where the curve is steep. Run the method until successive guesses agree to the accuracy wanted; if they jump about or repeat, start somewhere else. Then check the answer by a change of sign either side of it.

The usual mistakes

Thinking f is zero at a stationary point. It is the gradient that is zero there; the height, here −2, is not.

Deciding the curve has no root because the method failed. y = x² − 2 crosses the axis twice; only the start was bad.

Thinking a shallow tangent helps. A small gradient makes f/f' large, so the step is large too.

Giving x₁ when x₂ is asked for. In the cycle, x₁ = 1, and one more step sends it back to x₂ = 0.

Taking f(0) = 2 as a term of the sequence. It is the height of the curve at the guess, not the next guess.

Two applications

In the first application below, a walker starts Newton-Raphson at the top of a hill to find where the path reaches a lake. The summit is a stationary point, so the method has nowhere to go, and a start just beside it is thrown far beyond the lake.

In the second, a start at 1 minute sends the method back and forth between 1 and 2 forever, because the tangent at each meets the axis at the other. A start at 4 finds the landing time.

Worked example: A Hill Path Down to a Lake: Why a Start at the Summit Gives Newton-Raphson Nowhere to Go

Question A path climbs over a hill and down to a lake. At a distance x km along the path, measured horizontally, its height above the lake is y = 8 + 12x − x3 tens of meters, for x ≥ 0. (a) A walker wants to know where the path reaches the lake, and starts the Newton-Raphson method at the summit, x0 = 2. Explain why the method fails there. Then find x1 from x0 = 2.1, and say whether that start is any better. (b) Use the method from x0 = 4 to find where the path reaches the lake, to 3 decimal places.

  1. 1.The path reaches the lake where y = 0: f(x) = 8 + 12x − x3 = 0. Differentiate: f'(x) = 12 − 3x2, which is zero at x = 2, the summit, where f(2) = 24, a height of 240 m.

    −100102001234km along the path, xheight (tens of m), ysummitf(x) = 8 + 12x − x3, f'(x) = 12 − 3x2f'(2) = 0 at the summit, 240 m up
    −100102001234km along the path, xheight (tens of m), ysummitf(x) = 8 + 12x − x3, f'(x) = 12 − 3x2f'(2) = 0 at the summit, 240 m up
    The path meets the lake where f(x) = 8 + 12x − x3 = 0. The derivative f'(x) = 12 − 3x2 is zero at the summit, x = 2.
  2. 2.At x0 = 2 the formula needs f(2)f'(2) = 240, which has no value. The tangent at the summit is the horizontal line y = 24, which never meets the x-axis, so there is no x1.

    −100102001234km along the path, xheight (tens of m), ysummity = 24x1= 2 − 24/0: no valuethe tangent y = 24 never meets the axis
    −100102001234km along the path, xheight (tens of m), ysummity = 24x1= 2 − 24/0: no valuethe tangent y = 24 never meets the axis
    At the summit the tangent is the horizontal line y = 24. It never meets the x-axis, so f(2)f'(2) = 240 gives no x1.
  3. 3.(a) The method fails at the summit because f'(2) = 0. From x0 = 2.1 the tangent is nearly horizontal: f(2.1) = 23.939 and f'(2.1) = −1.23, so x1 = 2.1 − 23.939−1.23 = 21.56, far beyond the lake.

    −100102001234km along the path, xheight (tens of m), ysummity = 24to 21.56 →from 2.1: f = 23.939, f' = −1.23x1= 2.1 + 23.939/1.23 = 21.56
    −100102001234km along the path, xheight (tens of m), ysummity = 24to 21.56 →from 2.1: f = 23.939, f' = −1.23x1= 2.1 + 23.939/1.23 = 21.56
    (a) From x0 = 2.1 the tangent is nearly horizontal, with gradient −1.23, and it meets the axis at x1 = 21.56, far beyond the lake.
  4. 4.From x0 = 4: f(4) = −8 and f'(4) = −36, so x1 = 4 − −8−36 = 3.7778. Then f = −0.5816 and f' = −30.8148, so x2 = 3.7589, and x3 = 3.7588.

    −100102001234km along the path, xheight (tens of m), ysummity = 24to 21.56 →x0= 4from 4: f = −8, f' = −36, x1= 3.7778x2= 3.7589, x3= 3.7588
    −100102001234km along the path, xheight (tens of m), ysummity = 24to 21.56 →x0= 4from 4: f = −8, f' = −36, x1= 3.7778x2= 3.7589, x3= 3.7588
    From x0 = 4, where the path is steep, the tangents land at 3.7778, 3.7589 and 3.7588.
  5. 5.(b) The path reaches the lake at x = 3.759 km, to 3 decimal places. Check: f(3.7585) = 0.008 and f(3.7595) = −0.022 have opposite signs.

    −100102001234km along the path, xheight (tens of m), ysummity = 24to 21.56 →x0= 43.759the path reaches the lake at x = 3.759 kmcheck: f(3.7585) > 0 > f(3.7595)
    −100102001234km along the path, xheight (tens of m), ysummity = 24to 21.56 →x0= 43.759the path reaches the lake at x = 3.759 kmcheck: f(3.7585) > 0 > f(3.7595)
    (b) The path reaches the lake at x = 3.759 km. The start that works is on the steep side, near the lake.

Answer: (a) f'(2) = 0, so the tangent at the summit is horizontal and never meets the axis; from x0 = 2.1 the nearly horizontal tangent sends x1 to 21.56; (b) x = 3.759 km

Common mistakes

  • Starting at the highest point because it is easy to find. The top of a hill is exactly where the tangent is horizontal, so it is the one start Newton-Raphson cannot use; start where the path is steep, close to the lake.
  • Giving a root of the cubic that is not on the path. 8 + 12x − x3 = 0 also has the roots x ≈ −0.69 and x ≈ −3.06, but the path is described only for x ≥ 0.

More solving equations numerically problems, worked step by step →

Worked example: A Drone Coming In to Land: A Start That Sends Newton-Raphson Back and Forth Forever

Question A drone is launched from a roof and flies a programmed path. After x minutes its height is h(x) = −x3 + 6x2 − 10x + 6 meters, so h'(x) = −3x2 + 12x − 10. (a) After 1 minute the drone is only 1 m up, so an engineer starts the Newton-Raphson method at x0 = 1 to find when it lands. Show that the iterates go back and forth between two values forever. (b) Use the method from x0 = 4 to find the time at which the drone lands, to 3 decimal places.

  1. 1.The drone lands when h(x) = 0. From x0 = 1: h(1) = −1 + 6 − 10 + 6 = 1 and h'(1) = −3 + 12 − 10 = −1, so x1 = 1 − 1−1 = 2.

    −20241234minutes after launch, xheight (m), hx0= 1h(1) = 1, h'(1) = −1x1= 1 − 1/(−1) = 2
    −20241234minutes after launch, xheight (m), hx0= 1h(1) = 1, h'(1) = −1x1= 1 − 1/(−1) = 2
    The tangent at x0 = 1, where h = 1 and h'(1) = −1, meets the axis at x1 = 2.
  2. 2.From x1 = 2: h(2) = −8 + 24 − 20 + 6 = 2 and h'(2) = −12 + 24 − 10 = 2, so x2 = 2 − 22 = 1, which is x0 again.

    −20241234minutes after launch, xheight (m), hx0= 1x1= 2h(2) = 2, h'(2) = 2x2= 2 − 2/2 = 1, which is x0
    −20241234minutes after launch, xheight (m), hx0= 1x1= 2h(2) = 2, h'(2) = 2x2= 2 − 2/2 = 1, which is x0
    The tangent at x1 = 2, where h = 2 and h'(2) = 2, meets the axis back at x2 = 1.
  3. 3.(a) Each step repeats an earlier one, so the iterates run 1, 2, 1, 2, … forever and never approach a root. The tangent at x = 1 meets the axis at 2, and the tangent at x = 2 meets it back at 1. Between them the drone dips to about 0.91 m and climbs again, so neither tangent reaches the landing point.

    −20241234minutes after launch, xheight (m), hx0= 1x1= 21, 2, 1, 2, ... foreverthe drone dips to 0.91 m between them
    −20241234minutes after launch, xheight (m), hx0= 1x1= 21, 2, 1, 2, ... foreverthe drone dips to 0.91 m between them
    (a) The two tangents send each estimate to the other, so the iterates run 1, 2, 1, 2, … forever and never reach the landing point.
  4. 4.From x0 = 4: h(4) = −64 + 96 − 40 + 6 = −2, a negative height, which means the formula has already passed the landing. With h'(4) = −48 + 48 − 10 = −10, x1 = 4 − −2−10 = 3.8. Then h(3.8) = −0.232 and h'(3.8) = −7.72, so x2 = 3.8 − −0.232−7.72 = 3.7699.

    −20241234minutes after launch, xheight (m), hx0= 1x1= 2x0= 4from 4: h = −2, h' = −10, x1= 3.8x2= 3.8 − (−0.232)/(−7.72) = 3.7699
    −20241234minutes after launch, xheight (m), hx0= 1x1= 2x0= 4from 4: h = −2, h' = −10, x1= 3.8x2= 3.8 − (−0.232)/(−7.72) = 3.7699
    From x0 = 4 the tangents land at x1 = 3.8 and x2 = 3.7699.
  5. 5.The next step gives x3 = 3.7693, and x4 = 3.7693 again. (b) The drone lands 3.769 minutes after launch, about 3 minutes 46 seconds. Check: h(3.7685) = 0.006 and h(3.7695) = −0.002 have opposite signs.

    −20241234minutes after launch, xheight (m), hx0= 1x1= 2x0= 43.769x3= 3.7693, x4= 3.7693the drone lands after 3.769 minutes
    −20241234minutes after launch, xheight (m), hx0= 1x1= 2x0= 43.769x3= 3.7693, x4= 3.7693the drone lands after 3.769 minutes
    (b) The next estimates are 3.7693 and 3.7693: the drone lands 3.769 minutes after launch, about 3 minutes 46 seconds.

Answer: (a) x1 = 2, x2 = 1, x3 = 2, …: the tangent at each estimate meets the axis at the other, forever; (b) 3.769 minutes

Common mistakes

  • Taking a small value of h as a sign that a root is close. At x = 1 the drone is only 1 m up, but the curve turns back up before it reaches the axis, and the tangent there points the method to x = 2.
  • Running a fixed number of steps and reporting the last one. The iterates 1, 2, 1, 2 never settle, so a root may be stated only when successive iterates agree to the accuracy asked for.

More solving equations numerically problems, worked step by step →

Practice When Newton-Raphson Fails in the app