Numerical Analysis - MTH603 Handouts Lecture 3
Numerical Analysis - MTH603 Handouts Lecture 3
Numerical Analysis - MTH603 Handouts Lecture 3
VU
Polynomial
An expression of the form f ( x) = a0 x n + a1 x n 1 + a2 x n 2 + ... + an 1 x + an where n is a
positive integer and a0 , a1 , a2 + ....an are real constants, such type of expression is called
an nth degree polynomial in x if a0 0
Algebraic equation:
Root of an equation
For an equation f(x) =0 to find the solution we find such value which satisfy the equation
f(x)=0,these values are known as the roots of the equation .
A value a is known as the root of an equation f(x) =0 if and only if f (a) =0.
Copyright Virtual University of Pakistan
VU
1. Complex roots occur in the pairs. That is ,If (a+ib ) is a root of f(x)=0 then (a-ib )
is also a root of the equation
2. if x=a is a root of the equation f(x)=0 a polynomial of nth degree ,then (x-a) is a
factor of f(x) and by dividing f(x) by (x-a) we get a polynomial of degree n-1.
Descartes rule of signs
This rule shows the relation ship between the signs of coefficients of an equation and
its roots.
The number of positive roots of an algebraic equation f(x) =0 with real coefficients
can not exceed the number of changes in the signs of the coefficients in the polynomial
f(x) =0.similarly the number of negative roots of the equation can not exceed the number
of changes in the sign of coefficients of f (-x) =0
Consider the equation x3 3x 2 + 4 x 5 = 0 here it is an equation of degree three and
there are three changes in the signs
First +ve to ve second ve to +ve and third +ve to ve so the tree roots will be positive
Now f ( x) = x 3 3x 2 4 x 5 so there is no change of sign so there will be no negative
root of this equation.
Intermediate value property
If f(x) is a real valued continuous function in the closed interval a x b if f(a) and f(b)
have opposite signs once; that is f(x)=0 has at least one root such that a b
Simply
If f(x)=0 is a polynomial equation and if f(a) and f(b) are of different signs ,then f(x)=0
must have at least one real root between a and b.
Numerical methods for solving either algebraic or transcendental equation are classified
into two groups
Direct methods
Those methods which do not require any information about the initial approximation of
root to start the solution are known as direct methods.
The examples of direct methods are Graefee root squaring method, Gauss elimination
method and Gauss Jordan method. All these methods do not require any type of initial
approximation.
Iterative methods
VU
Bisection method, Newton raphson method, secant method, jacobie method are all
examples of iterative methods.
How to get an initial approximation?
The initial approximation may be found by two methods either by graphical method or
analytical method
Graphical method
The equation f(x)=0 can be rewritten as f1 ( x) = f 2 ( x) and initial approximation of f(x)
may be taken as the abscissa of the point of intersection of graphs of
y = f1 ( x) and y = f 2 ( x)
for example f ( x) = x sin x 1 = 0
so this may be written as x 1 = sin x Now we shall draw the graphs of
y = x 1 and y = sin x
Here both the graphs cut each other at 1.9 so the initial approximation should be taken as
1.9
Analytical method
This method is based on the intermediate value property in this we locate two values a
and b such that f(a) and f(b) have opposite signs then we use the fact that the root lies
Copyright Virtual University of Pakistan
VU
between both these points ,this method can be used for both transcendental and algebraic
equations.
Consider the equation
f (0) = 1
f ( x) = 3 x 1 + sin x = 0
180
f (1) = 3 1 + sin(1
) = 3 1 + 0.84147 = 1.64299
Here f(0) and f(1) are of opposite signs making use of intermediate value property we
infer that one root lies between 0 and 1 .
So in analytical method we must always start with an initial interval (a,b) so that f(a) and
f(b) have opposite signs.
Bisection method (Bolzano)
Suppose you have to locate the root of the equation f(x)=0 in an interval say ( x0 , x1 ) ,let
f ( x0 ) and f ( x1 ) are of opposite signs such that f ( x0 ) f ( x1 ) < 0
Then the graph of the function crossed the x-axis between x0 and x1 which exists the
existence of at least one root in the interval ( x0 , x1 ) .
x +x
The desired root is approximately defined by the mid point x2 = 0 1 if f ( x2 ) = 0 then
2
x2 is the root of the equation otherwise the root lies either between x0 and x2 or x1and x2
x +x
Now we define the next approximation by x3 = 0 2 provided f ( x0 ) f ( x2 ) < 0 then
2
root may be found between x0 and x2
x +x
If provided f ( x1 ) f ( x2 ) < 0 then root may be found between x1and x2 by x3 = 1 2
2
Thus at each step we find the desired root to the required accuracy or narrow the range to
half the previous interval.
This process of halving the intervals is continued in order to get smaller and smaller
interval within which the desired root lies. Continuation of this process eventually gives
us the required root.
NOTE: In numerical analysis all the calculation are carried out in radians mode
and the value of pi is supposed to be 3.14
Example
Solve x3 9 x + 1 = 0 for the root between x=2 and x=4 by bisection method
Solution:
Here we are given the interval (2,4) so we need not to carry out intermediate value
property to locate initial approximation.
Here
Copyright Virtual University of Pakistan
VU
f ( x) = x3 9 x + 1 = 0
now f (2) = 23 9(2) + 1 = 8 18 + 1 = 9
f (4) = 43 9(4) + 1 = 64 36 + 1 = 29
here f (2) f (3) < 0 so root lies between 2 and 4
x0 = 2 x1 = 4
2+4
=3
2
f (3) = 33 9(3) + 1 = 27 27 + 1 = 1
here f (2) f (3) < 0 so the root lies between 2 nad 3
2+3
= 2.5
x3 =
2
f (2.5) = 2.53 9(2.5) + 1 = 15.625 22.5 + 1 = 5.875 < 0
so the root lies between 2.5 and 3 as f (2.5) f (3) < 0
2.5 + 3
= 2.75
x4 =
2
now
similarly x5 = 2.875 and x6 = 2.9375 and the process is continued
x2 =
xn
f ( xn )
1.0
2.5
-5.875
2.75
-2.9531
2.875
-1.1113
2.9375
-0.0901
VU
find root with an accuracy of 103 then you will check the accuracy by subtracting two
consecutive root like 2.135648 and 2.135769
2.135769-2.135648=0.000121
So the accuracy of 103 is achieved so you will stop here.
Example:
x2 =
x3 =
x4 =
x5 =
0.75 0.8125
= 0.78125
2
Example :
Carry out the first five iterations f ( x) = x cos x 2 x 2 + 3 x 1 , 1.2 x 1.3
Note: All the calculations should be done in the radians.
Solution:
Copyright Virtual University of Pakistan
VU
f ( x) = x cos x 2 x 2 + 3 x 1
f (1.2) = 1.2 cos1.2 2(1.2) 2 + 3(1.2) 1
= 1.2(0.3623) 2(1.44) + 3.6 1 = 0.1548 > 0
f (1.3) = 1.3cos1.3 2(1.3) 2 + 3(1.3) 1
= 1.3(0.2674) 2(1.69) + 9.3 1 = 0.1322 < 0
as f (1.2) f (1.3) < 0 so the root lies between both
1.2 + 1.3
= 1.25
x2 =
2
f (1.25) = 1.25cos1.25 2(1.25) 2 + 3(1.25) 1
= 1.25(0.3153) 2(1.5625) + 3.75 1 = 0.0191 > 0
as f (1.25) f (1.3) < 0 so the root lies between both
1.25 + 1.3
= 1.275
x3 =
2
f (1.275) = 1.275cos1.275 2(1.275) 2 + 3(1.275) 1
= 1.275(0.2915) 2(1.6256) + 3.825 1 = 0.0545 < 0
as f (1.25) f (1.275) < 0 so the root lies between both
1.25 + 1.275
= 1.2625
2
f (1.2625) = 1.2625cos1.2625 2(1.2625) 2 + 3(1.2625) 1
x4 =
x5 =
1.25625 + 1.2625
= 1.259375
2