Ten problems on Newton's method: the update read off the tangent line, square roots and cube roots by iteration, a reciprocal computed without dividing, the exact error identity that makes the digits double, the slow convergence at a double root and its fix, a starting point that cycles, an iteration that runs away, Newton's method for a minimum, a system of two equations with its Jacobian, and a normal quantile found by inverting the distribution function, with worked solutions and the mistakes of adding the step instead of subtracting it, finding a root of the function when its minimum is wanted, expecting quadratic convergence at a double root, seeding the reciprocal iteration too high and transposing the Jacobian.
Before you start
Newton's method finds a root of an equation f(x)=0 by replacing f with its tangent line, solving the line instead, and repeating from the new point. Near a simple root it is remarkably fast, because the error at each step is roughly the square of the error before it, so the number of correct digits about doubles. It is how calculators take square roots, how hardware computes reciprocals, how statistical software inverts a distribution function, and, applied to f′ instead of ,f, how second-order optimizers find a minimum. These ten problems derive the update, run it on square roots, cube roots and reciprocals, prove the doubling of digits, and then look at what goes wrong: a double root, a starting point that cycles, an iteration that runs away. They end with a minimum, a system of two equations and a normal quantile. The five mistakes at the end are the ones that still produce numbers: a step added instead of subtracted, the root of the function found when its minimum was wanted, quadratic convergence expected at a double root, a reciprocal iteration started too far out, and a Jacobian used transposed.
The update. For a differentiable f and a current guess xn with ,f′(xn)=0, Newton's method sets .xn+1=xn−f′(xn)f(xn).
Error. If r is the root, en=xn−r is the error of the n-th guess. A root is simple when f(r)=0 and ,f′(r)=0, and has multiplicitym when f(x)=(x−r)mg(x) with .g(r)=0.
Quadratic convergence. Near a simple root, with f′′ continuous, .en+1≈2f′(r)f′′(r)en2. Linear convergence means en+1≈cen with a constant .0<∣c∣<1.
Minimization. To find a minimum of ,f, apply the method to :f′:.xn+1=xn−f′′(xn)f′(xn). It finds a point with ,f′=0, which is a minimum when f′′>0 there.
Systems. For F:Rn→Rn with Jacobian ,J,Jij=∂Fi/∂xj (row i is equation ,i, column j is variable ),j), the step d solves J(xn)d=−F(xn) and .xn+1=xn+d.
Φ is the standard normal distribution function and φ(z)=e−z2/2/2π its density, with .Φ′=φ.
Derive the Newton update from the tangent line at .xn. Then apply it to f(x)=x2−2 from :x0=1: show the update is xn+1=21(xn+2/xn) and find ,x1,x2 and x3 as fractions.
·
Write the Newton update for the cube root of ,a>0, using .f(x)=x3−a. Take a=10 and ,x0=2, and find x1 and .x2.
··
To compute 1/a without dividing, apply Newton's method to .f(x)=x1−a. Show that the update is xn+1=xn(2−axn) and that .1−axn+1=(1−axn)2. Find ,x1,x2 and x3 for a=7 from ,x0=0.1, and say for which x0 the iteration converges.
··
For the square-root iteration of Problem 1 with ,a=2, show that the errors satisfy en+1=2xnen2 exactly. Compute e0 to e4 from ,x0=1, and compare the limit of en+1/en2 with .2f′(r)f′′(r).
··
f(x)=x3−3x+2=(x−1)2(x+2) has a double root at .x=1. Starting from ,x0=2, find x1 and x2 and the ratios .en+1/en. Show that near 1 the ratio tends to .21. Then run the modified step xn+1=xn−2f(xn)/f′(xn) from the same start.
··
Apply Newton's method to f(x)=x3−2x+2 from ,x0=0, and then from .x0=−2. What happens in each case?
···
Show that for f(x)=x1/3 (the real cube root) the Newton update is ,xn+1=−2xn, whatever .x0=0. Then apply the method to f(x)=arctanx from x0=1 and from ,x0=1.5, and compute two steps of each.
··
Find the minimum of f(x)=ex−2x with Newton's method from :x0=0: write the update, compute x1 to ,x3, and compare with the exact minimizer.
···
Solve the system ,x2+y2=4,xy=1 with Newton's method from :(x0,y0)=(2,0.5): write F and its Jacobian, take one step, and compare with the exact solution near the start.
···
The 97.5% point of the standard normal is the root of .f(z)=Φ(z)−0.975. With Φ(2)≈0.977250 and ,φ(2)≈0.053991, take one Newton step from .z0=2. Why does the method suit this equation?
From 0 the guesses cycle 0,1,0,1,… forever; from −2 they converge to the only real root, r≈−1.7692924
:x1/3:,xn+1=−2xn, diverging from every start; :arctan: from 1 the iterates go to ,0, from 1.5 they alternate in sign and grow
;xn+1=xn−1+2e−xn;,x1=1,,x2≈0.7358,;x3≈0.6940; the minimizer is ln2≈0.6931
;(x1,y1)=(1529,6031)≈(1.93333,0.51667); the solution is (26+2,26−2)≈(1.93185,0.51764)
;z1≈1.9583; the iterates converge to ,1.959964, the 1.96 of a 95% confidence interval
Worked solutions
Problem 1
Derive the Newton update from the tangent line at .xn. Then apply it to f(x)=x2−2 from :x0=1: show the update is xn+1=21(xn+2/xn) and find ,x1,x2 and x3 as fractions.
Tangent at :xn:y=f(xn)+f′(xn)(x−xn)The line through (xn,f(xn)) with slope .f′(xn).
Set :y=0:x=xn−f(xn)/f′(xn)Solve for ,x, which needs .f′(xn)=0. This is .xn+1.
xn+1=xn−2xnxn2−2.f′(x)=2x.
=2xn2xn2−xn2+2=21(xn+xn2)Common denominator, then split.
,x1=21(1+2)=23,x2=21(23+34)=1217Each guess is the average of xn and .2/xn.
x3=21(1217+1724)=408577Common denominator ,204, then halve.
,x1=23,,x2=1217≈1.41667,x3=408577≈1.4142157,2≈1.4142136, so x3 is already right to six figures. If xn is too big, 2/xn is too small, and their average is closer than either: the Babylonian method for square roots.
Problem 2
Write the Newton update for the cube root of ,a>0, using .f(x)=x3−a. Take a=10 and ,x0=2, and find x1 and .x2.
xn+1=xn−3xn2xn3−a.f′(x)=3x2.
=3xn23xn3−xn3+a=31(2xn+xn2a)Common denominator, then split.
x1=31(4+410)=613≈2.16667,a=10,.x0=2.
x2=31(313+10⋅16936)≈2.154504.1/x12=36/169.
;xn+1=31(2xn+a/xn2);,x1=613≈2.16667,x2≈2.154504,310≈2.154435, so the errors are about 0.0122 and then .0.000069. The next step, ,x3≈2.1544347, is off by about .2×10−9.
Problem 3
To compute 1/a without dividing, apply Newton's method to .f(x)=x1−a. Show that the update is xn+1=xn(2−axn) and that .1−axn+1=(1−axn)2. Find ,x1,x2 and x3 for a=7 from ,x0=0.1, and say for which x0 the iteration converges.
f′(x)=−1/x2Power rule.
xn+1=xn−−1/xn21/xn−aThe update.
=xn+xn2(1/xn−a)=xn(2−axn)Dividing by −1/xn2 is multiplying by .−xn2. Only multiplications and a subtraction are left.
;xn+1=xn(2−axn);,x1=0.13,,x2=0.1417,;x3=0.14284777; it converges exactly when 0<x0<2/aWith ,εn=1−axn, step 4 gives :εn=ε02n: here ,0.3,,0.09,,0.0081,,0.0000656, against .1/7≈0.14285714. That tends to 0 exactly when ,∣ε0∣<1, that is 0<ax0<2 (Mistake 4).
Problem 4
For the square-root iteration of Problem 1 with ,a=2, show that the errors satisfy en+1=2xnen2 exactly. Compute e0 to e4 from ,x0=1, and compare the limit of en+1/en2 with .2f′(r)f′′(r).
xn+1−2=2xnxn2+2−2Problem 1's update, written over one denominator.
=2xnxn2−22xn+2=2xn(xn−2)2Common denominator; the numerator is a perfect square.
,e3≈2.12×10−6,e4≈1.59×10−12,x3=577/408, and .x4=665857/470832.
en+1/en2=1/(2xn)→1/(22)≈0.354Step 2, with .xn→2.
2f′(r)f′′(r)=2⋅222=221f′′=2 and .f′(2)=22.
;en+1=en2/(2xn); the errors are about ,0.0858,,0.00245,,2.1×10−6,;1.6×10−12; the ratio tends to ,1/(22), the general constantThe number of correct digits goes about ,1,2,5,11, roughly doubling each step. Every error after the first is positive, so from x1 on the guesses come down to 2 from above.
Problem 5
f(x)=x3−3x+2=(x−1)2(x+2) has a double root at .x=1. Starting from ,x0=2, find x1 and x2 and the ratios .en+1/en. Show that near 1 the ratio tends to .21. Then run the modified step xn+1=xn−2f(xn)/f′(xn) from the same start.
;x2≈1.2979; errors ,1,,0.556,0.298One more step; the ratios are 0.556 and .0.536.
f′f=(x−1)(3x+3)(x−1)2(x+2)=3(x+1)(x−1)(x+2);f′=3(x−1)(x+1); one factor x−1 cancels.
en+1=en(1−3(xn+1)xn+2)→en(1−63)Subtract step 3 from ;xn−1; at xn=1 the bracket is .21.
Modified: ,x1=2−98=910, then ,x2≈1.00195,x3≈1.00000063Twice the Newton step from each point.
Plain Newton: ,x1=914,,x2≈1.298, ratio →21 (linear); modified: errors ,0.111,,0.0019,6.3×10−7 (quadratic again)At a root of multiplicity ,m,,f/f′≈e/m, so a plain step removes only 1/m of the error and the ratio is .(m−1)/m. Multiplying the step by m restores the fast convergence, when m is known.
Problem 6
Apply Newton's method to f(x)=x3−2x+2 from ,x0=0, and then from .x0=−2. What happens in each case?
,f′(x)=3x2−2, so xn+1=xn−3xn2−2xn3−2xn+2The update.
x1=0−−22=1,f(0)=2,.f′(0)=−2.
x2=1−11=0,f(1)=1,.f′(1)=1.
From :−2:,x1=−2−10−2=−1.8, then x2≈−1.76995,f(−2)=−2,.f′(−2)=10.
,x3≈−1.769293,x4≈−1.7692924Two more steps; the iterates stop changing in the seventh figure.
From 0 the guesses cycle 0,1,0,1,… forever; from −2 they converge to the only real root, r≈−1.7692924The tangent at 0 crosses the axis at ,1, and the tangent at 1 crosses it at .0. Newton's method only promises convergence from a start close enough to a root. Here f has a local maximum and a local minimum at ,x=±2/3≈±0.816, where f′=0 and the update is not even defined, and the starts 0 and 1 sit on either side of the local minimum, far from the root.
Problem 7
Show that for f(x)=x1/3 (the real cube root) the Newton update is ,xn+1=−2xn, whatever .x0=0. Then apply the method to f(x)=arctanx from x0=1 and from ,x0=1.5, and compute two steps of each.
f′(x)=31x−2/3 for x=0Power rule; it holds for negative x too, with the real cube root.
f′(x)f(x)=31x−2/3x1/3=3x.x1/3⋅x2/3=x.
xn+1=xn−3xn=−2xnSo from :x0=1:,−2,,4,,−8,,…, doubling away from the root .0.
For :arctan:xn+1=xn−(1+xn2)arctanxn.f′(x)=1/(1+x2).
From :1:,x1=1−2⋅4π≈−0.5708,x2≈0.1169Then ,x3≈−0.0011, closing in on .0.
From :1.5:,x1≈1.5−3.25⋅0.98279≈−1.6941,x2≈2.3211;arctan1.5≈0.98279; then .x3≈−5.114.
:x1/3:,xn+1=−2xn, diverging from every start; :arctan: from 1 the iterates go to ,0, from 1.5 they alternate in sign and growAt the root of x1/3 the derivative is infinite, so the theory's assumption f′(r)=0 finite fails, and f/f′ is three times the distance to the root. arctan has a perfectly good simple root, but it flattens out, so a tangent from far away overshoots; the starts that converge are those with ∣x0∣<1.3917 about.
Problem 8
Find the minimum of f(x)=ex−2x with Newton's method from :x0=0: write the update, compute x1 to ,x3, and compare with the exact minimizer.
,f′(x)=ex−2,f′′(x)=exThe step uses the first two derivatives.
xn+1=xn−exnexn−2=xn−1+2e−xnNewton's method on .f′.
x1=0−1+2=1.e0=1.
x2=1−1+2/e≈0.735759.2e−1.
x3=x2−1+2e−x2≈0.694042.e−0.735759≈0.479142.
Exact: ,ex=2, so x∗=ln2≈0.693147f′′=ex>0 everywhere, so this is the global minimum.
;xn+1=xn−1+2e−xn;,x1=1,,x2≈0.7358,;x3≈0.6940; the minimizer is ln2≈0.6931The errors are ,0.307,,0.043,0.0009 and then :4×10−7: quadratic again, now for .f′. Each step jumps to the minimum of the quadratic Taylor model at .xn. The minimum value is ,2−2ln2≈0.614>0, so f itself has no root (Mistake 2).
Problem 9
Solve the system ,x2+y2=4,xy=1 with Newton's method from :(x0,y0)=(2,0.5): write F and its Jacobian, take one step, and compare with the exact solution near the start.
F(x,y)=(x2+y2−4,xy−1)Both equations moved to the form .F=0.
J=[2xy2yx]Row i holds the partial derivatives of Fi in x and then .y.
,F(2,0.5)=(0.25,0),J=[40.512]At the start.
4d1+d2=−0.25 and 0.5d1+2d2=0.Jd=−F.
,d1=−4d2, so −15d2=−0.25The second equation, substituted into the first.
;(x1,y1)=(1529,6031)≈(1.93333,0.51667); the solution is (26+2,26−2)≈(1.93185,0.51764)The errors fall from about 0.07 to 0.0015 in one step and to 1.1×10−6 in the next. The step solves the linearized system, so a 2×2 solve takes the place of the division by .f′.
Problem 10
The 97.5% point of the standard normal is the root of .f(z)=Φ(z)−0.975. With Φ(2)≈0.977250 and ,φ(2)≈0.053991, take one Newton step from .z0=2. Why does the method suit this equation?
f′(z)=φ(z),Φ′=φ, and the constant drops out.
z1=2−0.0539910.002250.f(2)=0.977250−0.975.
z1≈2−0.04167=1.95833The step is negative because Φ(2) is already above .0.975.
,z2≈1.959961,z3≈1.9599640Repeat with Φ and φ at the new point.
;z1≈1.9583; the iterates converge to ,1.959964, the 1.96 of a 95% confidence intervalThe derivative of a distribution function is its density, which is cheap to evaluate and positive, so every step is defined, and the root is simple. The errors are about ,0.0016, then ,2.6×10−6, then about :7×10−12: the digits double each step.
Where this goes wrong
1. Adding the step instead of subtracting it
The update is remembered as “x plus a correction”, and the sign of the correction is easy to flip.
,f(x)=x2−2,,x0=1,,f(1)=−1,f′(1)=2Right so far: Problem 1.
“.x1=x0+f(x0)/f′(x0).”The tangent line crosses zero at :x0−f(x0)/f′(x0): below the axis with a positive slope, the crossing is to the right.
x1=1+2−1=0.5The guess moves away from ,2, and the next wrong step jumps to ,−1.25, on the far side of .0. The right step gives .x1=1−2−1=1.5. A quick check: ∣f(x1)∣ should be smaller than ,∣f(x0)∣, and .f(0.5)=−1.75.
2. Finding a root of f when its minimum is wanted
The same formula finds roots and minima, and it is easy to feed it the function instead of its derivative.
Minimize f(x)=ex−2x from x0=0Right so far: Problem 8.
“Newton's step is .x−f/f′.”That finds where .f=0. A minimum is where ,f′=0, so the step is .x−f′/f′′.
,x1=0−−11=1,x2=1−e−2e−2=0The first step happens to agree with Problem 8, which hides the slip; then the guesses cycle .0,1,0,1. They cannot settle anywhere, because f≥2−2ln2≈0.614 has no root. The minimizer is .ln2≈0.693.
3. Expecting quadratic convergence at a double root
Newton's method is famous for doubling the digits, and the promise is quoted without its condition .f′(r)=0.
,f(x)=(x−1)2(x+2),x0=2Right so far: Problem 5.
“Ten steps of Newton's method are plenty for ten digits.”That holds at a simple root. Here ,f′(1)=0, and each step only halves the error.
After ten steps, x10 is 1 to about ten digitsIt is about :1.0013: the error is ,1.3×10−3, and twenty steps reach only about .1.2×10−6. The ratio en+1/en→21 is the sign of a double root; the step x−2f/f′ of Problem 5 gets six digits in three steps.
4. Seeding the reciprocal iteration too high
Any rough guess near 1/a looks good enough, and 0.3 seems a fair guess for .1/7.
xn+1=xn(2−7xn)Right so far: Problem 3 with .a=7.
“Start from .x0=0.3.”Convergence needs ,∣1−7x0∣<1, that is ;0<x0<2/7≈0.2857; here .1−7x0=−1.1.
,x1=0.3(2−2.1)=−0.03,x2=−0.03(2+0.21)=−0.0663The quantity 1−7xn is squared at each step, from −1.1 to ,1.21, then ,1.4641, and the guesses run off to .−∞. Hardware first reads a guess from a table, which keeps ∣1−ax0∣ well below .1.
5. Using the Jacobian transposed
In two variables the step needs a matrix, and the rows and columns of J are easy to swap.
F(2,0.5)=(0.25,0)Right so far: Problem 9, step 3.
“,J=[2x2yyx], with each column one equation.”Row i of the Jacobian is equation :i: the first row is .(2x,2y).
(x1,y1)≈(1.93333,0.53333)The transposed system gives d2=301 instead of ,601, so y overshoots: its error only shrinks from 0.018 to ,0.016, where the right step brings it to ,0.001, and the first equation is off by 0.022 instead of .0.005. Here the transposed steps still converge, but only linearly: after five of them the error is about ,2×10−5, where Newton's own steps reach 8×10−13 in three.
Print this set: newtons-method.pdf (problems, answers, and worked solutions on separate pages).