🌌 Calculus Kingdom · Calculus

Newton's Method

Approximate a root by sliding down tangent lines: take one step from a starting guess, write the iteration formula, run it to a given precision, and recognise the starts where it gets stuck.

In short

  • Newton's method replaces a curve by its tangent for one step, and takes the tangent's x-intercept as the next guess: x_(n+1) = x_n - f(x_n)/f'(x_n). The minus sign, and the order f over f', are both part of the formula.
  • Differentiate first, then substitute the start. f'(x) is a rule; f'(x_0) is the number you divide by, and the step has no value at all when that number is zero.
  • Work exactly, with fractions, and round only at the very end. Each step roughly squares the error, which roughly doubles the number of correct decimal places β€” so the digits you throw away early are the digits the next step wanted.
  • The method finds a root, not your root. A start with a flat tangent gives no step, a start in the wrong place can cycle or settle on a different root, and the first step is what tells you which.

Slide down the tangent, and land closer

There is a brass rail bolted to the long bench at the Tangent Laboratory, and a bead that runs along it. Technician Fluxion sets the rail against a curve at whatever point you name, lets the bead go, and it slides to where the rail meets the floor. Then the rail is picked up, set against the curve at the *new* point, and the bead slides again. Three or four goes and the bead is sitting almost exactly over a root.

That rail is the tangent line, the floor is the x-axis, and the game is Newton's method.

Here is the whole idea in one picture. You have a guess x0 at a root of f. The curve is complicated, but the tangent at x0 is a straight line, and straight lines are easy: you can find exactly where a line crosses the axis. So you pretend, for one step, that the curve *is* its tangent, take the tangent's x-intercept as your new guess, and repeat.

Work out where that intercept is. The tangent at x0 has slope f'(x0) and passes through the point (x0, f(x0)):

y - f(x0) = f'(x0)*(x - x0)

Set y = 0, because that is what "crosses the x-axis" means, and solve for x:

-f(x0) = f'(x0)*(x - x0) x - x0 = -f(x0)/f'(x0) x = x0 - f(x0)/f'(x0)

And that is the formula. Nothing else in this craft is new:

x_(n+1) = x_n - f(x_n)/f'(x_n)

Read it as a sentence: the new estimate is the old estimate, minus the height divided by the slope. The height f(x_n) says how far off the axis you are; the slope f'(x_n) converts that height into a horizontal distance. A tall curve with a steep slope needs only a small sideways move; the same height on a gentle slope needs a huge one.

Three things to notice before you use it once.

  • The minus sign is doing work. Subtracting walks towards the root; adding walks away from it. This is the single most common slip in the whole topic.
  • The quotient is f over f'. Not f' over f. The units decide it: a height divided by a slope is a length along the x-axis, which is exactly what you want to move.
  • f'(x0) is a number, not a rule. Differentiate to get f'(x), then substitute the start. Leaving 2x in the denominator instead of 2 times the start is the second most common slip.

One step, two steps, and the iteration formula

Take one step, exactly. Let f(x) = x2 - 10 and start at x0 = 3.

f(3) = 9 - 10 = -1 f'(x) = 2x, so f'(3) = 6 x1 = 3 - (-1)/6 = 3 + 1/6 = 19/6

Keep it as 19/6. Do not write 3.17 β€” the next step will double the number of correct digits you have, so it can only double the digits you actually hand it. Rounding early is throwing away the answer before you have finished earning it.

Take another. From x1 = 19/6:

f(19/6) = 361/36 - 10 = 1/36 f'(19/6) = 19/3 x2 = 19/6 - (1/36)/(19/3) = 19/6 - 1/228 = 721/228 = 3.162280...

The true square root of 10 is 3.1622776... So x1 was right to 1 decimal place, and x2 is right to 5. That is the pattern: the number of correct decimal places roughly doubles at every step.

Write the iteration once and reuse it. Instead of doing the algebra from scratch each time, substitute f and f' into the formula and keep the result. Writing x for x_n:

f(x) = x2 - a => x_(n+1) = x - (x2 - a)/(2x)

Tidy that up and something lovely happens:

x - (x2 - a)/(2x) = (2x2 - x2 + a)/(2x) = (x2 + a)/(2x) = (x + a/x)/2

Average your guess with a divided by your guess. That rule is thousands of years older than calculus, and Newton's method has just rediscovered it. Two more worth knowing:

  • f(x) = x3 - a gives x_(n+1) = x - (x3 - a)/(3x2), which tidies to (2x3 + a)/(3x2).
  • f(x) = 1/x - a gives x_(n+1) = 2x - a*x2, with no division anywhere at all. That is how a machine with no divider builds reciprocals: it multiplies its way to 1/a and then multiplies by the numerator.

When you write an iteration down, bracket the whole denominator. x - (x3 - 2x - 5)/(3x2 - 2) is right; leaving those last brackets off changes what the division applies to.

Choosing the f, and reading the table

Newton's method answers exactly one question: where is a root of f? So every problem begins by turning "find this number" into "find a root of this function". Write the number you want as an equation, then move everything to one side so the other side is 0.

  • the square root of 7 -> x2 = 7 -> f(x) = x2 - 7
  • the cube root of 20 -> x3 = 20 -> f(x) = x3 - 20
  • the solution of cos(x) = x -> f(x) = x - cos(x)
  • the solution of x*ex = 1 -> f(x) = x*ex - 1

Check your choice by substituting the number you wanted: a correct f gives exactly 0 there. Note that f(x) = x2 + 7 has no real root at all, and f(x) = sqrt(x) - 7 has its root at 49 rather than at the square root of 7 β€” both are the same slip, of writing the equation down without rearranging it.

Then pick a start. A rough sketch, a sign change, or simply the nearest whole number is enough; the method is forgiving about where you begin, so long as you begin somewhere sensible.

Knowing when to stop. Newton's method never announces that it has arrived, so you need a rule. The usual one is a gap test: stop as soon as

|x_(n+1) - x_n| < 0.001

Read that carefully, because the answer to "at which n" is the smaller subscript. Suppose a run on x2 - 45 from x0 = 8 gives

x0 = 8.000000, x1 = 6.812500, x2 = 6.709002, x3 = 6.708204, x4 = 6.708204

The gaps are 1.187500, then 0.103498, then 0.000798. The first gap under 0.001 is |x3 - x2|, so n = 2, and x3 is the estimate you keep. There are five numbers in that list but only four gaps between them, which is why counting rows gives the wrong answer.

Knowing how good the answer is. If you happen to know the true value, compare digit by digit after the decimal point and stop at the first disagreement. Against sqrt(45) = 6.708204, the estimate 6.709002 agrees in the 7 and the 0 and then differs at the next digit, so it has earned 2 decimal places; 6.708204 has earned all six shown. And if you know only that the error is about 0.01 right now, you already know a great deal about the next step: the error is roughly squared, so about 0.0001 comes next, and about 0.00000001 after that. Halving would be a slow method; squaring is why three or four steps is usually the whole job.

When the method gets stuck

Newton's method is fast, not infallible. Four things can go wrong, and all four are visible in the picture of the sliding tangent.

A horizontal tangent. If f'(x0) = 0 the step divides by zero, and there is no next estimate at all. Geometrically the tangent is a flat line that never meets the x-axis, so the bead has nowhere to slide to. Take f(x) = x2 - 8x + 3 from x0 = 4: f'(x) = 2x - 8, so f'(4) = 0 and the method stops before it starts. The cure is trivial β€” start a little to the left or the right. It is worth checking the derivative at a candidate start *before* iterating, because this one costs nothing to spot.

A nearly horizontal tangent. Not zero, but small, and the step is enormous. From f(x) = x2 - 7 at x0 = 0.1 the slope is only 0.2, and

x1 = 0.1 - (-6.99)/0.2 = 35.05

The estimate is thrown far away. Nothing is broken β€” the method works its way back and does eventually settle on the square root of 7 β€” but a start near a turning point costs several wasted steps.

A cycle. Take f(x) = x3 - 2x + 2 from x0 = 0. Then f(0) = 2 and f'(0) = -2, so x1 = 1. And f(1) = 1, f'(1) = 1, so x2 = 0. The estimates bounce between 0 and 1 for ever and the real root near -1.769 is never approached. A tiny change of start breaks the cycle at once.

The wrong basin. This one is not a breakdown, and it catches people out precisely because everything looks healthy. Newton's method has no idea which root you were hoping for; it goes wherever the tangent points. For f(x) = x2 - 25, whose roots are 5 and -5, a start at x0 = -1 gives

x1 = -1 - (1 - 25)/(-2) = -1 - 12 = -13

and the estimates then close in tidily on -5. The method has done its job perfectly and answered a different question. The root you find is chosen by the start, not by which root is nearest β€” and with three roots in play the nearest root often is not the one you land on. Work the first step out and see which root x1 has landed beside; that is what decides, every time.

Worked examples

Example 1

f(x) = x3 - 2x - 5. Newton's method starts at x0 = 2. Work out x1 exactly, as a fraction in lowest terms.

  1. Differentiate first, so that both pieces of the formula are ready: f'(x) = 3x2 - 2.
  2. Evaluate the height at the start: f(2) = 8 - 4 - 5 = -1.
  3. Evaluate the slope at the start β€” a number, not a rule: f'(2) = 3(4) - 2 = 10.
  4. Substitute into x1 = x0 - f(x0)/f'(x0): x1 = 2 - (-1)/10.
  5. Subtracting a negative adds: x1 = 2 + 1/10 = 21/10. As a decimal that is 2.1, and the true root is 2.0946, so one step from a whole number has already earned a decimal place.

Example 2

