Newton’s Method Calculator

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Differential#7

Newton's Method Root Finder

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

This Newton’s method calculator finds a root of \( f(x) = 0 \) numerically. You give it a function and a starting guess, and it runs Newton’s iteration step by step, showing \( x_n \), \( f(x_n) \) and the next estimate \( x_{n+1} \) in a table, then reports the root it lands on and how close \( f \) is to zero there.

Use it to check a numerical analysis assignment, see how fast the method converges, or find where a guess goes wrong. It’s free and needs no sign-up.

How to use the Newton’s method calculator

  1. Enter \( f(x) \), written so that you are solving \( f(x) = 0 \). To solve \( \cos x = x \), type cos(x) - x. Use ^ for powers, sqrt(x), sin(x), ln(x), e^(x) and pi; implicit multiplication such as 2x works.
  2. Enter the initial guess \( x_0 \). A sketch of the graph (try the graphing calculator), or a sign change of \( f \) between two numbers, helps you choose it.
  3. Set the number of iterations (1 to 50). Five or six is usually plenty.
  4. Press Iterate. If two iterates agree to machine precision before the limit, the calculator stops early and labels the result “Root (converged)”; otherwise it shows “Root estimate”.

You don’t need to enter \( f'(x) \). The calculator differentiates your function exactly.

Formula

Newton’s method replaces the curve with its tangent line at \( x_n \) and moves to where that line crosses the x-axis:

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

Near a simple root, each step roughly doubles the number of correct digits (quadratic convergence), which is why a handful of iterations is often enough.

Worked example

Solve \( \cos x = x \), that is, find the root of \( f(x) = \cos x - x \), starting at \( x_0 = 1 \).

The derivative is \( f'(x) = -\sin x - 1 \), so the update is

$$x_{n+1} = x_n - \frac{\cos x_n - x_n}{-\sin x_n - 1}$$

\( n \) \( x_n \) \( f(x_n) \) \( x_{n+1} \)
0 1 \( -0.45969769 \) 0.75036387
1 0.75036387 \( -0.018923074 \) 0.73911289
2 0.73911289 \( -0.000046455899 \) 0.73908513
3 0.73908513 \( -2.8472058 \times 10^{-10} \) 0.73908513

The root is \( x \approx 0.739085133215 \). Look at \( f(x_n) \): the error shrinks from about \( 10^{-2} \) to \( 10^{-5} \) to \( 10^{-10} \), which is quadratic convergence in action. Enter cos(x) - x with \( x_0 = 1 \) above to reproduce the table; it adds one more row confirming the value no longer changes, then stops.

When Newton’s method fails (and how the calculator shows it)

  • Zero derivative. If \( f'(x_n) = 0 \), the tangent is horizontal and never meets the x-axis. The calculator stops with a message asking you to choose another starting point. Example: x^2 - 4 with \( x_0 = 0 \).
  • Cycling. For \( f(x) = x^3 - 2x + 2 \) starting at \( x_0 = 0 \): \( x_1 = 0 - \frac{2}{-2} = 1 \), then \( x_2 = 1 - \frac{1}{1} = 0 \). The iterates bounce between 0 and 1 forever. Run it with 6 iterations and the table makes this obvious, and the final \( f(\text{root}) \) is 2, nowhere near zero. Always check that value.
  • Undefined values. If an iterate leaves the domain (for example a negative input to ln(x)), the calculator reports where \( f \) or \( f' \) is undefined.
  • Wrong root. With several roots, Newton’s method finds the one its starting point leads to, which isn’t always the nearest. Try different guesses to find the others.

For the derivation and more on convergence, read the Newton’s method guide. Because every step is a tangent line, the equation of a tangent line guide is useful background too, and the tangent line calculator shows the line at your starting guess.

Related guides

Further reading

FAQ

How many iterations of Newton’s method do I need?

Near a simple root, usually 4 to 6 are enough for full calculator precision, because the number of correct digits roughly doubles each step. The calculator stops early once the iterates stop changing.

How do I choose the initial guess?

Pick a value close to the root, ideally between two points where \( f \) changes sign and away from places where \( f'(x) = 0 \).

Why doesn’t Newton’s method converge for my function?

The usual causes are a starting point near a horizontal tangent, a cycle between two values, or a root where \( f' \) is also zero, which slows convergence. Try another starting point and check that \( f(\text{root}) \) is close to 0.

Can it solve an equation like e^x = 3x?

Yes. Move everything to one side and enter e^x - 3x. The calculator finds a root of that function, which is a solution of the original equation.

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators