KEMBAR78
Module IV | PDF | Equations | Zero Of A Function
0% found this document useful (0 votes)
21 views35 pages

Module IV

The document discusses numerical methods, particularly focusing on interpolation and the solution of algebraic and transcendental equations. It outlines the importance of numerical analysis in engineering and science, detailing methods such as the Regula-Falsi method for finding roots of equations. The document includes examples and problems to illustrate the application of these numerical techniques.

Uploaded by

manishkreddy123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views35 pages

Module IV

The document discusses numerical methods, particularly focusing on interpolation and the solution of algebraic and transcendental equations. It outlines the importance of numerical analysis in engineering and science, detailing methods such as the Regula-Falsi method for finding roots of equations. The document includes examples and problems to illustrate the application of these numerical techniques.

Uploaded by

manishkreddy123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

RV Institute of Technology & Management ®

Module-IV

NUMERICAL METHODS - 1

Introduction
Numerical analysis plays a great role in engineering and in the quantitative parts of
pure and applied science. Interpolation, the computing of values for a tabulated function at
points not in the table, is historically a most important task. Many famous mathematicians
have their names associated with procedures for interpolation: Gauss, Newton, Bessel,
Stirling. The need to interpolate began with the early studies of astronomy when the motion
of heavenly bodies was to be determined from periodic observations. Interpolation methods
demonstrate some important theory about polynomials and the accuracy of numerical
methods. Interpolating with polynomials serves as an excellent introduction to some
techniques for drawing smooth curves. These methods are the basis of many other procedures.
Among these procedures, we will focus on numerical integration in this module.

Topic Learning Objectives

Upon Completion of this module, student will be able to:

➢ Apply the knowledge of interpolation/extrapolation to numerical data arises in engineering


applications.
➢ Apply numerical methods to solve algebraic and transcendental equations whenever
analytical methods fail.
➢ Apply numerical integration technique whenever analytical methods fail or very
complicated, to offer solutions.

Solution of polynomial and transcendental equations


The study of numerical analysis is aimed at providing convenient methods for obtaining
useful solutions to problems of advanced learning in science and technology. Besides this,
analytical solutions to a large number of problems are not available. Numerical analysis
provides methods for obtaining approximate solutions to such problems also. Numerical
methods, in general, are of repeated nature. In each step, better approximation to the exact
solution of the problem is obtained and the process is continued till accuracy to the desired
degree is arrived at. Here, some numerical methods to solve algebraic and transcendental
equations are discussed.

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 1 | 35
RV Institute of Technology & Management ®

Algebraic and Transcendental Equation

An expression of the form 𝑓(𝑥) = 𝑎0 𝑥 𝑛 + 𝑎1 𝑥 𝑛−1 + 𝑎2 𝑥 𝑛−2 +. . . +𝑎𝑛−1 𝑥 + 𝑎𝑛 , where ai(i =


0, 1, 2, 3…) are constants (𝑎0 ≠ 0) and n is a positive integer, is called a polynomial in x of
degree n. The polynomial f (x) =0 is called an algebraic equation of degree n.

Examples
(1) 3𝑥 2 − 6𝑥 + 9 = 0
(2) (2𝑥 − 8)(𝑥 + 5) = 0
If 𝑓(𝑥) contains some other functions such as trigonometric, logarithmic, exponential etc.,
then 𝑓(𝑥) = 0 is called a transcendental equation.
Examples
(1) 2𝑒 𝑥 − 4 = 0
(2) 𝑐𝑜𝑠 𝑥 − 𝑥𝑒 𝑥 = 0

Root of an equation: The value ‘a’ of x which satisfies 𝑓(𝑥) = 0 is called a root of
𝑓(𝑥) = 0. Geometrically, a root of 𝑓(𝑥) = 0 is that value of x where the graph of
𝑦 = 𝑓(𝑥) crosses the x-axis.

Simple root: A number 𝜉 is a simple root of 𝑓(𝑥) = 0 if 𝑓(𝜉) = 0, 𝑓 ′ (𝜉) ≠ 0.

The process of finding the roots of an equation is called solution of that equation. This is a
problem of great importance in Scientific and Engineering studies. To solve higher order and
transcendental equations no analytical methods exist. Such equations are solved by numerical
methods.

Basic properties of equations


1. If 𝑓(𝑥) is exactly divisible by x-a, then ‘a’ is a root of 𝑓(𝑥) = 0.
2. Every polynomial equation of the nth degree has only 'n' roots (real or imaginary).
3. In an equation with real coefficients, imaginary roots occur in conjugate pairs, i e., if α+iβ
is a root of the equation𝑓(𝑥) = 0, then α - iβ must also be its root.
4. Every polynomial equation of odd degree has atleast one real root.

Intermediate value property: If 𝑓(𝑥) is continuous in the interval [a, b] and 𝑓(𝑎),𝑓(𝑏)
have different signs, then the equation 𝑓(𝑥) = 0 has at least one root between x=a and x=b.

Initial approximation
The common method used to obtain the initial approximation to the root is based upon the
intermediate value theorem which states that “If f(x) is a continuous function in the closed
interval [a, b] and if f(a) and f(b) are of opposite signs [i.e. f(a).f(b) < 0] then the equation f(x)
= 0 has atleast one simple root (or odd number of roots) lying between a and b”. By using this
property we take a (or) b as the initial approximation of the root to start the Iterative process.

Regula-Falsi method(Method of false position)

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 2 | 35
RV Institute of Technology & Management ®

This is method of finding the real root of an equation𝑓(𝑥) = 0. Here we choose two points
𝑥0 , 𝑥1 such that 𝑓(𝑥0 ) and 𝑓(𝑥1 ) are of opposite signs i.e., the graph of y=f(x) crosses the x-
axis between these points a root lies between 𝑥0 𝑎𝑛𝑑𝑥1 and consequently𝑓(𝑥0 )𝑓(𝑥1 ) < 0.
Consider the equation f(x) = 0, where f(x) may be Algebraic (or) Transcendental which is
known to have a root between [x0, x1] then𝑓(𝑥0 )𝑓(𝑥1 ) < 0.

Fig. 4.1. The function f(x)

Approximate the function f(x) by the straight line joining the points [x0, f(x0)] and[x1, f(x1)].
Let this straight line cut the x-axis at x2.
The equation of the chord joining the two points [x0, f(x0)] and [x1, f(x1)] is given by,
𝑦−𝑓(𝑥0 ) 𝑥−𝑥 𝑓(𝑥 )−𝑓(𝑥 )
= 𝑥 −𝑥0 ⇒ 𝑦 − 𝑓0 = 𝑥1 −𝑥 0 (𝑥 − 𝑥0 ) ---------(1)
𝑓(𝑥 )−𝑓(𝑥 )
1 0 1 0 1 0
The method consists in replacing the curve AB by means of the chord AB and taking the point
of intersection of the chord with x-axis as an initial approximation to the root. The point of
intersection is obtained by putting y = 0
𝑓(𝑥 )−𝑓(𝑥 )
∴Equation (1) becomes, 0 − 𝑓(𝑥0 ) = 𝑥1 −𝑥 0 (𝑥2 − 𝑥0 )
1 0
𝑓(𝑥0 )(𝑥1 −𝑥0 )
⇒ 𝑥2 − 𝑥0 = − 𝑓(𝑥1 )−𝑓(𝑥0 )

(𝑥1 −𝑥0 )
⇒ 𝑥2 = 𝑥0 − 𝑓(𝑥 𝑓(𝑥0 )
1 )−𝑓(𝑥0 )
𝑥0 𝑓(𝑥1 )−𝑥1 𝑓(𝑥0 )
𝑥2 = ----(2)
𝑓(𝑥1 )−𝑓(𝑥0 )

The formula given (2) is the first approximation to the root.


If f(x2) and f(x0) are opposite signs then replace x1by x2and draw a straight line joining f(x2)
and f(x0) to find the new intersection point. If f(x2) and f(x0) are of same sign then x0is
replaced by x2and repeat the above procedure till the root is found to the desired accuracy.
Repeating the above process n times we get the general formula given by

𝑥𝑛−1 𝑓(𝑥𝑛 ) − 𝑥𝑛 𝑓(𝑥𝑛−1 )


𝑥𝑛+1 = ---------(3) n = 1,2,3,....
𝑓(𝑥𝑛 ) − 𝑓(𝑥𝑛−1 )
Note:
1. Regula-Falsi method has linear rate of convergence.
2. Geometrically this method is equivalent to replacing the curve y=f(x) by a chord that
passes through the points A [a, f (a)] and B [b, f (b)] and intersection of chord with x-axis is
obtained as solution of equation.

Problems
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 3 | 35
RV Institute of Technology & Management ®

1. Find a real root of the equation 𝑥 3 -2x-5=0 by the method of false position correct to three
decimal places.
Solution: Let f(x) = 𝑥 3 - 2x -5
f(1) = -6(-ve) f(2) = -1(-ve), f(3) = 16(+ve)
A root lies between 2 and 3
therefore 𝑥0 = 2 𝑥1 = 3 𝑓(𝑥0 ) = −1 𝑓(𝑥1 ) = 16
By the method of false position,
𝒙 𝒇(𝒙 )−𝒙𝟏 𝒇(𝒙𝟎 )
𝒙𝟐 = 𝟎 𝒇(𝒙𝟏 )−𝒇(𝒙
𝟏 𝟎 )
1
We get, 𝑥2 = 2 + 17 = 2.0588
Since𝑓(2.0588) = −0.3908(−𝑣𝑒), therefore the root lies between 2.0588 and 3.
Now, 𝑥0 = 2.0588, 𝑥1 = 3, 𝑓(𝑥0 ) = −0.3908, 𝑓(𝑥1 ) = 16
0.9412
𝑥3 = 2.0588 − (−0.3908) = 2.0813
16.3908
Repeating this process, the successive approximations are 𝑥4 =
2.0862,𝑥5 =2.0915,𝑥6 =2.0934, x7 =2.0941,𝑥8 =2.0943
Hence, the root is 2.094 correct to 3 decimal places.

