Understanding the Newton-Raphson root finder — concept and principle
The Newton-Raphson method finds a root of an equation p(x) = 0, a value of x where the function crosses zero, by repeatedly improving a starting guess. This calculator applies it to a polynomial whose coefficients you enter from the highest power down, so "1 0 -2" means x² − 2. It is the standard tool when a root has no simple formula, and it is used inside calculators, engineering software and optimisation programs.
How it is calculated
- Start from your guess x₀.
- Repeat xₙ₊₁ = xₙ − p(xₙ) ÷ p′(xₙ), where p′ is the derivative of the polynomial.
- Stop when the change from one step to the next is below 10⁻¹³, when p′(xₙ) = 0, or after 100 iterations.
The calculator evaluates p and p′ with Horner's scheme and reports the root, the iteration count and p(root) as a check.
The principle
Near any point, a smooth curve looks almost like its tangent line. The tangent at xₙ has slope p′(xₙ) and crosses the x-axis at xₙ − p(xₙ) ÷ p′(xₙ). That crossing is usually much closer to the true root than xₙ was, so it becomes the next guess. When the guess is already close to a simple root, the method converges quadratically: the number of correct digits roughly doubles at every step.
Worked example
- Default inputs: coefficients 1 0 −2, so p(x) = x² − 2 and p′(x) = 2x; starting guess x₀ = 1.
- x₁ = 1 − (1 − 2) ÷ 2 = 1.5.
- x₂ = 1.5 − 0.25 ÷ 3 = 1.4166667.
- x₃ = 1.4142157, x₄ = 1.41421356237469, x₅ = 1.41421356237310. The errors shrink from about 0.086 to 0.0025, 2 × 10⁻⁶ and 1.6 × 10⁻¹².
- Step 6 gives x₆ = 1.414213562373095, a change smaller than 10⁻¹³, so the loop stops; every step is counted. Result: root = 1.414213562 (√2), iterations = 6, p(root) = −4.440892e-16.
How to read the result
p(root) should be close to zero. A value like −4.4 × 10⁻¹⁶ is pure floating-point rounding; the root is correct to about 15 significant digits. If p(root) is far from zero, or the iteration count is 100, the method did not converge from that guess. A polynomial can have several roots; the one you get depends on the starting guess, so try different guesses to find the others.
Common mistakes
- Leaving out zero coefficients: x² − 2 must be entered as 1 0 −2, not 1 −2.
- Starting at a point where p′(x) = 0, such as x₀ = 0 for x² − 2; the tangent is flat and the method stops.
- Expecting complex roots: from a real starting value, the iteration stays on the real line.
Frequently asked questions
How do I find all roots of a polynomial?
Run the method from several starting guesses, or sketch the graph first to see roughly where the curve crosses zero.
Why is Newton's method so fast?
Its error at the next step is roughly proportional to the square of the current error, so 10⁻³ becomes about 10⁻⁶ and then 10⁻¹².
What is the bisection method and how does it compare?
Bisection halves an interval where the sign changes. It always converges but gains only about one binary digit per step.
Sources: Burden, R. L., Faires, J. D., Numerical Analysis, Chapter 2: Solutions of Equations in One Variable · Press, W. H., et al., Numerical Recipes, 3rd ed., §9.4 Newton-Raphson Method