Newton–Raphson Explained with Worked Examples

The Newton–Raphson method improves an estimate of a root of with .

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

Before you start

This page is easier if you are comfortable with:

What Newton–Raphson means

Draw the tangent to the curve at and see where it meets the -axis; that point is . The tangent has gradient (see the tangent at a point), and setting its equation to zero gives the formula. A starting value can be found from a change of sign.

Convergence is very fast: the number of correct digits roughly doubles each step, as explained in Newton's quadratic convergence. For with : , . It fails when , or when the start is far from the root. It is a special case of fixed-point iteration with .

The method needs derivatives, so see the derivative of a power and the second derivative for the shape. Without a derivative, use the secant method. The same idea in optimisation is Newton's method for optimisation.

What is it used for?

Newton–Raphson follows the tangent down to the axis. Each step roughly doubles the number of correct digits.

How to use newton–raphson

  1. Write and .
  2. Choose a starting value near the root.
  3. Compute , and repeat.
  4. Stop when successive values agree to the required accuracy.

Graph

The tangent to y = x² − 2 at x = 1.5 meets the axis at 1.4167x0 = 1.5x1 = 1.416700.20.40.60.811.21.41.61.822.2-2-10123The tangent to y = x² − 2 at x = 1.5 meets the axis at 1.4167xyy = x² − 2tangent at x = 1.5Graph with x from 0 to 2.2 and y from -2 to 3. Shows the curve y = x² − 2; the curve tangent at x = 1.5; point x0 = 1.5 at (1.5, 0.25); point x1 = 1.4167 at (1.4167, 0).

The tangent crosses the axis very close to the true root √2 = 1.4142.

Worked examples

These examples are worked by hand, step by step, so you can compare your own working.

Example 1: square root of 2

Use Newton–Raphson on from to find and .

Worked example
Answer
x2≈1.41422x_2\approx1.41422
  1. x₁
  2. x₂

Example 2: a cubic

Use Newton–Raphson on from to find .

Worked example
Answer
x1≈1.52174x_1\approx1.52174
  1. f and f'
  2. x₁

Example 3: cos x = x

Use Newton–Raphson on from to find .

Worked example
Answer
x1≈0.75036x_1\approx0.75036
  1. f and f'
  2. x₁

Special cases

A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.

f = x² − 2, x₀ = 1

x₁ = 1 − (−1)/2

1.5.

x₂

1.5 − 0.25/3

1.4167.

f = x³ − x − 1, x₀ = 1.5

1.5 − 0.875/5.75

1.3478.

f = x² − 5, x₀ = 2

2 − (−1)/4

2.25.

Word problems

xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ). It converges quickly (roughly doubling the correct digits) when started near a simple root, but can fail where f′ ≈ 0.

x² − 2

x₀ = 1: f = −1, f′ = 2.

  1. 1 + 0.5
  2. Check: ✓1.5

Second step

x₁ = 1.5: f = 0.25, f′ = 3.

  1. 1.5 − 0.0833
  2. Check: ✓1.4167

Cubic Higher

x³ − x − 1, x₀ = 1.5.

  1. 1.5 − 0.875/5.75
  2. Check: ✓1.3478

x² − 5 Higher

x₀ = 2.

  1. 2 + 0.25
  2. Check: ✓2.25

Common mistakes

Forgetting f′

xₙ − f(xₙ) ✗

divide by f′(xₙ) ✓

Tangent.

Start at a stationary point

works ✗

f′ = 0 fails ✓

Division by zero.

Sign slip

xₙ + f/f′ ✗

xₙ − f/f′ ✓

Minus.

Degrees

mixed ✗

radians ✓

Units.

Exam tips

  1. xₙ₊₁ = xₙ − f/f′.
  2. Start near the root.
  3. Avoid f′ = 0.
  4. Quadratic convergence.
  5. Tangent intercept.

Practice questions

Try each one on paper, then open the answer. Use the solver above to see the full working.

1. x₁ for x² − 3, x₀ = 2 Foundation

1.75

2. x₁ for x² − 10, x₀ = 3 Foundation

3.1667

3. x₁ for x³ − 2, x₀ = 1 Foundation

1.3333

4. x₁ for x² − 2, x₀ = 2 Higher

1.5

5. x₁ for cos x − x, x₀ = 1 to 4 d.p. Higher

0.7504

6. x₁ for e^x − 3, x₀ = 1 to 4 d.p. Higher

1.1036

Practice generator

Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.

Solve: …

Key terms

Newton–Raphson method
Tangent-based iteration.
Tangent
Line of slope f′.
Quadratic convergence
Digits double.
Starting value
x₀.
Derivative f′
Slope.
Simple root
f′ ≠ 0 there.

Frequently asked questions

What is the Newton–Raphson formula?

xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ).

Where does it come from?

The x-intercept of the tangent.

When does it fail?

Where f′ is 0 or the start is poor.

How fast is it?

Quadratically.

Which page covers first-order integrating factors?

first-order linear integrating factor.

Which page covers fixed-point iteration?

fixed-point iteration.

More in Numerical methods and optimisation and the formula sheets.