2. Find the root of the equation xe𝑥 =cosx using Regula - falsi method correct to four decimal
places.
Solution: Let 𝑓(𝑥) = 𝑐𝑜𝑠 𝑥 − 𝑥𝑒 𝑥 = 0
f(0) = 1(+ve), f(1) = -2.17798(-ve)
root lies between 0 and 1
therefore, 𝑥0 = 0 , 𝑥1 = 1 , 𝑓(𝑥0 ) = 1 , 𝑓(𝑥1 ) = −2.17798
By the method of false position,
𝑥0 𝑓(𝑥1 ) − 𝑥1 𝑓(𝑥0 )
𝑥2 =
𝑓(𝑥1 ) − 𝑓(𝑥0 )
1
𝑥2 = 0 + 3.17798 = 0.31467
Since f(0.31467) = 0.51987
The root lies between 0.31467 and 1
therefore 𝑥0 = 0.31467 , 𝑥1 = 1 , 𝑓(𝑥0 ) = 0.51987 , 𝑓(𝑥1 ) = −2.17798
0.68533
𝑥3 = 0.31467 − 2.69785 (0.51987) = 0.44673
The successive approximations are
𝑥4 = 0.49402, 𝑥5 =0.50995,𝑥6 =0.51520,
x7 =0.51692,𝑥8 =0.51748, 𝑥9 =0.51767,𝑥10 =0.51775Hence the root is 0.5177.

3. Find a real root of the equation xlog10 𝑥 = 1.2 by Regular - Falsi method correct to four
decimal places.
Solution: Let 𝑓(𝑥) = xlog10 x-1.2
𝑓(1) = −𝑣𝑒, 𝑓(2) = −𝑣𝑒 𝑎𝑛𝑑 𝑓(3) = +𝑣𝑒
Therefore a root lies between 2 and 3
Now, 𝑥0 = 2 , 𝑥1 = 3 , 𝑓(𝑥0 ) = −0.59794 , 𝑓(𝑥1 ) = 0.23136
By Regular-Falsi method
𝒙 𝒇(𝒙 )−𝒙𝟏 𝒇(𝒙𝟎 )
𝒙𝟐 = 𝟎 𝒇(𝒙𝟏 )−𝒇(𝒙
𝟏 𝟎 )
= 2.72102

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 4 | 35
RV Institute of Technology & Management ®

𝑓(𝑥2 ) = 𝑓(2.72102) = -0.01709


⇒ the root lies between 2.72102 and 3
0.27898
𝑥3 = 2.72102 + (0.01709) = 2.74021
0.23136 + 0.01709
Repeating this process, the successive approximations are
𝑥4 = 2.74024,𝑥5 = 2.74063
Hence the root is 2.7406 correct to 4 decimal places.

Newton-Raphson method
Let f(x) = 0 ---------- (1), be the given equation, where f(x) may be Algebraic (or)
Transcendental and x0be the initial approximation to the root.
Let x1= x0+ h ---------- (2) be the exact root of the equation f(x) = 0, where h is very small
quantity.
From (1), we have f(x1) = f(x0+ h) = 0 ---------- (3)
Expanding f(x0+ h) by Taylor’s series expansion we get,
ℎ ℎ2 ℎ3
𝑓(𝑥0 + ℎ) = 𝑓(𝑥0 ) + 1! 𝑓′(𝑥0 ) + 2! 𝑓′′(𝑥0 ) + 3! 𝑓′′′(𝑥0 )+. . .. ------------(4)
Since f(x1) = f(x0+ h) = 0 and h is very small, so higher powers of h can be neglected.
∴Equation (3) becomes,
𝑓(𝑥0 + ℎ) = 𝑓(𝑥0 ) + ℎ𝑓′(𝑥0 )

⇒ 0 = 𝑓(𝑥0 ) + ℎ𝑓′(𝑥0 )(∵ 𝑓(𝑥0 + ℎ) = 0)


𝑓(𝑥0 )
⇒ ℎ = − 𝑓′(𝑥
0)
----------------------(5)
Substituting (5) in (2), we get the first approximation to the root given by,
𝑓(𝑥 )
𝑥1 = 𝑥0 − 𝑓′(𝑥0 ).
0
Similarly starting with x1and repeating the above procedure we get the second approximation
to the root given by,
𝑓(𝑥 )
𝑥2 = 𝑥1 − 𝑓′(𝑥1 )
1
Proceeding like this, we get the n𝑡ℎapproximation to the root given by,

𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 − ---------(6)
𝑓 ′ (𝑥𝑛 )
The formula given in (6) is known as Newton-Raphson Iterative formula to find the root of the
equation f(x) = 0.

Note: 1 Newton’s formula converges provided initial approximation 𝑥0 is chosen sufficiently


close to the root.
Note: 2 Newton’s method has a quadratic convergence. i.e., the subsequent error at each step
is proportional to the square of the previous error.
Geometrical Interpretation

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 5 | 35
RV Institute of Technology & Management ®

Fig. 4.2. The function f(x)

Let 𝑥0 be a point near the root 𝛼 of the equation 𝑓(𝑥) = 0


Then, the equation of the tangent at 𝐴0 [𝑥0 , 𝑓(𝑥0 )] is 𝑦 − 𝑓(𝑥0 ) = 𝑓 ′ (𝑥0 )(x-x0 )
𝑓(𝑥 )
It cuts the x-axis at 𝑥1 = 𝑥0 − 𝑓′ (𝑥0 ) , first approximation to the root 𝛼.
0
If 𝐴1 is a point corresponding to 𝑥1 on the curve, then the tangent at 𝐴1 will cut the x- axis at 𝑥2 ,
which is nearer to 𝛼 is a second approximation to the root. Hence the method consists in
replacing the part of the curve between the point 𝐴0 and the x- axis by means of tangent to the
curve at 𝐴0 .

Problems
1. Find by Newton’s method, the real root of the equation 3x = cos x+1.
Solution: Let 𝑓(𝑥) = 3x-cosx-1
𝑓(0) = -2 = -ve𝑓(1) = 1.4597 = +ve
So a root of 𝑓(𝑥) = 0 lies between 0 and 1.
It is nearer to 1 let us take 𝑥0 = 0.6
𝑓 ′ (𝑥) = 3+sinx
Therefore, Newton’s iteration formula is
𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 −
𝑓 ′ (𝑥𝑛 )
3x𝑛 -cosx𝑛 -1
𝑥n+1 = 𝑥𝑛 −
3 + sinx𝑛
𝑥𝑛 sinx𝑛 + cosx𝑛 + 1
𝑥n+1 =
3 + sinx𝑛
Put n = 0 first approximation 𝑥1 is

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 6 | 35
RV Institute of Technology & Management ®

𝑥0 sinx0 + cosx0 + 1
𝑥1 = = 0.6071
3 + sinx0
Put n = 1 second approximation 𝑥2 is
𝑥1 sinx1 + cosx1 + 1
𝑥2 = = 0.6071
3 + sinx1
clearly 𝑥1 =𝑥2
Hence the desired root is 0.6071 correct to 4 decimal places.
2. Use the Newton-Raphson method to find a root of the equation
𝑥 3 − 0.165𝑥 2 + 3.993 × 10−4 = 0
Solution: Let f (x) = x3 − 0.165x 2 + 3.99310−4
f (x) = 3x 2 − 0.33x
By using Intermediate value property an initial guess of the root of f (x ) = 0 is 𝑥0 = 0.05.
The Newton’s iteration formula is
𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 −
𝑓 ′ (𝑥𝑛 )
Put n = 0 first approximation 𝑥1 is
𝑓(𝑥0 )
𝑥1 = 𝑥0 −
𝑓 ′ (𝑥0 )

= 0.05 −
(0.05)3 − 0.165(0.05)2 + 3.993 10−4
3(0.05) − 0.33(0.05)
2

1.11810−4
= 0.05 −
− 9 10−3
= 0.05 − (− 0.01242 )
= 0.06242
Put n = 1 second approximation 𝑥2 is
𝑓(𝑥 )
𝑥2 = 𝑥1 − 𝑓′ (𝑥1 )
1

= 0.06242 −
(0.06242)3 − 0.165(0.06242)2 + 3.993 10−4
3(0.06242) − 0.33(0.06242)
2

− 3.9778110−7
= 0.06242 −
− 8.9097310−3
(
= 0.06242 − 4.464610−5 )
= 0.06238
Put n = 2 third approximation 𝑥3 is

𝑓(𝑥2 )
𝑥3 = 𝑥2 −
𝑓 ′ (𝑥2 )

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 7 | 35
RV Institute of Technology & Management ®

= 0.06238 −
(0.06238)3 − 0.165(0.06238)2 + 3.993 10−4
3(0.06238) − 0.33(0.06238)
2

4.44 10−11
= 0.06238 −
− 8.9117110−3
(
= 0.06238− − 4.982210−9 ) = 0.06238
Hence the desired root is 0.06238.

3. Using Newton’s iterative method, find the real root of 𝑥log10 𝑥 = 1.2 .
Solution: 𝑓(𝑥) = 𝑥log10 𝑥 − 1.2
𝑓(1) = -1.2,𝑓(2) = 0.59794,𝑓(3) = 0.23136
so 𝑎 root of 𝑓(𝑥) = 0 lies between 2 and 3.
Take 𝑥0 = 2
1
𝑓 ′ (𝑥) = log10 𝑥 + x. 𝑥 .log10 𝑒 = log10 𝑥 + 0.43429.
The Newton’s iteration formula is
𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 −
𝑓 ′ (𝑥𝑛 )
Put n = 0 first approximation 𝑥1 is
𝑓(𝑥 )
𝑥1 = 𝑥0 − 𝑓′ (𝑥0 ) = 2.81
0

Put n = 1 second approximation 𝑥2 is


𝑓(𝑥 )
𝑥2 = 𝑥1 − 𝑓′ (𝑥1 ) = 2.741
1

Put n = 2 third approximation 𝑥3 is


𝑓(𝑥 )
𝑥3 = 𝑥2 − 𝑓′ (𝑥2 ) = 2.74064
2

Hence the desired root is 2.74064.

4. Apply Newton-Raphson’s method to obtain a positive root of the equation


cos(x) - x ex = 0.
Solution: Given cos(x) - x ex = 0.
⇒f(x) = cos(x) - x ex and 𝑓 ′ (𝑥) = −sinx − xe𝑥 − 𝑒 𝑥
Since f (0) = 1>0 and f(1) =-2.1780 <0 , the root lies in the interval (0,1)
Let x0 = 1 be the initial approximation to the root.
The Newton’s iteration formula is

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 8 | 35
RV Institute of Technology & Management ®

𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 −
𝑓 ′ (𝑥𝑛 )
Put n = 0 first approximation 𝑥1 is
𝑓(𝑥 )
𝑥1 = 𝑥0 − 𝑓′ (𝑥0 ) = 0.65307940
0

Put n = 1 second approximation 𝑥2 is


