Newton's Method

Learning Project Summary

 * Project Code: Newton's Method
 * School: Computer Science
 * Department: Scientific Computing

Content Summary
This learning project offers learning activities to Newton's Method. In this course, students will learn how to solve problems of the type$$f(x) = 0\,$$ using the Newton’s Method, also called the Newton-Raphson iteration.

Derivation of the Newton's Method
In Newton’s method, we must first assume that the function is differentiable, i.e. that function$$f\,$$ has a definite slope at each point. Hence at any point$$(x_0, f(x_0))\,$$, we can calculate the tangent$$f'\!(x_0)\,$$, which is a fairly good approximation to the curve at that point. Alternatively, we can see that linear function

$$l(x) = f'\!(x_0)(x - x_0) + f(x_0)$$

is quite close to function$$f\,$$ near point $$x_0\,$$, and at $$x_0\,$$, the functions $$l\,$$ and$$f\,$$ give the same value. Hence, we take it that the solution to the problem $$l(x) = 0\,$$ will give a fairly good approximation to the problem$$f(x) = 0\,$$.



The zero of $$l(x)\,$$ can be easily found: $$l(x) = 0\,$$ $$f'\!(x_0)(x - x_0) + f(x_0) = 0$$ $$x = x_0 - \left(\frac{f(x_0)}{f'\!(x_0)}\right)$$

This can be done repeatedly to produce points with the following equation: $$x_{n+1} = x_n - \left(\frac{f(x_n)}{f'\!(x_n)}\right)$$

An alternative way of viewing Newton’s method is as follows: we let $$x_0\,$$ be our approximation to the problem $$f(x) = 0\,$$, then we try to solve for the correction h such that $$f(x_0 + h) = 0\,$$ If $$f\,$$ is well-behaved function, we can then write the Taylor series at $$x_0\,$$ as $$f(x_0) + hf'\!(x_0) + \frac{h^2}{2}f''\!(x_0) + ... = 0$$ By dropping all but the first two terms of the series, we can achieve an approximation of h through the equation $$f(x_0) + hf'\!(x_0) = 0$$ Solving for h, we then achieve our next approximation to the root of $$f\,$$ with the equation $$\begin{matrix}x_1 & = &x_0 + h \\ \ & = & x_0 - \left(\frac{f(x_0)}{f'\!(x_0)}\right) \end{matrix}$$ Repeating this process results in the recursive definition of Newton’s Method $$x_{n+1} = x_n - \left(\frac{f(x_n)}{f'\!(x_n)}\right)$$

The success of Newton’s method depends on whether the following equation holds: $$\lim_{n\rightarrow \infty} x_n = r\,$$ where r is the root of $$f\,$$.

Code
The following is an example of a function that can be written using MATLAB to perform Newton's Method on any given mathematical function $$f\,$$.

Example
We try to locate the root of the equation $$f(x) = x^3 - 2x^2 + x - 3\,$$ with initial starting point $$x_0\,$$ = 3. Note also that the derivative of the above function is $$f'\!(x) = 3x^2 - 4x + 1$$

Then we do the following:

Problems and Restrictions of Newton's Method
Firstly, and most obviously, Newton's Method can only be applied with functions that are differentiable. This can be seen straight from the formula, where f’(x) is a necessary part of the iterative function.

Secondly, the starting point must be chosen carefully, and it is best chosen with an approximate idea of the graph of the function in mind. If chosen wrongly, one of the following three situations could happen:




 * 1) Runaway: In which Newton’s Method leads away from the root instead of towards the root; the solution diverges rather than converges.
 * 2) Flat Spot: In which the derivative of the graph at the starting point is 0, and thus the next iterative point occurs at infinity and cannot be used.
 * 3) Cycle: In which the solutions cycle between two points, and never converges to the root.



Convergence
Newton's method is said to converge quadratically to the root r, if r is a simple root, i.e. $$f'\!(r) \ne \; 0$$. This means that the errors obey the inequality$$|r - x_{n+1}| \le \; c|r - x_n|^2$$.

Using the Taylor Series, we see that there exists some point $$\xi\,$$ between $$x_{n}\,$$ and $$r\,$$ such that

$$f(r) = f(x_n) + (r-x_n)f'\!(x_n) + \frac{1}{2} (r-x_n)^2f''\!(\xi\,) = 0$$

Dividing the last equation throughout by $$f'\!(x_n)$$, we get

$$\frac{f(x_n)}{f'\!(x_n)} + r - x_n + (r - x_n)^2 \frac{f''\!(\xi\,)}{2f'\!(x_n)} = 0$$

Substituting the equation used in Newton's Method, we get

$$r - x_{n+1} + (r - x_n)^2 \frac{f''\!(\xi\,)}{2f'\!(x_n)} = 0$$

Thus

$$|r - x_{n+1}| = \frac{f''\!(\xi\,)}{2f'\!(x_n)} |r - x_n|^2$$

Exercises

 * 1) Locate the root of $$f(x) = \cos(2x) + \sin(3x)\,$$ nearest $$\pi\,$$ using Newton's method.
 * 2) Two of the four zeros of $$f(x)=x^4 + 3x^3 - 5x^2 + 1\,$$ are positive. Find them by Newton's method, correct to two significant figures.

Active Participants
Active participants in this Learning Group
 * Esther