Newton's Method Calculator

Newton's method, also known as the Newton-Raphson method, is one of the most powerful and widely used algorithms for finding where a function equals zero. Starting from an initial guess x0, it repeatedly improves the estimate by following the tangent line at the current point to where it intersects the x-axis. The update formula is x1 = x0 minus f(x0) divided by f prime(x0). Because the method is based on a linear approximation of the function at each step, it converges quadratically near a simple root: the number of correct decimal places approximately doubles with each iteration. This means a few iterations from a reasonable starting point are usually enough to get many decimal places of accuracy. The classic example is finding the square root of 2 by solving x squared minus 2 = 0. Starting at x0 = 1.5, Newton's method converges to sqrt(2) = 1.4142135... in just a few steps. This calculator lets you enter any function f(x) using JavaScript math notation, an initial guess x0, and a maximum number of iterations up to 20. It computes the derivative numerically using the central difference formula and shows a table of each iteration with the x value, f(x) value, derivative value and the change in x. The iteration stops early if the change is smaller than 1e-12, indicating convergence.

Calculate.co.nz is proud to be partnered with Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
Advertise on this page

Use x for the variable. Examples: x*x-2, Math.sin(x)-0.5, x**3-x-1. Use Math.pow(x,n), Math.sqrt(x), Math.log(x) etc.

1.41421356
root (where f(x) = 0)
f(root)0.00000000
Iterations5
ConvergedYes

Convergence is declared when |x1 - x0| < 1e-12. The derivative is computed numerically by central difference.

nxf(x)f'(x)step

How it works

Newton's method iterates the formula xn+1 = xn - f(xn) / f'(xn). The derivative f'(x) is approximated numerically using the central difference formula: f'(x) ≈ (f(x+h) - f(x-h)) / (2h) with h = 1×10-7. Iteration stops when |step| < 1×10-12 or the maximum number of iterations is reached. If the derivative is zero or near zero at any step, the method cannot continue and a warning is shown.

Worked example

f(x) = x² - 2, x0 = 1.5, 10 iterations. Step 1: x1 = 1.5 - (1.5² - 2)/(2 × 1.5) = 1.5 - 0.25/3 = 1.4167. Step 2: x2 = 1.4167 - (1.4167² - 2)/(2 × 1.4167) = 1.4142. Step 3: the change is already less than 1e-12, so the method converges in about 3 to 4 steps to 1.4142 (√2), matching the defaults pre-filled above.

Related calculators