𝑓(𝑥 )
𝑥2 = 𝑥1 − 𝑓′ (𝑥1 ) = 0.53134337
1

Put n = 2 third approximation 𝑥3 is


𝑓(𝑥 )
𝑥3 = 𝑥2 − 𝑓′ (𝑥2 ) = 0.51790991
2

Hence, x = 0.51790991 is the approximate root.

5. Evaluate √12 to four decimal places by Newton’s iterative method.


Solution:
Let √𝑥 = 12
⇒ 𝑥 2 -12 = 0
Therefore 𝑓(𝑥) = 𝑥 2 − 12
𝑓(𝑥 )
Newton’s iterative formula is 𝑥𝑛+1 = 𝑥𝑛 − ′ 𝑛
𝑓 (𝑥𝑛 )

𝑥𝑛 2 − 12 1 12
𝑥𝑛+1 = 𝑥𝑛 − = (𝑥𝑛 + )
2𝑥𝑛 2 𝑥𝑛
Since f(3) =-3 , f(4) = 4
Root lies between 3 and 4
x 0 = 3.5
1 12 
x1 =  x 0 +  = 3.4643
2 x0 
1 12 
x2 =  3.4643+  =3.4641
2 3.4643 
x 3 = 3.4641
since 𝑥2 = 𝑥3 up to 4 decimal places, therefore √12 = 3.4641.

Failure of Newton-Raphson method


• Inflection points in vicinity of root.
• Oscillate around local maximum or minimum.
• Jump away for several roots.
• Disaster from zero slope.
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 9 | 35
RV Institute of Technology & Management ®

Fig. 4.3. Failure of Newton-Raphson method

Interpolation and Extrapolation


Interpolation is the technique of estimating the value of a function for any intermediate value of
the independent variable while the process of computing the value of the function outside the
given range is called Extrapolation.

Finite Differences
The finite difference deals with the changes in the value of the function (dependent variable)
due to the changes in the values of independent variable. The values of the independent
variable x are called Arguments and the corresponding values of dependent variables y are
called Entries.
If 𝑦0 , 𝑦1 , 𝑦2 ,…… 𝑦𝑛 denote the set of values of the function y=f(x).
Then 𝑦0 =𝑦1 - 𝑦2 ,  𝑦1 =𝑦2 - 𝑦1 ........., 𝑦𝑛−1 =𝑦𝑛 -𝑦𝑛−1 are called the First Forward Differences
of the function y=f(x) where ∆ is called the forward difference operator. The differences are
called first forward differences denoted by 𝑦0 ,  𝑦1  𝑦𝑛  second forward differences
and are denoted by  𝑦0 ,  𝑦1 ,......, 𝑦𝑛−1 .
i.e. 𝑦0 = 𝑦1 - 𝑦0 , 𝑦1 = 𝑦2 - 𝑦1 , ..., 𝑦𝑛−1 = 𝑦𝑛 -  𝑦𝑛−1 
Similarly, we can define third, fourth forward differences etc.
In general, the nth forward differences is defined by the equation, ∆𝑛 𝑦𝑖 = ∆𝑛−1 𝑦𝑖+1 − ∆𝑛−1 𝑦𝑖

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 10 | 35
RV Institute of Technology & Management ®

Forward Difference Table:

x y=f(x) ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
𝑥0 𝑦0
Δ𝑦0
𝑥1 = 𝑥0 + ℎ 𝑦1 Δ2 𝑦0
Δ𝑦1 Δ3 𝑦0
𝑥2 = 𝑥0 + 2ℎ 𝑦2 2
Δ 𝑦1 Δ4 𝑦0
Δ𝑦2 Δ3 𝑦1 Δ5 𝑦0
𝑥3 = 𝑥0 + 3ℎ 𝑦3 2
Δ 𝑦2 4
Δ 𝑦1
Δ𝑦3 3
Δ 𝑦2
𝑥4 = 𝑥0 + 4ℎ 𝑦4 Δ2 𝑦3
Δ𝑦4
𝑥5 = 𝑥0 + 5ℎ 𝑦5

Here 𝑦0 is called the First Entry and ∆𝑦0 , ∆2 𝑦0 , ∆3 𝑦0 ,...... ∆5 𝑦0 are called the Leading
Differences.
Example
 cos 2x =  {cos 2 (𝑥 + ℎ) − cos 2𝑥}
=  cos 2 (x + h) −  cos 2x
= [cos2(x + 2h) – cos 2 (x + h)] – [cos 2 (x + h) – cos 2x]
= - 2 sin (2x + 3h) sin h + 2 sin (2x + h) sin h
= - 2 sin h [sin (2x + 3h) – sin (2x + h)]
= - 2 sin h [2 cos (2x + 2h) sin h] = -4 sin2 h cos (2x + 2h)

Backward Difference
Consider the function y = f(x). If 𝑦0 , 𝑦1 , 𝑦2 ,...., 𝑦𝑛 denote the set of values of y.
Then ∇𝑦1=𝑦1− 𝑦0, ∇𝑦2 = 𝑦2 − 𝑦1 , .........,∇𝑦𝑛 = 𝑦𝑛 − 𝑦𝑛−1 are called the First Backward
Differences and  is called the backward difference operator.
The second backward difference of the function is given by,
∇2 𝑦2 = ∇𝑦2 − ∇𝑦1, ∇2 𝑦3 = ∇𝑦3 − ∇𝑦2 , …….., ∇𝑛 𝑦𝑛 = ∇𝑦𝑛 − ∇𝑦𝑛−1
Similarly, we can define higher order differences.
In general, the nth backward difference is given by ∇𝑛 𝑦𝑖 = ∇𝑛−1 𝑦𝑖 − ∇𝑛−1 𝑦𝑖−1 .

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 11 | 35
RV Institute of Technology & Management ®

Backward Difference Table:

x y=f(x) ∇𝑦 ∇2 𝑦 ∇3 𝑦 ∇4 𝑦 ∇5 𝑦
𝑥0 𝑦0

𝑥1 = 𝑥0 + ℎ ∇𝑦1
𝑦1 ∇2 𝑦2
∇𝑦2 ∇2 𝑦3
𝑥2 = 𝑥0 + 2ℎ 𝑦2 2 ∇4 𝑦4
∇ 𝑦3
∇𝑦3 ∇3 𝑦4 ∇5 𝑦5
𝑥3 = 𝑥0 + 3ℎ 𝑦3
∇2 𝑦4 ∇4 𝑦5
∇𝑦4 3
∇ 𝑦5
𝑥4 = 𝑥0 + 4ℎ
𝑦4
∇𝑦5 ∇2 𝑦5
𝑥5 = 𝑥0 + 5ℎ
𝑦5

Note: Only the notations are changed not the differences.


(i) Relation between forward and backward operators: ∆𝑛 𝑦𝑟 = ∇𝑛 𝑦𝑛+𝑟
(ii) f(x) = f(x + h) – f(x)
(iii) f(x) = f(x) – f(x – h)

Differences of a Polynomial
The nth differences of a polynomial of the nth degree are constant and all higher order
differences are zero.
Let f(x) =𝑎0 𝑥 𝑛 + 𝑎1 𝑥 𝑛−1 +. . . +𝑎𝑛 , then
n f(x) = 𝑎0 n (n - 1) (n - 2) … 1. ℎ𝑛 =𝑎0 n! ℎ𝑛 ........………………….(1)
𝑛+1 𝑛+2
and then for higher orders ∆ 𝑓(𝑥)=∆ 𝑓(𝑥) = . . . = 0. …….……….(2)

Problems

1. Construct the forward difference table, given that

x 5 10 15 20 25 30
y 9962 9848 9659 9397 9063 8660

and find the values of ∆2 𝑦10 , ∆3 𝑦5 , ∆4 𝑦5 .


Solution:
x y ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
5 9962
− 
10 9848 − 
−  
15 9659 −  −
− 
20 9397 −   
− 
25 9063 −  
30 8660 − 

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 12 | 35
RV Institute of Technology & Management ®

Now ∆2 𝑦10 = - 73 which is second element for the column ∆2 𝑦.


∆3 𝑦5 = 2 which is the first element of the column ∆3 𝑦.Similarly ∆4 𝑦5 = - 1.

2. Construct the finite difference table for the function f(x) = 𝑥 3 +x+1 where x takes the values
0,1,2,3,4,5,6. Identify the leading forward and backward differences. Hence find ∆2 𝑦1, ∇3 𝑦5.
Solution:
x y First Second Third Fourth
difference difference difference difference
0 1 
1 3
  6
2 11 
  6
3 31 
  6
4 69 
  6
5 131
6 223  

The leading forward differences are 2, 6, 6 and leading backward differences are 92, 30, 6.
∆2 𝑦1 = 12, ∇3 𝑦5 = 6 .
Note: Third differences are constants and higher order differences are zero as f(x) is a
polynomial of third degree.

Interpolation with equal intervals


Newton’s Forward Interpolation Formula
Let the function y = f(x) takes the values 𝑦0, 𝑦1......., 𝑦𝑛 at the points 𝑥0 , 𝑥1 ......., 𝑥𝑛 where 𝑥𝑖 =
𝑥0 + ih. Then Newton’s Forward Interpolation polynomial is given by,
𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2) 𝑝(𝑝−1)……..(𝑝−𝑛−1)
𝑦𝑝 = f(x) = 𝑦0 + 𝑝∆y0 + 2!
∆2 y0 + 3!
∆3y0 +........... 𝑛!
∆𝑛 𝑦0 ,
where x= 𝑥0 + ph

Newton’s Backward Interpolation Formula


Let the function y = f(x) takes the values 𝑦0 , 𝑦1, ......., 𝑦𝑛 at the points 𝑥0 , 𝑥1 ......., 𝑥𝑛 ,

where 𝑥𝑖 = 𝑥0 + 𝑖ℎ. The Newton’s Backward Interpolation polynomial is given by,


𝑝(𝑝+1) 𝑝(𝑝+1)(𝑝+2) 𝑝(𝑝+1)……..(𝑝+𝑛−1)
𝑦𝑝 = f(x) = 𝑦𝑛 + p∇𝑦𝑛 + ∇2 𝑦𝑛 + ∇3 𝑦𝑛 +........... ∇𝑛 𝑦𝑛 ,
2! 3! 𝑛!
where 𝑥 = 𝑥𝑛 + 𝑝ℎ