Use Newton's method to approximate the square root of 10. Take x0 = 3 and give x2 to 3 decimal places.

  1. Choose the function whose root is the number wanted: x2 = 10 rearranges to f(x) = x2 - 10, and f'(x) = 2x.
  2. First step: f(3) = -1 and f'(3) = 6, so x1 = 3 - (-1)/6 = 19/6.
  3. Keep the fraction. Second step: f(19/6) = 361/36 - 10 = 1/36, and f'(19/6) = 19/3.
  4. x2 = 19/6 - (1/36)/(19/3) = 19/6 - 1/228 = 721/228.
  5. As a decimal, x2 = 3.162280, so to 3 decimal places x2 = 3.162. The true value is 3.1622777, so two steps from a whole number have earned five decimal places.

Example 3

f(x) = (x - 1)(x - 2)(x - 4), whose roots are 1, 2 and 4. Newton's method starts at x0 = 3. Which root do the estimates settle on, and why is that surprising?

  1. Expand so the derivative is easy: f(x) = x3 - 7x2 + 14x - 8, so f'(x) = 3x2 - 14x + 14.
  2. At the start: f(3) = 27 - 63 + 42 - 8 = -2, and f'(3) = 27 - 42 + 14 = -1.
  3. One step: x1 = 3 - (-2)/(-1) = 3 - 2 = 1.
  4. x1 has landed exactly on the root at 1, so every later estimate stays there: the sequence settles on 1.
  5. The surprise is that 2 and 4 are both nearer to the start than 1 is. Newton's method does not go to the nearest root; the tangent at the start decides, and here it pointed straight past two roots to a third.

Practice problems, with solutions

Three problems of increasing difficulty, each with the full working. In the game these are generated fresh every time; these three are fixed so this page always shows the same ones.

Problem 1

Difficulty 1 of 5

f(x) = x2 - 14 Newton's method starts at x0 = 4. Work out x1 = x0 - f(x0)/f'(x0). Give the exact value as a fraction in lowest terms.

Answer: 3 3/4

  1. f(x) = x2 - 14
  2. f'(x) = 2x
  3. f(4) = 2
  4. f'(4) = 8
  5. x1 = 4 - (2)/(8) = 15/4
  6. As a decimal that is about 3.7500.

Problem 2

Difficulty 3 of 5

f(x) = x2 - x - 1 Write the Newton iteration for this function: give x_(n+1) in terms of x_n. Use x for x_n, and give your answer as an expression in x. You do not have to simplify it.

Answer: x - (x2 - x - 1)/(2*x - 1)

  1. f(x) = x2 - x - 1
  2. f'(x) = 2x - 1
  3. x_(n+1) = x_n - f(x_n)/f'(x_n)
  4. Writing x for x_n: x - (x2 - x - 1)/(2x - 1)

Problem 3

Difficulty 4 of 5

f(x) = x3 - 35 Start at x0 = 3 and take two steps of Newton's method. Give x2 to 3 decimal places.

Answer: 3.271

  1. f(x) = x3 - 35 and f'(x) = 3x2.
  2. x1 = 3 - (-8)/(27) = 89/27
  3. Now step again from 89/27: x2 = 89/27 - f(89/27)/f'(89/27).
  4. x2 = 2098843/641601
  5. As a decimal, x2 = 3.271259, which is 3.271 to 3 decimal places.

Common mistakes

  • Getting the formula's shape wrong: adding the correction instead of subtracting it, or turning the quotient upside down and dividing f'(x0) by f(x0). Adding walks away from the root rather than towards it, and the units settle the order β€” the correction is a distance along the x-axis, and only a height divided by a slope gives one.
  • Forgetting to evaluate the derivative at the start β€” leaving 2x, or 3x2 - 2, in the denominator instead of the number it takes at x0. Differentiate, then substitute, then divide, in that order.
  • Rounding the intermediate estimate. Turning x1 = 19/6 into 3.2 before the second step throws away exactly the digits Newton was about to double, and the final answer is wrong in the third decimal place. Carry the fraction, or carry far more digits than the question asks for.
  • Assuming the estimates go to the nearest root. They go wherever the tangent points, which with several roots is often somewhere else entirely. Work out x1 and see which root it has landed beside before answering.
  • Giving the correction f(x0)/f'(x0) as the answer, or stopping one step early. Read what is asked: x1 is the start minus the correction, and x2 is one whole step further on.

What you should be able to do

  • Take one Newton step x1 = x0 - f(x0)/f'(x0) exactly.
  • Write the iteration formula for a given function.
  • Iterate to a stated precision, read a table of successive estimates, and judge how many decimal places an estimate has earned.
  • Choose a function whose root is the number wanted, and recognise a start that gets stuck.

Where this fits in the curriculum

Common Core

  • CHA-3.F

    AP Calculus AB, Unit 4 β€” Approximate a value of a function using local linearity and linearization.

    The Common Core has no calculus standards and Newton's method is not an AP Calculus AB objective; each step is the x-intercept of a tangent line, so the linearization objective is the closest one.

Learn these first