Newton's method

Level UniversityDifficulty ★★★★★Method⌖ Open in the map

What is it?

To solve f(x)=0f(x) = 0, replace ff by its tangent line at the current guess and jump to where the tangent hits zero: xk+1=xk−f(xk)/f′(xk)x_{k+1} = x_k - f(x_k)/f'(x_k). Near a simple root the number of correct digits doubles every step.

Why does it exist?

Equations like cos⁡x=x\cos x = x or xex=3x e^x = 3 have no formula for their solution, and nonlinear systems in engineering have thousands of unknowns. Newton's insight: we cannot solve f=0f = 0, but we can solve its linear approximation exactly — and repeat.

Intuition

Stand on the curve at (xk,f(xk))(x_k, f(x_k)), slide down the tangent until you hit the xx-axis, step up to the curve again. If the curve is close to straight near the root, each tangent lands very close. The step −f/f′-f/f' is "how far, at the current slope, until I reach zero". It fails when the slope is nearly flat (huge jumps) or when the start is in the wrong basin.

Formal definition

Theorem (local quadratic convergence). Let f∈C2f \in C^2 near a root x∗x^\ast with f′(x∗)≠0f'(x^\ast) \ne 0. Then there is δ>0\delta > 0 such that for every x0x_0 with ∣x0−x∗∣<δ|x_0 - x^\ast| < \delta the iterates converge to x∗x^\ast and

∣xk+1−x∗∣≤C ∣xk−x∗∣2,C≈∣f′′(x∗)2f′(x∗)∣.|x_{k+1} - x^\ast| \le C\,|x_k - x^\ast|^2, \qquad C \approx \left|\frac{f''(x^\ast)}{2f'(x^\ast)}\right|.

Idea of the proof

Taylor at xkx_k: 0=f(x∗)=f(xk)+f′(xk)(x∗−xk)+12f′′(ξ)(x∗−xk)20 = f(x^\ast) = f(x_k) + f'(x_k)(x^\ast - x_k) + \tfrac12 f''(\xi)(x^\ast - x_k)^2. Divide by f′(xk)f'(x_k) and use the definition of xk+1x_{k+1}: xk+1−x∗=f′′(ξ)2f′(xk)(xk−x∗)2x_{k+1} - x^\ast = \frac{f''(\xi)}{2f'(x_k)}(x_k - x^\ast)^2.

Formulas

xk+1=xk−f(xk)f′(xk)x_{k+1} = x_k - \frac{f(x_k)}{f'(x_k)}
xk+1=xk−JF(xk)−1F(xk)x_{k+1} = x_k - J_F(x_k)^{-1}F(x_k)
systems: solve a linear system with the Jacobian each step
xk+1=xk−f′(xk)f′′(xk)x_{k+1} = x_k - \frac{f'(x_k)}{f''(x_k)}
optimization: Newton applied to f′=0f' = 0

How is it computed?

x = x0
repeat:
    step = f(x) / df(x)
    x = x - step
until |step| < tol·|x|  or  too many iterations

In practice add safeguards: fall back to bisection if the step leaves a bracketing interval, and damp the step (x−α f/f′x - \alpha\,f/f') far from the root.

Example

2\sqrt 2 as the root of x2−2x^2 - 2: xk+1=12(xk+2xk)x_{k+1} = \frac12\left(x_k + \frac{2}{x_k}\right) — the Babylonian method, 4000 years old. From x0=1x_0 = 1: 1.51.5, 1.416671.41667, 1.41421571.4142157, 1.414213562374691.41421356237469, … The correct digits go 1, 3, 6, 12: doubling each step.

Interactive visualization

kxkf(xk)|xk − x*|digits
Click the canvas to choose x₀. Near a simple root the number of correct digits roughly doubles each step. Try x³ − 2x + 2 from x₀ = 0 (a 2-cycle), ∛x (the iterates double and flee) or arctan x from |x₀| > 1.4.

Why does it matter?

Newton's method is inside your CPU (division and square roots refine an initial approximation by Newton steps), inside every nonlinear solver of engineering software, inside implicit physics integrators and inverse kinematics, and — applied to ∇f=0\nabla f = 0 — it is the prototype of all second-order optimization methods.

Where it shows up in computing

  • Scientific computing★★★★★fundamentalScientific computing and algorithms

    The default solver for nonlinear equations and systems, usually with safeguards.

  • Floating point (IEEE 754)★★★★★frequentScientific computing and algorithms

    Hardware and libraries compute 1/x1/x and x\sqrt x from a table guess refined by Newton iterations.

  • Inverse kinematics★★★★★frequentRobotics and control

    Solving for joint angles that reach a target is a Newton (Gauss–Newton) iteration with the robot Jacobian.

  • Physics engines★★★★★advancedPhysics and simulation

    Implicit integrators for stiff systems (cloth, soft bodies) solve a nonlinear system with Newton each step.

Where it shows up in AI

Where is it used?

Computing topics reachable from here, through the chain of ideas that leads to them:

Exercises

1Computation

Write the Newton iteration for f(x)=x3−2x−5f(x) = x^3 - 2x - 5 and do two steps from x0=2x_0 = 2.

Solution

xk+1=xk−xk3−2xk−53xk2−2x_{k+1} = x_k - \frac{x_k^3 - 2x_k - 5}{3x_k^2 - 2}. x1=2−−110=2.1x_1 = 2 - \frac{-1}{10} = 2.1, x2=2.1−0.06111.23≈2.094568x_2 = 2.1 - \frac{0.061}{11.23} \approx 2.094568 (root 2.09455152.0945515).

2Graphical

Use the demo with f(x)=x3−2x+2f(x) = x^3 - 2x + 2 and x0=0x_0 = 0. What happens, and why?

Solution

x1=0−2−2=1x_1 = 0 - \frac{2}{-2} = 1, x2=1−11=0x_2 = 1 - \frac{1}{1} = 0: a 2-cycle. The tangents bounce between 0 and 1 forever; the real root (≈−1.77\approx -1.77) is in another basin.

3Computing

Derive the Newton iteration that computes 1/a1/a using only multiplications and subtractions.

Solution

Take f(x)=1x−af(x) = \frac1x - a: xk+1=xk−1/xk−a−1/xk2=xk(2−axk)x_{k+1} = x_k - \frac{1/x_k - a}{-1/x_k^2} = x_k(2 - a x_k). No division needed — this is how many processors divide.

↑ ↓ to navigate · ↵ · Esc