Remark
Newton’s Forward Interpolation Formula is used to interpolate the values of y near the
beginning of the set of tabulated values or for extrapolating values of y to the left of the
beginning. Newton’s Backward Interpolation Formula is used to interpolate the values of y
near the end of the set of tabulated values or for extrapolating values of y to the right of the last
tabulated value y.

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 13 | 35
RV Institute of Technology & Management ®

Problems
1. The following table gives the population of a town during the last six census. Estimate the
increase in the population during the period from 1975 to 2019:
Year 1971 1981 1991 2001 2011 2021
Population (in 12 15 20 27 39 52
thousandth)
Solution: Now the difference table is:

x y y y  y  y  y
1971 12

1981 15 2 0

1991 20 2  −
 3
2001 27 5 −
 -4
2011 39 1

2021 52
Hence, we have
First differences: 3, 5, 7, 12, 13; Second differences: 2, 2, 5, 1; Third differences: 0, 3, -4;
Fourth differences: 3, -7; fifth differences: -10;
Using Newton’s forward interpolation formula, we get
𝑥−𝑥0 1975−1971
𝑝= = =0.4
ℎ 10
𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
f(1975) = 𝑦0 + p∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 +……. = 12.54=13
2! 3!
Using Newton’s backward interpolation formula we get,
𝑥−𝑥𝑛 2019−2021
𝑝= = = - 0.2
ℎ 10
𝑝(𝑝+1) 𝑝(𝑝+1)(𝑝+2)
f(2019) = 𝑦𝑛 + p∇𝑦𝑛 + ∇2 𝑦𝑛 + ∇3 𝑦𝑛 …….= 50.003=50
2! 3!
the increase in the population during the period from 1975 to 2019:

f(2019)-f(1975)=50-13 = 37.

2. The table gives the distance in nautical miles of the visible horizon for the given heights
in feet above the earth’s surface.

x =height: 100 150 200 250 300 350 400

y=distance: 10.63 13.03 15.04 16.81 18.42 19.90 21.27

Find the values of y when x=160ft and x=410ft.

Solution:

The difference table is

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 14 | 35
RV Institute of Technology & Management ®

x y First Second Third Fourth


difference difference difference difference
100 10.63
2.40
150 13.03 -0.39
2.01 0.15
200 15.04 -0.24 -0.07
1.77 0.08
250 16.81 -0.16 -0.05
1.61 0.03
300 18.42 -0.13 -0.01
1.48 0.02
350 19.90 -0.11
1.37
400 21.27

(i) 𝑥0 =160, 𝑦0 =13.03, ∆𝑦0 = 2.01, ∆2 𝑦0 = -0.24, ∆3 𝑦0 =0.08, ∆4 𝑦0 =-0.05 , h=50


𝑥−𝑥0 10
𝑝= ℎ
= 50
=0.2

Using Newton’s forward interpolation formula we get


𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
f(160) = 𝑦0 + p∆𝑦0 + + ∆2 𝑦0 + ∆3 𝑦0 +…….
2! 3!

f(160)=13.03+0.402+0.0192+0.00384+0.00168

=13.46 nautical miles.

(ii) x=410, 𝑥𝑛 =400, 𝑦𝑛 =21.27, ∇𝑦𝑛 =1.37,∇2 𝑦𝑛 =-0.11, ∇3 𝑦𝑛 =0.02,h=50


𝑥−𝑥𝑛 10
𝑝= ℎ
= 50
=0.2

Using Newton’s backward interpolation formula we get,


𝑝(𝑝+1) 𝑝(𝑝+1)(𝑝+2)
f(410) = 𝑦𝑛 + p∇𝑦𝑛 + ∇2 𝑦𝑛 + ∇3 𝑦𝑛 …….
2! 3!

0.2(1.2)
f(410)=21.27+0.2(1.37)+ 2
(-0.11)+…………….

=21.53 nautical miles.

3. From the following table, estimate the number of students who obtained marks between 40 and
45:

Marks (x): 30-40 40-50 50-60 60-70 70-80

No. of students(y): 31 42 51 35 31

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 15 | 35
RV Institute of Technology & Management ®

Solution: we prepare cumulative frequency table as follows:

Marks less than(x): 40 50 60 70 80

No. of students(y): 31 73 124 159 190

Solution: Now the difference table is:

x y y y  y  y
40 31

50 73 
 −
60 124 − 

70 159 − 

80 190

To find y(45) i.e. number of students with marks less than 45.
𝑥−𝑥0 5
Taking 𝑥0 = 40, x=45, h=10, p = ℎ
= 10 = 0.5

Using Newton’s Forward Interpolation formula we get,


𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
y(45) = 𝑦40 + 𝑝∆𝑦40 + ∆2 𝑦40 + ∆3 𝑦40 + ⋯ … … … … …
2 6

0.5(−0.5) 0.5(0.5)(−1.5) 0.5(−0.5)(−1.5)(−2.5)


=31+0.5(42)+ 2
(9)+ 6
(-25)+ 24
(37)

= 47.87

The number of students with marks less than 45 is 47.87 ≅48.

But the number of students with marks less than 40 is 31.

Hence the number of students getting marks between 40 and 45 =48-31=17.

4. Compute the number of men getting wages between Rs. 10 and 15 from the following data:

Wages in Rs. : 0 - 10 10 - 20 20 - 30 30 - 40
Frequency: 9 30 35 42

Solution: Now the difference table is:


x y y y  y
10 9

20 39  

30 74 

40 116

To find y(15) i.e. number of men getting wages less than 15.
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 16 | 35
RV Institute of Technology & Management ®

𝑥−𝑥 5
Taking 𝑥0 = 10, x=15, h=10, p = ℎ 0 = 10 = 0.5
Using Newton’s Forward Interpolation formula, we get,
𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2) 3
y(45) = 𝑦0 + 𝑝∆𝑦0 + 2 ∆2 𝑦0 + ∆ 𝑦0 + ⋯ … … … … …
6
0.5(−0.5) 0.5(−0.5)(−1.5)
=9+0.5(30)+ 2 (5)+ (2)
6
= 23.5
The number of men getting wages less than 15 is 23.5 ≅24.
But the number of men getting wages between Rs.10 and Rs.15 = 24-9=15.

5. Find a cubic polynomial which takes the following data

x 0 1 2 3
f(x) 1 2 1 10

Solution: The forward difference table is given by,


x y = f(x) ∆𝑦 ∆2 𝑦 ∆3 𝑦
0 1
1
1 2 -2
-1 12
2 1 10
9
3 10

𝑥−𝑥0 𝑥−0
Here, 𝑥0 = 0, h = 1, p= = = x, ∆𝑦0 =1, ∆2 𝑦0 = -2, ∆3 𝑦0 =12,
ℎ 1

By Newton-Gregory forward interpolation formula we have


𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
f(x) = y0 + p𝑦0 + + ∆𝑦0 + ∆𝑦0 + ......
2! 3!

𝑥(𝑥−1) 𝑥(𝑥−1)(𝑥−2)
f(x) = 1+x(1)++ (-2)+ (12) = 2x3 – 7x2 + 6x +1 is the required polynomial.
2! 3!

Exercise

1. Fit a cubic polynomial to the following data using suitable interpolation formula.

x 0 1 2 3
f(x) -2 2 12 34

2. Using Newton-Gregory Interpolation formulae, estimate f (0.12) from the following data.

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 17 | 35
RV Institute of Technology & Management ®

x 0.10 0.15 0.20 0.25 0.30


f(x) 0.1003 0.1511 0.2027 0.2553 0.3093

3. Apply Newton’s backward difference interpolation formula to find f(7.5) from the
following table:

x 1 2 3 4 5 6 7 8
f(x) 1 8 27 64 125 216 343 512

4. Using Newton -Gregory Interpolation formulae, find tan170 from the following data.

x 0 4 8 12 16 20 24
f(x) 0 0.0699 0.1405 0.2126 0.2867 0.3640 0.4452

Interpolation with unequal intervals

Lagrange’s formula for unequal intervals


Let y = f(x) be a function whose values are 𝑦0 , 𝑦1 , 𝑦2 ,......., 𝑦𝑛 corresponding to
𝑥0 , 𝑥1 , 𝑥2 ,......., 𝑥𝑛 not necessarily equally spaced.

(𝑥−𝑥1 ) (𝑥−𝑥2 )………..(𝑥−𝑥𝑛 ) (𝑥−𝑥0 )(𝑥−𝑥2 )…………(𝑥−𝑥𝑛 )


y or f (x) = (𝑥 𝑦 + (𝑥
) 0
𝑦1 +
0 −𝑥1 )(𝑥0 −𝑥2 )………(𝑥0 −𝑥𝑛 1 −𝑥0 )(𝑥1 −𝑥2 )……….(𝑥1 −𝑥𝑛 )

(𝑥−𝑥0 )(𝑥−𝑥1 )……….(𝑥−𝑥𝑛−1 )


……..+ (𝑥𝑛 −𝑥0 )(𝑥𝑛 −𝑥1 )………..(𝑥𝑛 −𝑥𝑛−1 )
𝑦𝑛

This formula is known as Lagrange’s Interpolation formula.

Problems
1. Apply Lagrange’s formula to find f(5) and f(6) given that f(1) =2, f(2)=4,f(3)=8,f(7)=128
and explain why the results differ from those obtained by f(x) = 2𝑥 .
Solution: 𝑥0 = 1 𝑥1 = 2 𝑥2 = 2 𝑥3 = 7
By Lagrange’s formula, we have
(𝑥−2)(𝑥−3)(𝑥−7) (𝑥−1)(𝑥−3)(𝑥−7)
f (x) = (1−2)(1−3)(1−7)
𝑓(𝑥0 ) + (2−1)(2−3)(2−7) 𝑓(𝑥1 ) +
(𝑥−1)(𝑥−3)(𝑥−17) (𝑥−1)(𝑥−2)(𝑥−3)
(3−1)(3−2)(1−7)
𝑓(𝑥2 ) + (7−1)(7−2)(7−3)
𝑓( 𝑥3 )
(𝑥−2)(𝑥−3)(𝑥−7) (𝑥−1)(𝑥−3)(𝑥−7)
f (x) = (2) + (4) +
−12 5
(𝑥−1)(𝑥−2)(𝑥−17) (𝑥−1)(𝑥−2)(𝑥−3)
(8) + (128)
−8 120
(3)(2)(−2) (4)(2)(−2) (4)(3)(−2) (4)(3)(2)
f (5) = (2) + (4) + (8) + (128)
−12 5 −8 120

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 18 | 35
RV Institute of Technology & Management ®

