Calculus/Newton's Method

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search
← Extrema and Points of Inflection Calculus Related Rates →
Newton's Method

Newton's Method (also called the Newton-Raphson method) is a recursive algorithm for approximating the root of a differentiable function. We know simple formulas for finding the roots of linear and quadratic equations, and there are also more complicated formulae for cubic and quartic equations. At one time it was hoped that there would be formulas found for equations of quintic and higher-degree, though it was later shown by Neils Henrik Abel that no such equations exist. The Newton-Raphson method is a method for approximating the roots of polynomial equations of any order. In fact the method works for any equation, polynomial or not, as long as the function is differentiable in a desired interval.

Newton's Method

Let f(x) be a differentiable function. Select a point x1 based on a first approximation to the root, arbitrarily close to the function's root. To approximate the root you then recursively calculate using:

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

As you recursively calculate, the xn's become increasingly better approximations of the function's root.

For n number of approximations,

x_n = x_0 - \sum_{i=0}^n \frac{f(x_i)}{f'(x_i)}

In order to explain Newton's method, imagine that x0 is already very close to a zero of f(x). We know that if we only look at points very close to x0 then f(x) looks like it's tangent line. If x0 was already close to the place where f(x) was zero, and near x0 we know that f(x) looks like its tangent line, then we hope the zero of the tangent line at x0 is a better approximation then x0 itself.

The equation for the tangent line to f(x) at x0 is given by

y = f'(x0)(xx0) + f(x0).

Now we set y = 0 and solve for x.

0 = f'(x0)(xx0) + f(x0)
f(x0) = f'(x0)(xx0)
\frac{-f(x_0)}{f'(x_0)}=(x-x_0)
x=\frac{-f(x_0)}{f'(x_0)}+x_0

This value of x we feel should be a better guess for the value of x where f(x) = 0. We choose to call this value of x1, and a little algebra we have

x_1=x_0-\frac{f(x_0)}{f'(x_0)}.

If our intuition was correct and x1 is in fact a better approximation for the root of f(x), then our logic should apply equally well at x1. We could look to the place where the tangent line at x1 is zero. We call x2, following the algebra above we arrive at the formula

x_2=x_1-\frac{f(x_1)}{f'(x_1)}.

And we can continue in this way as long as we wish. At each step, if your current approximation is xn our new approximation will be x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.


[edit] Examples

Find the root of the function  f(x) = x^2 \ .
x_1 = f(2) = 4 \
x_2 = x_1 - \frac{f(x_1)}{f'(x_1)} = 2
x_3 = x_2 - \frac{f(x_2)}{f'(x_2)} = 1
x_4 = x_3 - \frac{f(x_3)}{f'(x_3)} = \frac{1}{2}
x_5 = x_4 - \frac{f(x_4)}{f'(x_4)} = \frac{1}{4}
x_6 = x_5 - \frac{f(x_5)}{f'(x_5)} = \frac{1}{8}
x_7 = x_6 - \frac{f(x_6)}{f'(x_6)} = \frac{1}{16}
x_8 = x_7 - \frac{f(x_7)}{f'(x_7)} = \frac{1}{32}

As you can see xn is gradually approaching zero (which we know is the root of f(x)). One can approach the function's root with arbitrary accuracy.

Answer:  f(x) = x^2 \  has a root at  x = 0 \ .

[edit] Notes

This method fails when f'(x) = 0. In that case, one should choose a new starting place. Occasionally it may happen that f(x) = 0 and f'(x) = 0 have a common root. To detect whether this is true, we should first find the solutions of f'(x) = 0, and then check the value of f(x) at these places.

Newton's method also may not converge for every function, take as an example:

f(x) = \begin{cases} \sqrt{x-r}, & \mbox{for} x \ge r \\ -\sqrt{r-x}, & \mbox{for} x \le r \end{cases}

For this function choosing any x1 = rh then x2 = r + h would cause successive approximations to alternate back and forth, so no amount of iteration would get us any closer to the root than our first guess.

[edit] See Also