Newton’s method in this visualization
Newton’s method approximates a root of f, a number r with , by repeating one step. At the current guess , take the tangent line to the graph at , which is . Near the tangent stays close to the curve, so where it crosses the x-axis is a better guess for where the curve does. Solving gives the next guess. On the graph each step goes along the faint dashed line from to the curve, then along the tangent to the axis.
Write for the error. If r is a simple root () and f has a continuous second derivative, a Taylor expansion of the step gives once is close to r. Squaring the error roughly doubles the number of correct digits. For x² − 2 from x₀ = 1 the errors are 0.086, 0.0025, 2.1 × 10⁻⁶ and 1.6 × 10⁻¹², and the readout shows settling near . Far from the root there is no such guarantee. Where the squared term drops out and it is faster still: for arctan x the error is about , cubed each step.
The step needs . A flat tangent never meets the axis, and a nearly flat one meets it far away: for x² − 2 from 0.1 the first step lands at 10.05. The method can also fail without running away. For x³ − 2x + 2 the tangent at 0 lands on 1 and the tangent at 1 lands back on 0, and starts near 0 are pulled into this loop: the sequence stays bounded but has no limit. For arctan x there is a boundary α ≈ 1.3917, the number with . Starts with |x₀| < α converge, and starts beyond it land farther out on the other side each time. Every start colours the x-axis by where each start ends. For x³ − 2x + 2 about a fifth of [−3, 3] ends in the loop, including narrow bands that crowd toward the flat points . Starting from complex numbers turns those bands into the Newton fractal.
At a multiple root too, and the squaring is lost. For the step is exactly , so the error halves every step. That is linear convergence, about 3.3 steps for each new decimal digit. Near a root of multiplicity m the ratio tends to .
Things to notice
- Newton discussed in 1669. From 2 the method as used today gives 2.1, 2.0945681 and 2.0945514817, correct to nine decimal places after three steps.
- For the step is : the old rule for square roots, which averages a guess with a divided by it.
Controls
- Drag the blue point x₀ along the x-axis, or press on the axis to put it there. It catches at multiples of 0.5.
- Set n to show that many steps, or press n → ∞ to step to n = 10. The record keeps each xₙ and its error, and stops early at the root, at a flat tangent or past 10⁶.
- Turn on Every start to colour the x-axis by where each start ends.
Related
- Linear approximation
- Derivative
- Limit of a sequencePlanned
- Newton fractal
Further reading: Wikipedia: Newton's method; OpenStax, Calculus Volume 1, 4.9 Newton’s Method.