= 2 – 12.8 + 24 + 25.6 = 38.8


(4)(3)(−1) (5)(3)(−1) (5)(4)(−1) (5)(4)(3)
f (6) = (2) + (4) + (8) + (128)
−12 5 −8 120

= 2-12+20+64 = 74
But actual values of f(5) and f(6) are f(5) = 25 = 32 and f(6) = 26 = 64.
The difference in values of f(5) and f(6) are due to the assumption of f(x) as a polynomial,
when it is an exponential function of the form 2𝑥 .

2. Using Lagrange’s method find the value of y when 𝑥 = 2.5 from the following data:
𝑖 0 1 2 3
𝑥𝑖 0 0.5 1.5 3.0
𝑦𝑖 −6 −1.875 0.375 0

Compute up to four places of decimal only.


Solution: From Lagrange’s method, we have
𝑦(𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 + 𝐿3 (𝑥)𝑦3 , where

(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝐿0 (𝑥) =
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 )
(2.5 − 0.5)(2.5 − 1.5)(2.5 − 3.0)
=
(0 − 0.5)(0 − 1.5)(0 − 3.0)
2.0 × 1 × (−0.5)
= = 0.4444
(−0.5) × (−1.5) × (−3.0)
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )
𝐿1 (𝑥) =
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 )
(2.5−0)(2.5−1.5)(2.5−3.0) 2.5×1×(−0.5)
= (0.5−0)(0.5−1.5)(0.5−3.0) = 0.5×(−1.0)×(−2.5) = −1.0

(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥3 )
𝐿2 (𝑥) =
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 )
(2.5−0)(2.5−0.5)(2.5−3.0) 2.5×2×(−0.5)
= (1.5−0)(1.5−0.5)(1.5−3.0) = 1.5×1×(−1.5) = 1.1111
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
𝐿3 (𝑥) =
(𝑥3 − 𝑥0 )(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2 )
(2.5−0)(2.5−0.5)(2.5−1.5) 2.5×2.0×1
= (3.0−0)(3.0−0.5)(3.0−1.5) = 3.0×2.5×1.5 = 0.4444
Therefore,
𝑦(2.5) = 0.4444 × (−6) + (−1.0) × (−1.875) + (1.1111)(0.375) + (0.4444) × 0
= − 0.375

3. By using the Lagrange’s interpolation formula to fit a polynomial to the data given

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 19 | 35
RV Institute of Technology & Management ®

x 0 1 3 4
y -12 0 6 12
Hence, find y when x = 2
Solution:
𝑥0 = 0 𝑥1 = 1 𝑥2 = 3 𝑥3 = 4
𝑦0 = −12 𝑦1 = 0 𝑦2 = 6 𝑦2 = 12
By Lagrange’s formula
(𝑥−1)(𝑥−3)(𝑥−4) (𝑥−0)(𝑥−3)(𝑥−4) (𝑥−0)(𝑥−1)(𝑥−4)
y= (0−1)(0−3)(0−4)
(−12) + (1−0)(1−3)(1−4) (0) + (3−0)(3−1)(3−4) (6) +
(𝑥−0)(𝑥−1)(𝑥−3)
(12)
(4−0)(4−1)(4−3)

y = (x-1) (x-3) (x-4) – (x) (x-1) (x-4) + x (x-1) (x-3)


= (x-1) [𝑥 2 - 7x +12 - 𝑥 2 + 4x + 𝑥 2 - 3x]
= (x-1) (𝑥 2 - 6x + 12)
y = 𝑥 3 - 7𝑥 2 + 18 x – 12
for x = 2, we get y = 4

4. Find the polynomial 𝑓(𝑥) by using Lagrange’s interpolation formula and hence find𝑓(3)
for
x 0 1 2 5
f (x) 2 3 12 147
Solution:
By Lagrange’s formula
(𝑥−1)(𝑥−2)(𝑥−5) (𝑥−0)(𝑥−2)(𝑥−5) (𝑥−0)(𝑥−1)(𝑥−5)
y= (0−1)(0−2)(0−5)
(2) + (1−0)(1−2)(1−5) (3) + (2−0)(2−1)(2−5) (12) +
(𝑥−0)(𝑥−1)(𝑥−2)
(147)
(5−0)(5−1)(5−2)

y = 𝑥 3 +𝑥 2 – x+2
Hence, f(3) = 5
Newton’s General Interpolation Formula (Divided – difference)
The Lagrange’s interpolation formula, derived earlier has the disadvantage that if another
interpolation point were added, then we have to change the Lagrange’s interpolation formula
completely. Therefore, we seek an interpolation polynomial which has the property that a
polynomial of higher degree may be derived from it by simply adding new terms. Newton’s
general interpolation formula is one such formula for which we need divided differences.

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 20 | 35
RV Institute of Technology & Management ®

Let (𝑥0 , 𝑦0 ), (𝑥1 , 𝑦1 ), . . . . . . . . . , (𝑥𝑛 , 𝑦𝑛 ) be the given (𝑛 + 1) points. Then the divided
differences of orders 1,2, . . . . . . . . . . . ., 𝑛 are defined as

𝑦1 −𝑦𝑜 [𝑥1 ,𝑥2 ]−[𝑥𝑜 ,𝑥1 ]


[𝑥𝑜 , 𝑥1 ] = , [𝑥𝑜 , 𝑥1 , 𝑥2 ] = ,
𝑥1 −𝑥𝑜 𝑥2 −𝑥𝑜
[𝑥1 ,𝑥2 ,𝑥3 ]−[𝑥𝑜 ,𝑥1 ,2 ]
[𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 ] = , …………………,
𝑥3 −𝑥𝑜
[𝑥1 ,𝑥2 ,......𝑥𝑛 ]−[𝑥𝑜 ,𝑥1 ,.......𝑥𝑛−1 ]
[𝑥𝑜 , 𝑥1 , 𝑥2 , . . . . . . . , 𝑥𝑛 ] = .
𝑥𝑛 −𝑥𝑜
𝑦 −𝑦 𝑦 −𝑦
Note: [𝑥𝑜 , 𝑥1 ] = 𝑥1−𝑥𝑜 = 𝑥𝑜 −𝑥1 = [𝑥1 , 𝑥𝑜 ]
1 𝑜 𝑜 1

Newton’s divided-difference interpolation formula


From the definition of divided differences, we have
𝑦−𝑦
[𝑥, 𝑥𝑜 ] = 𝑥−𝑥𝑜 ⇒ 𝑦 = 𝑦𝑜 + (𝑥 − 𝑥𝑜 )[𝑥, 𝑥𝑜 ] − − − − − (1) Continuing in this way we get
𝑜
𝑦 = 𝑦𝑜 + (𝑥 − 𝑥𝑜 )[𝑥𝑜 , 𝑥1 ] + (𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )[𝑥𝑜 , 𝑥1 , 𝑥2 ]
+(𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )[𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 ] +. . . . . . . . . . . . . . . ..
+(𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ). . . . . (𝑥 − 𝑥𝑛 )[𝑥, 𝑥𝑜 , 𝑥1 , . . . . . . . , 𝑥𝑛 ]
This is called Newton’s general interpolation formula with divided differences; the last term
is called the remainder term after (n+1) terms.
Problems
1. Given the values
x: 5 7 11 13 17
f(x): 150 392 1452 2366 5202
Evaluate f(9), using Newton’s divided difference formula.

Solution: The divided difference table is


Value Value 1st 2nd 3rd divided 4th divided
of x of y divided divided difference difference
difference difference
5 150
121
7 392 24
265 1
11 1452 32 0
457 1
13 2366 42
709
17 5202

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 21 | 35
RV Institute of Technology & Management ®

By Newton divided difference formula


f(x) = y0+(x-x0)[x0, x1] + (x-x0)(x-x1)[x0, x1, x2] +(x-x0)(x-x1)(x-x2)[x0, x1, x2,x3]
+ (x-x0)(x-x1)(x-x2)(x-x3)[x0, x1, x2,x3,x4].
f(9) = 150 + (9 – 5)×121 + (9 – 5) (9 – 7)×24 + (9 – 5)(9 – 7)(9 – 11)×1
+ (9 – 5)(9 – 7)(9 – 11)(9 – 13)×0
= 150 + 484 + 192 – 16 + 0
= 810.

2. Using Newton’s divided difference formula, find 𝑓(8)&𝑓(15) from the following data:
𝑥: 4 5 7 10 11 13
𝑓(𝑥): 48 100 294 900 1210 2028
Solution: The divided difference table is
𝑥 𝑦 1𝑠𝑡 divided 2𝑛𝑑 divided 3𝑟𝑑 divided 4𝑡ℎ divided
differences differences differences differences
4 48
52
5 100 15
97 1
7 294 21 0
202 1
10 900 27 0
310 1
11 1210 33
409
13 2028

Newton’s divided differences interpolation formula is


𝑦 = 𝑦𝑜 + (𝑥 − 𝑥𝑜 )[𝑥𝑜 , 𝑥1 ] + (𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )[𝑥𝑜 , 𝑥1 , 𝑥2 ] + (𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )(𝑥
− 𝑥2 )[𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 ]
+(𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )[𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 ].
Here [𝑥𝑜 , 𝑥1 ] = 52, [𝑥𝑜 , 𝑥1 , 𝑥2 ] = 15, [𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 ] = 1, [𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 ] = 0,
∴ 𝑓(𝑥) = 48 + (𝑥 − 4) × 52 + (𝑥 − 4)(𝑥 − 5) × 15 + (𝑥 − 4)(𝑥 − 5)(𝑥 − 7) × 1 + (𝑥
− 4)(𝑥 − 5)(𝑥 − 7)(𝑥 − 10) × 0
⇒ 𝑓(8) = 48 + (8 − 4) × 52 + (8 − 4)(8 − 5) × 15 + (8 − 4)(8 − 5)(8 − 7) × 1 + (8
− 4)(8 − 5)(8 − 7)(8 − 10) × 0
= 48 + 4 × 52 + 4 × 3 × 15 + 4 × 3 × 1 × 1 + 0 = 448 &
𝑓(15) = 48 + (15 − 4) × 52 + (15 − 4)(15 − 5) × 15 + (15 − 4)(15 − 5)(15 −
7) × 1 + (15 − 4)(15 − 5)(15 − 7)(15 − 10) × 0 = 48 + 11 × 52 +
11 × 10 × 15 + 11 × 10 × 8 × 1 + 0 = 3150
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 22 | 35
RV Institute of Technology & Management ®

