Newton's method

Following tangents to find the solution of an equation numerically is Newton's method1. We use it to find the positive root of f(x)=x22f(x) = x^2 - 2, that is 2\sqrt{2}.

Following the tangents

Start from x0=2x_0 = 2. Since f(2)=2f(2) = 2 and f(2)=4f'(2) = 4, the tangent at (2,2)(2, 2) is y=4x6y = 4x - 6. It meets the xx-axis at x=1.5x = 1.5, and that becomes the next value x1x_1.

Repeat. Since f(1.5)=0.25f(1.5) = 0.25 and f(1.5)=3f'(1.5) = 3, the tangent is y=3x174y = 3x - \dfrac{17}{4}, meeting the xx-axis at x2=1712=1.41667x_2 = \dfrac{17}{12} = 1.41667.

The general formula

Find where the tangent y=f(xn)+f(xn)(xxn)y = f(x_n) + f'(x_n)(x - x_n) meets the xx-axis.

xn+1=xnf(xn)f(xn)x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}

For f(x)=x22f(x) = x^2 - 2 this tidies up as follows.

xn+1=xnxn222xn=12(xn+2xn)\begin{align*} x_{n+1} &= x_n - \frac{x_n^2 - 2}{2x_n} \\ &= \frac{1}{2}\left(x_n + \frac{2}{x_n}\right) \end{align*}

It takes the average of the current value and 2xn\dfrac{2}{x_n}. If xnx_n is larger than 2\sqrt{2} then 2xn\dfrac{2}{x_n} is smaller, so the average always lands between them.

How fast it converges

nnxnx_nError
00220.5860.586
111.51.50.0860.086
221.4166671.4166670.00250.0025
331.4142161.4142160.0000020.000002

Against 2=1.414214\sqrt{2} = 1.414214, the number of correct digits roughly doubles at each step.

When it fails

  • If f(xn)=0f'(x_n) = 0 the tangent is horizontal and the next value is undefined
  • If the starting value is far from a root, the iteration may jump to a different one
  • The values may also oscillate and never settle

What the method really is

That a tangent is the linear approximation of a curve is the substance of the method. The curve is replaced by a line and solved, and at the answer obtained the replacement is made again. That is all it repeats.

The parabola on the graph is y=x22y = x^2 - 2, the two lines are the tangents at x0=2x_0 = 2 and x1=1.5x_1 = 1.5, and the large dots are the points of tangency together with the points where the tangents cut the xx-axis.

  1. Newton's method, Wikipedia