Where does Newton’s method lead?
Type a function of x, a first guess x₀ and a number of steps. The page runs Newton’s method, shows each estimate, and says whether the estimates have settled.
- Last estimate xₙ
- 1.532088886
After the steps from x₀ = 2, Newton’s method for x^3 - 3x + 1 reaches 1.532088886.
- Settled?
- yes
- Steps
- x₀ = 2; x₁ = 1.666666667; x₂ = 1.548611111; x₃ = 1.532390162; x₄ = 1.532088989; x₅ = 1.532088886; x₆ = 1.532088886
- f′(x) =
- 3x^2 - 3
Last estimate xₙ: 1.532088886. After the steps from x₀ = 2, Newton’s method for x^3 - 3x + 1 reaches 1.532088886.
How it is worked out
How to calculate
Runs Newton’s method xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ) from a first guess x₀ and shows every step.
Example with the default inputs (Function f(x) x^3 - 3x + 1, First guess x₀ 2, Steps 6): After the steps from x₀ = 2, Newton’s method for x^3 - 3x + 1 reaches 1.532088886.
Method: xₖ₊₁ = xₖ − f(xₖ)/f′(xₖ), with f′ from a computer algebra system, checked numerically.
- Steps run in double precision; angles in radians.
- It stops when f′(xₖ) = 0 or f(xₖ) = 0.
Worked examples
Each example is checked against the calculator on every build.
- Function f(x) x^3 - 3x + 1, First guess x₀ 2, Steps 6 gives Last estimate xₙ 1.532089, Settled? yes.Source: OpenStax, Calculus Volume 1, section 4.9 Newton’s Method (https://openstax.org/books/calculus-volume-1/pages/4-9-newtons-method), Example 4.46: x₆ ≈ 1.532088886
- Function f(x) x^2 - 2, First guess x₀ 2, Steps 3 gives Last estimate xₙ 1.414216, Steps x₀ = 2; x₁ = 1.5; x₂ = 1.416666667; x₃ = 1.414215686.Source: OpenStax, Calculus Volume 1, section 4.9 Newton’s Method (https://openstax.org/books/calculus-volume-1/pages/4-9-newtons-method), Example 4.47: x₁ = 1.5, x₂ ≈ 1.416666667, x₃ ≈ 1.414215686 (exactly 577/408)
- Function f(x) x^3 - 2x + 2, First guess x₀ 0, Steps 4 gives Last estimate xₙ 0, Settled? not yet: take more steps or try another x₀.Source: OpenStax, Calculus Volume 1, section 4.9 Newton’s Method (https://openstax.org/books/calculus-volume-1/pages/4-9-newtons-method), Example 4.48: x₀ = 0, x₁ = 1, x₂ = 0, … the estimates swing between 0 and 1
How it works
For f(x), a first guess x₀ and a number of steps n (1 to 50):
- A computer algebra system (nerdamer, open source) finds f′(x), checked against a numeric difference quotient. Typed decimals go to it as exact fractions (1e300 as 10^300). If it writes f′ with a rounded number (a long fraction, or a whole number of more than 15 digits, such as 2^100 written as 1.2676506002282294e+30), there is no answer.
- For k = 0, 1, …, n − 1: xₖ₊₁ = xₖ − f(xₖ)/f′(xₖ), in double precision.
- If f(xₖ) = 0, xₖ is a root and the steps stop.
- If f(xₖ) is not a real number, or f′(xₖ) is 0 or not a real number, there is no answer.
- If xₖ₊₁ is not a real number or is beyond 10³⁰⁰ in size, there is no answer (the estimates run off).
- If xₖ₊₁ = xₖ exactly, the steps stop.
- Last estimate is the last xₖ. Settled? is "yes" when the last step changed x by at most 10⁻¹⁰ × max(1, |xₖ|), or f is exactly 0 there; otherwise "not yet".
- Each estimate shows to 10 significant figures.
Angles are in radians.
Worked examples by hand
f(x) = x³ − 3x + 1, x₀ = 2 (OpenStax Calculus Volume 1, Example 4.46). f′(x) = 3x² − 3. x₁ = 2 − 3/9 = 1.666666667, x₂ ≈ 1.548611111, x₃ ≈ 1.532390162, x₄ ≈ 1.532088989, x₅ ≈ 1.532088886, x₆ ≈ 1.532088886. The root is 2cos(2π/9).
f(x) = x² − 2, x₀ = 2, 3 steps (Example 4.47). x₁ = 2 − 2/4 = 1.5, x₂ = 1.5 − 0.25/3 = 17/12 ≈ 1.416666667, x₃ = 577/408 ≈ 1.414215686.
f(x) = x³ − 2x + 2, x₀ = 0 (Example 4.48). f′(x) = 3x² − 2. x₁ = 0 − 2/(−2) = 1, x₂ = 1 − 1/1 = 0, and the estimates swing between 0 and 1 without settling.
Other questions people ask
What is Newton’s method?
A way to estimate a zero of a differentiable function f. From a guess xₙ, follow the tangent line at (xₙ, f(xₙ)) to where it crosses the x-axis: xₙ₊₁ = xₙ − f(xₙ)/f′(xₙ). Repeat until the estimates stop changing.
How do I use Newton’s method to find a square root?
Find the positive zero of f(x) = x² − a. For √2, use f(x) = x² − 2 and x₀ = 2: x₁ = 1.5, x₂ ≈ 1.416666667, x₃ ≈ 1.414215686, x₄ ≈ 1.414213562. The number of correct digits roughly doubles each step.
How do I choose x₀?
Pick a value close to the root, for example from a graph or from a sign change of f (f(1) < 0 < f(2) means a root between 1 and 2). Different first guesses can lead to different roots.
When does Newton’s method fail?
When f′(xₙ) = 0 (the tangent is flat and never meets the x-axis), when the estimates swing back and forth (f(x) = x³ − 2x + 2 from x₀ = 0 gives 0, 1, 0, 1, …), or when they run away from the root. The page stops with a message in the first case and says "not yet" when the last step still changed x.
How many steps do I need?
Near a simple root, a few. The page stops early when a step no longer changes x; "Settled?" says yes when the last step changed x by at most 10⁻¹⁰ of its size. At a double root, such as x² at 0, the method is slower: each step only halves the distance.
Is Newton’s method the same as the Newton–Raphson method?
Yes. The method is named after Isaac Newton and Joseph Raphson; both names are used for the same formula.