3. Given that 𝑓(0) = 8, 𝑓(1) = 68, & 𝑓(5) = 123. Construct a divided difference table.
Using the table determine the value of 𝑓(2).
Solution: The divided difference table is

𝑥 𝑦 1𝑠𝑡 divided 2𝑛𝑑 divided


differences differences
0 8
60
1 68 -9.25
13.75
5 123

Newton’s divided differences interpolation formula is


𝑦 = 𝑦𝑜 + (𝑥 − 𝑥𝑜 )[𝑥𝑜 , 𝑥1 ] + (𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )[𝑥𝑜 , 𝑥1 , 𝑥2 ]
Here [𝑥𝑜 , 𝑥1 ] = 60, [𝑥𝑜 , 𝑥1 , 𝑥2 ] = −9.25,
∴ 𝑓(𝑥) = 8 + (𝑥 − 0) × 60 + (𝑥 − 0)(𝑥 − 1) × (−9.25)
⇒ 𝑓(2) = 8 + (2 − 0) × 60 + (2 − 0)(2 − 1) × (−9.25) = 8 + 2 × 60 + 2 × 1 × (−9.25)
= 109.50
4. Determine 𝑓(𝑥) as a polynomial in 𝑥 for the following data, using Newton’s divided
difference Formula

𝑥 -4 -1 0 2 5
𝑓(𝑥) 1245 33 5 9 1335

Solution: The divided differences table is


𝑥 𝑦 1𝑠𝑡 divided 2𝑛𝑑 divided 3𝑟𝑑 divided 4𝑡ℎ divided
differences differences differences differences
-4 1245
-404
-1 33 94
-28 -14
0 5 10 3
2 13
2 9 88
442
5 1335

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 23 | 35
RV Institute of Technology & Management ®

Newton’s divided differences interpolation formula is


𝑦 = 𝑦𝑜 + (𝑥 − 𝑥𝑜 )[𝑥𝑜 , 𝑥1 ] + (𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )[𝑥𝑜 , 𝑥1 , 𝑥2 ] + (𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )(𝑥
− 𝑥2 )[𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 ]
+(𝑥 − 𝑥𝑜 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 )[𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 ].
Here [𝑥𝑜 , 𝑥1 ] = −404, [𝑥𝑜 , 𝑥1 , 𝑥2 ] = 94, [𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 ] = −14, [𝑥𝑜 , 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 ] = 3,
∴ 𝑓(𝑥) = 1245 + (𝑥 + 4) × (−404) + (𝑥 + 4)(𝑥 + 1) × 94 + (𝑥 + 4)(𝑥 + 1)(𝑥
− 0) × (−14) + (𝑥 + 4)(𝑥 + 1)(𝑥)(𝑥 − 2) × 3
∴ 𝑓(𝑥) = 1245 − 404𝑥 − 1616 + 94𝑥 2 + 470𝑥 + 376 − 14𝑥 3 − 70𝑥 2 − 56𝑥 + 3𝑥 4 +
9𝑥 3 − 18𝑥 2 − 24𝑥
= 3𝑥 4 − 5𝑥 3 + 6𝑥 2 − 14𝑥 + 5

Exercises
1. Using Newton’s formula for divided differences find an interpolating polynomial for the
following data:
𝑥: 0.0 0.5 1.0 2.0
𝑓(𝑥): 0.00 0.57 1.46 5.05
Hence find 𝑓(0.3)&𝑓(1.6).
2. Given the data:
𝑥: 5 7 11 13 17
𝑓(𝑥): 150 392 1452 2366 5202
Find 𝑓(9) using the Newton’s divided difference formula.
3. For the data given in the following table, find the polynomial approximation of 𝑓(𝑥) using
Newton’s divided difference formula:
𝑥: 2 4 5 6 8 10
𝑓(𝑥): 10 96 196 350 868 1746

4. Given 𝑢20 = 24.37, u 22 = 49 .28, 𝑢29 = 162.86&𝑢32 = 240.5, find 𝑢28 by using the
Newton’s divided difference formula.
5. Given 𝑙𝑜𝑔10 3 00 = 2.4771, log10 304 = 2.4829, 𝑙𝑜𝑔10 3 05 = 2.4843, &

𝑙𝑜𝑔10 3 07 = 2.4871, find by divide difference formula the value of 𝑙𝑜𝑔10 3 06.
6. Given 𝑓(0) = −18, 𝑓(1) = 0, 𝑓(3) = 0, 𝑓(5) = −248, 𝑓(6) = 0, 𝑓(9) = 13104, find
𝑓(𝑥).

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 24 | 35
RV Institute of Technology & Management ®

7. Applying the method of divided differences for interpolation, find the value of 𝑦 when
𝑥 = 5, given
𝑥: 4.50 4.55 4.70 4.90 5.15
𝑦: 1345 1470 2010 3815 10965

8. If 𝑦(1) = −3, 𝑦(3) = 9, 𝑦(4) = 30, & 𝑦(6) = 132, find the interpolating polynomial that
takes these values.
Answers
1. 0.2834𝑥 3 + 0.2149𝑥 2 + 0.9617𝑥. 𝑓(0.3) = 0.3155&𝑓(1.6) = 3.2497
2. 810 3. 2𝑥 3 − 3𝑥 2 + 5𝑥 − 4 4. 141.938 5. 2.4857
5 4 3 2
6. 𝑥 − 9𝑥 + 18𝑥 − 𝑥 + 9𝑥 − 18 7. 5745 8. 𝑥 3 − 3𝑥 2 + 5𝑥 − 6

Numerical Integration
Numerical integration is a process of evaluating a definite integral from a set of tabulated values
of the integrand f(x). If the integrand is a function of a single-valued, then the numerical
integration is known as Quadrature.
Newton – Cote’s Quadrature formula
𝑏
𝐿𝑒𝑡 𝐼 = ∫𝑎 𝑓(𝑥)dx,
where f (x) takes the value 𝑦0, 𝑦1 , 𝑦2 ……..,𝑦𝑛 for x = 𝑥0 ,𝑥1 ,𝑥2 ….,𝑥𝑛 .Divide the interval (a, b)
into n sub-intervals of width h i.e. h = (b-a)/n, so that
𝑥0 = a, 𝑥1 =𝑥0 +h , 𝑥2 = 𝑥0 +2h,…..,𝑥𝑛 = 𝑥0 + nh = b
𝑥 +𝑛ℎ
Now, I = ∫𝑥 0 𝑓(𝑥) dx.
0
Let x=𝑥0 +rh then dx = h dr. Also when x = 𝑥0 , r = 0 and when
x = 𝑥0 + nh, r = n,
𝑛
I=∫0 𝑓( 𝑥0 +rh) h dr.
Now by Newton’s forward interpolation formula, we have
𝑛 𝑟(𝑟−1) 𝑟(𝑟−1)(𝑟−2)
I = h∫0 [ 𝑦0 + r 𝛥 𝑦0 + 𝛥2 𝑦0 + 𝛥3 𝑦0 +……] dr
2! 3!
Integrating terms by terms, we get
𝑟2 1 𝑟3 𝑟2 1 𝑟4
I = h[𝑦0 r + 𝛥𝑦0 + (3 - ) 𝛥2 𝑦0 + 3! ( - 𝑟 3 + 𝑟 2 ) 𝛥3 𝑦0 +……]𝑛0
2 2! 2 4
𝑛 1 𝑛2 𝑛 1 𝑛2
I = nh [𝑦0 +2(𝛥𝑦0 ) + 2!( - 2 ) (𝛥2 𝑦0) + 3! ( 4 − 𝑛2 + 𝑛 ) (𝛥3 𝑦0 ) +….].
3

This formula is known as Newton-Cote’s Quadrature formula or a general Quadrature


formula.
Taking n =1, 2, 3, 6 in Quadrature formula, we have
n=1 Trapezoidal rule
n=2 Simpson’s 1/3rd rule
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 25 | 35
RV Institute of Technology & Management ®

n=3 Simpson’s 3/8th rule


n=6 Weddle’s rule

1. Simpson’s 1/3rd rule


By taking n = 2 in the general Quadrature formula and neglecting terms containing
𝛥3 𝑦0 , 𝛥4 𝑦0 , … then we get

I = 3 [(𝑦0 + 𝑦𝑛 ] + 4 (𝑦1 + 𝑦3 +……. + 𝑦𝑛−1 ) + 2 (𝑦2 +𝑦4 …..+ 𝑦𝑛−2)]

This formula is known as Simpson’s one-third rule


Note: This formula is applicable only when n is a multiple of 2.

2. Simpson’s 3/8th rule


By taking n = 3 in the general Quadrature formula and neglecting terms containing
𝛥4 𝑦0 , 𝛥5 𝑦0 ,……we get
3ℎ
I= [(𝑦0 +𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 +𝑦5 + ⋯ + 𝑦𝑛−1 ) + 2 ( 𝑦3 +𝑦6 + ⋯ + 𝑦𝑛−3 ) ]
8

This formula is known as Simpson’s three-eight rule


Note: This formula is applicable only when n is a multiple of 3
Problems
5.2
1. Calculate ∫4 logx dx using (a) Simpson’s 1/3rd rule (b) Simpson’s 3/8th rule
5.2−4 1.2
Solution: h = = = 0.2
6 6

x 4 4.2 4.4 4.6 4.8 5.0 5.2


y 1.386 1.43508 1.48160 1.52605 1.5686 1.6094 1.6486

(a) By Simpson’s 1/3rd rule

I= ℎ3⌊[(𝑦0 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]⌋


= 0.2
3
[(1.38629 + 1.6486) + 4(1.43508 + 1.52605 + 1.60943) + 2(1.48160 + 1.56861)]
0.2
= [3.034953 + 18.28224 + 6.10042]
3
0.2
= (27.41761)
3
= 1.82784

(b) Simpson’s 3/8th Rule


3ℎ
= [(𝑦0 + 𝑦6 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 ) + 2𝑦3 )]
8
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 26 | 35
RV Institute of Technology & Management ®

3(0.2)
= [(1.38629 + 1.64865) + 3(1.43508 + 1.48160 + 1.56861 + 1.60943)
8
+ 2(1.52605)]
0.6
= [3.034953 + 18.28416 + 3.052]
8
0.6
= [24.371213]=1.82784
8

6 𝑑𝑥
2. Evaluate ∫0 using (a) Simpsons 1/3rd rule (b) Simpsons 3/8th rule
1+𝑥 2

Solution:

Dividing the interval (0, 6) into six equal parts of width h = 6−0
6
=1

