Module for Numerical I
Module for Numerical I
Chapter one
Objectives:
INTRODUCTION
Numerical methods are methods for solving problems on computers by numerical calculations,
often giving a table of numbers and/or graphical representations or figures. Numerical methods
tend to emphasize the implementation of algorithms. The aim of numerical methods is therefore
to provide systematic methods for solving problems in a numerical form. The process of solving
problems generally involves starting from an initial data, using high precision digital computers,
following the steps in the algorithms, and finally obtaining the results. Often the numerical data
and the methods used are approximate ones. Hence, the error in a computed result may be caused
by the errors in the data, or the errors in the method or both.
Definition: Numerical method is the study of approximate analysis for solving problems of
mathematical analysis by means of arithmetic calculations.
Objectives:
➢ define errors
➢ identifying thesource of errors
Page 1
Numerical Method for Engineering
Analysis of errors is the central concern in the study of numerical methods and therefore we
will investigate the sources of errors, the type of errors that may be occurring in the given
problem and the subsequent propagation of errors.
1.1. Sources of errors
The main sources of errors in obtaining numerical solutions to mathematical problems are:
a. The model: To solve different problems, mathematical models are formulated to describe
them and these models do not describe them exactly and as a result errors are introduced.
b. The numerical method: The methods used to solve the mathematical models are often
not exact and as a consequence errors are induced.
c. The data: There may be errors in measuring or estimating values.
d. The representation of numbers: A computer has a finite word length and so only a
fixed number of digits of a number are inserted and as a consequence errors are
introduced.
e. The arithmetic: Frequently errors are introduced in carrying out operations such as
addition and multiplication.
Remark 1: There are two kinds of numbers which are exact and approximate numbers.
Example 1.1
a. The numbers 1,2,3, … , 1⁄2 , 3⁄2 , … , √2, 𝜋, 𝑒 and so on written in this manner are exact
numbers.
b. The numbers 3.1428, 3.14285714, 3.142857, 3.14286 and so on are approximate values
of the number 𝜋.
✓ The digits that are used to express a number are called significant digits or significant
figures.
Example1. 2
a. The numbers 3.1416, 0.66667 and 4.0687 each contain five significant digits.
b. The numbers 0.00023, 3.4000 and 2.3 each contain two significant figures.
Page 2
Numerical Method for Engineering
Objectives:
Classification of errors
1. Inherent errors: Most of numerical computations are inexact either due to the given data
or due to the limitations of the computing aids such as mathematical tables, desk
calculators or the digital computers. Due to these limitations numbers have to be rounded
causing errors called inherent (rounded – off) errors. These errors cannot be completely
removed but can be minimized if we select a better data and by using computing aids of
higher precision.
2. Truncation errors: The mathematical models may be algebraic or transcendental or
other types of equations. The solution of such equations may not be solved analytically,
hence we use numerical methods. In the process errors are induced and such errors are
called truncation errors. In general, truncation errors are errors due to the model and
method.
1.3. Rounding of numbers
Objectives:
With 𝑡 −digit computer a number with mantissa greater than 𝑡 −digits cannot be represented
exactly. Such number must be reduced to 𝑡 −digits and there are two ways of reducing the
number of digits of the given number.
a. Chopping: In a 𝑡 −digit computation, all digits of the number to the right of 𝑡 are
dropped – off.
Page 3
Numerical Method for Engineering
𝑎̃ = 0. 𝑑1 𝑑2 … 𝑑𝑛
𝑥̃ = Sign(𝑎̃ × 10𝑏 )
𝑥̃ = Sign(𝑎̃ × 10𝑏 )
In both cases the resulted error in this process is given by the formula 𝑒 = |𝑥 − 𝑥̃|.
Example 1.3 Let 𝑥 = 0.142862 × 102 , 𝑡 = 4, then represent the number inside the computer
with the given capacity and find the error.
Page 4
Numerical Method for Engineering
Therefore, the number becomes, 𝑥̃ = 0.1428 × 102 and the resulted error is given by:
Therefore, the number becomes, 𝑥̃ = 0.1429 × 102 and the resulted error is given by:
Objectives:
Absolute error: Is the numerical difference between the true value of a quantity and its
approximate value. i.e. . if 𝑥 is the true value of a quantity and 𝑥̃ is its approximate value, then
the absolute error 𝐸𝐴 is given by:
𝐸𝐴 = |𝑥 − 𝑥̃|
𝑥−𝑥̃
Relative error: The relative error 𝐸𝑅 is defined by: 𝐸𝑅 = | |
𝑥
Example1. 4 Let the exact value or true value of the number is 20⁄3 and its approximate value is
6.666, then find the absolute error, relative error and the percentage relative error.
Page 5
Numerical Method for Engineering
Example 1.5 Three approximate values of the number 1⁄3 are given as 0.30, 0.33 and 0.34.
Which one of the three is the best approximation?
Solution: The value with the smallest absolute error is the best approximation and therefore we
have to find the absolute errors. Let 𝑥̃1 = 0.30, 𝑥̃2 = 0.33 and 𝑥̃3 = 0.34
Solution:
Remark 2: If the number is rounded to 𝑁 decimal places, then the absolute error is given by:
1
∆𝑥 = 2 × 10−𝑁
Page 6
Numerical Method for Engineering
Example 1.7 If 𝑥 = 0.51 and correct to two decimal places, then find the absolute error.
1
Solution: ∆𝑥 = 2 × 10−𝑁 , but in this case 𝑁 = 2
1
= 2 × 10−2 = 0.005
Propagation of errors is the measure how the error in the independent variable yield an error on
the dependent variable. Suppose that we have a function 𝑓(𝑥) that is dependent on a single
independent variable𝑥. Assume that 𝑥̃ is an approximation of 𝑥. Now, we would like to assess
the effect of the discrepancy between 𝑥 and 𝑥̃ on the value of the function. That is we would like
to estimate
∆𝑓(𝑥̃) = |𝑓(𝑥) − 𝑓(𝑥̃)|
The problem with evaluating ∆𝑓(𝑥̃) is that 𝑓(𝑥) is unknown, because 𝑥 is unknown. We can
overcome this difficulty if 𝑥̃ is very close to 𝑥 and 𝑓(𝑥̃) is continuous and differentiable. If these
conditions hold, then Taylor series expansion can be employed to compute 𝑓(𝑥) near𝑓(𝑥̃).
(𝑥−𝑥̃)2 (𝑥−𝑥̃)3
𝑓(𝑥) = 𝑓(𝑥̃) + 𝑓 ′ (𝑥̃)(𝑥 − 𝑥̃) + 𝑓 ′′′ (𝑥̃) + 𝑓 ′′′ (𝑥̃) +⋯
2! 3!
For very small ∆𝑥 = 𝑥 − 𝑥̃ dropping the second and higher order derivatives and rearranging the
rest yields
𝑓(𝑥) ≈ 𝑓(𝑥̃) + 𝑓 ′ (𝑥̃)(𝑥 − 𝑥̃)
⇒ 𝑓(𝑥) − 𝑓(𝑥̃) = 𝑓 ′ (𝑥̃)(𝑥 − 𝑥̃)
⇒ |𝑓(𝑥) − 𝑓(𝑥̃)| = |𝑓 ′ (𝑥̃)(𝑥 − 𝑥̃)|
⇒ ∆𝑓(𝑥̃) = |𝑓 ′ (𝑥̃)|∆𝑥̃
Page 7
Numerical Method for Engineering
Where, ∆𝑓(𝑥̃) = |𝑓(𝑥) − 𝑓(𝑥̃)| represents an estimation of the error of the function 𝑓 and ∆𝑥̃ =
|𝑥 − 𝑥̃| represents an estimation of the error of 𝑥.
Example 1.8 Estimate the error committed in 𝑓(𝑥) = 𝑥 3 , when 𝑥 is approximated by 𝑥̃ = 2.5
with error ∆𝑥̃ = 0.01.
= 3(2.5)2 × 0.001
= 0.1875
The analytic methods have certain limitation in practical application. So, exact solution is not
possible from applied mathematics, in such cases numerical methods are very important tools to
provide practical method for calculating the solutions of the problems.
So, it is essential to use numerical methods in programming problems on computers if and only
if the method is inherently efficient and good programmed.
Therefore, to solve problems using computers we have to follow the following steps.
1. Selection(choice) of a method
2. Designing(preparation) of algorithm
3. Flow charting
4. Programming
5. Execution of the program.
Selection of the method: Is the selection of a mathematical formula to the given problem to
find the solution. In this case, there may be more than one method available and hence only one
method must be chosen.
Page 8
Numerical Method for Engineering
After the method has been decided a complete set of computational steps have to be followed in
a sequence and this sequence of steps is called an algorithm. A diagrammatic representation that
illustrates the sequence of steps to be performed to arrive at the solution is called a flow chart.
We can summarize these commonly used symbols to represent these illustrations and their
meaning as
Computations
Decision making
For loops
Example1. 9 Develop the algorithm and draw the flow chart to solve a quadratic equation.
Case 1: Let 𝑑 is negative, then the roots are complex roots. That is
−𝑏+𝑖√|𝑑| −𝑏−𝑖√|𝑑|
𝑥1 = and 𝑥2 =
2𝑎 2𝑎
𝑏
Case 2: Let 𝑑 = 0, then the roots are real and equal and given by: 𝑥 = − 2𝑎
Page 9
Numerical Method for Engineering
Case 3: Let 𝑑 is positive, then we have two real roots and the roots are:
−𝑏+√𝑑 −𝑏−√𝑑
𝑥1 = and 𝑥2 =
2𝑎 2𝑎
Algorithm
1. Input 𝑎, 𝑏, 𝑐
2. 𝑑 = 𝑏 ∗ 𝑏 − 4 ∗ 𝑎 ∗ 𝑐
3. If 𝑑 < 0
4. Cout the roots are imaginary
𝑏
5. 𝑥1 = − 2𝑎
6. 𝑥2 = 𝑠𝑞𝑟𝑡(𝑎𝑏𝑠(𝑑))/2 ∗ 𝑎
7. Cout the roots are 𝑥1 + 𝑖𝑥2 , 𝑥1 − 𝑖𝑥2
8. Else if 𝑑 = 0
9. Cout the roots are equal and real
𝑏
10. 𝑥 = − 2∗𝑎
11. Cout 𝑥
12. Else
13. Cout the roots real and unequal
14. 𝑥1 = (−𝑏 + 𝑠𝑞𝑟𝑡(𝑑))/2 ∗ 𝑎
15. 𝑥2 = (−𝑏 − 𝑠𝑞𝑟𝑡(𝑑))/2 ∗ 𝑎
16. Cout 𝑥1 , 𝑥2
17. Stop
Page 10
Numerical Method for Engineering
Flow chart
Star
t
Input
𝑎, 𝑏, 𝑐
𝑑 =𝑏∗𝑏−4∗𝑎∗𝑐
Yes If 𝑑 < No
0
Display
𝑑
imaginary roots Yes
=0
No
Display
𝑏
𝑥1 = − equal real
2∗𝑎 Display two
roots
d/t real
𝑥2 = 𝑠𝑞𝑟𝑡(𝑎𝑏𝑠(𝑑))/2 ∗a
roots
−𝑏 𝑥1 = (−𝑏 + 𝑠𝑞𝑟𝑡(𝑎𝑏𝑠(𝑑)))/2 ∗ 𝑎
𝑥=
Display, 𝑥1 + 2∗𝑎 𝑥2 = (−𝑏 − 𝑠𝑞𝑟𝑡(𝑎𝑏𝑠(𝑑)))/2 ∗ 𝑎
𝑖𝑥2 , 𝑥1 − 𝑖𝑥2
Display Display
𝑥 𝑥1 , 𝑥2
Stop
Page 11
Numerical Method for Engineering
Unit Summary
Review Exercise
1. Determine the absolute and relative errors involved if x = 2/3 is represented in normalized
decimal form with 6 digits by
a. Round-off
b. Truncation.
2. Given that 5 digit chopping is used for arithmetic calculations involving 𝑥 𝑎𝑛𝑑 𝑦 where 𝑥 =
1 5
and 𝑦 = 7 . Determine the absolute and relative errors involved.
3
Page 12
Numerical Method for Engineering
References
Burden, R.L., and Faires, J.D., Numerical analysis, 9th ed., PWS publishing, Boston, 1993.
Chapra, S.C., and Raymond, P.C., Numerical Methods for Engineering, 6th ed.,
Grewal, B.S., Numerical Methods in Engineering and Science, Khanna, New Delhi, 1994.
Page 13
Numerical Method for Engineering
Chapter Two
Objectives:
Introduction
One of the most common problems encountered in engineering analysis is that given a function
𝑓 (𝑥), find the values of x for which𝑓 (𝑥) = 0. The solution (values of 𝑥) are known as the roots
of the equation𝑓 (𝑥) = 0, or the zeroes of the function 𝑓 (𝑥).
The roots of equations may be real or complex. In general, an equation may have any number of
(real) roots or no roots at all. For example, sin 𝑥 – 𝑥 = 0 has a single root, namely, 𝑥 = 0,
whereas tan x – x = 0 has infinite number of roots (𝑥 = 0, ± 4.493, ± 7.725, … ). There are two
types of methods available to find the roots of algebraic and transcendental equations of the form
𝑓 (𝑥) = 0.
1. Direct Methods: Direct methods give the exact value of the roots in a finite number of steps.
We assume here that there are no rounds off errors. Direct methods determine all the roots at the
same time.
2. Indirect or Iterative Methods: Indirect or iterative methods are based on the concept of
successive approximations. The general procedure is to start with one or more initial
approximation to the root and obtain a sequence of iterates (𝑥𝑘 ) which in the limit converges to
the actual or true solution to the root. Indirect or iterative methods determine one or two roots at a
time. The indirect or iterative methods are further divided into two categories: bracketing and open
methods. The bracketing methods require the limits between which the root lies, whereas the open
methods require the initial estimation of the solution. Bisection and False position methods are
Page 14
Numerical Method for Engineering
two known examples of the bracketing methods. Among the open methods, the Newton-Raphson
and the method of successive approximation are most commonly used. The most popular method
for solving a non-linear equation is the Newton-Raphson method and this method has a high rate
of convergence to a solution.
This chapter deals about way of solving non – linear equations using different types of numerical
methods.
Let us suppose that our aim is to find some or all roots of the non – linear equation𝑓(𝑥) = 0.
Before we use a numerical method we should have some idea about the approximate location of
the roots. The usual approach involves the construction of graphs or tables of values of the
function 𝑓(𝑥). The equation 𝑓(𝑥) = 0 can be expressed by splitting 𝑓(𝑥) into two elementary
functions 𝑓1 (𝑥) and 𝑓2 (𝑥) such that
And then sketch the graph of 𝑓1 (𝑥) 𝑎𝑛𝑑 −𝑓2 (𝑥). The desired roots are then the values of x in
the intersection points of the graphs.
Solution: let 𝑓1 (𝑥) = 𝑒 −𝑥 a𝑛𝑑 𝑓2 (𝑥) = −𝑥 2 + 𝑥, then the graphs of 𝑓1 and −𝑓2 are given as
follows:
Page 15
Numerical Method for Engineering
𝑓1 𝑓(𝑥)
−𝑓2
1 𝑥
Fig.1
We can deduce from the graph that the equation has only one root near 1.3 and we then tabulate
𝑓(𝑥) = 𝑒 −𝑥 − 𝑥(𝑥 − 1) near 1.3 as follows:
where 𝑓 is continuous on [𝑎, 𝑏] and 𝑓(𝑎) < 0 and 𝑓(𝑏) > 0 or vice versa and now assume
the first one.
Page 16
Numerical Method for Engineering
𝑦 𝑦 True solution
𝑎 𝑏 𝑥 𝑎 𝑏 𝑥
True solution
In order to find a root of 𝑓(𝑥) = 0 lying in the interval [𝑎, 𝑏] we divide the interval into half. i.e.
𝑎+𝑏
𝑚= 𝑎𝑛𝑑 then
2
Then the newly reduced interval denoted by [𝑎1 , 𝑏1 ] is again halved and the same
investigation is made. Finally, at some stage in the process, we get either the exact root of
𝑓(𝑥) = 0 or a finite sequence of intervals [𝑎, 𝑏] ⊇ [𝑎1 , 𝑏1 ] ⊇ ⋯ ⊇ [𝑎𝑛 , 𝑏𝑛 ] such that
𝑓(𝑎𝑛 ) < 0 and 𝑓(𝑏𝑛 ) > 0. If |𝑏𝑛 − 𝑎𝑛 )| ≤ 𝜀, 𝜀 is a given absolute error or tolerance,
then the process terminates and the approximate root is 𝑏𝑛 .
Example 2.2 Solve the equation 𝑥 3 − 5𝑥 + 3 = 0 using the Bisection method in the interval
[0,1] with error 𝜀 = 0.001.
𝑓 is continuous in the given interval [0,1] and 𝑓(0) = 3 > 0, 𝑓(1) = −1 < 0. Hence, there is a
root of the equation in the given interval.
𝑎+𝑏 0+1
𝑚1 = = = 0.5 and 𝑓(0.5) = 0.625 > 0
2 2
Then, the root lies in the interval [0.5,1] and 𝑒1 = |0.5 − 1| = 0.5 > 0.001
Page 17
Numerical Method for Engineering
0.5+1
𝑚2 = = 0.75 and 𝑓(0.75) = −0.328125 < 0
2
Then, the root lies in the interval [0.5,0.75] and 𝑒2 = |0.5 − 0.75| = 0.25 > 0.001
0.5+0.75
𝑚3 = = 0.625 and 𝑓(0.625) = 0.11914 > 0
2
Then, the root lies in the interval [0.625,0.75] and 𝑒3 = |0.625 − 0.75| = 0.125 > 0.001
0.625+0.75
𝑚4 = = 0.6875 and 𝑓(0.6875) = −0.112548 < 0
2
Then, the root is in the interval [0.625,0.6875] & 𝑒4 = |0.625 − 0.6875| = 0.0.0625 > 0.001
0.625+0.6875
𝑚5 = = 0.65625 and 𝑓(0.65625) = 0.001373 > 0
2
0.65625+0.6875
𝑚6 = = 0.671875 and 𝑓(0.671875) = −0.05607986 < 0
2
0.65625+0.671875
𝑚7 = = 0.6640625 and 𝑓(0.6640625) = −0.02747488 < 0
2
0.65625+0.6640625
𝑚8 = = 0.66015625
2
Page 18
Numerical Method for Engineering
0.65625+0.66015625
𝑚9 = = 0.658203125
2
0.65625+0.658203125
𝑚10 = = 0.657226562
2
Since |0.65625 − 0.657226562| = 0.000976562 < 0.001 = 𝜀, the process terminates and the
approximate root of the equation is 𝑚10 = 0.657226562 .
Exercise 2.1 Solve the following equations using the bisection method
The curve 𝑦 = 𝑓(𝑥) is not generally a straight line. Assume that 𝑓 is continuous in the interval
[𝑎, 𝑏] and 𝑓(𝑎)𝑓(𝑏) < 0.
Page 19
Numerical Method for Engineering
𝑓(𝑎) > 0
Approximate solution
𝑎 𝑏 𝑥
Now, the equation of the straight line which passes through the points (𝑎, 𝑓(𝑎)) and (𝑏, 𝑓(𝑏)) is
given by:
𝑦−𝑓(𝑎) 𝑓(𝑏)−𝑓(𝑎)
=
𝑥−𝑎 𝑏−𝑎
(𝑏−𝑎)(𝑦−𝑓(𝑎))+𝑎𝑓(𝑏)−𝑎𝑓(𝑎)
⇒𝑥= 𝑓(𝑏)−𝑓(𝑎)
−𝑏𝑓(𝑎)+𝑎𝑓(𝑎)+𝑎𝑓(𝑏)−𝑎𝑓(𝑎) 𝑎𝑓(𝑏)−𝑏𝑓(𝑎)
𝑥= =
𝑓(𝑏)−𝑓(𝑎) 𝑓(𝑏)−𝑓(𝑎)
Therefore, the approximate root of the equation 𝑓(𝑥) = 0 is given by the formula
𝑎𝑓(𝑏)−𝑏𝑓(𝑎)
𝑥̃ = 𝑓(𝑏)−𝑓(𝑎)
Suppose that 𝑓(𝑎) < 0 and𝑓(𝑏) > 0, then as in the Bisection method we follow three cases.
Page 20
Numerical Method for Engineering
✓ If either case 2 or 3 occurs, then the process is repeated until the root is obtained to the
desired accuracy.
Example 2.3 Solve the equation 𝑥 3 − 5𝑥 + 3 = 0 using False position method in the interval
[0,1] with 𝜀 = 0.001.
𝑎𝑓(𝑏)−𝑏𝑓(𝑎) 0𝑓(1)−1𝑓(0)
𝑥̃1 = = = 0.75, 𝑓(0.75) = −0.328125 < 0
𝑓(𝑏)−𝑓(𝑎) 𝑓(1)−𝑓(0)
and |𝑓(0.75)| = 0.328125 > 0.001. Then, the root lies in the interval[0,0.75].
0𝑓(0.75)−0.75𝑓(0)
𝑥̃2 = = 0.676056, 𝑓(0.676056) = −0.071287136 < 0
𝑓(0.75)−𝑓(0)
and |𝑓(0.676056)| = 0.071287136 > 0.001. Then, the root lies in the interval [0,0.676056].
0𝑓(0.676056)−0.676056𝑓(0)
𝑥̃3 = = 0.660364
𝑓(0.676056)−𝑓(0)
0𝑓(0.660364)−0.660364𝑓(0)
𝑥̃4 = = 0.65733
𝑓(0.660364)−𝑓(0)
0𝑓(0.65733)−0.65733𝑓(0)
𝑥̃5 = = 0.656754
𝑓(0.65733)−𝑓(0)
Since |𝑓(0.656754)| = 0.00049469 < 0.001 = 𝜀, the process terminates and the approximate
root of the equation is 𝑥̃5 = 0.656754.
Page 21
Numerical Method for Engineering
Exercise 2.2 Solve the following equations using False position method
This method is based on the idea of successive approximation. To find the roots of 𝑓(𝑥) = 0,
first write the equation in the form of 𝑥 = 𝑔(𝑥).
Now, chose the initial value 𝑥0 by the case |𝑔′ (𝑥0 ) ≤ 1| and the next approximations are given
by: 𝑥1 = 𝑔(𝑥0 ), 𝑥2 = 𝑔(𝑥1 ), 𝑥3 = 𝑔(𝑥2 ), … , 𝑥𝑛 = 𝑔(𝑥𝑛−1 )
Remark 2: the process terminates if two consecutive approximate values of 𝑥 are nearly equal
with the prescribed error.
Example 2.4 Solve the equation 𝑥 3 − 2𝑥 − 5 = 0 using trial and error method.
5 5
Solution: Let 𝑥 3 − 2𝑥 − 5 = 0 ⟹ 𝑥(𝑥 2 − 2) = 5 ⟹ 𝑥 2 − 2 = 𝑥 ⟹ 𝑥 = √𝑥 − 2 = 𝑔(𝑥)
𝑥 3 −5
Or 𝑥 3 − 2𝑥 − 5 = 0 ⟹ 2𝑥 = 𝑥 3 − 5 ⟹ = 𝑔(𝑥)
2
3
Or 𝑥 3 − 2𝑥 − 5 = 0 ⟹ 𝑥 3 = 2𝑥 + 5 ⟹ 𝑥 = √2𝑥 + 5 = 𝑔(𝑥)
Now, let us use the first equation and initial value 𝑥0 = 0.5, then
5 5
𝑥1 = √𝑥 + 2 = √0.5 + 2 = 3.4641
0
5 5
𝑥2 = √𝑥 + 2 = √3.4641 + 2 = 1.8556
1
Page 22
Numerical Method for Engineering
5 5
𝑥3 = √𝑥 + 2 = √1.8556 + 2 = 2.1666
2
Exercise 2.3 Solve the following equations using the method of successive approximation.
This method is simple and fast. Let 𝑥0 be an initial approximate root of 𝑓(𝑥) = 0 and let 𝑥1 =
𝑥0 + ℎ such that 𝑓(𝑥1 ) = 0 and 𝑓 is continuous and differentiable. Then, using Taylor series
expansion 𝑓(𝑥) can be expanded as:
(𝑥−𝑥0 )2 (𝑥−𝑥0 )𝑛
𝑓(𝑥) = 𝑓(𝑥0 ) + 𝑓 ′ (𝑥0 )(𝑥 − 𝑥0 ) + 𝑓 ′′ (𝑥0 ) + ⋯ + 𝑓 (𝑛) (𝑥0 )
2! 𝑛!
ℎ2 ℎ𝑛
0 = 𝑓(𝑥0 ) + 𝑓 ′ (𝑥0 )ℎ + 𝑓 ′′ (𝑥0 ) 2! + ⋯ + 𝑓 (𝑛) (𝑥0 ) 𝑛!
Now, neglect the second and higher order derivatives and we get
𝑓(𝑥 )
𝑓(𝑥0 ) + ℎ𝑓 ′ (𝑥0 ) = 0 ⟹ ℎ = − 𝑓′ (𝑥0 )
0
𝑓(𝑥 ) 𝑓(𝑥 )
⟹ 𝑥1 − 𝑥0 = − 𝑓′ (𝑥0 ) ⟹ 𝑥1 = 𝑥0 − 𝑓′ (𝑥0 )
0 0
𝑓(𝑥 ) 𝑓(𝑥 )
𝑥2 = 𝑥1 − 𝑓′ (𝑥1 ) , 𝑥3 = 𝑥2 − 𝑓′ (𝑥2 )
1 2
Page 23
Numerical Method for Engineering
𝑓(𝑥 )
𝑥𝑛+1 = 𝑥𝑛 − 𝑓′ (𝑥𝑛 ) With 𝑓 ′ (𝑥𝑛 ) ≠ 0
𝑛
✓ The process terminates when two successive values of 𝑥𝑖 are nearly equal with the
prescribed error.
Example 2.5 Solve the equation 𝑥 3 − 5𝑥 + 3 = 0 using Newton Raphson method with initial
point 𝑥0 = 0 and 𝜀 = 0.001.
𝑓(𝑥 ) 𝑓(0)
𝑥1 = 𝑥0 − 𝑓′ (𝑥0 ) = 0 − 𝑓′ (0) = 0.6
0
𝑓(𝑥 ) 𝑓(0.6)
𝑥2 = 𝑥1 − 𝑓′ (𝑥1 ) = 0.6 − 𝑓′ (0.6) = 0.65510204
1
𝑓(𝑥 ) 𝑓(0.65510204)
𝑥3 = 𝑥2 − 𝑓′ (𝑥2 ) = 0.65510204 − 𝑓′ (0.65510204) = 0.656619
2
𝑓(𝑥 ) 𝑓(0.656619)
𝑥4 = 𝑥3 − 𝑓′ (𝑥3 ) = 0.656619 − 𝑓′ (0.656619) = 0.65662
3
Since, |𝑥4 − 𝑥3 | = 0.000001 < 0.001 = 𝜀, the process terminates and the approximate root is
𝑥4 = 0.65662.
Exercise 2.4 Solve the following equations using the Newton raphson method
Page 24
Numerical Method for Engineering
The secant method is very similar to the Newton-Raphson method. The main disadvantage of the
Newton-Raphson method is that the method requires the determination of the derivatives of the
function at several points and often the calculations of these derivatives takes too much time. To
remove these difficulties we use this method. In this method 𝑓 ′ (𝑥) given in the Newton-Raphson
method is approximated in the following way
𝑓(𝑥𝑖 )−𝑓(𝑥𝑖−1 )
𝑓 ′ (𝑥) = 𝑥𝑖 −𝑥𝑖−1
Where, 𝑥𝑖 and 𝑥𝑖−1 are two approximations of the root. Then, the iterative formula to go from the
𝑖 𝑡ℎ to the (𝑖 + 1)𝑡ℎ approximation is given by:
𝑓(𝑥 )
𝑥𝑖+1 = 𝑥𝑖 − 𝑓′ (𝑥𝑖 )
𝑖
𝑓(𝑥𝑖 )
= 𝑥𝑖 − ⁄ 𝑓(𝑥𝑖 )−𝑓(𝑥𝑖−1)
( 𝑥 −𝑥 )
𝑖 𝑖−1
✓ The process terminates when two successive values of 𝑥𝑖 are nearly equal with the
prescribed error.
Example 2.6 Solve the equation 𝑥 2 − 25 = 0 using secant method with 𝑥0 = 4, 𝑥1 = 7 and 𝜀 =
0.05.
Page 25
Numerical Method for Engineering
𝑥1 𝑓(𝑥2 )−𝑥2 𝑓(𝑥1 ) 7𝑓(4.81818182)−4.81818182𝑓(7)
𝑥3 = = = 4.96923075
𝑓(𝑥2 )−𝑓(𝑥1 ) 𝑓(4.81818182)−𝑓(7)
Since 𝑒3 = 0.03134089 < 0.05 = 𝜀, the process terminates and the approximate root of the
equation is 𝑥4 = 5.00057164.
Exercise 2.5 Solve the following equations using the secant method
Page 26
Numerical Method for Engineering
Unit Summary
In this chapter, the techniques for the numerical solution of algebraic and transcendental
equations have been presented. Numerical methods involving iterative solution of
nonlinear equations are more powerful.
These methods can be divided into two categories: Direct methods and Indirect (or
iterative) methods. The indirect or iterative methods are further divided into two
categories: bracketing and open method. The bracketing methods require the limits
between which the root lies, whereas the open methods require the initial estimation of
the solution. Bisection and False Position methods are two known examples of the
bracketing methods. Among the open methods, the Newton-Raphson and the method of
Successive Approximation are most commonly used.
The most popular method for solving a non-linear equation is the Newton-Raphson
method and this method has a quadratic rate of convergence. These methods have been
illustrated with examples.
Review Exercise
1. Use the Bisection method to find a solution accurate to four decimal places for 𝑥 = 𝑡𝑎𝑛 𝑥
in the interval (4.4, 4.6).
2. Use the Bisection method to compute the root of 𝑒 𝑥 – 3𝑥 = 0 correct to three decimal
places in the interval (1.5, 1.6).
3. Use the Bisection method to determine a root correct to three decimal places of the equation
𝑥 log10 𝑥 = 1.2. Interval (2, 3).
4. Use the method of False Position to find solution accurate to within 𝟏𝟎−𝟒 for the function
𝜋
𝑓 (𝑥) = 𝑥 – 𝑐𝑜𝑠 𝑥 in the interval (0, 2 ).
5. Use the method of False Position to solve the equation 𝑥 𝑡𝑎𝑛 𝑥 + 1 = 0 accurate to three
decimal places starting with 2.5 𝑎𝑛𝑑 3.0 as the initial approximations to the root.
6. Use the method of False Position to solve the equation 𝑥𝑒 𝑥 – 𝑐𝑜𝑠 𝑥 = 0 correct to four
decimal places in the interval (0, 1).
Page 27
Numerical Method for Engineering
7. A root of 𝑓 (𝑥) = 𝑥 3 – 10𝑥 2 + 5 = 0 lies close to 𝑥 = 0.7. Determine this root with
the Newton-Raphson method to five decimal accuracy.
8. A root of 𝑓 (𝑥) = 𝑒 𝑥 – 2𝑥 2 lies in the interval (1, 2). Determine this root with the Newton-
Raphson method to five decimal accuracy.
9. Use Newton-Raphson method to find the smallest positive root of the equation 𝑡𝑎𝑛 𝑥 = 𝑥
accurate to four decimal places.
10. Use the Successive Approximation method to find correct to four significant figures a real
root of 𝑒 –𝑥 – 10𝑥 = 0.
11. Use the Successive Approximation method to find correct to four decimal places a real root
of 2𝑥 – 𝑙𝑜𝑔10 𝑥 – 7 = 0.
12. Find the real root of the equation 𝑥 – 𝑠𝑖𝑛 𝑥 – 0.25 = 0 to three significant digits using the
Successive Approximation method.
13. Find a root of the equation x3 – 75 = 0 using the secant method with the initial approximations
of 𝑥0 = 4 and 𝑥1 = 5.
14. Find a root of the equation 𝑐𝑜𝑠 𝑥 𝑐𝑜𝑠ℎ 𝑥 – 1 = 0 using the secant method with initial
approximations 𝑥0 = 4.5 and 𝑥 1 = 5.0.
Page 28
Numerical Method for Engineering
References
Burden, R.L., and Faires, J.D., Numerical analysis, 9th ed., PWS publishing, Boston, 1993.
Chapra, S.C., and Raymond, P.C., Numerical Methods for Engineering, 6th ed.,
Grewal, B.S., Numerical Methods in Engineering and Science, Khanna, New Delhi, 1994.
Page 29
Numerical Method for Engineering
Chapter Three
Systems of linear equations
Objectives:
Introduction
Systems of simultaneous equations occur in solving problems in a wide variety of disciplines,
including mathematics and statistics, the physical, biological, and social sciences, as well as
engineering and business. They arise directly in solving real world problems depending on the
structure of the equations. In this chapter we present the solution of n linear simultaneous
algebraic equations in n unknowns. Linear systems of equations are associated with many
problems in engineering and science, as well as with applications of mathematics to the social
sciences and quantitative study of business and economic problems.
A linear system of 𝑛 equations in 𝑛 unknowns 𝑥1 , … , 𝑥𝑛 is a set of the system of algebraic equations
has equations of the form
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2
. . . . (3.1)
. . . .
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛
Where, the coefficients 𝑎𝑗𝑘 and the 𝑏𝑗 are constants.
The system (3.1) is homogeneous if all the 𝑏𝑗 are zero, otherwise is non-homogeneous.
In matrix form, the system (3.1) can be written as
𝐴𝑥 = 𝑏, (3.2)
Page 30
Numerical Method for Engineering
Where,
𝑎11 𝑎12 . . . 𝑎1𝑛 𝑥1 𝑏1
𝑎21 𝑎22 . . . 𝑎2𝑛 𝑥2 𝑏2
. . . . .
𝐴= . . . . = .
. . . . .
(𝑎𝑛1 𝑎𝑛2 . . . 𝑎𝑛𝑛 ) (𝑥𝑛 ) (𝑏𝑛 )
There are two different approaches for finding numerical solutions of a system of equations,
namely
1) Direct methods (or exact methods)
2) Indirect methods (or approximated methods)
Objectives:
Let 𝐴𝑥 = 𝑏 be any given linear system. Then there are different numerical methods to find the
exact solution set of the given system, some of methods to be discussed in this chapter are:
1) Gauss elimination method
2) Gauss-Jordan elimination method
3) Matrix Inversion method
4) LU-decomposition method
In linear system of equations, where the coefficient matrix is triangular are simple to solve.
A system𝑈𝑥 = 𝐵, where 𝑈an upper triangular matrix is has the form:
Page 31
Numerical Method for Engineering
A linear system of equations which has a lower triangular coefficient matrix has the form 𝐿𝑥 =
𝐵 is written as:
𝑙11 𝑥1 = 𝑏1
𝑙21 𝑥1 + 𝑙22 𝑥2 = 𝑏2
.
.
.
𝑙𝑛1 𝑥1 + 𝑙𝑛2 𝑥2 + ⋯ + 𝑙𝑛𝑛 𝑥𝑛 = 𝑏𝑛
Assuming𝑙𝑖𝑖 ≠ 0, for all 𝑖 = 1,2, … , 𝑛, the unknowns are computed in the order of 𝑥1 , 𝑥2 , … , 𝑥𝑛 as
𝑏
follows: 𝑥1 = 𝑙 1
11
𝑏2 − 𝑙21 𝑥1
𝑥2 =
𝑙22
.
.
.
𝑏𝑛 − 𝑙𝑛1 𝑥1 − 𝑙𝑛2 𝑥2 − ⋯ − 𝑙𝑛(𝑛−1) 𝑥𝑛−1
𝑥𝑛 =
𝑙𝑛𝑛
Page 32
Numerical Method for Engineering
Remark 1: we make the above steps by applying one of the following elementary operations.
Page 33
Numerical Method for Engineering
Page 34
Numerical Method for Engineering
3𝑥1 + 4𝑥2 + 𝑥3 = 14
2 3 5 23
[𝐴: 𝑏] = (3 4 1 14)
6 7 2 26
Step 1:
2 3 5 23 −3𝑅 +𝑅 2 3 5 23
2 1 2 1 13 41
(3 4 1 14) −3𝑅 +𝑅 (0 − 2 − 2 − 2 ) = [𝐴(1) , 𝑏 (1) ]
1 3
6 7 2 26 0 −2 −13 −43
Step 2:
2 3 5 23 2 3 5 23
1 13 41 1 13 41
(0 −2 −2 − 2 ) − 4𝑅2 + 𝑅3 (0 − 2 − 2 − 2 ) = [𝑈, 𝑦]
0 −2 −13 −43 0 0 13 39
2 3 5 23
1 13 41
Here, (0 −2 − 2 − 2 ) is the augmented matrix of the system of equations given below
0 0 13 39
1 13 41
− 2 𝑥2 − 𝑥3 = − (2)
2 2
Page 35
Numerical Method for Engineering
13𝑥3 = 39 (3)
Now, to find the values of 𝑥1 , 𝑥2 and 𝑥3 we apply the backward substitution formula. i.e.
From equation (3), we get 𝑥3 = 3 and substitute this into equation (2) and solve for 𝑥2 and we
get 𝑥2 = 2. Finally, substitute values of 𝑥2 and 𝑥3 in equation (1) and solve for 𝑥1 , then we get
𝑥1 = 1.
Therefore, the solution of the system is 𝑥 = {(𝑥1 , 𝑥2 , 𝑥3 )𝑡 = (1,2,3)𝑡 }.
Exercise 3.1 Using Gaussian elimination method solve the following system of linear equations.
1. 𝑥 + 𝑦 + 𝑧 − 𝑤 = 2
4𝑥 + 4𝑦 + 𝑧 + 𝑤 = 11
𝑥 − 𝑦 − 𝑧 + 2𝑤 = 0
2𝑥 + 𝑦 + 2𝑧 − 2𝑤 = 2
1 1 1 1 𝑥 3
2 −1 3 0 𝑦 3
2. ( )( ) = ( )
0 2 0 3 𝑧 1
−1 0 2 1 𝑤 0
If the pivot is zero, the entire process in Gaussian elimination fails and if it closes to zero, round
off errors may occur. These problems can be avoided by adopting a procedure called pivoting. In
the first step, the numerically largest coefficient of 𝑥1 is chosen from all the equations from all the
equations and brought as the first pivot by interchanging the first equation with the equation having
the largest coefficient of 𝑥1 . In the second step, the numerically largest coefficient of 𝑥2 is chosen
from the remaining equations (leaving the first equation) and brought as the second pivot by
interchanging the second equation with the equation having the largest coefficient of 𝑥2 . This
process is continued till we arrive at the equation with the single variable. This modified procedure
is called partial pivoting.
Example 3.3 Use Gaussian elimination with partial pivoting method to solve the linear system
8𝑥2 + 2𝑥3 = −7
3𝑥1 + 5𝑥2 + 2𝑥3 = 8
6𝑥1 + 2𝑥2 + 8𝑥3 = 26
Page 36
Numerical Method for Engineering
Solution: Using Gaussian elimination with partial pivoting, since the first pivot element is zero,
interchanging the third equation with the first equation we have,
6𝑥1 + 2𝑥2 + 8𝑥3 = 26 (i)
3𝑥1 + 5𝑥2 + 2𝑥3 = 8 (ii)
8𝑥2 + 2𝑥3 = −7 (iii)
Then, to eliminate 𝑥1 from (ii), we operate [(ii)-3/6(i)]. We thus, get the new system
Exercise 3.2 Use Gauss elimination with partial pivoting method to solve the system
2𝑥1 + 𝑥2 + 4𝑥3 = 12
8𝑥1 − 3𝑥2 + 2𝑥3 = 20
4𝑥1 + 11𝑥2 − 𝑥3 = 33
Page 37
Numerical Method for Engineering
This is a modification of the Gaussian elimination method. In this method, elimination of the
unknowns is performed not in the equations below but in the equations above also, ultimately
reducing the system to a diagonal matrix form, i.e., equation involving only one unknown. From
the resulting system of equations the unknowns can be obtained readily.
Principle of the method: The Gauss Jordan method works by transforming the linear system
𝐴𝑥 = 𝑏 into an equivalent system 𝐴′ 𝑥 = 𝑏 ′ , where 𝐴 is an arbitrary non – singular matrix and 𝐴′
is an identity matrix of order 𝑛, so that 𝑥 = 𝑏 ′ is the solution of the original linear system.
Step 1: Assume that 𝑎11 ≠ 0, then replace 𝑎11 by 1 in the augmented matrix [𝐴: 𝑏] and this is
1
possible by pre – multiplying [𝐴: 𝑏] by elementary matrix 𝐸1 (𝑎 ). So after normalization the
11
𝑎1𝑗
𝑎1𝑗 (1) = ⁄𝑎11, for all 𝑗 = 1,2, … , 𝑛 + 1
Now, we make the non – diagonal elements of the first column of 𝐴 to become zero. That is
𝑎𝑖1 = 0, for all 𝑖 = 2,3, … , 𝑛.
Step 2: Assuming 𝑎22 (2) ≠ 0, then replace 𝑎22 (2) by 1 in the augmented matrix [𝐴: 𝑏](1) and this
1
is possible by pre – multiplying [𝐴: 𝑏] by elementary matrix 𝐸2 (𝑎 ). So after normalization the
22
𝑎2𝑗 (1)
𝑎2𝑗 (2) = ⁄ (1) , for all 𝑗 = 2,3, … , 𝑛 + 1
𝑎22
Page 38
Numerical Method for Engineering
Now, we make the non – diagonal elements of the second column of 𝐴 to become zero. That is
𝑎𝑖2 = 0, for all 𝑖 = 1,3, … , 𝑛.
1
Step k: Assume 𝑎𝑘𝑘 (𝑘−1) ≠ 0, then multiply [𝐴: 𝑏](𝑘−1) by the elementary matrix 𝐸𝑘 (𝑎 (𝑘−1) ) to
𝑘𝑘
change 𝑎𝑘𝑘 (𝑘−1) to 1. The other coefficients of the 𝑘 𝑡ℎ row are given by:
𝑎𝑘𝑗 (𝑘−1)
𝑎𝑘𝑗 (𝑘) = ⁄ (𝑘−1) , for all 𝑗 = 𝑘, 𝑘 + 1, … , 𝑛 + 1.
𝑎𝑘𝑘
The non – diagonal elements of the 𝑘 𝑡ℎ column must be zero. That is 𝑎𝑖𝑘 = 0, ∀𝑖 = 1,2, … , 𝑘 −
1, 𝑘 + 1, … , 𝑛.
Remark 2: Similar to the Gaussian elimination method the steps listed above are done by
applying the three elementary operations.
Example 3.4 Using Gauss Jordan method, solve the matrix equation defined by:
1 3 3 𝑥1 0
(2 2 𝑥
0) ( 2 ) = ( 2 )
3 3 6 𝑥3 11
1 3 3 0
[𝐴: 𝑏] = (2 2 0 2)
3 3 6 11
Step 1: Eliminate the coefficients of the first column below the diagonal element.
1 3 3 0 1 3 3 0
−2𝑅1 +𝑅2
(2 2 0 2 ) −3𝑅 +𝑅 (0 −4 −6 2 ) = [𝐴: 𝑏](1)
1 3
3 3 6 11 0 −6 −3 11
1
Step 2: Normalization is obtained on by pre – multiplying [𝐴: 𝑏](1) by 𝐸2 (− 4). i.e.
1 3 3 0 1 3 3 0
1 3 1
(0 −4 −6 2 ) − 𝑅2 (0 1 2
− 2)
4
0 −6 −3 11 0 −6 −3 11
Once again eliminate the non – diagonal elements of the second column. i.e.
Page 39
Numerical Method for Engineering
3 3
1 3 3 0 1 0 −2 2
3 1 −2𝑅2 +𝑅1
(0 1 2
− 2) (0 1 3 − 1) = [𝐴: 𝑏](2)
6𝑅2 +𝑅3
2 2
0 −6 −3 11 0 0 6 8
1
Step 3: Normalization is obtained on by pre – multiplying [𝐴: 𝑏](2) by 𝐸3 (6). i.e.
3 3
1 0 −2
3 3 1 0 −2 2
2 3 1
1
(0 − 2) 6 𝑅2 0 1 −2
3 1
1 2
2 4
0 0 6 8 0 0 1
( 3 )
Then, eliminate the non – diagonal elements of the third column. i.e.
3 3 7
1 0 −2 1 0 0
2 3 2
3 1 − 𝑅3 +𝑅2 5
0 1 2
−2 3
2
0 1 0 −2 = [𝐴: 𝑏](3)
𝑅 +𝑅1
2 3
4 4
0 0 1 0 0 1
( 3 ) ( 3 )
7
1 0 0
2
5
Here, 0 1 0 −2 is the augmented matrix of the system of equation given below.
4
0 0 1
( 3 )
7
𝑥1 = 2
5
𝑥2 = − 2
4
𝑥3 = 3
7 5 4 𝑡
Therefore, the solution of the system is 𝑥 = {(𝑥1 , 𝑥2 , 𝑥3 )𝑡 = (2 , − 2 , 3) }.
Page 40
Numerical Method for Engineering
𝑥1 + 𝑥2 + 𝑥3 = 9 (i)
2𝑥1 − 3𝑥2 + 4𝑥3 = 13 (ii)
3𝑥1 + 4𝑥2 + 5𝑥3 = 40 (iii)
First, to eliminate 𝑥1 from (ii) and (iii), we operate [(ii)-2(i)] and [(iii)-3(i)]. We get,
𝑥1 + 𝑥2 + 𝑥3 = 9 (i)
−5𝑥2 + 2𝑥3 = −5 (iv)
𝑥2 + 2𝑥3 = 13 (v)
Second, to eliminate 𝑥2 from (i) and (v), we operate [(i)+1/5(iv)] and [(v)+1/5(iv)]. We get,
7
𝑥1 + 5 𝑥3 = 8 (vi)
Next, to eliminate 𝑥3 from (iv) and (vi), we operate [(iv)-5/6(vii)] and [(vi)-7/12(vii)].
Finally, we obtain the diagonal system
𝑥1 = 1
−5𝑥2 = −15
12
𝑥3 = 12
5
c. 2𝑥1 + 𝑥2 + 4𝑥3 = 12
8𝑥1 − 3𝑥2 + 2𝑥3 = 20
4𝑥1 + 11𝑥2 − 𝑥3 = 33
Page 41
Numerical Method for Engineering
The computation of 𝑐𝑖𝑗 can be viewed as the multiplication of the entries of the 𝑖𝑡ℎ row of A with
corresponding entries in the 𝑗𝑡ℎ column of B, followed by a summation; that is,
𝑏1𝑗
[𝑎𝑖1 … 𝑎𝑖𝑚 ] [ ⋮ ] = 𝑐𝑖𝑗 , where 𝑐𝑖𝑗 = 𝑎𝑖1 𝑏1𝑗 + 𝑎𝑖2 𝑏2𝑗 + ⋯ + 𝑎𝑖𝑚 𝑏𝑚𝑗 .
𝑏𝑚𝑗
This explains why the number of columns of A must equal the number of rows of B for the product
AB to be defined.
Definition: A square matrix has the same number of rows as columns. A diagonal matrix D=[𝑑𝑖𝑗 ]
is a square matrix with 𝑑𝑖𝑗 = 0 whenever 𝑖 ≠ 𝑗. The identity matrix of order 𝑛, 𝐼𝑛 = [𝛿𝑖𝑗 ], is a
1, 𝑖𝑓 𝑖 = 𝑗
diagonal matrix with entries 𝛿𝑖𝑗 = { .
0, 𝑖𝑓 𝑖 ≠ 𝑗
Definition: An 𝑛 × 𝑛 matrix A is nonsingular (or invertible) if an 𝑛 × 𝑛 matrix 𝐴−1 exists with
𝐴𝐴−1 = 𝐴−1 𝐴 = 𝐼𝑛 . The matrix 𝐴−1 is called the inverse of A. A matrix without an inverse is
called singular (or noninvertible).
Reading assignment
✓ determinant of a matrix
Condition for the existence of inverse
If the determinant of a square matrix A is nonzero, i.e., if det (𝐴) ≠ 0, then the matrix A is
nonsingular.
Consider a system of 𝑛 equations in 𝑛 unknowns
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 = 𝑏1
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 = 𝑏2
Page 42
Numerical Method for Engineering
. . .. . .
. . . .
𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + ⋯ + 𝑎𝑛𝑛 𝑥𝑛 = 𝑏𝑛
In matrix form, it is written as
𝐴𝑥 = 𝑏,
Where,
𝑎11 𝑎12 … . 𝑎1𝑛 𝑥1 𝑏1
𝑎
𝐴 = [ 21. 𝑎22. … . 𝑎2𝑛 𝑥 𝑏
. ] , 𝑥 = [ 2. ] , 𝑏 = [ 2. ]
𝑎𝑛1 𝑎𝑛2 … . 𝑎𝑛𝑛 𝑥𝑛 𝑏𝑛
If the coefficient matrix A is invertible, then the solution of the above system is given by the
formula
𝑥 = 𝐴−1 𝑏
The task to solve a certain system of linear equations using matrix-inversion method is then to find
the inverse of the coefficient matrix. There are several methods of finding the inverse of a matrix.
Some of the methods include:
✓ method of adjoint,
✓ Gauss elimination method, and
✓ Gauss-Jordan method.
In this section we will discuss Gauss-Jordan elimination method in finding the inverse of a
nonsingular coefficient matrix of a system of linear equations. In this method, the matrix is
converted in to an identity matrix.
In practice, we apply the elementary row operations for the augmented matrix formed by
combining the coefficient matrix A and the identity matrix 𝐼𝑛 . As soon as A is reduced to identity,
the other matrix represents the inverse 𝐴−1 of the coefficient matrix.
Page 43
Numerical Method for Engineering
Page 44
Numerical Method for Engineering
Note: The symbol ~ is used to say that the given augmented matrix and the successive augmented
matrices are equivalent.
Hence, the inverse of the given coefficient matrix A is
−3/24 9/24 15/24
−1
𝐴 = [−9/24 3/24 21/24 ]
21/24 −15/24 −33/24
Thus, the solution of the system is given by
9 27 60
− −+
−3/24 9/24 15/24 24 24 24
3 27 9 84 1
−1
𝑥 = 𝐴 𝑏 = [−9/24 3/24 21/24 ] [−3] = − − + =[ 2 ]
21/24 −15/24 −33/24 4 24 24 24 −1
63 45 132
[ 24 + 24 − 24 ]
That is, 𝑥1 = 1, 𝑥2 = 2, and 𝑥3 = −1.
Note:
✓ Matrix inversion using Jordan’s method fails if the coefficient matrix A is a singular matrix.
✓ Matrix inversion using Jordan’s method It is not suitable for a large system.
Example 3.7 Using Gauss Jordan method find the inverse of the matrix
1 3 3
𝐴 = (2 2 0 )
3 2 6
Solution: The augmented matrix of 𝐴 and 𝐼 is given by:
1 3 3 1 0 0
[𝐴: 𝐼3 ] = (2 2 0 0 1 0)
3 2 6 0 0 1
Transform the elements below the diagonal element in the first column of [𝐴: 𝐼3 ] to zero,
i.e.
1 3 3 1 0 0 1 3 3 1 0 0
−2𝑅 +𝑅
(2 2 0 0 1 0) −3𝑅1+𝑅2 (0 −4 −6 −2 1 0) = [𝐴: 𝐼](1)
1 3
3 2 6 0 0 1 0 −7 −3 −3 0 1
1
Now, multiply [𝐴: 𝐼](1) by 𝐸2 (− 4) to change 𝑎22 = −4 to 1. i.e.
1 3 3 1 0 0 1 3 3 1 0 0
1 3 1 1
(0 −4 −6 −2 1 0) − 4 𝑅2 (0 1 2 2
−4 0)
0 −7 −3 −3 0 1 0 −7 −3 −3 0 1
Then, eliminate the non – diagonal elements of the second column, i.e.
Page 45
Numerical Method for Engineering
3 1 3
1 0 −2 −2 0
1 3 3 1 0 0 4
3 1 1 −3𝑅2 +𝑅1 3 1 1
(0 1 2 2
− 4 0) 0 1 2 2
−4 0 = [𝐴: 𝐼](2)
7𝑅2 +𝑅3
0 −7 −3 −3 0 1 15 1 7
0 0 −4 1
( 2 2 )
2 15
Now, multiply [𝐴: 𝐼](2) by 𝐸3 (15) to change 𝑎33 = to 1. i.e.
2
3 1 3 3 1 3
1 0 −2 −2 0 1 0 −2 −2 0
4 4
3 1 1 2 3 1 1
0 1 −4 0 𝑅3 0 1 −4 0
2 2 15 2 2
15 1 7 1 7 2
0 0 − 1 0 0 1 −
( 2 2 4 ) ( 15 30 15)
Then, eliminate the non – diagonal elements of the third column, i.e.
3 1 3 2 2 1
1 0 −2 −2 0 1 0 0 −5
4 3 5 5
3 1 1 𝑅 +𝑅1 2 1 1
2 3
0 1 2 2
−4 0 3 0 1 0 5 10
−5 = [𝐴: 𝐼](3)
− 𝑅3 +𝑅2
2
1 7 2 1 7 2
0 0 1 − 30 0 0 1 − 30
( 15 15) ( 15 15 )
Here, the last matrix is the end of the gauss Jordan method and in this 𝐴 is changed to
identity and this shows 𝐴 is invertible and its inverse is
2 2 1
−5 5 5
−1 2 1 1
𝐴 = −5
5 10
1 7 2
− 30
( 15 15 )
Exercise 3.4 Use Matrix inversion using Jordan’s method to solve the system
2𝑥1 − 𝑥2 = 7
−𝑥1 + 2𝑥2 − 𝑥3 = 1
−𝑥2 + 2𝑥3 = 1
3.1.5 Matrix decomposition method
This method is also known as LU-decomposition method.
This method is based on the fact a square matrix 𝐴 can be factorized into the form 𝐿𝑈, where 𝐿 is
lower triangular matrix and 𝑈 is unit upper triangular matrix. Provided that the principal minors
of 𝐴 are non – singular. i.e.
Page 46
Numerical Method for Engineering
𝑎11 𝑎12 𝑎13
𝑎11 𝑎12
𝑎11 ≠ 0, |𝑎 𝑎 𝑎22 𝑎23 | ≠ 0, etc.
21 𝑎22 | ≠ 0, | 21
𝑎31 𝑎32 𝑎33
𝑎
𝑙11 × 𝑢12 = 𝑎12 ⟹ 𝑢12 = 𝑎12
11
𝑎
𝑙11 × 𝑢13 = 𝑎13 ⟹ 𝑢13 = 𝑎13
11
𝑎21 ×𝑎12
𝑙21 × 𝑢12 + 𝑙22 = 𝑎22 ⟹ 𝑙22 = 𝑎22 − 𝑎11
𝑎
𝑙31 × 𝑢12 + 𝑙32 = 𝑎32 ⟹ 𝑙32 = 𝑎32 − 𝑎31 × 𝑎12
11
1 𝑎
𝑙21 × 𝑢13 + 𝑙22 × 𝑢23 = 𝑎23 ⟹ 𝑢23 = 𝑙 (𝑎23 − 𝑎21 × 𝑎13 )
22 11
𝑎
𝑙31 × 𝑢13 + 𝑙32 × 𝑢23 + 𝑙33 = 𝑎33 ⟹ 𝑙33 = 𝑎33 − 𝑎31 × 𝑎13 − 𝑙32 × 𝑢23
11
Page 47
Numerical Method for Engineering
𝑙11 0 0 𝑥1 𝑏1
⟹ (𝑙21 𝑙22 𝑥
0 ) ( 2 ) = (𝑏2 )
𝑙31 𝑙32 𝑙33 𝑥3 𝑏3
⟹ 𝑙11 × 𝑣1 = 𝑏1
𝑙21 × 𝑣1 + 𝑙22 × 𝑣2 = 𝑏2
1 𝑢12 𝑢13 𝑥1 𝑣1
𝑈𝑥 = 𝑣 ⟹ (0 1 𝑢23 ) (𝑥2 ) = (𝑣2 )
0 0 1 𝑥3 𝑣3
⟹ 𝑥1 + 𝑢12 × 𝑥2 + 𝑢13 × 𝑥3 = 𝑣1
𝑥2 + 𝑢23 × 𝑥3 = 𝑣2
𝑥3 = 𝑣3
Then, solve for 𝑥1 , 𝑥2 and 𝑥3 using the backward substitution formula.
Example 3.8 Using matrix decomposition method solve the following system of linear
equations.
𝑥+𝑦+𝑧 =1
4𝑥 + 3𝑦 − 𝑧 = 6
3𝑥 + 5𝑦 + 3𝑧 = 4
Solution: The system is given as:
1 1 1 𝑥 1
(4 3 −1) (𝑦) = (6)
3 5 3 𝑧 4
Let 𝐿𝑈 = 𝐴
𝑙11 0 0 1 𝑢12 𝑢13 1 1 1
⟹ (𝑙21 𝑙22 0 ) (0 1 𝑢23 ) = (4 3 −1)
𝑙31 𝑙32 𝑙33 0 0 1 3 5 3
Then, solve the unknowns by equating the two matrices and we get
𝑙11 = 1, 𝑙21 = 4, 𝑙31 = 3
Page 48
Numerical Method for Engineering
𝑢12 = 1, 𝑢13 = 1
𝑙22 = −1, 𝑙32 = 2
𝑢23 = 5 and 𝑙33 = −10
Then, we have
1 0 0 𝑣1 1
𝐿𝑣 = 𝑏 ⟹ (4 −1 𝑣
0 ) ( 2 ) = (6 )
3 2 −10 𝑣3 4
⟹ 𝑣1 = 1
4𝑣1 − 𝑣2 = 6
3𝑣1 + 2𝑣2 − 10𝑣3 = 4
1 1 1 𝑥 1
−2
Then, 𝑈𝑥 = 𝑣 ⟹ (0 1 5) (𝑦) = ( 1)
0 0 1 𝑧 −2
⟹𝑥+𝑦+𝑧 =1
𝑦 + 5𝑧 = −2
1
𝑧 = −2
Page 49
Numerical Method for Engineering
Exercise 3.5 Solve the following system of linear equations using matrix decomposition method.
a. 2𝑥 + 𝑦 + 4𝑧 = 12 b. 2𝑥 + 𝑦 − 3𝑧 = 11
8𝑥 − 3𝑦 + 2𝑧 = 20 4𝑥 − 2𝑦 + 3𝑧 = 8
4𝑥 + 11𝑦 − 𝑧 = 33 −2𝑥 + 2𝑦 − 𝑧 = −6
Page 50
Numerical Method for Engineering
⌈𝑏1 𝑏2 𝑏3 𝑏4 ⌉ = [5 5 10 1]
Page 51
Numerical Method for Engineering
𝑎𝑖1 𝑎(𝑖−1)3
Step 1: Set 𝑦1 = 𝑎12 and compute 𝑦𝑖 = 𝑎𝑖2 − 𝑖 = 2,3,4 … 𝑛
𝑦𝑖−1
𝑎21 𝑎13 2(−1) 7
𝑦1 = 3 𝑖=2 𝑦2 = 𝑎22 − = −3 − = −3
𝑦1 3
𝑏2 − 𝑎21 𝑧1 5 − 2(5⁄3) 5
𝑖=2 𝑧2 = = =−
𝑦2 −7⁄ 7
3
𝑏3 − 𝑎31 𝑧2 10 − 1(−5⁄7) 75
𝑖=3 𝑧3 = = =
𝑦3 20⁄ 20
7
𝑏4 − 𝑎41 𝑧3 1 − 1(75⁄20)
𝑖=4 𝑧4 = = =1
𝑦4 −55⁄
20
𝑎𝑖3 𝑥𝑖+1
Step 2: Set 𝑥4 = 𝑧4 = 1 and compute 𝑥𝑖 = 𝑧𝑖 − 𝑖 = 𝑛 − 1, 𝑛 − 2 , … ,1.
𝑦𝑖
𝑎33 𝑥4 75 5𝑥1
𝑖=3 𝑥3 = 𝑧3 − = − =2
𝑦3 20 20⁄7
𝑎23 𝑥3 5 2𝑥2
𝑖=2 𝑥2 = 𝑧2 − = − =1
𝑦2 7 −7⁄3
𝑎13 𝑥2 5 (−1)(2)
𝑖=1 𝑥1 = 𝑧1 − = − =2
𝑦1 3 3
Exercise 3.6
Solve the following set of tridiagonal set of algebraic equations using Thomas’s method.
𝑥1 + 4𝑥2 = 10
2𝑥1 + 10𝑥2 − 4𝑥3 = 7
𝑥2 + 8𝑥3 − 𝑥4 = 6
𝑥3 − 6𝑥4 = 4
Page 52
Numerical Method for Engineering
Objectives
➢ Identify Gauss Jacobi method and Gauss Seidel method of solving of system of linear
equation
➢ Solve system of linear equations using Gauss Jacobi and Gauss Seidel methods
The first iterative technique is called the Jacobi method, after Carl Gustav Jacob Jacobi
(1804–1851). This method makes two assumptions:
Page 53
Numerical Method for Engineering
To begin, solve the 1st equation for 𝑥1 , the 2nd equation for 𝑥2 and so on to obtain the rewritten
equations:
1
𝑥1 = (𝑏 − 𝑎12 𝑥2 − 𝑎13 𝑥3 − ⋯ − 𝑎1𝑛 𝑥𝑛 )
𝑎11 1
1
𝑥2 = (𝑏 − 𝑎21 𝑥1 − 𝑎23 𝑥3 − ⋯ − 𝑎2𝑛 𝑥𝑛 )
𝑎22 2
⋮
1
𝑥𝑛 = (𝑏 − 𝑎𝑛1 𝑥1 − 𝑎𝑛2 𝑥2 − ⋯ − 𝑎𝑛−1 𝑥𝑛−1
𝑎𝑛𝑛 𝑛
Then make an initial guess (assumption) of the solution 𝑋 (0) = (𝑥1 (0) , 𝑥2 (0) , … , 𝑥𝑛 (0) ). Substitute
these values into the right hand side the of the rewritten equations to obtain the first approximation,
(𝑥1 (1) , 𝑥2 (1) , … , 𝑥𝑛 (1) ).
This accomplishes one iteration.
In the same way, the second approximation (𝑥1 (2) , 𝑥2 (2) , … , 𝑥𝑛 (2) ) is computed by substituting
the first approximation’s 𝑋 − values into the right hand side of the rewritten equations.
The Jacobi Method, for each 𝑘 ≥ 1, generate the components of from 𝑥𝑖 (𝑘) of 𝑋 (𝑘) by
𝑛
(𝑘)
1
𝑥𝑖 = ∑(−𝑎𝑖𝑗 𝑥𝑗 (𝑘−1) ) + 𝑏𝑖 , 𝑓𝑜𝑟 𝑖 = 1,2, … , 𝑛
𝑎𝑖𝑖
𝑗=1,
[ 𝑗≠𝑖 ]
−3𝑥1 + 9𝑥2 + 𝑥3 = 2
2𝑥1 − 𝑥2 − 7𝑥3 = 3
Page 54
Numerical Method for Engineering
Continue the iterations until two successive approximations are identical when rounded to three
significant digits.
Solution: To begin, write the system in the form
1 2 3
𝑥1 = − + 𝑥2 − 𝑥3
5 5 5
2 3 1
𝑥2 = + 𝑥1 − 𝑥3
9 9 9
3 2 1
𝑥3 = − + 𝑥1 − 𝑥2
7 7 7
𝑥1 = 0, 𝑥2 = 0, 𝑥3 = 0 Initial approximation
1 2 3
𝑥1 = − + (0) − (0) = −0.200
5 5 5
2 3 1
𝑥2 = + (0) − (0) ≈ 0.222
9 9 9
3 2 1
𝑥3 = − + (0) − (0) ≈ −0.429
7 7 7
Continuing this procedure, we obtain the sequence of approximations shown in Table 3.2.
Table 3.2
𝑛 0 1 2 3 4 5 6 7
𝑥1 0.000 −0.200 0.146 0.192 𝑜. 181 0.185 0.186 0.186
𝑥2 0.000 0.222 0.203 0.328 0.332 0.329 0.331 0.331
𝑥3 0.000 −0.429 −0.517 −0.416 −0.421 −0.424 −0.423 −0.423
Because the last two columns in Table 3.2 are identical, we can conclude that to three significant
digits the solution is
Page 55
Numerical Method for Engineering
Note: For the system of linear equations given in Example 3.10, the Jacobi method is said to
converge. That is, repeated iterations succeed in producing an approximation that is correct to
three significant digits. As is generally true for iterative methods, greater accuracy would require
more iteration.
3.2.2. The Gauss-Seidel Method
You will now look at a modification of the Jacobi method called the Gauss-Seidel method, named
after Carl Friedrich Gauss (1777–1855) and Philipp L. Seidel (1821–1896). This modification is
no more difficult to use than the Jacobi method, and it often requires fewer iterations to produce
the same degree of accuracy.
With the Jacobi method, the values of 𝑥𝑖 obtained in the nth approximation remain
Unchanged until the entire (𝑛 + 1)th approximation has been calculated. With the Gauss-
Seidel method, on the other hand, we use the new values of each as soon as they are known. That
is, once we have determined 𝑥1 from the first equation, its value is then used in the second equation
to obtain the new 𝑥2 .
Similarly, the new 𝑥1 and 𝑥2 are used in the third equation to obtain the new 𝑥3 and so on. This
procedure is demonstrated in
Example 3.12 Use the Gauss-Seidel iteration method to approximate the solution to the system
of equations given in Example 3.10.
Solution: The first computation is identical to that given in Example 3.10. That is, using
(𝑥1 , 𝑥2 , 𝑥3 ) = (0,0,0)
as the initial approximation, we obtain the following new value for 𝑥1 .
1 2 3
𝑥1 = − + (0) − (0) = −0.200
5 5 5
Now that we have a new value for 𝑥1 , however, use it to compute a new value for 𝑥2 . That is,
2 3 1
𝑥2 = + (−0.200) − (0) ≈ 0.156
9 9 9
Similarly, use 𝑥1 = −0.200 and 𝑥2 = 0.156 to copmute a new value for 𝑥3 . That is,
3 2 1
𝑥3 = − 7 + 7 (−0.200) − 7 (0.156) ≈ −0.508.
Page 56
Numerical Method for Engineering
𝑛 0 1 2 3 4 5
Note that after only five iterations of the Gauss-Seidel method, we achieved the same accuracy as
was obtained with seven iterations of the Jacobi method in Example 3.2.
Note: Neither of the iterative methods presented in this section always converges. That is, it is
possible to apply the Jacobi method or the Gauss-Seidel method to a system of linear equations
and obtain a divergent sequence of approximations. In such cases, it is said that the method
diverges.
Example 3.13: (An Example of Divergence) Apply the Jacobi method to the system
𝑥1 = 5𝑥2 = −4
7𝑥1 − 𝑥2 = 6
using the initial approximation (𝑥1 , 𝑥2 ) = (0,0), and show that the method diverges.
𝑥2 = −6 + 7𝑥1
Then the initial approximation (0, 0) produces
𝑥1 = −4 + 5(0) = −4
𝑥2 = −6 + 7(0) = −6
As the first approximation. Repeated iterations produce the sequence of approximations shown in
Table 3.4.
Page 57
Numerical Method for Engineering
Table 3.4
𝑛 0 1 2 3 4 5 6 7
For this particular system of linear equations we can determine that the actual solution is 𝑥1 = 1
and 𝑥2 = 1. So we can see from Table 3.4 that the approximations given by the Jacobi method
become progressively worse instead of better, and you can conclude that the method diverges.
The problem of divergence in Example 3.3 is not resolved by using the Gauss-Seidel method rather
than the Jacobi method. In fact, for this particular system the Gauss-Seidel method diverges more
rapidly, as shown in Table 3.4.
Table 3.4
𝑛 0 1 2 3 4 5
With an initial approximation of (𝑥1 , 𝑥2 ) = (0,0) neither the Jacobi method nor the Gauss-Seidel
method converges to the solution of the system of linear equations given in Example 3.3. We will
now look at a special type of coefficient matrix 𝐴, called a strictly diagonally dominant matrix, for
which it is guaranteed that both methods will converge.
Definition: (Strictly Diagonally Dominant Matrix)
An 𝑛 × 𝑛 matrix A is strictly diagonally dominant if the absolute value of each entry on the main
diagonal is greater than the sum of the absolute values of the other entries in the same row. That
is,
|𝑎11 | > |𝑎12 | + |𝑎13 | + ⋯ + |𝑎1𝑛 |
|𝑎22 | > |𝑎21 | + |𝑎23 | + ⋯ + |𝑎2𝑛 |
⋮
Page 58
Numerical Method for Engineering
a) 3𝑥1 − 𝑥2 = −4
2𝑥1 + 5𝑥2 = 2
b) 4𝑥1 + 2𝑥2 − 𝑥3 = −1
𝑥1 + 2𝑥3 = −4
3𝑥1 − 5𝑥2 + 𝑥3 = 3
Solution
Page 59
Numerical Method for Engineering
In Example 3.13 we looked at a system of linear equations for which the Jacobi and Gauss-Seidel
methods diverged. In the following example you can see that by interchanging the rows of the
system given in Example 3.13, we can obtain a coefficient matrix that is strictly diagonally
dominant. After this interchange, convergence is assured.
Example 3.15: Interchange the rows of the system
𝑥1 − 5𝑥2 = −4
7𝑥1 − 𝑥2 = 6
to obtain one with a strictly diagonally dominant coefficient matrix. Then apply the Gauss-Seidel
method to approximate the solution to four significant digits.
Solution: Begin by interchanging the two rows of the given system we obtain
7𝑥1 − 𝑥2 = 6
𝑥1 − 5𝑥2 = −4
Note that the coefficient matrix of this system is strictly diagonally dominant. Then solve
for 𝑥1 and 𝑥2 as follows.
6 1
𝑥1 = + 𝑥
7 7 2
4 1
𝑥2 = + 𝑥1
5 5
Using the initial approximation (𝑥1 , 𝑥2 ) = (0,0) you can obtain the sequence of approximations
shown in Table 3.5.
Table 3.5
𝑛 0 1 2 3 4 5
Note: Theorem 3.2 does not imply that strict diagonal dominance is a necessary condition for
convergence of the Jacobi or Gauss-Seidel methods. For instance, the coefficient matrix of the
system
−4𝑥1 + 5𝑥2 = 1
𝑥1 + 2𝑥2 = 3
Page 60
Numerical Method for Engineering
Here the coefficient of the system is not a strictly diagonally dominant matrix, and yet both
methods converge to the solution 𝑥1 = 1 and 𝑥2 = 1 when you use an initial approximation of
(𝑥1 , 𝑥2 ) = (0,0).
Exercise 3.7
1. Apply the Jacobi and Gauss-Seidel methods to the given system of linear equations, using
the initial approximation(𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = (0,0, … ,0). Continue performing iterations until
two successive approximations are identical when rounded to three significant digits.
a) 3𝑥1 − 𝑥2 = 2
𝑥1 + 4𝑥2 = 5
b) 2𝑥1 − 𝑥2 =2
𝑥1 − 3𝑥2 + 𝑥3 = −2
−𝑥1 + 𝑥2 − 3𝑥3 = −6
c) 4𝑥1 + 𝑥2 + 𝑥3 = 7
𝑥1 − 7𝑥2 + 2𝑥3 = −2
3𝑥1 + 4𝑥3 = 11
2. Show that the Gauss-Seidel method diverges for the given system using the initial
approximation(𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = (0,0, … ,0).
a) 𝑥1 − 2𝑥2 = −1
2𝑥1 + 𝑥2 = 3
b) 2𝑥1 − 3𝑥2 = −7
𝑥1 + 3𝑥2 − 10𝑥3 = 9
3𝑥1 + 𝑥3 = 13
3. Determine whether the following matrices are strictly diagonally dominant or not.
2 1
a) 𝐴 = [ ]
3 5
12 6 0
b) 𝐴 = [ 2 −3 2]
0 6 13
7 5 −1
c) 𝐴 = [1 −4 1]
0 2 −3
Page 61
Numerical Method for Engineering
4. Interchange the rows of the system of linear equations in Exercise 2 (a) to obtain a system
with a strictly diagonally dominant coefficient matrix. Then apply the Gauss-Seidel method
to approximate the solution to two significant digits.
5. Interchange the rows of the system of linear equations
−𝑥1 + 4𝑥2 = 1
3𝑥1 − 2𝑥2 = 2
to obtain a system with a strictly diagonally dominant coefficient matrix. Then apply the
Gauss-Seidel method to approximate the solution to two significant digits.
6. The coefficient matrices of the following system of linear equations are not strictly
diagonally dominant. Show that the Jacobi and Gauss-Seidel methods converge using an
initial approximation of (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = (0,0, … ,0).
a) −4𝑥1 + 5𝑥2 = 1
𝑥1 + 2𝑥2 = 3
b) 4𝑥1 + 2𝑥2 − 2𝑥3 = 0
𝑥1 − 3𝑥2 − 𝑥3 = 7
3𝑥1 − 𝑥2 + 4𝑥3 = 5
3.3. Solving systems of Non-linear Equations using Newton’s Method
Objectives:
Introduction:
Solving a system of nonlinear equations is a problem that is avoided when possible, customarily
by approximating the nonlinear system by a system of linear equations. When this is
unsatisfactory, the problem must be tackled directly
Page 62
Numerical Method for Engineering
𝑓1 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = 0
𝑓2 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = 0
⋮ ⋮
𝑓𝑛 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = 0
In general, we can usually find solutions to a system of equations when the number of unknowns
matches the number of equations. Thus, we wish to find solutions to systems that have the form:
𝑓1 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = 0
𝑓2 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = 0
⋮ ⋮
𝑓𝑛 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ) = 0. (1)
Page 63
Numerical Method for Engineering
Here 𝐷𝒇(𝒙0 ) is an 𝑛 × 𝑛 matrix whose entries are the various partial derivative of the components
of . Specifically:
𝜕𝑓1 𝜕𝑓1 𝜕𝑓1
(𝒙0 ) (𝒙0 ) (𝒙0 )
𝜕𝑥1 𝜕𝑥2 𝜕𝑥𝑛
𝜕𝑓2 𝜕𝑓2
⋯ 𝜕𝑓2
(𝒙0 ) (𝒙0 ) (𝒙0 )
𝐷𝒇(𝒙0 ) = 𝜕𝑥 𝜕𝑥2 𝜕𝑥𝑛 (2)
⋮ ⋮ ⋱ ⋮
𝜕𝑓𝑛 𝜕𝑓𝑛 𝜕𝑓𝑛
(𝒙0 ) (𝒙0 ) ⋯ (𝒙0 )]
[ 𝜕𝑥 1 𝜕𝑥 2 𝜕𝑥𝑛
The matrix 𝐷𝑓(𝑥0 ) is called the Jacobian matrix and id denoted by 𝐽(𝒙0 )and has a number of
applications in analysis. That is
𝜕𝑓1 𝜕𝑓1 𝜕𝑓1
(𝒙0 ) (𝒙 ) (𝒙 )
𝜕𝑥1 𝜕𝑥2 0 𝜕𝑥𝑛 0
⋯
𝜕𝑓2 𝜕𝑓2 𝜕𝑓2
𝐽(𝒙0 ) = 𝜕𝑥 (𝒙0 ) 𝜕𝑥2 (𝒙0 ) (𝒙 )
𝜕𝑥𝑛 0
⋮ ⋮ ⋱ ⋮
𝜕𝑓𝑛 𝜕𝑓𝑛 𝜕𝑓𝑛
(𝒙 ) (𝒙 ) ⋯ (𝒙 )
[𝜕𝑥1 0 𝜕𝑥2 0 𝜕𝑥𝑛 0 ]
Newton’s method
We wish to find 𝒙 that makes 𝒇 equal to the zero vectors, so let’s choose 𝒙1 so that
provided that the inverse exists. The formula is the vector equivalent of the Newton’s method
formula we learned before. However, in practice we never use the inverse of a matrix for
computations, so we cannot use this formula directly. Rather, we can do the following. First solve
the equation
𝐽(𝒙0 )∆𝒙 = −𝒇(𝒙0 ) (3)
Page 64
Numerical Method for Engineering
Since 𝐽(𝒙0 ) is a known matrix and −𝒇 (𝒙0 ) is a known vector, this equation is just a system of
linear equations, which can be solved efficiently and accurately. Once we have the solution vector
∆𝒙, we can obtain our improved estimate 𝒙1 by:
𝒙1 = 𝒙0 + ∆𝒙
For subsequent steps, we have the following process:
❖ Solve 𝐽(𝒙𝑖 )∆𝒙 = −𝒇(𝒙𝑖 ) for ∆𝒙
❖ Let 𝒙𝑖+1 = 𝒙1 + ∆𝒙
Example 3.16 Solve the following non-linear system equations using Newton’s method by leting
𝑥0 = (2,1) for about four approximations.
𝑥 2 + 𝑦 2 − 50 = 0
𝑥𝑦 − 25 = 0
Solution: let
𝑓1 (𝑥, 𝑦) = 𝑥 2 + 𝑦 2 − 50 = 0
𝑓2 (𝑥, 𝑦) = 𝑥𝑦 − 25 = 0
𝑥 2 + 𝑦 2 − 50
⟹ 𝑓(𝒙) = [ ]
𝑥𝑦 − 25
From this we have
2𝑥 2𝑦
𝐽(𝒙) = [ ]
𝑦 𝑥
and ∆𝒙 = 𝐽(𝒙)−1 (−𝑓(𝒙))
−45
Where 𝑓(𝒙0 ) = [ ] because 𝒙0 = (2,1), which implies
−23
45 4 2 1 2 −2
−𝑓(𝒙0 ) = [ ] and 𝐽(𝒙0 ) = [ ] ⟹ 𝐽(𝒙0 )−1 = 6 [ ]
23 1 2 1 4
Hence
22
∆𝑥0 = 𝐽(𝒙0 )−1 (−𝑓(𝒙0 )) = [ 3 ]
53
6
28
3 9.33333
⟹ 𝒙1 = 𝒙0 + ∆𝒙0 = [59 ]=[ ]
8.83333
6
Page 65
Numerical Method for Engineering
9.33333
Again consider 𝒙1 = [ ] as initial value and hence calculate the next Approximation.
8.83333
9.33333 115.1389 −115.1389
Here 𝒇(𝒙1 ) = 𝒇 [ ]=[ ] ⟹ −𝒇(𝒙1 ) = [ ]
8.83333 57.44444 −57.44444
18.66667 17.66667 0.513761 −0.97248
and 𝐽(𝒙1 ) = [ ] ⟹ 𝐽(𝒙1 )−1 = [ ]
8.833333 9.333333 −0.48624 1.027523
−3.29052
∆𝒙1 = 𝐽(𝒙1 )−1 (−𝑓(𝑥1 )) = [ ]
−3.04052
Thus
6.042813
𝒙2 = 𝒙1 + ∆𝒙1 = [ ]
5.792813
6.042813
Again consider 𝒙2 = [ ] as initial value and hence calculate the next approximation. Then
5.792813
6.042813 20.072289 −20.0723
𝒇(𝒙2 ) = 𝒇 [ ]=[ ] ⟹ −𝒇(𝒙2 ) = [ ]
5.792813 10.00489 −10.0049
12.08563 11.58563 1.021123 −1.95775
And 𝐽(𝒙2 ) = [ ] ⟹ 𝐽(𝒙2 )−1 = [ ] and
5.792813 6.042813 −0.97888 2.042245
−0.90914
∆𝒙𝟐 = 𝐽(𝒙2 )−1 (−𝑓(𝒙2 )) = [ ]
−0.78414
Hence
5.133673
𝒙3 = 𝒙2 + ∆𝒙2 = [ ]
5.008673
5.133673
Again consider 𝒙3 = [ ] as initial value and hence calculate the next approximation.
5.008673
5.133673 1.441411 −1.441411
Then 𝒇(𝒙3 ) = 𝒇 [ ]=[ ] ⟹ −𝒇(𝒙3 ) = [ ]
5.008673 0.712893 −0.712893
10.26735 10.01735 2.024649 −3.9507
And 𝐽(𝒙3 ) = [ ] ⟹ 𝐽(𝒙3 )−1 = [ ] and
5.008673 5.133673 −1.97535 4.049298
−0.10192
∆𝒙𝟑 = 𝐽(𝒙3 )−1 (−𝑓(𝒙3 )) = [ ]
−0.03942
Hence
5.031749
𝒙4 = 𝒙3 + ∆𝒙3 = [ ]
4.969249
Note: We precede this process until we get the idea ‖∆𝑥𝑛 ‖ ≤ 𝜀 or ‖𝑥𝑛 − 𝑥𝑛−1 ‖ ≤ 𝜀. Where 𝜀 is
called pre specified error (or tolerance) and is usually given.
Exercise 3.8
Page 66
Numerical Method for Engineering
Unit Summary
➢ The solution of n linear simultaneous algebraic equations in n unknowns is presented.
Page 67
Numerical Method for Engineering
➢ There are two classes of methods of solving system of linear algebraic equations: direct
and iterative methods.
➢ Direct methods transform the original equation into equivalent equations that can be solved
more easily.
➢ Iterative or indirect methods start with a guess of the solution x, and then repeatedly refine
the solution until a certain convergence criterion is reached.
➢ Direct methods (matrix inversion method, Gauss elimination method, Gauss-Jordan
method, Matrix decomposition method and Thomas algorithm for tridiagonal system) are
presented.
➢ Two indirect or iterative methods (Jacobi’s iteration method and Gauss-Seidal iteration
method) re presented.
➢ The LU decomposition method is closely related to Gauss elimination method. LU
decomposition is computationally very effective if the coefficient matrix remains the same
but the right hand side vector changes.
➢ Gauss-Jordan method is a very stable method for solving linear algebraic equations. Gauss-
Seidal iterative substitution technique is very suitable for predominantly diagonal systems.
It requires a guess of the solution.
Review Exercise
1. Using Gaussian elimination method solve the following system of linear equations
𝑎 𝑥+𝑦+𝑧−𝑤 =2 𝑏. 𝑥+𝑦+𝑧+𝑤 =3
4𝑥 + 4𝑦 + 𝑧 + 𝑤 = 11 2𝑥 − 𝑦 + 3𝑧 + 0 = 3
𝑥 − 𝑦 − 𝑧 + 2𝑤 = 0 2𝑦 + 3𝑤 = 1
2𝑥 + 𝑦 + 2𝑧 − 2𝑤 = 2 −𝑥 + 𝑧 + 𝑤 = 0
2. Solve the system of equations by Gauss Jordan method
𝑎. 𝑥 + 5𝑦 − 𝑧 = 4 b. 2𝑥 + 𝑦 − 3𝑧 = 11 c. 𝑥 + 3𝑦 + 2𝑧 = 17
2𝑥 − 𝑦 + 3𝑧 = 7 4𝑥 − 2𝑦 + 3𝑧 = 8 𝑥 + 3𝑦 + 3𝑧 = 16
3𝑥 − 𝑦 + 5𝑧 = 12 −2𝑥 + 2𝑦 − 𝑧 = −6 2𝑥 − 𝑦 + 4𝑧 = 13
3. Using Gauss-Jacobi method find the first three approximate solutions of the following
systems with 𝑥 0 = 𝑦 0 = 𝑧 0 = 0 and 𝑥 0 = 𝑦 0 = 𝑧 0 = 1 respectively.
Page 68
Numerical Method for Engineering
a. 15𝑥 + 3𝑦 − 2𝑧 = 85 b. 𝑥 + 2𝑦 + 𝑧 = 0
2𝑥 + 10𝑦 + 𝑧 = 51 3𝑥 + 𝑦 − 𝑧 = 0
𝑥 − 2𝑦 + 8𝑧 = 5 𝑥 − 𝑦 + 4𝑧 = 3
4. Solve the following system of linear equations using matrix decomposition method.
b. 2𝑥 + 𝑦 + 4𝑧 = 12 b. 2𝑥 + 𝑦 − 3𝑧 = 11
8𝑥 − 3𝑦 + 2𝑧 = 20 4𝑥 − 2𝑦 + 3𝑧 = 8
4𝑥 + 11𝑦 − 𝑧 = 33 −2𝑥 + 2𝑦 − 𝑧 = −6
𝑐. 𝑥 + 𝑦 + 𝑧 − 𝑤 = 2 d . 2𝑥 − 6𝑦 + 8𝑧 = 24
𝑥 − 𝑦 − 𝑧 + 2𝑤 = 0 5𝑥 + 4𝑦 − 3𝑧 = 2
4𝑥 + 4𝑦 + 𝑧 + 𝑤 = 11 3𝑥 + 𝑦 + 2𝑧 = 16
2𝑥 + 𝑦 + 2𝑧 − 2𝑤 = 2
5. Solve the following set of simultaneous linear equations by the matrix inverse method.
a. 2𝑥 + 3𝑦 – 𝑧 = – 10 b. 𝑥1 + 2𝑥2 + 3𝑥3 + 4𝑥4 = 8
– 𝑥 + 4𝑦 + 2𝑧 = – 4 2𝑥1 − 2𝑥2 − 𝑥3 − 𝑥4 = −3
2𝑥 – 2𝑦 + 5𝑧 = 35 𝑥1 − 3𝑥2 + 4𝑥3 − 𝑥4 = 8
2𝑥1 + 2𝑥2 − 3𝑥3 + 4𝑥4 = −2
6. Solve the following tridiagonal system of equations using the Thomas algorithm.
a. 2𝑥1 + 𝑥2 = 4 b. 2𝑥1 + 𝑥2 = 3
3𝑥1 + 2𝑥2 + 𝑥3 = 8 𝑥1 + 3𝑥2 + 𝑥3 = 3
𝑥2 + 2𝑥3 + 2𝑥4 = 8 𝑥2 + 4𝑥3 + 2𝑥4 = 4
2𝑥3 + 4𝑥4 = 9 2𝑥3 + 4𝑥4 = 4
7. Using Gauss-seidel method find the first three approximate solutions of the following
systems with 𝑥 0 = 𝑦 0 = 𝑧 0 = 0 and 𝑥 0 = 𝑦 0 = 𝑧 0 = 1 respectively.
a. 8𝑥 + 2𝑦 − 2𝑧 = 8 b. 𝑥 + 2𝑦 + 𝑧 = 0
𝑥 − 8𝑦 + 3𝑧 = −4 3𝑥 + 𝑦 − 𝑧 = 0
2𝑥 + 𝑦 + 9𝑧 = 12 𝑥 − 𝑦 + 4𝑧 = 3
8. Solve the system of non-linear equations
1
3𝑥1 − cos(𝑥2𝑥3 ) − =0
2
Page 69
Numerical Method for Engineering
References
Burden, R.L., and Faires, J.D., Numerical analysis, 9th ed., PWS publishing, Boston, 1993.
Page 70
Numerical Method for Engineering
Chapra, S.C., and Raymond, P.C., Numerical Methods for Engineering, 6th ed.,
Grewal, B.S., Numerical Methods in Engineering and Science, Khanna, New Delhi, 1994.
Chapter Four
Finite Differences
Page 71
Numerical Method for Engineering
Objectives:
This chapter concentrates on shift operators, forward difference operators, backward difference
operators and central difference operators.
Introduction:
Consider a function 𝑦 = 𝑓 (𝑥) defined on (a, b), 𝑥 and 𝑦 are the independent and dependent
variables respectively. If the points 𝑥𝑜 , 𝑥1 , … . , 𝑥𝑛 are taken at equidistance that is, 𝑥𝑖 =
𝑥𝑜 + 𝑖ℎ, for 𝑖 = 0, 1, 2, … . , 𝑛, then the value of y, when 𝑥 = 𝑥𝑖 , is denoted by 𝑦𝑖 , where 𝑦𝑖 =
𝑓(𝑥𝑖 ). Here, the values of x are called arguments and the values of y are called as entries. The
interval h is called the difference interval. The differences 𝑦1 – 𝑦𝑜 , 𝑦2 – 𝑦1 , … , 𝑦𝑛 – 𝑦𝑛−1 are
called the first differences of the function 𝑦 and are denoted by ∆𝑦𝑜 , ∆𝑦1 , … , ∆𝑦𝑛−1 etc. That is
∆𝑦𝑜 = 𝑦1 – 𝑦𝑜
∆𝑦1 = 𝑦2 – 𝑦1
⋮
∆𝑦𝑛−1 = 𝑦𝑛 – 𝑦𝑛−1 (4.1)
Objectives
Page 72
Numerical Method for Engineering
Actvity4.1: Let 𝑓(𝑥) = 𝑥 2 + 2𝑥 − 4. Find 𝑓(𝑥 + ℎ), 𝑓(𝑥 + 2ℎ) and 𝑓(𝑥 + 3ℎ).
Shift operator, E:
Difinition4.1. The shift operator 𝐸 of a function 𝑓 denoted by 𝐸𝑓(𝑥) is defined as
𝐸𝑓 (𝑥) = 𝑓 (𝑥 + ℎ) or
𝐸𝑦𝑖 = 𝑦𝑖+1
Hence, shift operator sifts the function value 𝑦𝑖 to the next higher value 𝑦𝑖+1. The second shift
operator is given as follow.
𝐸 2 𝑓(𝑥) = 𝐸[𝐸𝑓(𝑥)] = 𝐸[𝑓(𝑥 + ℎ)] = 𝑓(𝑥 + 2ℎ)
E is linear and obeys the law of indices. And hence the generalized shift operator is given by
Example4.1.: Let 𝑓(𝑥) = 𝑥 2 + 3𝑥. Find the first three shift operators.
Solution: the first three shift operators are 𝐸𝑓(𝑥), 𝐸 2 𝑓(𝑥)𝑎𝑛𝑑 𝐸 3 𝑓(𝑥). Thus
= 𝑥 2 + 2𝑥ℎ + ℎ2 + 3𝑥 + 3ℎ = 𝑥 2 + 3𝑥 + 2𝑥ℎ + ℎ2 + 3ℎ
Page 73
Numerical Method for Engineering
= 𝑓(𝑥 + 3ℎ)
Average operator, 𝜇:
Objectives:
Definition 4.2.: The forward difference or simply difference operator is denoted by ∆ and is
defined as ∆𝑓(𝑥) = 𝑓(𝑥 + ℎ) – 𝑓(𝑥)
Page 74
Numerical Method for Engineering
x y ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
Page 75
Numerical Method for Engineering
𝑥𝑜 𝑥𝑜
∆𝑦𝑜
𝑥1 𝑥1 ∆2 𝑦𝑜
∆𝑦1 ∆3 𝑦𝑜
𝑥2 𝑥2 ∆2 𝑦1 ∆4 𝑦𝑜
∆𝑦2 ∆3 𝑦1 ∆5 𝑦𝑜
𝑥3 𝑥3 ∆2 𝑦2 ∆4 𝑦1
∆𝑦3 ∆3 𝑦2
𝑥4 𝑥4 ∆2 𝑦3
∆𝑦4
𝑥5 𝑥5
The forward differences for the arguments 𝑥𝑜 , 𝑥1 , … . , 𝑥5 are shown in Table 4.1. Table 4.1 is called
a diagonal difference table or forward difference table. The first term in Table 4.1 is 𝑦𝑜 and is
called the leading term. The differences ∆𝑦𝑜 , ∆2 𝑦𝑜 , ∆3 𝑦𝑜 , …., are called the leading differences.
Similarly, the differences with fixed subscript are called forward differences.
Example 4.2.
Solution: The forward difference table for the given data is shown below.
Page 76
Numerical Method for Engineering
0 0
0.174
10 0.174 −0.001
0.173 −0.001
20 0.347 −0.002
0.171
30 0.518
Page 77
Numerical Method for Engineering
1 4
2 6 1
3 −1
3 9 0 3
3 2
4 12 2
5 17
Exercise 4.1: Construct the forward difference table for the following.
1.
x 0 1 2 3 4 5 6
2. 𝑓(𝑥) = 𝑥𝑙𝑛𝑥 2 , 𝑓𝑜𝑟 𝑥 = 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2, 2.4
4.3. Backward difference operators
Objectives:
At the end of this topic students should be able to:
➢ Define backward difference operator
➢ Differentiate backward difference from forward difference
➢ Identify the tabular representation of backward difference
Activity4.2: Let 𝑦 = 𝑓(𝑥) = 𝑒 𝑥 + 2𝑥 3 + 6, 𝑓𝑜𝑟 𝑥 = −1,0,1,2,3,4. Find
𝑦1 − 𝑦𝑜 , 𝑦2 − 𝑦1 , 𝑦3 − 𝑦2 , 𝑦4 − 𝑦3 , 𝑦5 − 𝑦4 , 𝑎𝑛𝑑𝑦2 − 2𝑦1 + 𝑦𝑜
Definition4.3: The backward difference operator denoted by ∇ is defined as
Page 78
Numerical Method for Engineering
∇𝑓(𝑥) = 𝑓 (𝑥) – 𝑓 (𝑥 – ℎ) .
This equation can be written as
∇𝑦𝑖 = 𝑦𝑖 – 𝑦𝑖−1 , 𝑖 = 𝑛, 𝑛 – 1, … . , 1.
or ∇𝑦1 = 𝑦1 – 𝑦𝑜 , ∇𝑦2 = 𝑦2 – 𝑦1 , … . , ∇𝑦𝑛 = 𝑦𝑛 – 𝑦𝑛−1 (4.2)
The differences in equation (4.2) are called first differences. The second differences are denoted
by
∇2 𝑦2 , ∇2 𝑦3 , … . , ∇2 𝑦𝑛 .
Hence
∇2 𝑦2 = ∇(∇𝑦2 ) = ∇(𝑦2 – 𝑦1 ) = ∇𝑦2 – ∇𝑦1 = (𝑦2 – 𝑦1 ) – (𝑦1 – 𝑦𝑜 ) = 𝑦2 – 2𝑦1 + 𝑦𝑜 .
Similarly,
∇2 𝑦3 = 𝑦3 – 2𝑦2 + 𝑦1 , ∇2 𝑦4 = 𝑦4 – 2𝑦3 + 𝑦2 , and so on.
In general, we have
∇𝑘 = ∇k−1 yi − ∇k−1 yi−1 , 𝑖 = 𝑛, 𝑛 − 1, … , 𝑘
Where ∇0 𝑦𝑖 = 𝑦𝑖 , and hence ∇1 𝑦𝑖 = ∇𝑦𝑖
The backward differences written in a tabular form is shown in Table 4.4 below. In Table 4.4, the
differences ∇n 𝑦 with a fixed subscript ‘𝑖’ lie along the diagonal upward sloping.
Page 79
Numerical Method for Engineering
𝑥 𝑦 ∇𝑦 ∇2 y ∇3 y ∇4 y
𝑥𝑜 𝑦𝑜
∇𝑦1
𝑥1 𝑦1 ∇2 y2
∇𝑦2 ∇3 y3
𝑥2 𝑦2 ∇2 y3 ∇4 y4
∇𝑦3 ∇3 y4
𝑥3 𝑦3 ∇2 y4
∇𝑦4
𝑥4 𝑦4
Page 80
Numerical Method for Engineering
𝑥 𝑦 ∇𝑦 ∇2 y ∇3 y
0 0
0.174
10 0.174 −0.001
0.173 −0.001
20 0.347 −0.002
0.171
30 0.518
Page 81
Numerical Method for Engineering
𝑥 𝑦 ∇𝑦 ∇2 𝑦 ∇3 𝑦 ∇4 𝑦 ∇5 𝑦
1.00 1
0.030
0.031 −0.001
0.032 0.000
0.033
1.05 1.157
𝑦 3 2 3 ? 11
Solution: Let the missing term be 𝑎, then using backward difference table, we have;
Page 82
Numerical Method for Engineering
𝑥 𝑦 ∇𝑦 ∇2 𝑦 ∇3 𝑦 ∇4 𝑦
0 3
−1
1 2 2
1 𝑎−6
2 3 𝑎−4
𝑎−3 18 − 4𝑎
3 𝑎 14 − 2𝑎
11 − 𝑎
4 11
From the table we see that 𝑎 = 6 and hence the missing term.
Exercise 4.3:
1. Construct a backward difference table for the following data.
𝑥 45 55 65 75
𝑦 20 60 120 180
𝑥 0 1 2 3 4
𝑦 1 3 13 ? 81
Page 83
Numerical Method for Engineering
Page 84
Numerical Method for Engineering
𝑥 𝑦 𝛿𝑦 𝛿 2𝑦 𝛿 3𝑦 𝛿 4𝑦 𝛿 5𝑦 𝛿 6𝑦
𝑥0 𝑦0
𝛿𝑦1/2
𝑥1 𝑦1 𝛿 2 𝑦1
𝛿𝑦3/2 𝛿 3 𝑦3/2
𝑥2 𝑦2 𝛿 2 𝑦2 𝛿 4 𝑦2
𝑥3 𝑦3 𝛿 2 𝑦3 𝛿 4 𝑦3 𝛿 6 𝑦3
𝑥4 𝑦4 𝛿 2 𝑦4 𝛿 4 𝑦4
𝛿𝑦9/2 𝛿 3 𝑦9/2
𝑥5 𝑦5 𝛿 2 𝑦5
𝛿𝑦11/2
𝑥6 𝑦6
It is noted in table 4.7 that all the odd differences have fraction suffices and all the even differences
are integral suffices.
Exercise 4.4:
1. Construct the central difference table for
𝑥 1 2 3 4 5
Page 85
Numerical Method for Engineering
𝑦 4 6 9 12 17
2. Let 𝑓(𝑥) = 𝑥𝑠𝑖𝑛𝑥. Formulate the central difference table for 𝑥 = 0, 2, 4, 6, 8, 10.
4.5. Properties of the operators
Objectives
At the end of this topic the students will be able to;
➢ Identify relationships of the operators
➢ Prove properties of the operators
➢ Solve different related problems
Activity 4.5:
1. Let 𝑓(𝑥) = 6, find ∆𝑓(𝑥).
2. Let 𝑓(𝑥) = 𝑥 2 + 5𝑥 + 3. Compute ∆𝐸𝑓(𝑥).
Properties of ∆.
1. If 𝑐 is a constant then ∆𝑐 = 0.
2. ∆[𝑓(𝑥) ± 𝑔(𝑥)] = ∆𝑓(𝑥) ± ∆𝑔(𝑥)
3. ∆[𝑐𝑓(𝑥)] = 𝑐∆𝑓(𝑥), for a constant 𝑐.
4. If 𝑚 and 𝑛 are positive integers, then ∆𝑚 ∆𝑛 𝑓(𝑥) = ∆𝑚+𝑛 𝑓(𝑥)
5. ∆[𝑓(𝑥)𝑔(𝑥)] = 𝑓(𝑥)∆𝑔(𝑥) + 𝑔(𝑥)∆𝑓(𝑥)
𝑓(𝑥) 𝑔(𝑥)∆𝑓(𝑥)−𝑓(𝑥)∆𝑔(𝑥)
6. ∆ [𝑔(𝑥)] = 𝑔(𝑥)𝑔(𝑥+ℎ)
Proof (1):
Let 𝑓(𝑥) = 𝑐
Hence 𝑓(𝑥 + ℎ) = 𝑐, ℎ is the interval of differencing.
Then ∆𝑓(𝑥) = 𝑓(𝑥 + ℎ) − 𝑓(𝑥) = 𝑐 − 𝑐 = 0 or
∆𝑐 = 0
Proof (2):
∆[𝑓(𝑥) + 𝑔(𝑥)] = [𝑓(𝑥 + ℎ) + 𝑔(𝑥 + ℎ)] − [𝑓(𝑥) + 𝑔(𝑥)]
= 𝑓(𝑥 + ℎ) − 𝑓(𝑥) + 𝑔(𝑥 + ℎ) − 𝑔(𝑥)
= ∆𝑓(𝑥) + ∆𝑔(𝑥)
Similarly
∆[𝑓(𝑥) − 𝑔(𝑥)] = ∆𝑓(𝑥) − ∆𝑔(𝑥)
and hence
Page 86
Numerical Method for Engineering
= 𝑐[𝑓(𝑥 + ℎ) − 𝑓(𝑥)]
= 𝑐∆𝑓(𝑥)
𝑚 𝑓𝑎𝑐𝑡𝑜𝑟𝑠 𝑛 𝑓𝑎𝑐𝑡𝑜𝑟𝑠
Proof (4) 𝑚 𝑛 ⏞× ∆ × … × ∆) (∆
∆ ∆ 𝑓(𝑥) = (∆ ⏞× ∆ × … × ∆) 𝑓(𝑥)
𝑚+𝑛 𝑓𝑎𝑐𝑡𝑜𝑟𝑠
⏞× ∆ × ∆ × … × ∆) 𝑓(𝑥)
= (∆
= ∆𝑚+𝑛 𝑓(𝑥)
Page 87
Numerical Method for Engineering
∆𝑓(𝑥)
Example 4.5: Show that ∆log𝑓(𝑥) = log (1 + ).
𝑓(𝑥)
∆2
Example 4.5: Evaluate ( 𝐸 )𝑥 3
Page 88
Numerical Method for Engineering
∆2
Hence ( 𝐸 ) 𝑒 𝑥 = (∆2 𝐸 −1 )𝑒 𝑥
= ∆2 𝑒 𝑥−ℎ = 𝑒 −ℎ (∆2𝑒 𝑥 )
= 𝑒 −ℎ 𝑒 𝑥 (𝑒 ℎ − 1)2
𝑒 𝑥+ℎ
Therefore, the right hand side = 𝑒 −ℎ 𝑒 𝑥 (𝑒 ℎ − 1) 𝑒 𝑥 (𝑒 ℎ −1) = 𝑒 𝑥
Page 89
Numerical Method for Engineering
= 𝐸𝑓(𝑥) − 𝐸𝑓(𝑥 − ℎ)
= 𝑓(𝑥 + ℎ) − 𝑓(𝑥) = ∆𝑓(𝑥)
Thus 𝐸∇= ∆ --------------------------------------------------------- (1)
Again
∇𝐸𝑓(𝑥) = ∇𝑓(𝑥 + ℎ)
= 𝑓(𝑥 + ℎ) − 𝑓(𝑥) = ∆𝑓(𝑥)
Hence we have ∇𝐸 = ∆ ---------------------------------------------------------- (2)
Also 𝛿𝐸1/2 𝑓(𝑥) = 𝛿𝑓(𝑥 + ℎ/2)
= 𝑓(𝑥 + ℎ) − 𝑓(𝑥) = ∆𝑓(𝑥)
Which implies 𝛿𝐸1/2 = ∆ -------------------------------------------------------------- (3)
From (1), (2) and (3), we have that
∆= 𝐸∇= ∇𝐸 = 𝛿𝐸1/2
5. ∆∇= ∇∆= 𝛿 2
Proof:
Since ∆∇𝑓(𝑥) = ∆[𝑓(𝑥) − 𝑓(𝑥 − ℎ)]
= ∆𝑓(𝑥) − ∆𝑓(𝑥∆ − ℎ)
= [𝑓(𝑥 + ℎ) − 𝑓(𝑥)] − [𝑓(𝑥) − 𝑓(𝑥 − ℎ)]
= 𝛿𝑓(𝑥 + ℎ/2) − 𝛿𝑓(𝑥 − ℎ/2)
= 𝛿 2 𝑓(𝑥)
⟹ ∆∇= 𝛿 2 --------------------------------------------------------------- (1)
Also ∇∆𝑓(𝑥) = ∇[𝑓(𝑥 + ℎ) − 𝑓(𝑥)]
= ∇𝑓(𝑥 + ℎ) − ∇𝑓(𝑥)
= [𝑓(𝑥 + ℎ) − 𝑓(𝑥)] − [𝑓(𝑥) − 𝑓(𝑥 − ℎ)]
= 𝛿𝑓(𝑥 + ℎ/2) − 𝛿𝑓(𝑥 − ℎ/2)
= 𝛿 2 𝑓(𝑥)
⟹ ∇∆= 𝛿 2 ------------------------------------------------- (2)
Therefore from (1) and (2), we have;
∆∇= ∇∆= 𝛿 2
Example 4.8: Find ∆3 (1 − 3𝑥)(1 − 2𝑥)1 − 𝑥).
Solution:
Page 90
Numerical Method for Engineering
Unit summery
Page 91
Numerical Method for Engineering
𝑥 1 2 3 4 5
Page 92
Numerical Method for Engineering
a) 𝑦 8 17 38 ? 140
b)
𝑥 0 1 2 3 4
𝑦 1 −2 −1 ? 37
Page 93
Numerical Method for Engineering
UNIT OBJECTIVES
INTRODUCTION
Interpolation is the technique of estimating the value of a function for any intermediate value of
the independent variable. The process of computing or finding the value of a function for any value
of the independent variable outside the given range is called extrapolation. Here, interpolation
denotes the method of computing the value of the function 𝑦 = 𝑓(𝑥) for any given value of the
independent variable 𝑥 when a set of values of 𝑦 = 𝑓 (𝑥) for certain values of 𝑥 are known or
given.
Hence, 𝑖𝑓 ( 𝑥𝑖 , 𝑦𝑖 ), 𝑖 = 0, 1, 2, … . , 𝑛 are the set of (𝑛 + 1) given data points of the function 𝑦 =
𝑓 (𝑥), then the process of finding the value of y corresponding to any value of 𝑥 = 𝑥𝑖
Between 𝑥0 𝑎𝑛𝑑 𝑥𝑛 , is called interpolation.
If the function 𝑓(𝑥) is known explicitly, then the value of 𝑦 corresponding to any value of 𝑥 can
easily be obtained. On the other hand, if the function 𝑓 (𝑥) is not known, then it is very hard to
find the exact form of 𝑓 (𝑥) with the tabulated values( 𝑥𝑖 , 𝑦𝑖 ) . In such cases, the function 𝑓 (𝑥)
can be replaced by a simpler, function, say, p(𝑥), which has the same values as 𝑓 (𝑥) for
𝑥0, 𝑥1, 𝑥2 , … , 𝑥𝑛 . The function 𝑝(𝑥) is called the interpolating or smoothing function and any other
value can be computed from 𝑝 (𝑥).
If 𝑝(𝑥) is a polynomial, then 𝑝(𝑥) is called the interpolating polynomial and the process of
computing the intermediate values of 𝑦 = 𝑓 (𝑥) is called the polynomial interpolation.
Page 94
Numerical Method for Engineering
Let 𝑦 = 𝑓(𝑥) be a real valued continuous function defined in an interval[𝑎, 𝑏]. Let
𝑥0 , 𝑥1 , … , 𝑥𝑛 be (𝑛 + 1) distinct points and the corresponding values of the function are
𝑦0 , 𝑦1 , … , 𝑦𝑛 . Our aim is to construct the unique approximate polynomial which passes through the
given points. Since (𝑛 + 1) points are given, we can represent the function 𝑦 = 𝑓(𝑥) is a
Polynomial in 𝑥 of degree 𝑛 with 𝑃(𝑥) such that 𝑃(𝑥𝑖 ) = 𝑓(𝑥𝑖 ) = 𝑓𝑖 , 𝑖 = 0,1, … , 𝑛. But to
construct this polynomial we follow two different approaches which are interpolation with equal
intervals and interpolation with unequal intervals.
𝑥−𝑥0 𝑥−3
𝑙1 (𝑥) = 𝑥 = 4−3 = 𝑥 − 3
1 −𝑥0
Objective
Page 95
Numerical Method for Engineering
Let 𝑦 = 𝑓(𝑥) be a real valued continuous function defined in an interval [𝑎, 𝑏]. Let
𝑥0 , 𝑥1 , … , 𝑥𝑛 be (𝑛 + 1) distinct points which are not necessarily equally spaced and the
corresponding values of the function are 𝑦0 , 𝑦1 , … , 𝑦𝑛 . Since (𝑛 + 1) values of the function
are given corresponding to the (𝑛 + 1) values of the independent variable𝑥, we can represent
the function 𝑓(𝑥) as a polynomial in 𝑥 of degree 𝑛.
Let the polynomial is represented by
𝑓(𝑥) = 𝑎0 (𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) … (𝑥 − 𝑥𝑛 ) + 𝑎1 (𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) … (𝑥 − 𝑥𝑛 )
+𝑎2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥3 ) … (𝑥 − 𝑥𝑛 ) + ⋯ + 𝑎𝑛 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥3 ) … (𝑥 − 𝑥𝑛−1 )
To find the values of 𝑎0 , 𝑎1 , … , 𝑎𝑛 substitute 𝑥 = 𝑥0 , 𝑥1 , … , 𝑥𝑛 respectively in the above
formula. That is
Let 𝑥 = 𝑥0 , the we obtain
𝑓(𝑥0 ) = 𝑎0 (𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) … (𝑥0 − 𝑥𝑛 )
𝑓(𝑥0 )
Or 𝑎0 = (𝑥
0 −𝑥1 )(𝑥0 −𝑥2 )…(𝑥0 −𝑥𝑛 )
Page 96
Numerical Method for Engineering
1
= − 12 (𝑥 3 − 8𝑥 2 + 19𝑥 − 12)
1
= 6 (𝑥 3 − 7𝑥 2 + 12𝑥)
1
= − 6 (𝑥 3 − 5𝑥 2 + 4𝑥)
Therefore,
1 −1 1
𝑃3 (𝑥) = −12 (− 12 (𝑥 3 − 8𝑥 2 + 19𝑥 − 12)) + 6 ( 6 (𝑥 3 − 5𝑥 2 + 4𝑥)) + 12 (12 (𝑥 3 − 4𝑥 2 +
3𝑥)) = 𝑥 3 − 7𝑥 2 + 18𝑥 − 12
Example 5.3: Let 𝑃3 (𝑥) is the interpolating polynomial for the data (0,0), (0.5, 𝑦), (1,3) and
(2,2). Then find 𝑦 if the coefficient of 𝑥 3 in 𝑃3 (𝑥) is 6.
Page 97
Numerical Method for Engineering
(𝑥−𝑥0 )(𝑥−𝑥2 )(𝑥−𝑥3 ) (𝑥−0)(𝑥−1)(𝑥−2)
𝐿1 (𝑥) = (𝑥 = (0.5−0)(0.5−1)(0.5−2)
1 −𝑥0 )(𝑥1 −𝑥2 )(𝑥1 −𝑥3 )
8
= 3 (𝑥 3 − 3𝑥 2 + 2𝑥)
= −2𝑥 3 + 5𝑥 2 − 2𝑥
1
= (𝑥 3 − 1.5𝑥 2 + 0.5𝑥)
3
Therefore,
8 1
𝑃3 (𝑥) = 𝑦 (3 (𝑥 3 − 3𝑥 2 + 2𝑥)) + 3(−2𝑥 3 + 5𝑥 2 − 2𝑥) + 2 (3 (𝑥 3 − 1.5𝑥 2 + 0.5𝑥))
8 16 16 17
= (3 𝑦 − ) 𝑥 3 + (−8𝑦 + 14)𝑥 2 + ( 3 𝑦 − )
3 3
8 16
Now, the coefficient of 𝑥 3 in the polynomial 𝑃3 (𝑥) is (3 𝑦 − ).
3
8 16 14
⟹ (3 𝑦 − )=6⟹𝑦=
3 7
14
Therefore, the value of the unknown 𝑦 is .
7
Exercise: 5.1
1. Using the Lagrange interpolation formula find the polynomial 𝑝2 (𝑥)with 𝑥0 = 2, 𝑥1 = 2.5
1
and 𝑥2 = 4 and 𝑓(𝑥) = 𝑥.
2. Apply Lagrange’s interpolation formula to find a polynomial which passes through the
points (0, – 20), (1, – 12), (3, – 20) 𝑎𝑛𝑑 (4, – 24).
3. Using Lagrange’s interpolation formula, find the value of 𝑦 corresponding to 𝑥 = 10
from the following data.
𝑥 5 6 9 11
Page 98
Numerical Method for Engineering
Here, we assume that for function𝑦 = 𝑓(𝑥), the set of (𝑛 + 1) functional values 𝑦0 , 𝑦1 , … , 𝑦𝑛 are
given corresponding to the set of (𝑛 + 1) equally spaced values of the independent variable, 𝑥𝑖 =
𝑥0 + 𝑖ℎ, 𝑖 = 0,1,2, … , 𝑛, where ℎ is the spacing.
5 .3.1 Newton’s Forward Interpolation Formula
Let 𝑦 = 𝑓 (𝑥), which takes the values 𝑦0 , 𝑦1 , 𝑦2 , … , 𝑦𝑛 that is the set of (n + 1) functional values
𝑦0 , 𝑦1 , 𝑦2 , … , 𝑦𝑛 are given corresponding to the set of (n + 1) equally spaced values of the
independent variable, 𝑥 𝑖 = 𝑥0 + 𝑖ℎ, 𝑖 = 0, 1, 2, … . , 𝑛 where ℎ is the spacing. Let 𝑝(𝑥) be a
polynomial of the 𝑛𝑡ℎ degree in 𝑥 taking the same values as 𝑦 corresponding to 𝑥 =
𝑥0 , 𝑥1 , 𝑥2 , … . , 𝑥𝑛. Then, 𝑝(x) represents the continuous function 𝑦 = 𝑓(𝑥) such that
𝑓 (𝑥𝑖 ) = 𝑝(𝑥𝑖 ) for i = 0, 1, 2, …., n and at all other points f (x) =p(x) + R(x) where R(x) is called
the error term (remainder term) of the interpolation formula.
Let 𝑝(𝑥) = 𝑎0 + 𝑎1 (𝑥 − 𝑥0 ) + 𝑎2 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + 𝑎3 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) + ⋯ +
𝑎𝑛 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) … (𝑥 − 𝑥𝑛−1 ) (5.1)
and 𝑝(𝑥𝑖 ) = 𝑦𝑖 𝑖 = 0,1,2,3 … 𝑛 (5.2)
The constants, 𝑎0 , 𝑎1 , 𝑎2 , … ., an can be determined as follows:
Substituting 𝑥 = 𝑥0 , 𝑥1 , 𝑥2 , … . , 𝑥𝑛. successively in Eq.(5.1), we get
𝑎0 = 𝑦0 (5.3)
𝑦1 = 𝑎0 + 𝑎1 (𝑥1 − 𝑥0 )
𝑦1 = 𝑦0 + 𝑎1 (𝑥1 − 𝑥0 )
𝑦 −𝑦 ∆𝑦0
𝑎1 = 𝑥1−𝑥0 = (5.4)
1 0 ℎ
Page 99
Numerical Method for Engineering
𝑦 −𝑦
(𝑦2 − 𝑦0 ) − 𝑥1−𝑥0 (𝑥2 − 𝑥0 ) = 𝑎2 (𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )
1 0
𝑦2 −2𝑦1 +𝑦0 ∆2 𝑦0
𝑎2 = = (5.5)
2ℎ2 2!ℎ2
∆3 𝑦 ∆𝑛 𝑦
Similarly, we obtain 𝑎3 = 3!ℎ30 𝑎𝑛 = 𝑛!ℎ𝑛0 (5.6)
∆𝑦0 ∆2 𝑦0 ∆3 𝑦0
𝑝(𝑥) = 𝑦0 + (𝑥 − 𝑥0 ) + 2
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) + ⋯ +
ℎ 2!ℎ 3!ℎ3
∆𝑛 𝑦0
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) … (𝑥 − 𝑥𝑛−1 ) (5.7)
𝑛!ℎ𝑛
Let x = x0 + uh or x - x0 = uh
The formula given in Eq. (5.9) is called the Newton’s forward interpolation formula. This
formula is used to interpolate the values of y near the beginning of a set of equally spaced tabular
values.
Example 5.4 Given that √15500 = 124.4990, √15510 =124.5392, √15520 = 124.5793
and √15530 = 124.6194, 𝑓𝑖𝑛d the value of √15516 .
Page 100
Numerical Method for Engineering
𝑥 𝑦=√𝑥 ∆𝑦 ∆2 𝑦 ∆3 𝑦
15500 124.4990
0.0402
0.0401 0.0001
15520 124.5793 0
0.0401
15530 124.6194
𝑥−𝑥0 15516−15500
𝑢= = = 1.6
10 10
𝑢(𝑢−1) 𝑢(𝑢−1(𝑢−2)
𝑓(𝑥) = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0
2! 3!
1.6(1.6 − 1)
𝑓(15516) = 124.4990 + 1.6(0.0402) + (−0.0001)
2!
1.6(1.6 − 1)(1.6 − 2)
+ (.0001) = 124.5632656
3!
Example 5.5
A second degree polynomial passes through the points (1, – 1), (2, – 2), (3, – 1) 𝑎𝑛𝑑 (4, 2).
Find the polynomial.
Solution: The difference table is constructed with the given values of 𝑥 𝑎𝑛𝑑 𝑦 as shown below:
Page 101
Numerical Method for Engineering
𝑥 𝑦 ∆𝑦 ∆2 𝑦 ∆3 𝑦
1 −1
−1
2 −2 2
1 0
3 −1 2
4 2
𝑥−𝑥0
𝑢= =𝑥−1
ℎ
𝑢(𝑢−1)
𝑦 = 𝑓(𝑥) = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0
2!
(𝑥 − 1)(𝑥 − 1 − 1)
𝑓(𝑥) = −1 + (𝑥 − 1)(−1) + (2) = 𝑥 2 − 4𝑥 + 2
2
Example 5.6 The values of 𝑠𝑖𝑛 𝑥 are given below for different values of 𝑥. Find the value of
sin 42º.
𝑥 40 45 50 55 60
Page 102
Numerical Method for Engineering
𝑥 𝑦 = 𝑠𝑖𝑛𝑥 ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
400 0.6428
0.0643
0.0589 −0.0003
0.0532 −0.0007
0.0468
600 0.8660
𝑥 − 𝑥0 420 − 400
𝑢= = = 0.4
ℎ 5
0.4(0.4 − 1)
𝑓(420 ) = 0.6428 + 0.4(0.0643) + (−0.0054)
2
0.4(0.4 − 1)(0.4 − 2(−0.0003))
+
6
0.4(0.4 − 1)(0.4 − 2)(0.4 − 3)(−0.0004)
+ = 0.66915
24
Page 103
Numerical Method for Engineering
Example 5.7
The profits of a company (in thousands of rupees) are given below:
1990 120
−20
1993 100 31
11 −45
−3 8
1999 108 −6
−9
2002 99
𝑥−𝑥0 1991−1990
Let 𝑥0 = 1990, 𝑥 = 1991, ℎ = 3, 𝑝 = = = 0.33
ℎ 3
Page 104
Numerical Method for Engineering
𝑢(𝑢−1) 𝑢(𝑢−1)(𝑢−2) 𝑢(𝑢−1)(𝑢−2)(𝑢−3)
𝑓(1991) = 𝑦0 + 𝑢∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 + ∆4 𝑦0 + ⋯
2! 3! 4!
Exercise 5.2
1. Find 𝑦 = 𝑒 3𝑥 for 𝑥 = 0.05 using the following table.
𝑥 0 0.1 0.2 0.3 0.3
𝑥 11 15 19 23 27
Newton’s forward interpolation formula is not suitable for interpolation values of y near the end
of a table of values.
Let 𝑦 = 𝑓 (x) be a function which takes the values 𝑦0 , 𝑦1 , 𝑦2 , … , 𝑦𝑛 corresponding to the values
𝑥0 , 𝑥1 , 𝑥2 , … 𝑥𝑛 of the independent variable𝑥. Let the values of 𝑥 be equally spaced with ℎ as the
interval of differencing. That is 𝑥𝑖 = 𝑥0 + 𝑖ℎ, 𝑖 = 0, 1, 2, … . , 𝑛
Let 𝑝(𝑥) be a polynomial of the nth degree in 𝑥 taking the same values of y corresponding to
𝑥 = 𝑥0 , 𝑥1 , 𝑥2 , … 𝑥𝑛 That is, 𝑝(𝑥) represents 𝑦 = 𝑓 (𝑥) such that f (xi) = 𝑝(xi), 𝑖 = 0, 1, 2, … .
Hence we can write 𝑝(x) as
𝑝 (𝑥𝑖 ) = 𝑦𝑖 𝑖 = 𝑛, 𝑛 – 1, … . , 1, 0
𝑎𝑛𝑑 𝑥𝑛−𝑖 = 𝑥𝑛−𝑖ℎ , 𝑖 = 1, 2, … . , 𝑛
(𝑥 − 𝑥𝑛−2 ) … (𝑥 − 𝑥0 ) (5.10)
𝑎0 = 𝑦𝑛 (5.11)
𝑦𝑛−1 = 𝑎0 + 𝑎1 (𝑥𝑛−1 − 𝑥𝑛 )
𝑦 −𝑦 ∇yn
𝑎1 = 𝑥𝑛−1−𝑥𝑛 = (5.12)
𝑛−1 𝑛 ℎ
∇2 yn ∇𝑛 𝑦𝑛
Similarly, we obtain 𝑎2 == , …, 𝑎𝑛 = (5.13)
2!ℎ2 𝑛!ℎ𝑛
Substituting the values from Esq. (5.11), (5.12) and (5.13) in Eq. (5.10), we get
∇yn ∇2 yn ∇n yn
p(𝑥) = yn + (x − xn ) + (x − x n )(𝑥 − 𝑥𝑛−1 ) + ⋯ (x − xn )
h 2! h2 n! hn
(𝑥 − 𝑥𝑛−1 ) … (𝑥 − 𝑥0 ) (5.14)
𝑥 – 𝑥0 = (𝑣 + 𝑛 – 1)ℎ
v(v+1) v(v+1)(v+2)(v+3)…..(v+n−1)
p(𝑥) = yn + v∇yn + ∇2 yn + ⋯ + ∇𝑛 𝑦𝑛 (5.15)
2! n!
𝑥−𝑥𝑛
Where 𝑣 = ℎ
The formula given in Eq. (5.15) is called the Newton’s backward interpolation formula. This
formula is used for interpolating values of 𝑦 near the end of the tabulated values and also used for
extrapolating values of y a little backward of 𝑦n.
Example 5.8
Page 106
Numerical Method for Engineering
Calculate the value of f (84) for the data given in the table below:
𝑥 40 50 60 70 80 90
Solution:
The value of 84 is near the end of Table. Hence, we use the Newton’s backward interpolation
formula. The difference table is shown below:
𝑥 𝑓(𝑥) ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
40 204
20
50 224 2
22 0
60 246 2 0
24 0 0
70 270 2 0
26 0
80 296 2
28
90 324
∇3 𝑦𝑛 = ∇4 𝑦𝑛 = ∇5 𝑦𝑛 = 0,
𝑥−𝑥𝑛 80−90
𝑢= = = −0.6
ℎ 10
Page 107
Numerical Method for Engineering
(−0.6)(−0.6+1)
𝑓(84) = 324 − 0.6(28) + (2) = 324 − 16.8 − 0.24 = 306.96
2
Example 5.9
From the following table estimate the number of students who obtained marks in computer
programming between 75 𝑎𝑛𝑑 80.
𝑚𝑎𝑟𝑘𝑠 35 − 45 45 − 55 55 − 65 65 − 75 75 − 85
𝑁𝑜. 𝑜𝑓 𝑠𝑡𝑢𝑑𝑒𝑛𝑡𝑠 20 40 60 60 20
45 20
55 60 20
65 120 60 20
75 180 60 0 −20
𝑥−𝑥0 80−85
Let 𝑥𝑛 = 85, 𝑥 = 80, ℎ = 10 𝑝 = = = −0.5
ℎ 10
Page 108
Numerical Method for Engineering
Exercise 5.3
1. The population of a town in the decennial census is given below. Estimate the
population for the year 1925.
Population:𝑦 46 66 81 93 101
𝑥𝑖 0 1 2 3 4
𝑓𝑖 1 7 23 55 109
Page 109
Numerical Method for Engineering
Objective
Numerical differentiation deals with the following problem: given the function
𝑦 = 𝑓 (𝑥) finds one of its derivatives at the point 𝑥 = 𝑥𝑘 Here, the term given implies that
w e either have an algorithm for computing the function, or possesses a set of discrete data points
(𝑥𝑖 , 𝑦𝑖 ) , 𝑖 = 1, 2, … . , 𝑛. In other words, we have a finite number of (𝑥, 𝑦) data points or pairs
from which we can compute the derivative. Numerical differentiation is a method to compute the
derivatives of a function at some values of independent variable 𝑥, when the function 𝑓 (𝑥) is
explicitly unknown; however it is known only for a set of arguments.
𝑥−𝑥𝑖
Let 𝑥𝑖 = 𝑥0 + 𝑖ℎ, and 𝑢 = where ℎ is the spacing
ℎ
Page 110
Numerical Method for Engineering
𝑑𝑢
Note here that = ℎ1 since 𝑢 = 𝑋−𝑋
ℎ
𝑖
𝑑𝑥
+⋯ ] (5.18)
and so on.
Equations (5.17) and (5.18) give the approximate derivatives of f(x) at arbitrary point
x = x0 + uh.
When x = x0, u = 0, Esq. (5.17) and (5.18) become
1 1 1 1 1 5
𝑓 ′ (𝑥0 ) = ℎ[∆𝑦0 − 2∆2 𝑦0 + 3∆3 𝑦0 − 4∆4 𝑦0 + ∆ 𝑦0 − ⋯ ] (5.19)
5
1 11 5 5
𝑓 ′ ′(𝑥0 ) = ℎ2 [∆2 𝑦0 − ∆3 𝑦0 + 12∆4 𝑦0 − ∆ 𝑦0 + ⋯ ] (5.20)
6
And so on.
𝑑𝑦 𝑑2 𝑦
Example 5.10: From the following table find the value of 𝑎𝑛𝑑 𝑑𝑥 2 at the point x = 1.0
𝑑𝑥
Solution:
The forward difference table is
Page 111
Numerical Method for Engineering
𝑥 𝑦 ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
1.0 5.4680
0.1985
0.2599 0.0074
0.4050 0.0074
0.4887
1.5 7.1488
𝑑2𝑦 ′ 1 2 3 11 4 5 5
= 𝑓 ′(𝑥0 ) = [∆ 𝑦0 − ∆ 𝑦0 + ∆ 𝑦0 − ∆ 𝑦0 + ⋯ ]
𝑑𝑥 2 ℎ 2 12 6
𝑑2 𝑦 ′
1 11 5
= 𝑓 ′(1.0) = [0.0614 − 0.0074 − (0.0001) + (0.0002)] = 5.4040
𝑑𝑥 2 (0.1)2 12 6
Example 5.11:
Obtain the first and second derivatives of the function tabulated below at the points x = 1.1 and
Page 112
Numerical Method for Engineering
x = 1.2
x 1 1.2 1.4 1.6 1.8 2.0
y 0 0.128 0.544 1.298 2.440 4.020
𝑥 𝑦 ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
1.0 0
0.128
0.416 0.05
0.754 0.05 0
1.142 0.05
1.580
2.0 4.020
Since x = 1.1 is a non-tabulated point near the beginning of the table, we take
𝑥0 = 1.0 and compute 𝑝 = 1.1−1.0
0.2
= 0.5
Page 113
Numerical Method for Engineering
𝑑𝑦 1 2(0.5)−1 3(0.5)2 −6(0.5)+2
= 0.2 [0.128 + (0.288) + (0.05)] = 0.62958
𝑑𝑥 2 6
𝑑2𝑦 1 1
2
= 2 [∆2 𝑦0 + (𝑝 − 1)∆3 𝑦0 ] = (0.2)2 [0.288 + (0.5 − 1)(0.05) = 6.575
𝑑𝑥 ℎ
Solution: First we find the forward differences using forward difference table as follows
𝑥 𝑓(𝑥) ∆ ∆2 ∆3 ∆4 ∆5 ∆6
1 1 −2 7 −6 2 7 −22
3 −1 5 1 −4 9 −15
5 4 6 −3 5 −6
7 10 3 2 −1
9 13 5 1
11 18 6
13 24
1 ∆2 𝑦0 ∆3 𝑦0 ∆4 𝑦0 ∆5 𝑦0 ∆6 𝑦0
Then, 𝑓 ′ (1) = ℎ (∆𝑦0 − + − + − ),ℎ = 2
2 3 4 5 6
1 1 1 1 1 1
= 2 (−2 − 2 (7) + 3 (−6) − 4 (2) + 5 (7) − 6 (−22))
Page 114
Numerical Method for Engineering
1 7 1 7 11 22
= 2 (−2 − 2 − 2 − 2 + 5 + ) = − 15
3
1 ∆2 𝑦2 ∆3 𝑦2 ∆4 𝑦2
𝑓 ′ (5) = ℎ (∆𝑦2 − + − ),ℎ = 2
2 3 4
1 1 1 1 1 3 5 3 22
= 2 (6 − 2 (−3) + 3 (5) − 4 (−6)) = 2 (6 + 2 + 3 + 2) = 3
1 11 5
𝑓 ′′ (3) = ℎ2 (∆2 𝑦1 − ∆3 𝑦1 + 12 ∆4 𝑦1 − 6 ∆5 𝑦1 ) , ℎ = 2
1 11 5 1 33 25 103
= 4 (1 − (−4) + 12 (9) − 6 (−15)) = 4 (1 + 4 + + )=
4 2 16
Exercise 5.4
𝑦 −4 3 22 59 120 211
2. From the following table of values, estimate 𝑦′ 𝑎𝑛𝑑 𝑦′′ at the points 𝑥 = 1.5 and
𝑥 = 1.25
+⋯ (5.21)
Page 115
Numerical Method for Engineering
1 2 +6𝑣+2
𝑓 ′ (𝑥) = ℎ [∇𝑦𝑛 + 2𝑣+1
2!
∇2 𝑦𝑛 + 3𝑣 3!
∇3 𝑦𝑛 +
4𝑣3 +18𝑣2 +22𝑣+6
4!
∇4 𝑦𝑛 +. . . ] (5.22)
INTERPOLATI FOULA
(𝑥) 1 2 6𝑣+6 12𝑣 2 +36𝑣+22 4 20𝑣 3 +120𝑢2 +210𝑣+100 5
𝑓 ′′ = 2
[∇ 𝑦𝑛 + 3! ∇3 𝑦𝑛 + ∇ 𝑦𝑛 + ∇ 𝑦𝑛
ℎ 4! 5!
+⋯ ] (5.23)
Equations (5.22) and (5.23) can be used to determine the approximate differentiation of first,
second, etc. order at any point x, where 𝑥 = 𝑥𝑛 + 𝑣ℎ.
If 𝑥 = 𝑥𝑛 , then v = 0. Equations (5.22) and (5.23) become
1 1 1 1 1 5
𝑓 ′ (𝑥0 ) = ℎ[∇𝑦𝑛 + 2∇2 𝑦𝑛 + 3∇3 𝑦𝑛 + 4∇4 𝑦𝑛 + ∆ 𝑦𝑛 + ⋯ ] (5.24)
5
1 11 5 5
𝑓 ′ ′(𝑥0 ) = ℎ2 [∇2 𝑦𝑛 + ∇3 𝑦𝑛 + 12∇4 𝑦𝑛 + ∇ 𝑦𝑛 + ⋯ ] (5.25)
6
and so on.
Example 5.13
A slider in a machine moves along a fixed straight rod. Its distance x (m) along the rod are given
in the following table for various values of the time t (seconds).
𝑡(𝑠𝑒𝑐) 1 2 3 4 5 6
𝑡(𝑠𝑒𝑐) 𝑥(𝑚) ∇𝑥 ∇2 𝑥 ∇3 𝑥 ∇4 𝑥 ∇5 𝑥
Page 116
Numerical Method for Engineering
1 0.0201
2 0.0844 0.0643
Here ℎ = 1.0
𝑑𝑥 1 1 1 1 1
= ℎ[∇𝑦𝑛 + 2∇2 𝑦𝑛 + 3∇3 𝑦𝑛 + 4∇4 𝑦𝑛 + ∆5 + ⋯ ]
𝑑𝑡 5
1 1 1 1 1
= 1.0 [2.4059 + 2(1.0499) + 3(0.3595) + 4(0.0748) + (0.0)]
5
= 3.0 694
𝑑2𝑥 1 11 5
2
= ℎ2[∇2 𝑦𝑛 + ∇3 𝑦𝑛 + 12∇4 𝑦𝑛 + ∇5 𝑦𝑛 + ⋯ ]
𝑑𝑡 6
𝑑2 𝑥 1 11 5
2
= (1.0)2[1.0499 + 0.3595 + 12(0.0748) + (0.0) = 1.4780
𝑑𝑡 6
Exercise 5.5
1. Find the values of 𝑦′(4) and 𝑦′′(4) from the following table
𝑥 0 1 2 3 4
𝑦 5 8 12 17 26
2. Compute the values of 𝑦′(2.6) and 𝑦′′(2.6) from the following table:
Page 117
Numerical Method for Engineering
𝑥 1 1.5 2 2.5 3
′
1 ∆𝑦−1 + ∆𝑦0 2
3𝑢2 − 1 ∆3 𝑦−2 + ∆3 𝑦−1 2𝑢3 − 𝑢 4
𝑓 (𝑥) = [ + 𝑢∆ 𝑦−1 ( )+ ∆ 𝑦−2
ℎ 2 6 2 12
5𝑢4 − 15𝑢2 + 4 ∆5 𝑦−3 + ∆5 𝑦−2
+ ( )+⋯] (5.27)
120 2
and
1 2 ∆3 𝑦−2 + ∆3 𝑦−1 6𝑢2 − 1 4 2𝑢3 − 3𝑢 ∆5 𝑦−3 + ∆5 𝑦−2
𝑓′′(𝑥) = 2 [∆ 𝑦−1 + 𝑢 ( )+ ∆ 𝑦−2 + ( )
ℎ 2 12 120 2
+⋯] (5.28)
1 2 1 4
𝑓′′(𝑥0 ) = 2
[∆ 𝑦−1 − ∆ 𝑦−2 + ⋯ ] (5.30)
ℎ 12
Page 118
Numerical Method for Engineering
𝑑𝑦 𝑑2 𝑦
Example 5.14: Find 𝑎𝑛𝑑 for 𝑥 = 0.2 for the given in the following table.
𝑑𝑥 𝑑𝑥 2
0 0
0.10017
0.10117 0.00101
0.10318 0.00105 0
0.10624 0.00109
0.11039
0.5 0.52115
Page 119
Numerical Method for Engineering
𝑑2 𝑦 1 1 4 1 1
2
= 2 [∆2 𝑦−1 − ∆ 𝑦−2 ] = 2
[0.00201 + (0.00004)]
𝑑𝑥 ℎ 12 (0.1) 12
= 0.200666
Example 5.15
Compute the values of f '(3.1) and f '(3.2) using the following table.
𝑥 1 2 3 4 5
𝑦 = 𝑓(𝑥) 0 1.4 3.3 5.6 8.1
𝑥− 2 = 1 0
1.4
𝑥− 1 = 2 1.4 0.5
1.9 -0.1
2.3 -0.2
𝑥1 = 1 5.6 0.2
2.5
𝑥2 = 1 8.1
3.1−3
Let 𝑥0 = 3, ℎ = 1, 𝑢 = = 0.1
1
Page 120
Numerical Method for Engineering
𝑥 1 2 3 4 5
2. Compute the values of y'(2) and y''(2) from the following table
𝑥 1 1.5 2 2.5 3
Page 121
Numerical Method for Engineering
Objective
If F(x) is a differentiable function whose derivative is f (x), then we can evaluate the definite
integral I as
𝑏
𝐼 = ∫𝑎 𝑓(𝑥)𝑑𝑥 = 𝐹(𝑏) − 𝐹(𝑎) 𝐹 ′ (𝑥) = 𝑓(𝑥) (5.31)
Equation (5.31) is known as the fundamental theorem of calculus. Most integrals can be
evaluated by the formula given by Eq. (5.31) and there exists many techniques for making such
evaluations. However, in many applications in science and engineering, most integrals cannot be
evaluated because most integrals do not have anti-derivatives F(x) expressible in terms of
elementary functions.
In other circumferences, the integrands could be empirical functions given by certain measured
values. In all these instances, we need to resort to numerical methods of integration. It should be
noted here that, sometimes, it is difficult to evaluate the integral by analytical methods. Numerical
integration (or numerical quadrature, as it is sometimes called) is an alternative approach to solve
such problems. As in other numerical techniques, it often results in approximate solution. The
integration can be performed on a continuous function or a set of data.
The integration given by Eq. (5.31) is called closed since the function values at the two points
(a, b) where the limits of integration are located are used to find the integral.
In open integration, information on the function at one or both limits of integration is not required.
The range of integration (b – a) is divided into a finite number of intervals in numerical integration.
The integration techniques consisting of equal intervals are based on formulas known as Newton-
Cotes closed quadrature formulas.
In this chapter, we present the following methods of integration with illustrative examples:
1. Trapezoidal rule.
2. Simpson’s 1/3 rule.
3. Simpson’s 3/8 rule.
Page 122
Numerical Method for Engineering
The general form of the problem of numerical integration may be stated as follows:
Given a set of data points (𝑥𝑖 , 𝑦𝑖 ), 𝑖 = 0, 1, 2, … ., n of a function y = f (x), where f (x) is not
𝑏
explicitly known. Here, we are required to evaluate the definite integral 𝐼 = ∫𝑎 𝑦𝑑𝑥 (5.32)
In what follows, we derive a general formula for numerical integration by using Newton’s forward
difference formula. Here, we assume the interval (a, b) is divided into n-equal subintervals such
𝑏−𝑎
that ℎ= 𝑛
𝑥
𝐼 = ∫𝑥 𝑛[𝑦0 + 𝑝∆𝑦0 + 𝑝(𝑝−1)
2!
∆2 𝑦0 + 𝑝(𝑝−1)(𝑝−2)
3!
∆3 𝑦0 + ⋯ ]𝑑𝑥 (5.35)
0
Where x = x0 + ph
𝑛 2 3 −3𝑝2 +2𝑝
= ℎ ∫0 [𝑦0 + 𝑢∆𝑦0 + 𝑝 2−𝑝∆2 𝑦0 + 𝑝 6
∆3 𝑦0 + ⋯ ]𝑑𝑝 (5.36)
⋯] (5.37)
Page 123
Numerical Method for Engineering
A) Trapezoidal Rule
In this method, the known function values are joined by straight lines. The area enclosed by these
lines between the given end points is computed to approximate the integral as shown in Fig. 1.
Fig.1.
Each subinterval with the line approximation for the function forms a trapezoid as shown in
Fig 1. The area of each trapezoid is computed by multiplying the interval size h by the average
value of the function value in that subinterval. After the individual trapezoidal areas are obtained,
they are all added to obtain the overall approximation to the integral.
Substituting n = 1 in Eq. (5.37) and considering the curve y = f(x) through the points (x0, y0) and
(x1, y1) as a straight line (a polynomial of first degree so that the differences of order higher than
first become zero), we get
𝑥 1 ℎ 1 ℎ
𝐼1 = ∫𝑥 1 𝑦𝑑𝑥 = ℎ [𝑦0 + 2 ∆𝑦0 ] = 2 [𝑦0 + 2 (𝑦1 − 𝑦0 )] = 2 (𝑦0 + 𝑦1 ) (5.38)
0
𝑥 ℎ 𝑥 ℎ
Similarly, we have 𝐼2 = ∫𝑥 2 𝑦𝑑𝑥 = 2 (𝑦1 + 𝑦2 ) 𝐼3 = ∫𝑥 3 𝑦𝑑𝑥 = 2 (𝑦2 + 𝑦3 )
1 2
Page 124
Numerical Method for Engineering
Fig.2
Adding all the integrals (Eq. (5.38), Eq. (5.39)) and using the interval additive property of the
definite integrals, we obtain
𝑥 ℎ ℎ
𝐼 = ∑𝑛𝑖=1 𝐼𝑖 = ∫𝑥 𝑛 𝑦𝑑𝑥 = 2 [𝑦0 + 2(𝑦1 + 𝑦3 + ⋯ 𝑦𝑛−1 ) + 𝑦𝑛 ] = 2 [𝑋 + 2𝐼] (5.40)
0
Summarizing, the trapezoidal rule signifies that the curve y = f (x) is replaced by n-straight lines
joining the points (𝑥𝑛 , 𝑦𝑛 ), 𝑖 = 0, 1, 2, 3, … , 𝑛. The area bounded by the curve y = f (x), the
ordinates 𝑥 = 𝑥0 , 𝑥 = 𝑥𝑛 and the x-axis is then approximately equivalent to the sum of the
areas of the n-trapezoids so obtained.
1.2
Example 5.16: Evaluate the integral ∫0 𝑒 𝑥 𝑑𝑥 taking six intervals by using trapezoidal rule
up to three significant figures
𝑏−𝑎 1.2−0
Solution: 𝑎 = 0 , 𝑏 = 1.2 , 𝑛 = 6 ℎ= = = 0.2
𝑛 6
ℎ
𝐼= [(𝑦 + 𝑦6 ) + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 )]
2 0
Page 125
Numerical Method for Engineering
0.2
𝐼= [(1 + 3.320) + 2(1.221 + 1.492 + 1.822 + 2.226 + 2.718)] = 2.3278 ≅ 2.328
2
1.2
The exact value is = ∫0 𝑒 𝑥 𝑑𝑥 = 2.320
12 1
Example 5.17: Evaluate ∫0 𝑑𝑥 by using trapezoidal rule, taking n = 6, correct to give
1+𝑥 2
significant figures
1 𝑏−𝑎 12−0
Solution: 𝑓(𝑥) = 𝑎 = 0 , 𝑏 = 12, 𝑛 = 6 ℎ= = =2
1+𝑥 2 𝑛 6
𝑥 0 2 4 6 8 10 12
𝑦 = 𝑓(𝑥) 1 1 1 1 1 1 1
5 17 37 65 101 145
ℎ
𝐼= [(𝑦 + 𝑦6 ) + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 )]
2 0
2
𝐼= [(1 + 0.00690) + 2(0.2 + 0.05882 + 0.02703 + 0.01538 + 0.00990)] = 1.62916
2
12 1
The exact value is ∫0 𝑑𝑥 = tan−1 (𝑥)|12 −1 −1
0 = tan (12) − tan (0) = 1.48766
1+𝑥 2
6
Example 5 .18: Evaluate ∫2 log10 𝑥 𝑑𝑥 by using trapezoidal rule, taking n = 8, correct to
five decimal places.
𝑏−𝑎 6−2
Solution: 𝑓(𝑥) = log10 𝑥 𝑎 = 2 , 𝑏 = 6, 𝑛 = 8 ℎ= = = 0.5
𝑛 8
Page 126
Numerical Method for Engineering
ℎ
The trapezoidal rule is 𝐼 = 2 [(𝑦0 + 𝑦8 ) + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 + 𝑦6 + 𝑦7 )]
0.5
𝐼= [(0.30103 + 0.77815) + 2(0.39794 + 0.47712 + 0.54407 + 0.60206 + 0.65321
2
+ 0.69897 + 0.74036)] = 2.32666
6
The exact value is give by ∫2 log10 𝑥 𝑑𝑥 = [𝑥𝑙𝑜𝑔𝑥 − 𝑥]|62 = 6.06685
Exercise 5.8
2
1. Using trapezoidal rule evaluate ∫1 𝑓(𝑥)𝑑𝑥 with step size ℎ = 0.25 and with the tabulated
values of 𝑓 given below.
4 2
2. Evaluate the integration of ∫0 𝑒 −𝑥 𝑑𝑥 using trapezoidal rule with 𝑛 = 4
𝟏
B) Simpson’s 𝟑 Rule
Fig .3.
Consider three equally spaced points 𝑥0 , 𝑥1 𝑎𝑛𝑑 𝑥2 . Since the data are equally spaced,
Page 127
Numerical Method for Engineering
Fig. 4.
Substituting n = 2 in Eq. (5.37) and taking the curve through the points (𝑥0 , 𝑦0 ), (𝑥1 , 𝑦1 ) and (𝑥2 , 𝑦2 )
as a polynomial of second degree (parabola) so that the differences of order higher than two vanish,
𝑥 1 𝑛
we obtain 𝐼1 = ∫𝑥 2 𝑦𝑑𝑥 = 2ℎ [𝑦0 + 4𝑦0 + 6 ∆2 𝑦0 ] = 3 [𝑦0 + 4𝑦1 + 𝑦2 ] ( 5.41)
0
𝑥 ℎ
Similarly 𝐼2 = ∫𝑥 4 𝑦𝑑𝑥 = 3 [𝑦2 + 4𝑦3 + 𝑦4 ]
2
𝑥 ℎ
𝐼3 = ∫𝑥 6 𝑦𝑑𝑥 = 3 [𝑦4 + 4𝑦5 + 𝑦6 ] (5.42)
4
and so on.
𝑥 ℎ
In general, we can write 𝐼𝑛 = ∫𝑥 2𝑛 𝑦𝑑𝑥 = 3 [𝑦2𝑛−1 + 𝑦2𝑛−2 + 𝑦2𝑛 ] (5.43)
2𝑛−2
𝑥 ℎ
𝐼 = ∫𝑥 𝑛 𝑦𝑑𝑥 = 3 [𝑦0 + 4(𝑦1 + 𝑦3 + 𝑦5 +. . 𝑦2𝑛−1 ) + 2(𝑦2 + 𝑦4 + 𝑦6 + ⋯ 𝑦2𝑛−2 ) + 𝑦2𝑛 ]
0
ℎ
= 3 [𝑋 + 4𝑃 + 𝐸] (5.44)
Page 128
Numerical Method for Engineering
𝑏−𝑎 1.2−0
Solution: 𝑓(𝑥) = 𝑒 𝑥 𝑎 = 0 , 𝑏 = 1.2 , 𝑛 = 6 ℎ= = = 0.2
𝑛 6
ℎ
The Simpson’s rule is 𝐼 = 3 [(𝑦0 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]
0.2
𝐼= [(1 + 3.32012) + 4(1.22140 + 1.82212 + 2.71828) + 2(1.49182 + 2.22554)]
3
0.2
𝐼= [4.32012 + 4(5.7618) + 2(3.71736)] = 2.320136 ≈ 2.32014
3
1.2
The exact value is∫0 𝑒 𝑥 𝑑𝑥 = 2.3201
12 1
Example 5.20: Evaluate ∫0 𝑑𝑥te by using Simpson’s 1/3 rule, taking n = 6.
1+𝑥 2
1 𝑏−𝑎 12−0
Solution: 𝑓(𝑥) = 1+𝑥 2 𝑎 = 0 , 𝑏 = 12, 𝑛 = 6 ℎ= = =2
𝑛 6
𝑥 0 2 4 6 8 10 12
𝑦 = 𝑓(𝑥) 1.0 0.2 0.05882 0.02703 0.01538 0.0099 0.0069
𝑦0 𝑦1 𝑦2 𝑦3 𝑦4 𝑦5 𝑦6
ℎ
The Simpson’s rule is 𝐼 = 3 [(𝑦0 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]
2
𝐼 = [(1 + 0.0069) + 4(0.2 + 0.02703 + 0.0099) + 2(0.05882 + 0.01538)] = 1.40201
3
6
Example 5.21: Evaluate∫2 log10 𝑥 𝑑𝑥 , by using Simpson’s 1/3 rule, taking n = 6.
𝑏−𝑎 6−2 2
Solution: 𝑓(𝑥) = log10 𝑥 𝑎 = 2 , 𝑏 = 6, 𝑛 = 6 ℎ= = =3
𝑛 6
Page 129
Numerical Method for Engineering
2⁄
𝐼 = 3 [(0.30103 + 0.77815) + 4(0.42597 + 0.60206 + 0.72700) + 2(0.52288
3
+ 0.66901)] = 2.32957
Exercise 5.9
2
1. Using Simpson’s 1/3 evaluate ∫1 𝑓(𝑥)𝑑𝑥 with step size ℎ = 0.25 and with the tabulated
values of 𝑓 given below.
𝑥 1 1.25 1.5 1.75 2
4 2
2. Evaluate the integration of ∫0 𝑒 −𝑥 𝑑𝑥 using Simpson’s 1/3with 𝑛 = 4
Putting 𝑛 = 3 in Eq. (5.37) and taking the curve through (𝑥𝑛 , 𝑦𝑛 ), 𝑛 = 0, 1, 2, 3 as a polynomial
of degree three such that the differences higher than the third order vanish, we obtain
𝑥 3 3 1 3
𝐼1 = ∫𝑥 3 𝑦𝑑𝑥 = 3ℎ [𝑦0 + 2 ∆𝑦0 + 2 ∆2 𝑦0 + 8 ∆3 𝑦0 ] = 8 ℎ[𝑦0 + 3𝑦1 + 3𝑦2 + 𝑦3 ] (5.45)
0
𝑥 3
Similarly, we get 𝐼2 = ∫𝑥 6 𝑦𝑑𝑥 = 8 ℎ[𝑦3 + 3𝑦4 + 3𝑦5 + 𝑦6 ]
3
𝑥9 3
𝐼3 = ∫𝑥6 𝑦𝑑𝑥 = 8 ℎ[𝑦6 + 3𝑦7 + 3𝑦8 + 𝑦9 ] (5.46)
and so on.
𝑥 3
Finally, we have 𝐼𝑛 = ∫𝑥 3𝑛 𝑦𝑑𝑥 = 8 ℎ[𝑦3𝑛−3 + 3𝑦3𝑛−2 + 𝑦3𝑛−1 + 𝑦3𝑛 ] (5.47)
3𝑛−3
Page 130
Numerical Method for Engineering
Equation (5.48) is called the Simpson’s 3/8 rule. Here, the number of subintervals should be
taken as multiples of 3. Simpson’s 3/8 rule is not as accurate as Simpson’s 1/3 rule.
1.2
Example 5 .22 Evaluate the integral∫0 𝑒 𝑥 𝑑𝑥, by using Simpson’s 3/8 rule and taking seven
ordinates.
Solution: n+1=7 n=6
1 1 1 2 5 1
The points of division are 0, 6 , 3 , ,2 , 3 , 6 , 1 ℎ=6
𝑥 0 1⁄ 2⁄ 3⁄ 4⁄ 5⁄ 1
6 6 6 6 6
Solution: n+1=7 n = 6, h = 2
The points of division are 0, 2, 4, 6, 8, 10, and 12.
𝑥 0 2 4 6 8 10 12
Page 131
Numerical Method for Engineering
Exercise 5.10
2
1. Using Simpson’s 3/8 Rule evaluate ∫1 𝑓(𝑥)𝑑𝑥 with step size ℎ = 0.25 and with the
tabulated values of 𝑓 given below.
4 2
1. Evaluate the integration of ∫0 𝑒 −𝑥 𝑑𝑥 using Simpson’s 3/8 Rule with 𝑛 = 4
Page 132
Numerical Method for Engineering
Unit Summary
➢ Interpolation is the method of computing the value of the function y = f (x) for any given
value of the independent variable x when a set of values of y = f (x) for certain values of x
are given.
➢ The study of interpolation is based on the assumption that there is no sudden jump in the
values of the dependent variable for the period under consideration.
➢ In this chapter, the study of interpolation was presented based on the calculus of finite
differences. Some important interpolation formulae by means of forward and backward
differences of a function, which are frequently used in scientific and engineering
calculations, were also presented.
Page 133
Numerical Method for Engineering
When x = x0, u = 0
1
➢ 𝑓 ′ (𝑥0 ) = ℎ1[∆𝑦0 − 12∆2 𝑦0 + 13∆3 𝑦0 − 14∆4 𝑦0 + ∆5 𝑦0 − ⋯ ]
5
Page 134
Numerical Method for Engineering
′(𝑥0 ) 5
➢ 𝑓′ = ℎ12 [∆2 𝑦0 − ∆3 𝑦0 + 11
12
∆4 𝑦0 − ∆5 𝑦0 + ⋯ ]
6
When x = x0, v= 0
1
➢ 𝑓 ′ (𝑥0 ) = ℎ1[∇𝑦𝑛 + 12∇2 𝑦𝑛 + 13∇3 𝑦𝑛 + 14∇4 𝑦𝑛 + ∆5 𝑦𝑛 + ⋯ ]
5
5
➢ 𝑓 ′ ′(𝑥0 ) = ℎ12 [∇2 𝑦𝑛 + ∇3 𝑦𝑛 + 11
12
∇4 𝑦𝑛 + ∇5 𝑦𝑛 + ⋯ ]
6
𝑥
➢ Trapezoidal rule.= ∫𝑥 𝑛 𝑓(𝑥)𝑑𝑥 = [𝑦0 + 2(𝑦1 + 𝑦3 + ⋯ 𝑦𝑛−1 ) + 𝑦𝑛 ]
0
𝑥 ℎ
➢ Simpson’s 1/3 rule 𝐼 = ∫𝑥 𝑛 𝑦𝑑𝑥 = 3 [𝑦0 + 4(𝑦1 + 𝑦3 + 𝑦5 +. . 𝑦2𝑛−1 ) + 2(𝑦2 + 𝑦4 + 𝑦6 +
0
⋯ 𝑦2𝑛−2 ) + 𝑦2𝑛 ]
𝑥 3
➢ Simpson’s 3/8 rule 𝐼 = ∫𝑥 3𝑛 𝑦𝑑𝑥 = 8 ℎ[𝑦0 + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + +𝑦7 + 𝑦8 + ⋯ +
0
Review Exercise
1. Find the polynomial of degree three relevant to the following data using Lagrange’s
interpolation formula
𝑥 1 2 3 5
Page 135
Numerical Method for Engineering
2. Find the polynomial of the least degree which attains the prescribed values at the given
point using Lagrange’s interpolation formula.
𝑥 1 2 4 5
𝑥 5 6 11 13
6. A second degree polynomial passes through the points (2, – 1), (3, 1), (4, 5) 𝑎𝑛𝑑 (5, 11).
Find the polynomial.
7. In an examination the number of students who obtained marks between certain limits was
as follows.
Marks 30 − 40 40 − 50 50 − 60 60 − 70 70 − 80
No of students 18 40 64 50 20
Find the number of students whose scores lie between 70 𝑎𝑛𝑑 75.
8. The table below gives the values of 𝑓 (𝑥, ) 𝑓𝑜𝑟 0.10 ≤ 𝑥 ≤ 0.30. Find 𝑓 (0.12) and
𝑓 (0.26).
Page 136
Numerical Method for Engineering
9. The population (in thousands) of a small town is given in the following table. Estimate the
population in the years 1965 and 1995.
10. From the following table of values, estimate y'(1.0) and y''(1.0).
X 1 2 3 4 5 6
11. A particle is moving along a straight line. The displacement 𝑥 at some time instance 𝑡 are
given below. Find the velocity and acceleration of the particle 𝑎𝑡 𝑡 = 4
𝑡 1 3 5 7 9 11
12. Find the values of 𝑦′(2) and 𝑦′′(2) from the following table:
13. Find the values of y'(6.0) and y''(6.0) from the following table:
𝑥 1 2 3 4 5 6
Page 137
Numerical Method for Engineering
1
14. Evaluate ∫0 𝑐𝑜𝑠𝑥 2 𝑑𝑥 by taking eight subintervals using trapezoidal rule.
1
15. Compute the following integral numerically using the trapezoidal rule:𝐼 = ∫0 𝑒 𝑥 𝑑𝑥
Use (a) 𝑛 = 1, (b) 𝑛 = 2, (c) 𝑛 = 𝑘 and (d) 𝑛 = 8. The exact value of 𝐼 = 1.7183.
Compare your computed results in each case with the exact result.
16. Determine the area bounded by the curve 𝑓 (𝑥) = x𝑒 2𝑥 and the 𝑥-axis between 𝑥 = 0 and
𝑥 = 1 using the trapezoidal rule with an interval size of (a) ℎ = 0.5, (b) ℎ = 0.1
0.6
17. Evaluate ∫0 𝑒 𝑥 𝑑𝑥 , taking n = 6, correct to five significant figures by Simpson’s 1/3 rule.
5.2
18. Evaluate ∫4 log 𝑥 𝑑𝑥 by taking seven grid points and using the Simpson’s 1/3 rule.
1
19. Evaluate∫0 √𝑠𝑖𝑛𝑥 + 𝑐𝑜𝑠𝑥 𝑑𝑥 correct to two decimal places using Simpson’s 3/8 rule
with 𝑛 = 6
6 1
20. Evaluate ∫2 𝑑𝑥 by using Simpson’s 3/8 rule.
log 𝑒 𝑥
Reference
➢ Akai, T.J., Applied Numerical Methods for Engineers, Wiley, New York, NY, 1993.
➢ Al-Khafaji, A.W. and Tooley, J.R., Numerical Methods in Engineering Practice, Holt,
Rinehart and Winston, New York, 1986.
➢ Allen, M. and Iaacson, E., Numerical Analysis for Applied Science, Wiley, New York,
1998.
➢ Atkinson, K.E., An Introduction to Numerical Analysis, 2nd ed., Wiley, New York, NY,
1993.
➢ Atkinson, K.E. and Han, W., Elementary Numerical Analysis, 3rd ed. Wiley, New York,
2004.
➢ Rao.V.Dukkipati , Numerical Methods ,New Age International Publisher, New Delhi, 2010
Page 138
Numerical Method for Engineering
Chapter six
First order initial value problems
UNIT OBJECTIVES
Page 139
Numerical Method for Engineering
In spite of the fact that the error analysis is an important part of any numerical procedure, the
discussion in this chapter is limited primarily to the use of the procedure itself.
An ordinary differential equation is one in which an ordinary derivative of a dependent variable
y with respect to an independent variable x is related in a prescribed manner to x, y and lower
derivatives
6.1 Definition of ODE and Examples
Definition 6.1: An equation involving one or more derivatives of a dependent variable with
respect to one or more independent variables is called a differential equation.
Example 6 1: Consider the following examples
1. 𝑦 ′ − 𝑥𝑦 = 3 is a differential equation with independent variable 𝑥 and dependent
variable 𝑦.
3
𝑑2 𝑢 𝑑𝑢
2. ( 𝑑𝑡 2 ) + 𝑑𝑡 = 𝑢 − 𝑒 𝑡 is a differential equation with independent variable 𝑡 and
dependent variable u.
𝜕2𝑢 𝜕𝑢
3. − 𝜕𝑦 = 𝑦 2 − 3𝑥 is a differential equation with independent variables 𝑥 and 𝑦 and
𝜕𝑥 2
dependent variable 𝑢.
Remark 1: A differential equation is divided into an ordinary differential equation and a partial
differential equation.
Definition 6.2: A differential equation involving one or more derivatives of a dependent variable
with respect to only one variable is called an ordinary differential equation (ODE). But, if the
number of independent variables is two or more then it is called a partial differential equation
(PDE).
Example 6. 2: Consider the following examples
𝑑𝑦
1. = 𝑥 − 5, 𝑦 ′′ − 𝑥𝑦 ′ + 𝑦 = 2 etc. are ordinary differential equations.
𝑑𝑥
𝜕𝑧 𝜕𝑧
2. − 𝜕𝑦 = 0, 𝑢𝑡𝑡 − 4𝑢𝑠𝑠 + 𝑢𝑡 = 𝑒 𝑡 , 𝑢𝑡 − 4𝑢𝑥𝑥 = 0 etc. are partial differential equations.
𝜕𝑥
Definition 6.3: The order of a differential equation is the order (number) of the highest
derivative appearing in the differential equation.
✓ An ordinary differential equation of 𝑛𝑡ℎ order is an equation of the form:
𝐹(𝑥, 𝑦, 𝑦 ′ , … , 𝑦 (𝑛) ) = 0
Where, 𝐹 is a continuous function of (𝑛 + 2) variables with 𝑦 = 𝑦(𝑥).
Page 140
Numerical Method for Engineering
Definition 6 5: A relation that is free of derivatives and that satisfies identically an ordinary
differential equation on a region 𝐷 is called a solution of the ordinary differential equation.
✓ A solution of an 𝑛𝑡ℎ order differential equation with 𝑛 arbitrary constants is called the
general solution.
✓ A solution that is free of any arbitrary constant is called a particular solution.
Example 6. 4: Justify the following examples
1. 𝑦 ′ = −5 is an ordinary differential equation, then the function 𝑦 = −5𝑥 + 𝑐 is a solution
of the ODE on ℝ2 and it is a general solution. and again
𝑦 = −5𝑥 + 1, 𝑐 = 1
𝑦 = −5𝑥 + 2, 𝑐 = 2
} are also solutions and they are particular solutions.
𝑦 = −5𝑥 − 1, 𝑐 = −1
𝑒𝑡𝑐
2. 𝑦 ′ − 𝑦 = 0 is an ordinary differential equation, then 𝑦 = 𝑐𝑒 𝑥 is the general solution and
𝑦 = 𝑒𝑥, 𝑐 = 1
𝑦 = 2𝑒 𝑥 , 𝑐 = 2
} are particular solutions.
𝑦 = −2𝑒 𝑥 , 𝑐 = −2
𝑒𝑡𝑐
Page 141
Numerical Method for Engineering
Page 142
Numerical Method for Engineering
𝑑𝑦
= 𝑓(𝑥)𝑔(𝑦)
𝑑𝑥
𝑑𝑦
⟹ 𝑔(𝑦) = 𝑓(𝑥)𝑑𝑥, 𝑔(𝑦) ≠ 0
𝑑𝑦
⟹ ∫ 𝑔(𝑦) = ∫ 𝑓(𝑥)𝑑𝑥 + 𝑐, is the general solution.
3 2 3 2
⟹ 𝑦 = ±𝑒 2𝑥 −𝑥+𝑐1
= 𝑐𝑒 2𝑥 −𝑥
3 2
Therefore, 𝑦 = 𝑐𝑒 2𝑥 −𝑥
is the general solution of the differential equation.
Exercise 6.1: solve the following initial value problems
1. 𝑦 ′ = 𝑒 𝑥+𝑦 with 𝑦(0) = 0.
2. 𝑦 ′ = 𝑒 𝑥+𝑦 + 𝑥 2 𝑒 𝑦 with 𝑦(0) = 0.
Page 143
Numerical Method for Engineering
= √𝑡 2 𝑥 2 + 𝑡 2 𝑦 2
= √𝑡 2 (𝑥 2 + 𝑦 2 )
= 𝑡√𝑥 2 + 𝑦 2
= 𝑡𝐹(𝑥, 𝑦)
⟹ 𝐹(𝑡𝑥, 𝑡𝑦) = 𝑡 2 𝐹(𝑥, 𝑦)
Therefore, the differential equation is homogeneous of degree 1.
3. 𝐹(𝑥, 𝑦) = 𝑦 − 𝑥 2 𝑦
Solution: 𝐹(𝑡𝑥, 𝑡𝑦) = 𝑡𝑦 − (𝑡𝑥)2 (𝑡𝑦)
= 𝑡𝑦 − 𝑡 2 𝑥 2 𝑡𝑦
= 𝑡(𝑦 − 𝑡 2 𝑥 2 𝑦) ≠ 𝑡 𝑟 𝐹(𝑥, 𝑦)
⟹ 𝐹(𝑡𝑥, 𝑡𝑦) ≠ 𝑡 𝑟 𝐹(𝑥, 𝑦)
Therefore, the differential equation is not homogeneous.
Remark 3:
𝑥
1. 𝐹(𝑥, 𝑦) = 𝑓 (𝑦) is a homogeneous differential equation of degree 0.
Page 144
Numerical Method for Engineering
1−𝑣 𝑑𝑥
⟹ 1+𝑣2 𝑑𝑣 = and this shows the differential equation is separable.
𝑥
1−𝑣 𝑑𝑥
⟹ ∫ 1+𝑣2 𝑑𝑣 = ∫ 𝑥
1 𝑣
⟹ ∫ 1+𝑣2 𝑑𝑣 − ∫ 1+𝑣2 𝑑𝑣 = ln|𝑥| + 𝑐
1
⟹ tan−1 𝑣 − 2 ln(1 + 𝑣 2 ) = ln|𝑥| + 𝑐
𝑦 𝑦 2
⟹ tan−1 (𝑥 ) − ln √1 + (𝑥 ) − ln 𝑥 = 𝑐
𝑦
Therefore, tan−1 (𝑥 ) − ln √𝑥 2 + 𝑦 2 = 𝑐 is the general solution of the differential equation.
𝑦 2 −𝑥𝑦
Exercise 6.2: Solve 𝑦 ′ = 𝑥2
Theorem: Suppose 𝑀(𝑥, 𝑦) and 𝑁(𝑥, 𝑦) have continuous first order partial derivatives, then the
differential equation 𝑀(𝑥, 𝑦)𝑑𝑥 + 𝑁(𝑥, 𝑦)𝑑𝑦 = 0 is exact if and only if
𝜕𝑀 𝜕𝑁
=
𝜕𝑦 𝜕𝑥
Example 6.9: Show the differential equation 2𝑥𝑦𝑑𝑥 + 𝑥 2 𝑑𝑦 = 0 with 𝑢(𝑥, 𝑦) = 𝑥 2 𝑦 is exact.
Solution: Here, 𝑀(𝑥, 𝑦) = 2𝑥𝑦 and 𝑁(𝑥, 𝑦) = 𝑥 2
𝜕𝑢 𝜕
= 𝜕𝑥 (𝑥 2 𝑦) = 2𝑥𝑦
𝜕𝑥
𝜕𝑢
⟹ 𝜕𝑥 = 𝑀(𝑥, 𝑦)
𝜕𝑢 𝜕
And = 𝜕𝑦 (𝑥 2 𝑦) = 𝑥 2
𝜕𝑦
𝜕𝑢
⟹ 𝜕𝑦 = 𝑁(𝑥, 𝑦)
𝜕𝑢 𝜕𝑢
Therefore, 𝜕𝑥 = 𝑀(𝑥, 𝑦) and = 𝑁(𝑥, 𝑦) implies the differential equation is exact.
𝜕𝑦
𝜕𝑀(𝑥,𝑦) 𝜕
Or = 𝜕𝑦 (2𝑥𝑦) = 2𝑥
𝜕𝑦
𝜕𝑁(𝑥,𝑦) 𝜕
= 𝜕𝑥 (𝑥 2 ) = 2𝑥
𝜕𝑥
𝜕𝑀 𝜕𝑁
⟹ =
𝜕𝑦 𝜕𝑥
Page 145
Numerical Method for Engineering
𝜕
⟹ 𝑔(𝑦) = ∫ (𝑁(𝑥, 𝑦) − 𝜕𝑦 (∫ 𝑀(𝑥, 𝑦)𝑑𝑥)) 𝑑𝑦
𝜕
Therefore, 𝑢(𝑥, 𝑦) = ∫ 𝑀(𝑥, 𝑦)𝑑𝑥 + ∫ (𝑁(𝑥, 𝑦) − 𝜕𝑦 (∫ 𝑀(𝑥, 𝑦)𝑑𝑥)) 𝑑𝑦
𝜕𝑢(𝑥,𝑦)
2. = 𝑁(𝑥, 𝑦) ⟹ 𝜕𝑢(𝑥, 𝑦) = 𝑁(𝑥, 𝑦)𝜕𝑦
𝜕𝑦
𝜕
Therefore, 𝑢(𝑥, 𝑦) = ∫ 𝑁(𝑥, 𝑦)𝑑𝑦 + ∫ (𝑀(𝑥, 𝑦) − 𝜕𝑥 (∫ 𝑁(𝑥, 𝑦)𝑑𝑦)) 𝑑𝑥
Page 146
Numerical Method for Engineering
𝑥3
= − 𝑦 2 𝑥 + 𝑔(𝑦)
3
𝑥3
⟹ 𝑢(𝑥, 𝑦) = − 𝑦 2 𝑥 + 𝑔(𝑦)
3
𝜕𝑢 𝜕 𝑥3
And = 𝜕𝑦 ( 3 − 𝑦 2 𝑥 + 𝑔(𝑦))
𝜕𝑦
𝑥2 𝑥2
= + 𝑔′ (𝑦) = 𝑁(𝑥, 𝑦) = − cos 3𝑦
2 2
⟹ 𝑔′ (𝑦) = −cos 3𝑦
1
⟹ 𝑔(𝑦) = ∫ −cos 3𝑦 𝑑𝑦 + 𝑐1 = − 3 sin 3𝑦 + 𝑐1 , 𝑐1 = 0
𝑥2𝑦 1
Therefore, 𝑢(𝑥, 𝑦) = − 3 sin 3𝑦.
2
𝑥2𝑦 1
Hence, 𝑢(𝑥, 𝑦) = − − 3 sin 3𝑦 = 𝑐 is the solution of the differential equations.
2
Page 147
Numerical Method for Engineering
1. (𝑦 − 1)𝑑𝑥 + 𝑥𝑑𝑦 = 0.
2. (𝑥 − 2𝑦)𝑑𝑥 − 2𝑥𝑑𝑦 = 0.
Unit Summary
❖ Differential equations arise in scientific and engineering applications when a dependent
variable y varies with the independent variable either time t or position x.
❖ A differential equation involving one or more derivatives of a dependent variable with
respect to only one variable is called an ordinary differential equation (ODE).
❖ But, if the number of independent variables is two or more then it is called a partial
differential equation (PDE).
❖ The degree of a differential equation is the highest exponent of the differential equation is
expressed as a polynomial of the derivatives of the dependent variable.
❖ A differential equation 𝑀(𝑥, 𝑦)𝑑𝑥 + 𝑁(𝑥, 𝑦)𝑑𝑦 = 0 is said to be exact if and only if there
𝜕𝑢 𝜕𝑢
is a differentiable (partially) function 𝑢 = 𝑢(𝑥, 𝑦) such that 𝜕𝑥 = 𝑀(𝑥, 𝑦) and 𝜕𝑦 = (𝑥, 𝑦)
Page 148
Numerical Method for Engineering
Review Exercise
Reference
➢ Akai, T.J., Applied Numerical Methods for Engineers, Wiley, New York, NY, 1993.
➢ Al-Khafaji, A.W. and Tooley, J.R., Numerical Methods in Engineering Practice, Holt,
Rinehart and Winston, New York, 1986.
➢ Chui, C., An Introduction to Wavelets, Academic press, Burlington, MA, 1992.
➢ Collatz, L., Numerical Treatment of Differential Equations,3rd ed., Springer-Verlag, Berlin,
1966.
➢ Consatantinides, A., Applied Numerical Methods with Personal Computers, McGraw-Hill,
New York, 1987.
➢ Dukkipati, R.V., Numerical Methods through Solved Problems, New Age International
Publishers (P) Ltd., New Delhi, India, 2009.
➢ Rao.V.Dukkipati , Numerical Methods ,New Age International Publisher, New Delhi, 2010.
Page 149
Numerical Method for Engineering
Chapter seven
Numerical Methods for Initial value problems
UNIT OBJECTIVES
INTRODUCTION: Numerical methods are becoming more and more important in engineering
applications, simply because of the difficulties encountered in finding exact analytical solutions
but also, because of the ease with which numerical techniques can be used in conjunction with
modern high-speed digital computers. Several numerical procedures for solving initial value
problems involving first-order ordinary differential equations are discussed in this chapter.
Page 150
Numerical Method for Engineering
In spite of the fact that the error analysis is an important part of any numerical procedure, the
discussion in this chapter is limited primarily to the use of the procedure itself. The theory of
errors and error analysis is sometimes fairly complex and goes beyond the intended scope of this
chapter.
Definition: Solutions (particular) to differential equations may require satisfied certain defined
conditions and such conditions are called initial conditions if they are given at only one point of
the independent variable.
✓ Conditions given at more than one point of the independent variable are called boundary
conditions.
✓ The problem of solving an 𝑛𝑡ℎ order ordinary differential equation together with initial
conditions is called an initial value problem (IVP).
✓ The problem of solving an 𝑛𝑡ℎ order ordinary differential equation together with boundary
conditions is called a boundary value problem (BVP).
Given 𝑦 ′ (𝑥) = 𝑓(𝑥, 𝑦) with 𝑦(𝑥0 ) = 𝑦0 in the interval 𝑎 ≤ 𝑥 ≤ 𝑏 is called an initial value
problem (IVP).
(𝑥−𝑥𝑛 )2 (𝑥−𝑥𝑛 )𝑛
𝑦(𝑥) ≈ 𝑦𝑛+1 = 𝑦𝑛 (𝑥𝑛 ) + 𝑦𝑛 ′ (𝑥𝑛 )(𝑥 − 𝑥𝑛 ) + 𝑦𝑛 ′′ (𝑥𝑛 ) + ⋯ + 𝑦𝑛 (𝑛) (𝑥𝑛 ) (7.3)
2! 𝑛!
ℎ2 ℎ𝑛
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 ′ (𝑥0 )ℎ + 𝑦 ′′ (𝑥0 ) 2! + ⋯ + 𝑦 (𝑛) (𝑥0 ) 𝑛! ( 7.4)
Page 151
Numerical Method for Engineering
ℎ2 ℎ𝑛
𝑦(𝑥) ≈ 𝑦𝑛+1 = 𝑦𝑛 (𝑥𝑛 ) + 𝑦𝑛 ′ (𝑥𝑛 )ℎ + 𝑦𝑛 ′′ (𝑥𝑛 ) 2! + ⋯ + 𝑦𝑛 (𝑛) (𝑥𝑛 ) 𝑛! (7.5)
Example 7.1: Given 𝑦 ′ = 𝑥 − 𝑦 2 and 𝑦(0) = 1. Then find the approximate solution by Taylor’s
method of order 3 at 𝑥 = 0.1.
(𝑥−𝑥0 )2 (𝑥−𝑥0 )3
𝑦(𝑥) = 𝑦(𝑥0 ) + 𝑦 ′ (𝑥0 )(𝑥 − 𝑥0 ) + 𝑦 ′′ (𝑥0 ) + 𝑦 ′′′ (𝑥0 )
2! 3!
𝑦0 ′ = 𝑦(𝑥0 ) = 0 − (1)2 = −1
(𝑥−0)2 (𝑥−0)3
⟹ 𝑦(𝑥) = 1 + (−1)(𝑥 − 0) + 3 +4
2! 3!
𝑥2 𝑥3
= 1 + (−1)𝑥 + 3 +4
2 6
𝑥0 2 𝑥0 3
Then, 𝑦(𝑥0 ) = 1 + (−1)𝑥0 + 3 +4
2 6
3 2
⟹ 𝑦(0.1) = 1 − 0.1 + 2 (0.1)2 + 3 (0.1)3
Page 152
Numerical Method for Engineering
Exercise 7.1:
1. Use the second-order Taylor series method on (2, 3) for the initial value
𝑑𝑦
problem = −𝑥𝑦 2 , 𝑦(2) = 1 Take h = 0.1.
𝑑𝑥
2. Use the fourth order Taylor series method with a single integration step to determine
𝑑𝑦
𝑦(0.2). Given that 𝑑𝑥 + 4𝑦 = 𝑥 2 𝑦(0) = 1
Euler’s explicit method (also called the forward Euler method) is a single-step, explicit method
for solving a first-order ordinary differential equation.
Let the differential equation is given by:
𝑑𝑦
𝑦 ′ = 𝑑𝑥 = 𝑓(𝑥, 𝑦), 𝑤𝑖𝑡ℎ 𝑦(𝑥0 ) = 𝑦0 (7.6)
To solve the equation given in (6.6) for the values of 𝑦 at 𝑥 = 𝑥𝑖 = 𝑥0 + 𝑖ℎ, 𝑖 = 1,2, … . 𝑛 integrate
𝑥
equation (6.6) with one step size. 𝑦1 = 𝑦0 + ∫𝑥 1 𝑓(𝑥, 𝑦)𝑑𝑥 (7.7)
0
Page 153
Numerical Method for Engineering
𝑥0 = 0, 𝑦0 = 1 and ℎ = 0.02.
Solution: The values of 𝑥 with the given step size ℎ are, 𝑥0 = 0, 𝑥1 = 0.02, 𝑥2 =
0.04, 𝑥3 = 0.06, 𝑥4 = 0.08 and 𝑥5 = 0.1. then,
0−1
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ), but 𝑓(𝑥0 , 𝑦0 ) = 𝑓(0,1) = 0+1 = −1
Page 154
Numerical Method for Engineering
In case of Euler’s method we approximate 𝑓(𝑥, 𝑦) by 𝑓(𝑥0 , 𝑦0 ) in the range 𝑥0 to 𝑥1 , but in this
case we approximate 𝑓(𝑥, 𝑦) by means of Trapezoidal rule i.e.
ℎ
𝑓(𝑥, 𝑦) = 2 (𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 0 )) (7.9)
ℎ
Then, 𝑦1 = 𝑦0 + 2 (𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦1 0 )) (7.10)
𝑦0 = 1 and ℎ = 0.02.
0−1
Solution: 𝑦1 0 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 ), but 𝑓(𝑥0 , 𝑦0 ) = 𝑓(0,1) = 0+1 = −1.
Page 155
Numerical Method for Engineering
Exercise 7.3
1. Using Modified Euler’s method solve 𝑦 ′ = 𝑥 + 𝑦 with 𝑦(0) = 1 and ℎ = 0.02.
2. Using Modified Euler’s method to solve the following differential equation
𝑑𝑦 1
= 2𝑦 𝑦(0) = 1 and 0 < 𝑥 < 1 𝑤𝑖𝑡ℎ 𝑠𝑡𝑒𝑝 𝑖𝑠𝑒 ℎ = 0.1
𝑑𝑥
Unit Summary
Review Exercise
1. Using Taylor’s series method for 𝑦(𝑥), find 𝑦(0.1) correct to four decimal places from the
initial value problem 𝑦′ = 𝑥𝑦 + 1, 𝑦(0) = 1.
Page 156
Numerical Method for Engineering
2. Find the value of y at 𝑥 = 0.1 and 𝑥 = 0.2 using the Taylor’s series method from
𝑑𝑦
= 𝑥 2 𝑦 − 1 𝑦(0) = 1 accurate to five decimal places.
𝑑𝑥
3. Using Taylor’s series method for y(x) given that 𝑦′ = 𝑦 2 – x, 𝑦(0) = 1, find
𝑦(0.1) 𝑎𝑛𝑑 𝑦(0.3) correct to four decimal places.
𝑑𝑦 1
4. Use Taylor’s series method to solve the differential equation𝑑𝑥 = 𝑥 2+𝑦 𝑦(4) = 4 to find
9. Use the modified Euler’s method to approximate the solution to the following initial value
𝑑𝑦
problem.𝑑𝑥 = 1 + (𝑡 − 𝑦)2 2≤𝑡≤3 𝑦(2) = 1, with step size ℎ = 0.5
𝑑𝑦
10. Solve = √𝑥𝑦 + 1 with y(0) = 1 for finding 𝑦(0.075) by using modified Euler’s method
𝑑𝑥
taking ℎ = 0.025.
Page 157
Numerical Method for Engineering
Reference
➢ Akai, T.J., Applied Numerical Methods for Engineers, Wiley, New York, NY, 1993.
➢ Al-Khafaji, A.W. and Tooley, J.R., Numerical Methods in Engineering Practice, Holt,
Rinehart and Winston, New York, 1986.
➢ Chui, C., An Introduction to Wavelets, Academic press, Burlington, MA, 1992.
➢ Collatz, L., Numerical Treatment of Differential Equations,3rd ed., Springer-Verlag, Berlin,
1966.
➢ Consatantinides, A., Applied Numerical Methods with Personal Computers, McGraw-Hill,
New York, 1987.
➢ Dukkipati, R.V., Numerical Methods through Solved Problems, New Age International
Publishers (P) Ltd., New Delhi, India, 2009.
➢ Rao.V.Dukkipati , Numerical Methods ,New Age International Publisher, New Delhi, 2010.
Page 158
Numerical Method for Engineering
Page 159