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 or Newton-Raphson method is a procedure used to generate successive approximations to the zero of function f as follows:

xn+1 = xn- f(xn) / f '(xn),       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.

Example 1: Use Newton's method to approximate the largest zero of function f given by

f(x) = x 2 + 3x + 1


Solution to Example 1.

The 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

newton's method example 1




We now calculate the first derivative f '

f '(x) = 2 x + 3


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:

x1 = x0 - f(x0) / f '(x0)

Substitute x
0 by its value 0 and calculate x1

x1 = 0 - f(0) / f '(0)

= - ((0) 2 + (0)x + 1) / (2(0) + 3)

= -1/3


We now calculate x
2 as follows

x2 = x1 - f(x1) / f '(x1)

x2 = -1/3 - f(-1/3) / f '(-1/3) ≈ -0.38095238


We now calculate x
3 as follows

x3 = x2 - f(x2) / f '(x2)

x3 ≈ -0.38196555


Continue with the procedure to find

x4 ≈ -0.38196601

x5 ≈ -0.38196601


Since x
5 ≈ x4 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(x5) ≈ 2.8 10-9

Since f(x
5) is very close to zero, x5 ≈ -0.38196601 is a good approximate value to the zero of f.

Example 2: Use Newton's method to solve the following equation

e(x - 3) = - x + 2


Solution to Example 2.

Note 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 '.

f '(x) = e(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.

newton's method example 2


Let x
0 = 2 an calculate x1

x1 = x0 - f(x0) / f '(x0)

= 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.

x2 = 1.72154537

x3 = 1.72153545

x4 = 1.72153545


Now that x
4 and x3 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

f(x4) ≈ -9.3 10-9


and also the two sides of the given equation at x
4 to show that they are very close.

e (x4 - 2) ≈ 0.278464540

- x 4 + 2 ≈ 0.278464550
We can say that 1.72153545 is a good approximation to the solution of the given equation.

Example 3: Use Newton's method to approximate the cube root of 5.

Solution to Example 3.

The cube root of 5 is the solution to the equation

x = cuberoot[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.

newton's method example 3


The first derivative of f is given by

f '(x) = 3 x
2

We now let x
0 = 2 an calculate x1

x1 = x0 - f(x0) / f '(x0)

= 1.75


We calculate more values that approximate the zero of f.

x2 = 1.71088435

x3 = 1.70997642

x4 = 1.70997594

x5 = 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 differentiation
applications of differentiation