x 0 1 2 3 4 5 6
f(x) 1 0.5 0.2 0.1 0.0588 0.0385 0.027

(a) Simpson’s 1/3rd rule


6
1 ℎ
∫ 2
𝑑𝑥 = [(𝑦0 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]
0 1+𝑥 3
1
= [(1 + 0.027) + 4(0.5 + 0.1 + 0.0385) + 2(0.2 + 0.0588)]
3
1
= 3 [1.027 + 2.554 + 0.5176] =1.3662
(b) Simpson’s 3/8th Rule
6
1 3ℎ
∫ 2
𝑑𝑥 = [(𝑦0 + 𝑦6 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 ) + 2𝑦3 )]
0 1+𝑥 8
3(1)
= [(1 + 0.027) + 3(0.5 + 0.2 + 0.0588 + 0.0385) + 2(0.1))]
8
3
= [1.027 + 2.3919 + 0.2)]
8
=1.3571

0.6 2
3. Evaluate ∫0 𝑒 −𝑥 𝑑𝑥 by taking 6 intervals using (a) Simpsons 1/3rd rule (b) Simpsons
3/8th rule

Solution: Dividing the interval (0, 0.6) into six equal parts of width h = 0.6−0
6
=0.1

x 0 0.1 0.2 0.3 0.4 0.5 0.6


f(x) 1 0.99 0.961 0.914 0.852 0.779 0.698

(a) Simpson’s 1/3rd rule


6
1 ℎ
∫ 2
𝑑𝑥 = [(𝑦0 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]
0 1+𝑥 3
=0.5351
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 27 | 35
RV Institute of Technology & Management ®

(b) Simpson’s 3/8th Rule


6
1 3ℎ
∫ 2
𝑑𝑥 = [(𝑦0 + 𝑦6 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 ) + 2𝑦3 )]
0 1+𝑥 8
=0.5351

4. A solid of revolution is formed by rotating about the x-axis, the area between the x-axis,
the line x=0 and x=1 and a curve through the points with the following coordinates.
x 0.00 0.25 0.50 0.75 1.00
y 1.0000 0.9896 0.9589 0.9089 0.8415
Solution:
1
The volume of the solid generated is given by ∫0 𝜋 𝑦 2 dx
1
By Simpson’s 3 rule, we have (here h = 0.25)
1 ℎ
∫0 𝜋 𝑦 2 dx = 𝜋 3 [(𝑦0 2 + 𝑦4 2 ) + 4( 𝑦1 + 𝑦3 2 ) + 2(𝑦2 2 )]
0.25
= 𝜋 {1+ (0.8415)2 + 4[ (0.9896)2 + (0.9089)2 ] + 2(0.9589)2 }
3
(0.25)(3.1416)
= [1.7081 + 4(0.9793 + 0.8261) + 1.8389]
3
= (0.2618) [1.7081 + 7.2216 + 1.8389]
= (0.2618) (10.7686) = 2.8192.

Self-Study

Bisection method
One of the first numerical methods developed to find the root of a nonlinear equation
𝑓(𝑥) = 0 was the bisection method (also called Binary-Search method). The method is based
on the following theorem:

Theorem: An equation𝑓(𝑥) = 0, where 𝑓(𝑥) is a real continuous function, has at least one root
between 𝑥ℓ and 𝑥𝑢 if 𝑓(𝑥ℓ )𝑓(𝑥𝑢 ) < 0 (Fig. 4.4).

Note that if 𝑓(𝑥ℓ )𝑓(𝑥𝑢 ) > 0, there may or may not be any root between 𝑥ℓ and 𝑥𝑢 .
If𝑓(𝑥ℓ )𝑓(𝑥𝑢 ) < 0, then there may be more than one root between 𝑥ℓ and 𝑥𝑢 . So, the theorem
only guarantees one root between 𝑥ℓ and 𝑥𝑢 .
Since the method is based on finding the root between two points, the method falls under the
category of bracketing methods.

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 28 | 35
RV Institute of Technology & Management ®

f(x)

xl
x
xu

Fig. 4.4. At least one root exists between two points if the function is real, continuous,
and changes sign.

Since the root is bracketed between two points, 𝑥ℓ and 𝑥𝑢 , one can find the mid-point,
𝑥𝑚 between 𝑥ℓ and 𝑥𝑢 . This gives us two new intervals 𝑥ℓ and 𝑥𝑚 , and 𝑥𝑚 and 𝑥𝑢 .
One can find the sign of 𝑓(𝑥ℓ )𝑓(𝑥𝑚 ), and if 𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) < 0 then the new bracket is between
𝑥ℓ and 𝑥𝑚 , otherwise, it is between 𝑥𝑚 and 𝑥𝑢 . So, you can see that you are literally halving
the interval. As one repeats this process, the width of the interval [𝑥ℓ , 𝑥𝑢 ] becomes smaller and
smaller, and you can “zero” in to the root of the equation 𝑓(𝑥) = 0. The algorithm for the
bisection method is given as follows.

The steps to apply the bisection method to find the root of the equation 𝑓(𝑥) = 0 are:

1. Choose 𝑥ℓ and 𝑥𝑢 as two guesses for the root such that𝑓(𝑥ℓ )𝑓(𝑥𝑢 ) < 0, or in other
words, 𝑓(𝑥) changes sign between 𝑥ℓ and 𝑥𝑢 .

2. Estimate the root, 𝑥𝑚 of the equation 𝑓(𝑥) = 0 as the mid-point between 𝑥ℓ and 𝑥𝑢 as
𝑥 +𝑥
𝑥𝑚 = ℓ 2 𝑢.

3. Now check the following


a. If 𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) < 0, then the root lies between 𝑥ℓ and 𝑥𝑚 ; then 𝑥ℓ = 𝑥ℓ
and 𝑥𝑢 = 𝑥𝑚 .
b. If𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) > 0, then the root lies between 𝑥𝑚 and 𝑥𝑢 ; then
𝑥ℓ = 𝑥𝑚 and 𝑥𝑢 = 𝑥𝑢 .
c. If 𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) = 0; then the root is 𝑥𝑚 . Stop the algorithm if this is true.

4. Find the new estimate of the root


𝑥ℓ + 𝑥𝑢
𝑥𝑚 =
2
Find the absolute approximate relative error as
𝑛𝑒𝑤 𝑜𝑙𝑑
𝑥𝑚 - 𝑥𝑚
|𝜀𝑎 | = | 𝑛𝑒𝑤 | x 100
𝑥𝑚
where
𝑛𝑒𝑤
𝑥𝑚 = estimated root from present iteration
𝑜𝑙𝑑
𝑥𝑚 = estimated root from previous iteration

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 29 | 35
RV Institute of Technology & Management ®

5. Compare the absolute relative approximate error |𝜀𝑎 | with the pre-specified relative
error tolerance𝜀𝑠 . If|𝜀𝑎 | > 𝜀𝑠 , then go to Step 3, else stop the algorithm.
Note: One should also check whether the number of iterations is more than the
maximum number of iterations allowed. If so, one needs to terminate the algorithm and
notify the user about it.

Problems

1. Find the positive root of the equation 𝑥 3 + 4𝑥 2 − 10 = 0 by bisection method correct up to


two places of decimal.
Solution:
Let 𝑓(𝑥) ≡ 𝑥 3 + 4𝑥 2 − 10 = 0
Let us find location of the + ive roots.

x 0 1 2 >2
f(x) − 10 −5 14
Sign f(x) − − + +

There is only one + ive root and it lies between 1 and 2. Let x1 = 1 and x2 = 2; at x = 1,
𝑥 +𝑥
f(x) is – ive and at x = 2, f(x) is + ive. We examine the sign of f(x) at 𝑥 = 1 2 2 = 1.5
and check whether the root lies in the interval (1, 1.5) or (1.5, 2). Let us show the
computations in the table below :

Iteration 𝑥1 + 𝑥2 Sign f(x) 


𝑥= Sign f(x) x1 x2
No. 2 f(x2)
1 1.5 + 2.375 + 1 1.5
2 1.25 − 1.797 − 1.25 1.5
3 1.375 + 0.162 + 1.25 1.375
4 1.3125 − 0.8484 − 1.3125 1.375
5 1.3438 − 0.3502 − 1.3438 1.375
6 1.3594 − 0.0960 − 1.3594 1.375
7 1.367 − 0.0471 − 1.367 1.375
8 1.371 + 0.0956 + 1.367 1.371

We see that |𝑥1 − 𝑥2 | = 0.004.


1.367+1.371
We can choose the root as 𝑥 = = 1.369.
2
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 30 | 35
RV Institute of Technology & Management ®

2. You are working for ‘DOWN THE TOILET COMPANY’ that makes floats for ABC
commodes. The floating ball has a specific gravity of 0.6 and has a radius of 5.5 cm. You
are asked to find the depth to which the ball is submerged when floating in water.
The equation that gives the depth 𝑥 to which the ball is submerged under water is given by
𝑥 3 − 0.165𝑥 2 + 3.993 × 10−4 = 0
Use the bisection method of finding roots of equations to find the depth 𝑥 to which the ball
is submerged under water. Conduct three iterations to estimate the root of the above equation.
Find the absolute relative approximate error at the end of each iteration.

Solution:
From the physics of the problem, the ball would be submerged between 𝑥 = 0 and𝑥 = 2𝑅,
where
𝑅 = radius of the ball,
that is
0 ≤ 𝑥 ≤ 2𝑅
0 ≤ 𝑥 ≤ 2(0.055)
0 ≤ 𝑥 ≤ 0.11
Let us assume
𝑥ℓ = 0, 𝑥𝑢 = 0.11
Check if the function changes sign between 𝑥ℓ and 𝑥𝑢 .
𝑓(𝑥ℓ ) = 𝑓(0) = (0)3 − 0.165(0)2 + 3.993 × 10−4 = 3.993 × 10−4
𝑓(𝑥𝑢 ) = 𝑓(0.11) = (0.11)3 − 0.165(0.11)2 + 3.993 × 10−4 = −2.662 × 10−4
Hence
𝑓(𝑥ℓ )𝑓(𝑥𝑢 ) = 𝑓(0)𝑓(0.11) = (3.993 × 10−4 )(−2.662 × 10−4 ) < 0
So there is at least one root between 𝑥ℓ and 𝑥𝑢 , that is between 0 and 0.11.

Fig. 4.5. Floating ball problem.

Iteration 1:

The estimate of the root is


