# Newton's Method to Find Zeros of a Function

Newton's method is an example of how the first derivative is used to find zeros of functions and solve equations numerically. Examples with detailed solutions on how to use Newton's method are presented.

## Newton's method
Newton's method or Newton-Raphson method is a procedure used to generate successive approximations to the zero of function f as follows:
x_{n+1} = x_{n} - f(x_{n}) / f '(x_{n}), for n = 0,1,2,3,...In order to use Newton's method, you need to guess a first approximation to the zero of the function and then use the above procedure. Below we show you how to use this method in order to find good approximations to the zero of a function or solution of an equation. Newton's method may be easily programmed, using almost any programming language with mathematical functions, to solve complicated equations numerically.
## Example 1Use Newton's method to approximate the largest zero of function f given by^{ 2} + 3x + 1
## Solution to Example 1The given function is quadratic and we can easily find its zeros using the quadratic formulas. However we start with this example in order to be able to compare the zero found using Newton's method with the one using the quadratic formulas.How to use Newton's method to find the largest zero of f? First we need to find a close approximation to the zero. This can be done graphically. The graph of f below clearly shows that f has two zeros, both of them negative and the largest one is closer to zero. We can use zero as a starting value in the Newton's method procedure We now calculate the first derivative f ' Now we start the procedure as follows: Let x _{0} = 0 . This is the starting approximate value to the largest zero. You might decide to take another value as long as it is close to the zero you are approximating.
We now calculate x _{1} using the above procedure for n = 0 as follows:
x _{1} = x_{0} - f(x_{0}) / f '(x_{0})Substitute x _{0} by its value 0 and calculate x_{1}x _{1} = 0 - f(0) / f '(0)
= - ((0) ^{ 2} + (0)x + 1) / (2(0) + 3)
= -1/3 We now calculate x _{2} as follows
x _{2} = x_{1} - f(x_{1}) / f '(x_{1})
x _{2} = -1/3 - f(-1/3) / f '(-1/3) ≈ -0.38095238
We now calculate x _{3} as follows
x _{3} = x_{2} - f(x_{2}) / f '(x_{2})
x _{3} ≈ -0.38196555
Continue with the procedure to find x _{4} ≈ -0.38196601
x _{5} ≈ -0.38196601
Since x _{5} ≈ x_{4} there is no need to continue as we will not be able to make any more progress in approximating the zero.
We now compare x _{5} to the exact value of the largest zero which is ( -3 + sqrt (5)) / 2 ≈ -0.38196601 and we can say that they are equal up to 8 decimal places. Another way to check the accuracy of our approximation is to compute
f(x _{5}) ≈ 2.8 10^{-9}Since f(x _{5}) is very close to zero, x_{5} ≈ -0.38196601 is a good approximate value to the zero of f.
## Example 2Use Newton's method to solve the following equation^{(x - 3)} = - x + 2
## Solution to Example 2Note that the solution to the above equation cannot be found analytically, hence the use of Newton's method.We first write the equation with the right side equal to zero. e ^{(x - 3)} + x - 2 = 0
The solution to the given equation is equal to the zero of function f(x) = e ^{(x - 3)} + x - 2.
Calculate the first derivative f '. ^{(x - 3)} + 1
Below is the graph of f and it can easily be seen that the zero of f is closer to 2 hence the choice of x _{0} = 2 as the starting value.
Let x _{0} = 2 an calculate x_{1}x _{1} = x_{0} - f(x_{0}) / f '(x_{0})
= 2 - (e ^{(2 - 3)} + 2 - 2) / (e^{(2 - 3)} + 1)
= 1.73105857 We now continue the process to calculate more values that approximate the zero of f. x _{2} = 1.72154537
x _{3} = 1.72153545
x _{4} = 1.72153545
Now that x _{4} and x_{3} are equal up to 8 decimal places and we have reached the limit of accuracy of our calculator. As a final check let us compute
_{4}) ≈ -9.3 10^{-9}
and also the two sides of the given equation at x _{4} to show that they are very close.
^{ (x4 - 2)} ≈ 0.278464540
- x _{ 4} + 2 ≈ 0.278464550
## Example 3Use Newton's method to approximate the cube root of 5.## Solution to Example 3The cube root of 5 is the solution to the equationx = ^{3}√5
Elevate the two sides of the equation to the power 3 to obtain the equation x ^{ 3} = 5
which can be written f(x) = x ^{ 3} - 5 = 0
The graph of f below shows that there is a zero close to 2 and we can use as a starting value. The first derivative of f is given by f '(x) = 3 x ^{ 2}We now let x _{0} = 2 an calculate x_{1}x _{1} = x_{0} - f(x_{0}) / f '(x_{0})
= 1.75 We calculate more values that approximate the zero of f. x _{2} = 1.71088435
x _{3} = 1.70997642
x _{4} = 1.70997594
x _{5} = 1.70997594
1.70997594 is a good approximation to cube root 5. Use your calculator to calculate cube root 5 and compare that result to the one obtained using Newton's method. ## More on applications of differentiationapplications of differentiation |