Newton's Method Calculator

Find roots iteratively with tangent lines, watching each guess improve in a table.

Newton's Method Calculator

What Is Newton's Method?

Newton's method (also called the Newton–Raphson method) is an iterative algorithm for solving equations of the form f(x) = 0 — finding roots, the input values where a function's output vanishes. Most equations can't be solved by algebra: x³ − x − 2 = 0 has no nice factored form, and cos(x) = x has no closed-form solution at all. Newton's method sidesteps algebra entirely with a geometric idea: from a guess, slide down the tangent line.

Starting from a guess xₙ, draw the tangent line to f at that point; the tangent is a line, so finding where it crosses zero is trivial. That crossing becomes the next guess:

xn+1 = xn − f(xn) / f'(xn)

Because tangent lines hug curves closely (the whole point of linear approximation), each new guess is dramatically better than the last. Near a well-behaved root, the number of correct decimal places roughly doubles every iteration — a property called quadratic convergence that makes Newton's method one of the fastest root-finders known.

How to Use This Calculator

Enter the function whose root you want (rearrange your equation into f(x) = 0 form first — to solve cos(x) = x, enter cos(x) - x), an initial guess, and a maximum iteration count. The calculator differentiates f symbolically, then runs the iteration, displaying a complete table: each xₙ, f(xₙ), f'(xₙ), and the next guess. It stops when successive guesses agree to 12 decimal places (converged) or when trouble arises — a horizontal tangent, an undefined value — and says which. The graph marks your starting point and the converged root on the curve.

Worked Example: Computing √2 by Hand

Solve x² − 2 = 0 from x₀ = 1. Here f'(x) = 2x, so the iteration is xn+1 = xₙ − (xₙ² − 2)/(2xₙ):

nxₙcorrect digits
011
11.52
21.41666…3
31.4142156…6
41.4142135623747…12

Four iterations produce √2 to twelve digits — the doubling of correct digits per step is quadratic convergence made visible. (This particular iteration is, in fact, the ancient Babylonian square-root algorithm rediscovered.)

When Newton's Method Struggles

  • Horizontal tangents. If f'(xₙ) ≈ 0, the tangent line is nearly flat and its zero-crossing shoots far away (or nowhere). The calculator halts with an explanation; restart with a guess away from critical points.
  • Bad starting guesses. Far from a root, tangent lines can send iterates bouncing chaotically or toward a different root than intended. Plotting first (or bracketing with sign changes) tames this.
  • Multiple roots. At a repeated root (like x² = 0), f and f' vanish together and convergence degrades from quadratic to merely linear — the method still works, just slower.
  • Cycles. Rare functions make the iteration oscillate between two values forever. A different x₀ almost always breaks the cycle.

Real-World Applications

Newton's method (and its variants) is the workhorse root-finder inside scientific software. Your calculator's square-root button runs essentially the iteration above; GPS receivers solve nonlinear positioning equations with Newton steps; and circuit simulators like SPICE solve the nonlinear equations of transistor networks by Newton iteration at every time step of every simulation. In finance, the "implied volatility" quoted on options markets is extracted from the Black–Scholes formula by Newton's method — there is no closed-form inverse, so iteration is the only way.

The method also scales up: in many dimensions it drives the optimization algorithms that train statistical models and solve engineering design problems (there, the "root" sought is a zero of the gradient, connecting directly to critical point finding). Robotics inverse kinematics — computing the joint angles that place a robot arm's hand at a target — is solved with Newton iterations thousands of times per second, and weather models use Newton-type solvers inside every forecast timestep. Whenever software says "solver converged in 6 iterations," odds are excellent a Newton-type step was involved.

Frequently Asked Questions

How do I choose a good initial guess?

Sketch or plot the function and start near where it visibly crosses zero. Failing that, find two x-values where f has opposite signs — a root lies between them (by the Intermediate Value Theorem), and either endpoint makes a reasonable x₀.

Why does the formula subtract f(x)/f'(x)?

It's the tangent line solved for its own zero: the tangent at xₙ is y = f(xₙ) + f'(xₙ)(x − xₙ), and setting y = 0 gives x = xₙ − f(xₙ)/f'(xₙ). The correction term is literally "how far the tangent line says you are from the root."

How is this different from the bisection method?

Bisection halves a sign-change interval each step — guaranteed but slow, gaining one binary digit per iteration. Newton's method gains roughly double the digits each step but needs a derivative and a decent start. Production solvers often combine both: bisection's safety with Newton's speed.

What happens if my equation has several roots?

Newton's method converges to one of them, determined by the starting guess — usually the nearest, though the basins of attraction can be surprisingly intricate (for complex polynomials they're literal fractals). Run the method from several different guesses to collect multiple roots.

Can I solve equations that aren't set equal to zero?

Rearrange first: to solve g(x) = h(x), define f(x) = g(x) − h(x) and find its roots. The example button "cos(x) = x" does exactly this, entering cos(x) − x as f.

What does "quadratic convergence" mean precisely?

It means the error at each step is roughly proportional to the square of the previous error: if you're off by 0.01 now, expect to be off by about 0.0001 next iteration, then 0.00000001. In digit terms, correct decimal places double each round — visible directly in the worked example's table, where the digit count went 1, 2, 3, 6, 12. Compare that with bisection's steady one-bit-per-step crawl and you see why Newton-type methods dominate scientific computing whenever a derivative is available. The catch is that the guarantee is local: quadratic speed kicks in only once the iterate is reasonably close to a simple root, which is why a decent starting guess matters so much.