Applications

Newton’s Method: Formula, Worked Example and When It Fails

Newton’s Method: Formula, Worked Example and When It Fails — CalculusCalc cover image

Newton’s method (Newton–Raphson) is a fast way to approximate a root of \( f(x) = 0 \) when you can’t solve it with algebra. Start with a guess \( x_0 \) and repeat:

$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$$

Each pass through the formula is called an iteration. You keep iterating until two successive values agree to the number of decimal places you need.

Why it works: the tangent line picture

Near any point, a smooth curve looks almost like its tangent line. That is the whole idea behind linear approximation. A line is easy to solve: you can always find exactly where it crosses the x-axis. So Newton’s method replaces the hard problem (where does the curve cross?) with an easy one (where does the tangent line cross?), and uses the answer as a better guess.

If your guess is already close to the root, the tangent line hugs the curve tightly in that region, so its x-intercept lands very close to the true root. That is why the method speeds up dramatically as it closes in.

Where the formula comes from

At the current guess \( x_n \), replace the curve by its tangent line:

$$y = f(x_n) + f'(x_n)(x - x_n)$$

Set \( y = 0 \) and solve for \( x \). That x-intercept is the next guess. Each step “slides down the tangent” to the axis.

Here is the algebra, one step at a time. Setting \( y = 0 \) gives \( 0 = f(x_n) + f'(x_n)(x - x_n) \). Subtract \( f(x_n) \) from both sides, then divide by \( f'(x_n) \), which is allowed as long as the slope is not zero:

$$x - x_n = -\frac{f(x_n)}{f'(x_n)}$$

Add \( x_n \) to both sides and call the result \( x_{n+1} \). That is exactly the Newton formula. Notice the division by \( f'(x_n) \): this is where things break when the tangent is flat.

How to apply Newton’s method step by step

  1. Rewrite the equation in the form \( f(x) = 0 \). For example, \( \cos x = x \) becomes \( \cos x - x = 0 \).
  2. Find \( f'(x) \). A derivative calculator is handy for checking this step.
  3. Pick a starting value \( x_0 \) close to the root. A sign change of \( f \) tells you a root is nearby.
  4. Apply the formula repeatedly, keeping plenty of decimal places.
  5. Stop when successive values agree to the accuracy you need, then plug the result into \( f \) to confirm it is nearly zero.

Worked example: x³ − 2x − 5 = 0

This is the equation Newton himself used. \( f(x) = x^3 - 2x - 5 \), \( f'(x) = 3x^2 - 2 \). Start at \( x_0 = 2 \) (since \( f(2) = -1 \) and \( f(3) = 16 \), a root lies between).

n \( x_n \) \( f(x_n) \)
0 2 \( -1 \)
1 2.1 0.061
2 2.0945681 0.000186
3 2.0945515 \( \approx 2\times10^{-9} \)

Step 1 in detail: \( x_1 = 2 - \frac{-1}{3(4) - 2} = 2 + \frac{1}{10} = 2.1 \).

Step 2: at \( x_1 = 2.1 \) the function value is 0.061 and the slope is \( 3(2.1)^2 - 2 = 11.23 \), so you subtract \( 0.061 / 11.23 \approx 0.0054319 \) to land on 2.0945681.

The root is \( x \approx 2.0945515 \). Notice how the number of correct digits roughly doubles each step. That is quadratic convergence.

Example 2: computing √2

A square root is a root of \( f(x) = x^2 - 2 \). The formula simplifies to

$$x_{n+1} = x_n - \frac{x_n^2 - 2}{2x_n} = \frac12\left(x_n + \frac{2}{x_n}\right)$$

This is the ancient Babylonian method. From \( x_0 = 1.5 \): \( x_1 = 1.41667 \), \( x_2 = 1.4142157 \), already correct to 5 decimal places (\( \sqrt2 = 1.4142136\ldots \)).

The simplified form has a nice interpretation: if your guess is too big, then \( 2/x_n \) is too small, and averaging the two lands you in between.

Example 3: solving cos x = x

No algebra trick solves this equation, so it is a perfect Newton problem. Rewrite it as \( f(x) = \cos x - x \), with derivative \( f'(x) = -\sin x - 1 \). Because \( f(0) = 1 \) is positive and \( f(1) \approx -0.46 \) is negative, a root lies between 0 and 1. Start at \( x_0 = 1 \), working in radians.

$$x_1 = 1 - \frac{\cos 1 - 1}{-\sin 1 - 1} \approx 0.7503639$$

Repeating gives \( x_2 \approx 0.7391129 \) and \( x_3 \approx 0.7390851 \). The next iteration agrees with \( x_3 \) to all the digits shown, so the solution is \( x \approx 0.7390851 \). Three steps from a rough guess gave seven correct decimals.

Example 4: an exam-style question

A typical test asks: “Use Newton’s method with \( x_0 = 1 \) to find \( x_2 \) for \( x^3 - x - 1 = 0 \).” Here \( f'(x) = 3x^2 - 1 \).

  • First step: \( f(1) = -1 \) and \( f'(1) = 2 \), so \( x_1 = 1 - \frac{-1}{2} = 1.5 \).
  • Second step: \( f(1.5) = 0.875 \) and \( f'(1.5) = 5.75 \), so \( x_2 = 1.5 - \frac{0.875}{5.75} \approx 1.3478 \).

The true root is about 1.3247, which you reach after two more iterations. On exams, show each \( f(x_n) \) and \( f'(x_n) \) so partial credit is easy to award.

When Newton’s method fails

  • Zero derivative: if \( f'(x_n) = 0 \), the tangent is horizontal and never meets the axis.
  • Bad starting point: for \( f(x) = x^3 - 2x + 2 \) starting at \( x_0 = 0 \), the iterates bounce between 0 and 1 forever.
  • Wrong root: a guess near a local max or min can shoot off to a distant root.
  • Divergence: for \( f(x) = x^{1/3} \), every step doubles the distance from the root.

To see the cycle in the second bullet, compute it yourself: from 0 the slope is \( -2 \) and \( f(0) = 2 \), so the next guess is 1. From 1 the slope is 1 and \( f(1) = 1 \), so the next guess is 0 again. The method never escapes.

The divergence in the last bullet is just as concrete. For \( f(x) = x^{1/3} \) the formula simplifies to \( x_{n+1} = -2x_n \): the tangent is so steep near zero, and so flat far away, that every jump overshoots by more than it gained.

Tip: pick \( x_0 \) close to the root. The Intermediate Value Theorem (a sign change of \( f \)) or a quick plot in the visual lab helps.

Why it converges so fast

Suppose \( r \) is the root and the error at step \( n \) is \( e_n = x_n - r \). Expanding \( f \) around \( x_n \) with a second-order Taylor series and using the Newton formula shows that, when \( f'(r) \ne 0 \),

$$e_{n+1} \approx \frac{f''(r)}{2f'(r)}\,e_n^2$$

Squaring the error is what doubles the digits. An error of 0.01 becomes roughly 0.0001, then 0.00000001. Compare that with bisection, which only halves the error each step. The catch is the phrase “near the root”: the estimate only holds once you are already close.

When the root is a repeated root (for example \( f(x) = (x - 1)^2 \)), \( f'(r) = 0 \) and the speed drops to linear: the error only shrinks by a constant factor each step.

Common mistakes

  • Not rewriting as f(x) = 0. For \( e^x = 3 \), use \( f(x) = e^x - 3 \), not \( f(x) = e^x \).
  • Adding instead of subtracting. The formula is \( x_n \) minus \( f/f' \). A sign slip sends you away from the root.
  • Using degrees. Calculus formulas for \( \sin \) and \( \cos \) assume radians. Put your calculator in radian mode.
  • Rounding too early. Keep at least two more digits than you need in every intermediate value, or the final answer drifts.
  • Evaluating f’ at the wrong point. Both \( f \) and \( f' \) must be evaluated at the current \( x_n \), not at \( x_0 \).

Newton’s method in optimization

To find a maximum or minimum, apply Newton’s method to \( f'(x) = 0 \). The update becomes \( x_{n+1} = x_n - \frac{f'(x_n)}{f''(x_n)} \), which is how many critical points are found numerically.

Where Newton’s method is used

Calculators and computer libraries use Newton-style iterations to compute square roots and even division: the update \( x_{n+1} = x_n(2 - a x_n) \) converges to \( 1/a \) using only multiplication and subtraction. Engineers use it to solve equations of state, and statisticians use its multivariable version to fit models. It is also a close cousin of Euler’s method: both follow tangent lines, but Euler’s method uses them to trace a solution curve, while Newton’s method uses them to hunt for a zero.

Newton’s method calculator

Enter \( f(x) \), a starting guess and the number of iterations. The gadget shows every step:

Differential#7

Newton's Method Root Finder

Iterates \(x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}\) and shows every step.

For a full-page version with a step table, open the Newton’s method calculator.

Practice problems

Try these before checking the answers.

  1. Newton step for \( x^2 - 5 \) from \( x_0 = 2 \)
  2. Next step from \( x_1 = 2.25 \)
  3. Formula for \( \sqrt[3]{a} \)
  4. One Newton step for \( \cos x - x \) from \( x_0 = 1 \)
  5. Find \( x_2 \) for \( x^3 - x - 1 \) from \( x_0 = 1 \)
  6. Use \( x_{n+1} = x_n(2 - 3x_n) \) twice from \( x_0 = 0.3 \) to approximate \( 1/3 \)

Answers: (1) \( x_1 = 2.25 \); (2) \( x_2 \approx 2.236111 \); (3) \( x_{n+1} = \frac{2x_n^3 + a}{3x_n^2} \); (4) \( x_1 \approx 0.750364 \); (5) \( x_2 \approx 1.347826 \); (6) \( x_1 = 0.33 \), \( x_2 = 0.3333 \).

FAQ

How many iterations do I need?

Usually very few. Stop when successive values agree to the accuracy you need.

Is Newton’s method always faster than bisection?

Near a simple root, yes, much faster. But bisection always converges when you have a sign change; Newton’s method can fail with a bad start.

What happens if f'(x) = 0 at my guess?

The formula divides by zero, because the tangent line is horizontal and never reaches the x-axis. Choose a different starting value, ideally one where the graph is clearly sloping toward the root.

How do I choose a good starting value?

Look for a sign change: if \( f(a) \) and \( f(b) \) have opposite signs, a root lies between them, so start near the middle or at the endpoint where \( |f| \) is smaller. A quick sketch also shows whether a local max or min sits between your guess and the root.

Can Newton’s method find more than one root?

Yes, but each run finds only one. Start near each root you want. Different starting values can lead to different roots, and near a turning point a small change in \( x_0 \) can change which root you get.

Further reading

Calculators for this topic

Leave a comment

Your email address will not be published. Required fields are marked *