Professional Documents
Culture Documents
Chapter 2 SOLVING NONLINEAR EQUATION 2
Chapter 2 SOLVING NONLINEAR EQUATION 2
Chapter 3
Newton’s &
Secant
Methods
At the end of this chapter, students should be able to:
Derive Newton’s and Secant methods graphically and algebraically
Apply Newton’s and Secant methods for solving non-linear equations
Determine the rate of convergence of different root finding methods
3.1 Introduction
In Chapter 2, the Bisection method has been discussed for solving non-linear
equations. Based on the examples given, we conclude that if the existence of a
root is guaranteed then the method always converge to the required root. Even
though the Bisection method is perhaps a simple method, its approach is
relatively inefficient due to slow convergence rate. In contrast, the Newton’s and
Secant methods to be discussed in this chapter are generally more
computationally efficient.
31
SOLVING NONLINEAR EQUATIONS Part 2
initial value. The third estimate is obtained by using the tangent line of f (x ) at the
second estimate. The process goes on and on until desired accuracy is achieved.
Geometric Derivation
y y f (x )
L0
Actual
root r
x
x2 x1 x0
Figure 3.1
solution for the equation f ( x ) 0 . Say, for instance, one root is known to lie
32
SOLVING NONLINEAR EQUATIONS Part 2
first, x 0 .
If the procedure is then repeated by finding the line L1 tangent to the graph of f at
to the actual root than x1 . The procedure is repeated again and again, until an
approximation of sufficiently high accuracy is obtained.
We can obtain a simple equation for obtaining the (n + 1) th approximation, xn 1 ,
y y f (x )
Ln
Ln1
Actual
root r
x
xn1 xn
Figure 3.2
by the derivative f ' (xn ) , the equation for Ln can be written as:
f ( xn )
xn 1 xn , f ' (xn ) ≠ 0
f ' ( xn )
33
SOLVING NONLINEAR EQUATIONS Part 2
Algebraic Derivation
Newton’s method can also be derived based upon the Taylor’s polynomial.
Suppose that the function f (x ) is twice continuously differentiable on the interval
[a, b]. Let xn [a, b] be an approximation of the true root r such that
(r - xn )2
f(x) f(xn ) (r - xn )f ' (xn ) f " ( ) (1)
2
where in between x and xn . Since f (r ) 0 , with x r , gives
(r - xn )2
0 f(xn ) (r - xn )f ' (xn ) f( )
2
2
Since xn - r is assumed to be small, xn - r is even smaller, and if this
Theorem
Assume that f C 2 [a, b] and there exists a number r [a, b] , where f (r ) 0 .
the iteration
f(rn )
rn 1 rn - for n = 0, 1, 2, …
f ' (rn )
34
SOLVING NONLINEAR EQUATIONS Part 2
Example 1
For the x - cosx 0 , use the Newton’s method with three iterations to find a
solution to the equation given x0 1.4 . What can be said about the accuracy
of the estimated value (root)?
Solution
f ( x ) x - cosx
Compute the derivative f ' ( x )
35
SOLVING NONLINEAR EQUATIONS Part 2
1
f '(x) sinx
2 x
Identify initial value x 0
x0 1.4
Evaluate f (x ) and f ' ( x ) at x 0 (angles in radian mode)
f (1.4) 1.0132
1.0132
x1 1.4
1.4080
0.6804
Hence after three iterations, the estimated root is 0.642 (accurate to 3 decimal
places).
Example 2
f ( x ) e x x 2 has one real root in [0, 1]. Estimate the root accurate to 3
decimal places by Newton’s method.
Solution
Identify the function f (x )
f (x) ex x 2 0
36
SOLVING NONLINEAR EQUATIONS Part 2
f '(x) ex 1
Identify initial value x 0
x0 0.5
0.1487
x1 0 .5
2.6487
0.4439
Repeat until desired iterations/accuracy
n xn f ( x) e x x 2 f ' ( x) e x 1 3D
0 0.5 0.1487 2.6487
1 0.4439 0.0026 2.5587 ~ 0.444
2 0.4429 0.0000 2.5571 ~ 0.443
3 0.4429 ~ 0.443
Example 3
Solution
Given
h( x ) x 3 x 1
hence,
h' ( x ) 3x 2 1
37
SOLVING NONLINEAR EQUATIONS Part 2
f ( x0 )
x1 x 0
f ' ( x0 )
1
1
2
1.5
n xn f (x ) f ' (x) 3 SD
0 -1 1 2
1 -1.5 -0.8750 5.7500 ~ -1.35
2 -1.3478 -0.1007 4.4499 ~ - 1.33
3 -1.3252 -0.0021 4.2685 ~ -1.32
4 -1.3247 0.0000 4.2646 ~ -1.32
5 -1.3247
x-x
% x 100% , x ≠ 0 .
x
x-x
x 100
x
(-1.5) - (-1)
x 100
1.5
0.33
iteration xn xn+1 %
1 -1 -1.5 0.33
2 -1.5 -1.3478 11.29
3 -1.3478 -1.3252 1.71
4 -1.3252 -1.3247 0.04
5 -1.3247 -1.3247 0
38
SOLVING NONLINEAR EQUATIONS Part 2
Example 4
Solution
Identify the function f (x )
x3 a
then f (x) x 3 a
3
x a 0
Compute the derivative f ' ( x )
f ' ( x ) 3x 2
Identify initial value;
xn
f ( xn ) xn 3 a f ' ( xn ) 3xn2
Warm up exercise
Let x 3 - 2x - 5 0 where 2 ≤ r ≤ 3 .
(i) Identify the function f(x).
(ii) Compute the derivative f’(x).
(iii) Identify initial value x 0 .
(iv) Evaluate f(x) and f’(x) at x 0 .
(v) Apply Newton’s formula to determine the next root estimate
f ( x0 )
x1 x0
f ' ( x0 )
(vi) Continue until the third iteration and determine the root estimate.
39
SOLVING NONLINEAR EQUATIONS Part 2
CASES OF FAILURE
When the approximations produced by Newton’s method approach the desired
zero, we say that the method converges to that zero. Depending on the initial
approximation and the function, Newton’s method may not converge to the
desired zero.
y y = f(x)
x0
X1
Figure 3.4
y y = f(x)
x1 x
x0
Figure 3.5
40
SOLVING NONLINEAR EQUATIONS Part 2
x1 x0
r x
Figure 3.6
x
r1 x0 r2 x1
y = f(x)
Figure 3.7
(e) Iterations move away from zero rather than converging or simply oscillate
between two or more distinct approximations.
x2
r1 xo r2 x
x1
y = f(x)
x3
Figure 3.8
41
SOLVING NONLINEAR EQUATIONS Part 2
When using Newton’s method, consideration must be given to the proper choice
of starting point or initial value. Usually, one must have some insights as to the
shape of the function. Many times a rough graph is adequate, but in other cases
step-by-step evaluation of the function at various points may be necessary to
locate the root. Often the Bisection method is used initially to obtain a starting
point, and Newton’s method is used to improve the precision.
f(xn )
xn 1 xn - (1)
f ' (xn )
In the secant method we replace f ' (xn ) in formula (1) by an approximation that
is easily computed. Since the derivative is defined by
f(xn h) - f(xn )
f ' (xn ) lim
h →0 h
for small h, we can say
f(x h) - f(x)
f ' (x) ≈
h
in particular, if x xn and h xn xn 1 , we have
f(xn ) - f(xn -1 )
f ' (xn ) ≈ (2)
xn - xn -1
When this is used in equation (1), the result defines the secant method:
x - xn -1
xn 1 xn - f(xn ) n n 1, 2, 3,... (3)
f(xn ) - f(xn -1 )
42
SOLVING NONLINEAR EQUATIONS Part 2
Example 5
One of the solutions for the equation e x 3 x 2 lies in the interval [-0.6, -0.4].
If the Secant method is used to find this root with xo 0.6 and x1 0.4 ,
Solution
Identify the function : f(x)
ex 3 x2
e x 3x 2 0 f ( x ) e x 3x 2
43
SOLVING NONLINEAR EQUATIONS Part 2
x - x0
x2 x1 - f(x1 ) 1
f(x1 ) - f(x0 )
( 0.4) ( 0.6)
( 0.4) (0.1903)
0.1903 ( 0.5312)
0.4528
Repeat until desired iterations/accuracy
x2 0.4528
f ( x 2 ) f ( 0.4528) 0.0208
x - x1
x3 x2 - f(x2 ) 2
f(x2 ) - f(x1 )
( 0.4528) ( 0.4)
( 0.4528) (0.0208)
0.0208 (0.1903)
0.4593
Example 6
Let f ( x ) ln x x 2 . Use the Secant method to estimate the root of f
accurate to 1 decimal place if x0 = 0.1 and x1 = 0.25.
Solution
44
SOLVING NONLINEAR EQUATIONS Part 2
x - x0
x2 x1 - f(x1 ) 1
f(x1 ) - f(x0 )
(0.25) (0.1)
0.25 (0.3637)
0.3637 ( 0.4026)
0.1788 0.2 (1D )
Repeat until desired iterations/accuracy
x - x1
x3 x2 - f(x2 ) 2
f(x2 ) - f(x1 )
(0.1788) (0.25)
x3 0.1788 (0.0997)
0.0997 (0.3637)
0.1519 0.2 (1D )
Example 7
Let f ( x ) x cos x . Use the Secant method to estimate the root of f(x)
accurate to 2 significant digits if x0 = 0 and x1 = 1.
Solution
f ( x ) x cos x
xo 0 and x1 1
root 2 SD
n xn-1 xn f(xn-1) f(xn)
xn+1
0 0 1 -1.0000 0.4597 0.6851 ~ 0.69
1 1 0.6851 0.4597 0.0533 0.6438 ~ 0.64
2 0.6851 0.6438 0.0533 0.0025 0.6417 ~ 0.64
Example 8
3
Determine an approximate value for 95 accurate to 3 decimal places.
45
SOLVING NONLINEAR EQUATIONS Part 2
Solution
x 3 95
x 3 95
x 3 95 0
f ( x ) x 3 95
xo 4 and x1 5
Warm up exercise
46
SOLVING NONLINEAR EQUATIONS Part 2
Exercise 3
1. Show that x3 – x – 2 = 0 has a root between 1 and 2. Using the Newton’s method
and initial point 1.5, find this root accurate to two decimal places.
2. Using the Newton’s method, solve x + ln x = 3, given that the root is close to 2.
Obtain the root correct to two decimal places.
3. Use the Newton’s method to approximate the zero of f(x) = 1 – x – x2 with initial
guess of 0.5. Give your answers accurate to 2 significant digits.
5. Use the Newton’s method with two iterations to find the point in the right half-
plane where the graphs of f(x) 2x 3 and g(x) = 5x + 1 intersects.
6. Use the Newton’s method to find the zero of f(x) = (x – 2)1/3 with the initial guess
x = 3. What happens? Why?
9. Approximate the cube root of 757 given initial values 8.9 and 9.
47
SOLVING NONLINEAR EQUATIONS Part 2
11. Discuss the situations where by Newton’s method and secant method fail.
12. Show that the Newton’s formula for finding the reciprocal of A is
xn 1 xn ( 2 Axn ) .
13. Approximate the roots of h(x) = 2x3 − 4x − 2. How many real roots does h have?
48
SOLVING NONLINEAR EQUATIONS Part 2
1. 1.52
2. 2.21
3. 0.62
4. 1.7592
5. 1.6729
6. Case of failure
7. -1.5
8. 1.3247
9. 9.1138
10. a) 0.540
b)
11.
12.
49
SOLVING NONLINEAR EQUATIONS Part 2
1. Graphically, show that x3 + 6x – 16 = 0 has only one real root in the interval
(1, 2).
4. If a = 0.1 and b = 1.0, how many iterations of the bisection method are needed to
determine the root with an error of at most 0.5 x 10-8.
50