Lecture 1
Lecture 1
Mathematical models for many problems in different branches of science and engineering
are formulated as
f(x) = 0 (1)
where the variables x and f(x) may be real or complex, and scalar or vector quantities. In
this chapter, the variables x and f(x) are real and scalar quantities. The value of x, which
satisfies the Eq. (1), is called the root of the equation. It is also known as the zero of the
function f(x). For example, the quadratic equation
x 2 − 3x + 2 = 0 .has roots 1 and 2
y = f(x) y
5
f(x) y = x2 − 3x + 2
4
3
2
Root
x 1
x
1 2 3
Fig. .1 Root off(x) = 0
Fig. 3.2 Root ofx2 – 3x + 2 = 0
Numerical Methods
Root finding is also essential in many branches of mathematics. For example, the critical
points of the function f(x) are the roots of the equation f '(x) = 0. Eigenvalues of a square
matrix A are the roots of the characteristic equation.
(p λ) = det ( A − λ I) = 0
where p(λ) is a polynomial of degree n (order of matrix A).
The nonlinear equations can be categorized broadly as polynomial equations and
transcendental equations as follows
Polynomial Equations
The polynomial equations are given by
y = f (x ) = an x n + an−1 x n−1 + … + a1 x + a0 = 0
This equation is an nth degree polynomial equation, and has exactly n roots. These roots
may be real or complex. Some examples of polynomial equations are
i) 3x 3 + x 2 − 9 = 0
ii) x2 − 4x − 5 = 0
Transcendental Equations
An equation which is not a polynomial equation is a transcendental equation. These
equations involve trigonometric, exponential and logarithmic functions, etc. A few
examples of the transcendental equations are as follows
i) 3 sin( x ) − e − x = 0
ii) 3x 2 − 2 cos x = 0
iii) 2e x sin x − ln(x ) = 0
Transcendental equations may have finite or infinite numbers of real roots or may not have
real roots at all.
The roots of simple equations are easy to compute by the direct methods. But in the
case of higher order equations and transcendental equations, there is no general analytical
method to compute the exact roots. So for this purpose, numerical techniques can be used
to find approximate roots of the equation. The main objective of this chapter is to present
and discuss the various numerical techniques which are useful for finding the
approximate roots of the nonlinear equation, Eq. (1).
In this section, we shall have a brief idea of these methods and conclude that iterative
methods for finding numerical approximations for the roots of Eq. (1) are the best
methods for the complex and complicated equations.
The graph (Fig. 3.3) of y = x 2 + x +1 has no point of intersection with x – axis, so the
. equation x 2 + x + 1 = 0 has no real root
Any equation f(x) = 0 can be rewritten as f1(x) = f2(x), and points of intersections of the
curves y = f1(x) and y = f2(x) provide the roots of the equation f(x) = 0. For example, consider
the graphs of y = ex and y = x, then the points of intersection of these two curves are the
roots of equation x – ex = 0 (x = ex). It is easy to see that there is no point of intersection
(Fig. 3.4), so the equation x – ex = 0 has no real root. Similarly, we can easily find that
equation x − l n(x ) = 0 also has no real root (Fig. 3.5).
6 y y
6 y = ex 1 y=x
5
4 0.2 0.4 0.6 0.8 x
4 0
3
y=x
2 2 -1
y
1 y = ln(x)
x -2
-2 -1 0 1 2 -1 1
x -3
Case 2. Equations with finite numbers of real roots like x 3 − 3x 2 + 2x = 0, x − cos x = 0, etc.
The points of intersection of two curves y = cos( x ) and y = x are the roots of equation
x − cos x = 0 (Fig. 3.6). There is only one point of intersection, so the equation x − cos x = 0
has only one real root. Similarly, the graph of the function y = x 3 − 3x 2 + 2 x provides that
the equation x 3 − 3x 2 + 2x = 0 has three real roots (Fig. 3.7).
y
4 y=x
3
2
1
x
2 4
-1
y = cos(x)
y
5
y = x3-5x2 + 6x
1 2 3
x
-5
-10
Case 3. Equations with infinite numbers of real roots like e x − cos x = 0, x − tan x = 0,
e − x − sin x = 0, etc. The following graphs show that these equations have infinitely many
real roots.
Newton Raphson Method
The Newton Raphson method is for solving equations of the form f (x) = 0. We make
an initial guess for the root we are trying to find, and we call this initial guess x0 .
The sequence x0 , x1 , x2 , x3 , . . . generated in the manner described below should con-
verge to the exact root.
To implement it analytically we need a formula for each approximation in terms of
the previous one, i.e. we need xn+1 in terms of xn .
The equation of the tangent line to the graph y = f (x) at the point (x0 , f (x0 )) is
In Newton–Raphson method, the function f(x) is approximated with the tangent of f(x)
at point x = x0. Next approximation is the point of intersection of the tangent (at the point
x = x0) and the x-axis. In general, the iteration xn+1 is the value of x at which tangent at the
( )
point xn , f (xn ) cuts the x-axis.
f(x)
ξ
x2 x1 x0 x
y = f(x)
Example
Let us solve x3 − x − 1 = 0 for x.
In this case f (x) = x3 − x − 1, so f 0 (x) = 3x2 − 1. So the recursion formula (1)
becomes
(x3 − xn − 1)
xn+1 = xn − n 2
3xn − 1
Need to decide on an appropriate initial guess x0 for this problem. A rough graph
can help. Note that f (1) = −1 < 0 and f (2) = 5 > 0. Therefore, a root of f (x) = 0
must exist between 1 and 2. Let us take x0 = 1 as our initial guess. Then
(x30 − x0 − 1)
x1 = x0 −
3x20 − 1
and with x0 = 1 we get x1 = 1.5.
Now
(x31 − x1 − 1)
x2 = x1 −
3x21 − 1
(x32 − x2 − 1)
x3 = x2 −
3x22 − 1
and with the value just found for x2 , we find x 3 = 1.32520.
Carrying on, we find t hat x 4 = 1 .32472, x 5 = 1 .32472, e tc. We c an s top w hen the
digits stop changing to the required degree of accuracy. We conclude that the root is
1.32472 to 5 decimal places.
Example
Let us solve cos x = 2x to 5 decimal places.
This is equivalent to solving f (x) = 0 where f (x) = cos x − 2x. [NB: make sure
your calculator is in radian mode]. The recursion formula (1) becomes
(cos xn − 2xn )
xn+1 = xn −
(− sin xn − 2)
x0 = 0.5
x1 = 0.45063
x2 = 0.45018
x3 = 0.45018
..
.
with no further changes in the digits, to five decimal p laces. Therefore, to this degree
of accuracy, the root is x = 0.45018.