𝑥 +𝑥 0+0.11
𝑥𝑚 = ℓ 2 𝑢 = 2 = 0.055
f (xm ) = f (0.055) = (0.055) − 0.165(0.055) + 3.99310−4 = 6.65510−5
3 2

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 31 | 35
RV Institute of Technology & Management ®

𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) = 𝑓(0)𝑓(0.055) = (3.993 × 10−4 )(6.655 × 10−4 ) > 0


Hence the root is bracketed between 𝑥𝑚 and 𝑥𝑢 , that is, between 0.055 and 0.11. So, the
lower and upper limit of the new bracket is
𝑥ℓ = 0.055, 𝑥𝑢 = 0.11
At this point, the absolute relative approximate error |∈𝑎 | cannot be calculated as we do not
have a previous approximation.

Iteration 2:

The estimate of the root is


𝑥 +𝑥 0.055+0.11
𝑥𝑚 = ℓ 2 𝑢 = = 0.0825
2
𝑓(𝑥𝑚 ) = 𝑓(0.0825) = (0.0825)3 − 0.165(0.0825)2 + 3.993 × 10−4 =
−1.622 × 10−4
𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) = 𝑓(0.055)𝑓(0.0825) = (6.655 × 10−5 ) × (−1.622 × 10−4 ) < 0
Hence, the root is bracketed between 𝑥ℓ and 𝑥𝑚 , that is, between 0.055 and 0.0825. So the
lower and upper limit of the new bracket is
𝑥ℓ = 0.055, 𝑥𝑢 = 0.0825
The absolute relative approximate error |∈𝑎 | at the end of Iteration 2 is
new −𝑥 old
𝑥𝑚 0.0825−0.055
𝑚
|∈𝑎 | = | new | × 100 =| | × 100 = 33.33%
𝑥𝑚 0.0825
None of the significant digits are at least correct in the estimated root of 𝑥𝑚 = 0.0825
because the absolute relative approximate error is greater than 5%.

Iteration 3:

𝑥ℓ +𝑥𝑢 0.055+0.0825
𝑥𝑚 = = = 0.06875
2 2
𝑓(𝑥𝑚 ) = 𝑓(0.06875) = (0.06875)3 − 0.165(0.06875)2 + 3.993 × 10−4
= −5.563 × 10−5
𝑓(𝑥ℓ )𝑓(𝑥𝑚 ) = 𝑓(0.055)𝑓(0.06875) = (6.655 × 105 ) × (−5.563 × 10−5 ) < 0
Hence, the root is bracketed between 𝑥ℓ and 𝑥𝑚 , that is, between 0.055 and 0.06875. So the
lower and upper limit of the new bracket is
𝑥ℓ = 0.055, 𝑥𝑢 = 0.06875
The absolute relative approximate error |∈𝑎 | at the ends of Iteration 3 is
new −𝑥 old
𝑥𝑚 0.06875−0.0825
𝑚
|∈𝑎 | = | new | × 100 =| | × 100 = 20%
𝑥𝑚 0.06875

Lagrange’s Inverse interpolation


The process of estimating the value of x for a given value of y is called Inverse interpolation.
So far given a table of values of x and y, using one of the interpolation formulae we find the
value of y corresponding to some value of x which is not in the table. On the other hand, the
process of estimating the value of x for some value of y which is not in the table is called
inverse interpolation.
This method is used when the values of x are not necessarily equally spaced. Lagrange’s
interpolation formula can be simply viewed as a relation between two variables and any one of
the variables can be taken as an independent variable. Therefore, inverse interpolation formula
can be obtained by interchanging the variables x and y in Lagrange’s formula, we get.
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 32 | 35
RV Institute of Technology & Management ®

(𝑦−𝑦1 )(𝑦−𝑦2 )………….(𝑦−𝑦𝑛 ) (𝑦−𝑦0 )(𝑦−𝑦2 )……..(𝑦−𝑦𝑛 )


x = (𝑦 𝑥0 + 𝑥
(𝑦1 −𝑦0 )(𝑦1 −𝑦2 )………..(𝑦1 −𝑦𝑛 ) 1
+
0 −𝑦1 )(𝑦0 −𝑦2 )……….(𝑦0 −𝑦𝑛 )

(𝑦−𝑦0 )(𝑦−𝑦1 )………(𝑦−𝑦𝑛−1 )


…….+(𝑦 𝑥𝑛
𝑛 −𝑦0 )(𝑦𝑛 −𝑦1 )……..(𝑦𝑛 −𝑦𝑛−1 )

Problems
1. For the following data, find x for y = 7.

x 1 3 4
y 4 12 19
Solution:
𝑥0 =1 𝑥1 =3 𝑥2 =4
𝑦0 = 4 𝑦1 = 12 𝑦2 = 14
(𝑦−𝑦1 )(𝑦−𝑦2 ) (𝑦−𝑦0 )(𝑦−𝑦2 ) (𝑦−𝑦0 )(𝑦−𝑦1 )
x = (𝑦 𝑥0 + (𝑦 𝑥1 + 𝑥2
0 −𝑦1 )(𝑦0 −𝑦2 ) 1 −𝑦0 )(𝑦1 −𝑦2 ) (𝑦2 −𝑦0 )(𝑦2 −𝑦1 )
(𝑦−12)(𝑦−19) (𝑦−4)(𝑦−19) (𝑦−4)(𝑦−12)
= (4−12)(4−19)
(1) + (12−4)(12−19) (3) + (19−4)(19−12) (4)

at y=7
60 108 60
x= + -
120 56 105

= 1.85714

2. Find the value of x when y = 3 from the following table of values

x 4 7 10 12
y –1 1 2 4
Solution: The Lagrange’s interpolation polynomial of x is given by

(𝑦 − 1)(𝑦 − 2)(𝑦 − 4) (𝑦 + 1)(𝑦 − 2)(𝑦 − 4)


𝑓(𝑦) = (4) + (7)
(−2)(−3)(−5) (2)(1)(−3)

(𝑦 + 1)(𝑦 − 1)(𝑦 − 4) (𝑦 + 1)(𝑦 − 1)(𝑦 − 2)


+ (10) + (12)
(3)(1)(−2) (5)(3)(2)

(2)(1)(−1) (4)(1)(−1) (4)(2)(−1) (4)(2)(1)


So 𝑓(3) = −(2)(3)(5) ⋅ (4) + (2)(3) ⋅ (7) + (10) + (5)(3)(2) (12)
−(3)(2)
4 14 40 48 182
= − + + = = 12.1333
15 3 3 15 15

∴ 𝑥(3) ≈ 𝑓(3) = 12.1333.

Weddle’s rule

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 33 | 35
RV Institute of Technology & Management ®

Weddle's rule is a method of integration used for computing definite integral. The integral is
calculated from a set of numerical values of the integrand. This method of integration is also
known as mechanical quadrature.
By taking n = 6 in the general Quadrature formula, we obtain
𝑥 +𝑛ℎ
0 3ℎ
∫𝑥0 𝑓(𝑥) 𝑑𝑥 = 10 [(𝑦0 + 𝑦𝑛 ) + 5(𝑦1 + 𝑦5 + ⋯ + 𝑦𝑛−5 + 𝑦𝑛−1 ) + (𝑦2 + 𝑦4 + ⋯ +
𝑦𝑛−4 + 𝑦𝑛−2 ) + 2(𝑦6 + 𝑦12 + ⋯ + 𝑦𝑛−6 ) + 6(𝑦3 + 𝑦9 + ⋯ + 𝑦𝑛−3 )]

This formula is known as Weddle’s rule.


In particular, taking n = 6 in Weddle’s rule
3ℎ
I = 10 (𝑦0 +5𝑦1 + 𝑦2 + 6𝑦3 +𝑦4 + 5𝑦5 + 𝑦6 )

Note: This formula is applicable only when n is a multiple of 6.

Problems
5.2
1. Calculate ∫4 logx dx using Weddle’s rule.
5.2−4 1.2
Solution: h = = = 0.2
6 6

x 4 4.2 4.4 4.6 4.8 5.0 5.2


y 1.386 1.43508 1.48160 1.52605 1.5686 1.6094 1.6486
3ℎ
y= 10
[(𝑦0 + 𝑦6 ) + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 ]
3(0.2)
= [(1.38629 + 5(1.43508) + 1.48160 + 6(1.52605) + 1.56861 + 5(1.60943) +
10
1.64865]
= 0.6
10
[1.38629 + 7.1754 + 1.48160 + 9.1563 + 1.5686 + 8.04715 + 1.64865]
0.6
= 10 [30.464]
= 1.82784.

6 𝑑𝑥
2. Evaluate ∫0 using Weddle’s rule.
1+𝑥 2

Solution: Dividing the interval (0, 6) into six equal parts of width h = 6−0
6
=1

x 0 1 2 3 4 5 6
f(x) 1 0.5 0.2 0.1 0.0588 0.0385 0.027
6
1 3ℎ
∫ 𝑑𝑥 = [(𝑦 + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 + 𝑦6 ))]
0 1+𝑥 2 10 0
3(1)
= [(1 + 5(0.5) + 0.2 + 6(0.1) + 0.0588 + 5(0.385) + 6.027] = 1.3735
10

0.6 2
3. Evaluate ∫0 𝑒 −𝑥 𝑑𝑥 by taking 6 intervals using Weddle’s rule
II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)
P a g e 34 | 35
RV Institute of Technology & Management ®

Solution: Dividing the interval (0, 0.6) into six equal parts of width h = 0.6−0
6
=0.1

x 0 0.1 0.2 0.3 0.4 0.5 0.6


f(x) 1 0.99 0.961 0.914 0.852 0.779 0.698

6
1 3ℎ
∫ 𝑑𝑥 = [(𝑦 + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 + 𝑦6 ))]
0 1+𝑥
2 10 0
= 0.5351.

Youtube links:

1 Mod-05 Lec-21 Interpolation - YouTube

2 Newton's Forward Interpolation & Backward Interpolation Formula - Concepts & Solved
Problems - YouTube

3 Newton Raphson Method: Advantages and Drawbacks: Part 1 of 2 - YouTube

4 Numerical Integration : Newton Cotes Formula, Trapezium Rule, Simpson's 1/3rd and 3/8th
Rule - YouTube

Disclaimer: The content provided is prepared by department of Mathematics for the specified
syllabus by using reference books mentioned in the syllabus. This material is specifically for
the use of RVITM students and for education purpose only.

II-Semester: Mathematics- II for Computer Science & Engineering stream (BMATS201)


P a g e 35 | 35

You might also like