You are on page 1of 132

Prepared by Dr. Ralph W.P.

MASENGE
African Virtual university
Universit Virtuelle Africaine
Universidade Virtual Africana
Numerical
Methods

/lr|can v|rrua| un|vers|r, '
Notice
This document is published under the conditions of the Creative Commons
http://en.wikipedia.org/wiki/Creative_Commons
Attribution
http://creativecommons.org/licenses/by/2.5/
License (abbreviated cc-by), Version 2.5.
/lr|can v|rrua| un|vers|r, 2
I. NumericalMethods_________________________________________3
II. PrerequisiteCourseorKnowledge _____________________________3
III. Time ____________________________________________________3
IV. Materials_________________________________________________3
V. ModuleRationale __________________________________________3
VI. Content__________________________________________________4
6.1 Overview___________________________________________4
6.2 Outline _____________________________________________5
6.3 GraphicOrganizer_____________________________________6
VII. GeneralObjective(s)________________________________________7
VIII. SpecificLearningActivities___________________________________8
IX. TeachingandLearningActivities_______________________________9
X. LearningActivities_________________________________________16
XI. CompiledListofallKeyConcepts(Glossary)___________________107
XII. CompiledListofCompulsoryReadings_______________________113
XIII. CompiledListofMultimediaResources_______________________114
XIV. SynthesisoftheModule___________________________________115
XV. SummativeEvaluation_____________________________________116
XVI.References_____________________________________________130
XVII.MainAuthoroftheModule_________________________________131

Table of ConTenTs
/lr|can v|rrua| un|vers|r, J
I. numerical Methods
by Dr. Ralph W.P Masenge
II. Prerequisite Courses or Knowledge
Calculus 2 is prerequisite.
III. Time
The total time for this module is 120 study hours.
IV. Material
Students should have access to the core readings specifed later. Also, they will need
a computer to gain full access to the core readings. Additionally, students should
be able to install the computer software wxMaxima and use it to practice algebraic
concepts.
V. Module Rationale
A key attribute of mathematics is its applicability in problem solving. The history of the
subject is full of evidence that the driving force in its early development was based in
trying to solve problems in plane geometry, celestial mechanics and in navigation.
Unfortunately, mathematical formulations (models) of most problems in science and
engineering are, in general, diffcult to solve analytically either because of the com-
plex nature of the analytical solutions or because such solutions cannot be expressed
in terms of combinations of known mathematical functions.
In all such cases, numerical methods have to be resorted to. The mathematics or
science student is therefore expected to have a working knowledge of and ability
to apply numerical methods in solving some basic mathematical problems such as
interpolation, numerical integration and fnding roots of functions.
Figure 3: Surfng on the Internet is a key to elearning
/lr|can v|rrua| un|vers|r, 4
VI. Content
6.1 Overview
First Learning Activity: Types and Causes of Errors
The frst learning activity aims at making the learner appreciate the need for numerical
methods. It is also felt that this is the right moment to defne the concept of a mathe-
matical error, point out the sources and types of errors and mention some practical
ways of reducing their cumulative effect on the numerical solution.
Second Learning Activity: Interpolation
The second learning activity deals with the concept of interpolation. Both linear and
higher order polynomial interpolation methods, based on Lagrange, Newtons divided
differences and fnite difference interpolation techniques are presented.
Third Learning Activity: Numerical Integration
The third learning activity looks at the problem of numerical integration. The discus-
sion is limited to NewtonCotes formulae. Specifc attention is given to the
Trapezoidal and Simpsons rules and the application of Richardsons extrapolation
technique on both the Trapezoidal and Simpsons rules in deriving
Romberg integration schemes.
Fourth Learning Activity: Roots of functions
The fourth and fnal learning activity presents the root fnding problem associated
with solving the nonlinear equation f (x) = 0 and solving the coupled system of two
nonlinear equations f (x, y) = 0 , g(x, y) = 0 .

Figure 4: A Baobab Tree. Number of roots equals number of twigs
/lr|can v|rrua| un|vers|r, 5
6.2 Outline: Syllabus (include specific timings here if needed).
This is a two unit course offered at Level 2 with priority rating A. Mathematics
Module 3 is its prerequisite course.
The following is a detailed outline of the contents of each Learning Activity. The
timings shown are suitable for students following a unit level course allowing 35
hours per unit. The timings show the length of time the Learner is recommended to
spend learning each of its components.
[Students following a module level course should allow 120 hours for the complete
module].
Preperation, taking and review for Pre-Assessment (4 hrs)
Learning Activity No.1: Types and Causes of Errors (25 hrs)
Types and sources of errors
Need for numerical methods
Error sources and types
Strategies for reducing errors
Learning Activity No.2: Interpolation (35 hrs)
Linear interpolation
Lagrangian interpolation
Newtons divided differences
Finite difference operators
Finite difference tables
Finite difference interpolation polynomials
Learning Activity No.3: Numerical integration (25 hrs)
Newton Cotes formulae
Derivation of the trapezoidal and Simpsons rules
Romberg integration
Gaussian quadrature formulae
Learning Activity No. 4: Roots of functions. (25 hrs)
Bisection method
Convergence of the bisection method
The Regula Falsi or False Position method
Secant method
Newton-Raphsons method
Solving a coupled system of two nonlinear equations
Fixed point iterations
/lr|can v|rrua| un|vers|r, 6
Preperation and taking Summative Assessment (6 hrs)
6.3 Graphic Organiser
Figure 5: Graphic Organizer
/lr|can v|rrua| un|vers|r, 7
VII. General objective(s)
At the end of this module:
You will be equipped with knowledge and understanding of the properties of
elementary functions and their various applications necessary to confdently teach
these subjects at the secondary school level.
You will have secure knowledge of the related contents of school mathematics to
enable you confdently teach these subjects at the secondary school level.
You will acquire knowledge of and the ability to apply available ICT to improve the
teaching and learning of school mathematics.
Specifically you will be able to:
(1) Distinguish between numerical and analytical methods/solutions
(2) Appreciate the need for learning and applying numerical methods
(3) Identify the main sources of errors and take measures to eliminate or reduce
such errors
(4) Derive and apply a number of interpolation methods
(5) Derive and apply a number of numerical integration methods
(6) Derive and apply a number of numerical methods for fnding roots of func-
tion
(7) Solve a coupled system of two nonlinear equations in two variables.
Figure 6: Internet Dish at the AVU-Learning Center, University of Dar Es Salaam
/lr|can v|rrua| un|vers|r, 8
VIII. specifc learning objectives
As already mentioned in the Module Outline given in Section VI, this is a two units
module and its contents will be presented using four learning activities. Each learning
activity has a set of specifc learning objectives. We are stating them here in advance
with a view to enable the learner have a global overview of what lies ahead in terms
of what s/he will be able to do on completion of the module.
At the end of the module, the learner will be able to:
S/N Lear-
ning
Activity
Specifc Learning Objectives
1 Types
and sour-
ces of
errors
List the chief sources of computational errors and the practical
steps to be taken to eliminate or reduce their cumulative effect on
the numerical solution
Appreciate the difference between the size (accuracy) and the
seriousness (precision) of an error.
Understand and apply linear interpolation on a given table of
function values
Estimate the error in linear interpolation for a known smooth
function
2 Interpo-
lation
Explain why numerical methods are essential in solving mathe-
matical problems
Write down and apply the Lagrange interpolation polynomial for
equally spaced data
Write down and apply Newtons interpolation based on divided
differences
Defne and manipulate the shift, forward, backward, central and
mean difference operators
Construct tables of differences for a given function or given data
Derive and apply Newtons forward, Newtons backward, and
Stirlings central difference interpolation polynomials.
3 Numeri-
cal Inte-
gration
Derive, understand and apply the Trapezoidal rule, Simpsons
rule and any other Newton-Cotes type numerical integration for-
mula
Derive, understand and apply Rombergs numerical integration
scheme based on either the Trapezoidal or Simpsons rule.
4 Roots of
functions
Derive and apply the bisection method
Prove convergence of the bisection method
Derive, understand and apply both the Secant and the Regula
Falsi methods
Derive, understand and apply the Newton Raphson method
Derive, understand and apply the Newtons method on a pair of
nonlinear simultaneous equations.
/lr|can v|rrua| un|vers|r, 9
IX. Teaching and learning activities
9.1 Pre-assessment
1. If x is an exact measurement of a certain quantity and x
0
is its approximation,
the concept of error in the approximation is defned by

(a)
(b)
(c)
(d)

x
0
x
x x
0
x x
0
x x
0
2. The absolute error in approximating the exact quantity x = 104 by the approxi-
mate value x
0
= 107 is given by

(a)
(b)
(c)
(d)

4
3
7
104

The relative error in the approximation x
0
given in Question 1 is

(a)
(b)
(c)
(d)

0.028846
0.299462
0.002885
0.038462
3. One valid reason why the function
f (x) =
1 if x > 0
0 if x = 0


/lr|can v|rrua| un|vers|r, '0
is not continuous at x = 0 is

(a)
(b)
(c)
(d)

lim
x 0
lim
x 0
lim
x 0
lim
x 0
f (x) = f (0)
f (x) = 0
f (x) = 1
f (x) f (0)

4. The continuous function x
3
3x 3 must have a zero (root) at some point in
the
interval 2 < x < 3 because
(a)
(b)
(c)
(d)

f (2) f (3) = 0
f (2) f (3) < 0
f (2) > 0
f (2) = 0
f (3) < 0
f (3) = 0
5. The frst derivative of the function y = x
x
is
(a)
(b)
(c)
(d)

1+ ln(x) ( ) x
x
x
x
x
x
ln(x)
(1 ln(x))x
x
6. The truncated cubic Maclaurin series expansion of the function f (x) = 1+ x is

(a) :1
x
2
+
x
2
4

3x
3
8
(b) :1+
x
2

x
2
4
+
3x
3
8
(c) :1
x
2
+
x
2
8

x
3
16
(d) :1+
x
2

x
2
8
+
x
3
16

/lr|can v|rrua| un|vers|r, ''
7. The general anti-derivative of the function f (x) = ln(x) is given by

(a)
(b)
(c)
(d)

xln(x) + C
ln(x) x + C
xln(x) x + C
xln(x) + x + C

8. The value of the integral
1+ x
x
2
+ 2x + 5
3 1
2

dx is
(a)
(b)
(c)
(d)

1.146581
1.145681
1.146185
1.164581
9. Working throughout with six decimal places accuracy, the approximate
value of
1+ x
x
2
+ 2x + 5
3 1
2

dx using the Trapezoidal rule with h = 0.25 is


(a)
(b)
(c)
(d)

1.146850
1.416560
1.146038
1.146580
10. Working under the same conditions, the approximate value of the integral given
in Question 8 using Simpsons rule is found to be
(a) :
(b) :
(c) :
(d) :

1.416039
1.146083
1.146038
1.146580
/lr|can v|rrua| un|vers|r, '2
11. If the 3
rd
and 13
th
terms of an arithmetic sequence of numbers are 7 and 27 ,
respectively, then the 52
nd
element of the sequence is

(a)
(b)
(c)
(d)

103
105
107
106
12. Starting with x
0
= 2, the value of x
4
using the iteration formula x
n+1
=
3(1+ x
n
)
x
n

is
(a) :
(b) :
(c) :
(d) :

2.104255
2.103731
2.130731
2.103713
13. Given two points P(x
0
, y
0
) andQ(x
1
, y
1
) , the x-coordinate of the point where the
secant line AB cuts the x - axis is
(a)
x
1
y
0
x
0
y
1
y
1
y
0
(b)
y
1
y
0
x
1
y
0
x
0
y
1
(c)
x
0
y
1
x
1
y
0
y
1
y
0
(d)
y
1
y
0
x
0
y
1
x
1
y
0

/lr|can v|rrua| un|vers|r, 'J


14. The curve of a function y = f (x) passes through two points whose coordinates
are (0.2,1.183) and(0.4,1.342) . By using the straight line which joins the
two points to approximate the curve of the function in the given interval, the
approximate value of y at x = 0.3 is found to be

(a)
(b)
(c)
(d)

y = 1.2265
y = 1.6225
y = 1.5262
y = 1.2625
15. Given a point P(x
0
, f (x
0
)) on the curve of a differentiable function y = f (x) ,
the x coordinate of the point where the tangent at P cuts the x - axis is

(a) : x
0

f (x
0
)
f
'
(x
0
)
(b) : x
0
+
f (x
0
)
f
'
(x
0
)
(c) : x
0

f
'
(x
0
)
f (x
0
)
(d) : x
0
+
f
'
(x
0
)
f (x
0
)
16. The Bisection method is based on the principle that a continuous function which
is positive at one point x = a and negative at another point x = b has a root
(zero) at some point x = c in the interval a < c < b and that the point x =
a + b
2
, which bisects the interval [a, b], is a reasonable approximation of c . Starting
with the two points a = 2, b = 3, application of the bisection method on
the function x
3
3x 3 gives the value
(a)
(b)
(c)
(d)

x
3
=
x
3
=
x
3
=
x
3
=
2.215
2.115
2.125
2.225
after the third
bisection process.
/lr|can v|rrua| un|vers|r, '4
17. The Newton Raphson method for approximating a root of a function f (x) uses
the iteration formula

x
n+1
= x
n

f (x
n
)
f
'
(x
n
)

n = 0,1, 2,...
If x
0
= 2 is an approximation of one of the roots of the function f (x) = x
3
3x 3,
then application of the Newton-Raphson method on the function gives the value of
x
2
as:

(a)
(b)
(c)
(d)

x
2
=
x
2
=
x
2
=
x
2
=
2.130836
2.103386
2.301836
2.103836

18. The coordinates of the point where the curves representing the functions
x
2
+ y
2
= 4 ; x
2
y
2
= 1 intersect each other and which lies in the frst qua-
drant are

(a)
(b)
(c)
(d)

x = 1.224745,
x = 1.581139,
x = 1.511839,
x = 1, 242745,
y = 1.561139
y = 1.224745
y = 1.227445
y = 1.561139
19. Starting with x
0
= 1.5 , y
0
= 1.2 , the values x
3
and y
3
obtained using the pair
formulae x
n+1
= 4 y
n
2
, y
n+1
= x
n
2
1 n = 0,1, 2,... are
(a)
(b)
(c)
(d)

x
3
= 1.562050,
x
3
= 1.322875,
x
3
= 1.526050,
x
3
= 1.233875,
y
3
= 1.322875
y
3
= 1.562050
y
3
= 1.322875
y
3
= 1.562050
/lr|can v|rrua| un|vers|r, '5
Solutions
1. (c) 11. (b)
2. (b) 12. (b)
3. (d) 13. (c)
4. (b) 14. (d)
5. (a) 15. (a)
6. (d) 16. (c)
7. (d) 17. (d)
8. (c) 18. (b)
9. (c) 19. (c)
10. (d)
Pedagogical Comment For Learners
The learners confdence to embark on this module will greatly be enhanced by
solving these preassessment questions.
Questions 1,2 are on errors and 3 is on continuity. If you have problems in solving
them you are advised to look up the defnitions given in the Module Glosary.
Questions 4,5,6 and 7 are on the concepts of limits, continuity, differentiation and
the anti-derivative. If you fail to solve any of them then work through the relevant
Sections of the pre-requisite Module (Mathematics Module 3). The same tip holds if
you experience diffculties in solving Questions 8,9,10 and 11 on integration.
Questions 12,13,16,17,18 and 19 relate to the concept of iterations and simula-
tneous equations. Here, simply study carefully the given formulae and apply them
faithfully.
Questions 15, 16 and 17 are on linear approximation of a function. In case one faces
some problems in solving any of these, one should work through the relevant section
in your Higher Level Mathmatics books.
Each correct solution has 5 marks, giving a maximum score of 90 marks. A score in
the range 41 60 is average. A below average score (0 40) probably implies that
you need a thorough go at the relevant prerequisite material before starting the mo-
dule. An average score may mean you can start the module but with frequent cross
reference to some prerequisite materials. With an above average score (61 90) the
learner should confdently embark on the module in the knowledge that he/she has
the required background knowledge to start and successfully complete it.
/lr|can v|rrua| un|vers|r, '6
X. learning activities
LEARNING ACTIVITY # 1
Types and Sources of Errors
Summary
In this learning activity we discuss three important introductory topics. We begin by
making a distinction between analytic and numerical solutions. This is followed by
discussion of some typical mathematical problems specifcally selected to convince
the learner why numerical methods are needed. We conclude the activity by defning
the concept of errors in computational mathematics, pointing out their main causes,
types and presenting practical ways of eliminating or reducing their effect on nume-
rical solutions.
Specific Learning objectives
At the end of this learning activity the learner will be able to:
Defne the concept of errors in computational mathematics
Distinguish between absolute and relative errors and appropriately relate
them to the concepts of accuracy and precision
List the chief sources of computational errors and the practical steps to be taken
to eliminate or reduce their cumulative effect on the numerical solution
Appreciate the difference between the size (accuracy) and the seriousness
(precision) of an error.
Understand and apply linear interpolation on a given table of function va-
lues
Estimate the error in linear interpolation for a known smooth function
List of required readings
Wikipedia: Numerical Methods/Errors Introduction
List of relevant useful links
Wolfram MathWorld (visited 03.04.07)
http://mathworld.wolfram.com
Students should search for the entry covering the unit title. Also, search for
any key words in the text. Mathworld gives a detailed reference in all cases.
/lr|can v|rrua| un|vers|r, '7
Wikipedia (visited 03.04.07)
http://en.wikipedia.org/wiki
As with mathworld, students should search for the entry covering the unit title.
Also, search for any key words in the text. Wikipedia generally gives shorter
and less complete entries. However, they can be easier to read.
MacTutor History of Mathematics (visited 03.03.07)
http://www-history.mcs.standrews.ac.uk/Indexes
The MacTutor Archive is the most comprehensive history of mathematics on
the internet. Students should search for their unit title and read the history of
the subject. This gives a helpful overview of the importance and context of
the topic being studied.
Key Words
[Full defntions are given in the text]
Error in an approximation: The difference between the exact and the approximate
value.
Absolute error: The error without consideration of the sign (positive or negative).
Relative error: The ratio between the absolute error and the exact quantity.
Initial, discretization, truncation and rounding errors: Different types of errors
caused by different sources of error.
/lr|can v|rrua| un|vers|r, '8
Learning Activity 1: Types and Sources of Errors
Introduction
This frst learning activity of the module is intended to provide the learner with
answers to the following important questions; questions raised by many students
taking a numerical methods course for the frst time.
(1) What is a numerical solution and how does such a solution differ from an exact
(true) or analytical solution?
(2) Why should one learn numerical methods? Are numerical methods needed?
(3) What are errors in the context of mathematics? What are the main sources of
computational errors? How can one eliminate errors or reduce their effect on
numerical solutions?
We begin the activity by explaining the difference between an analytic and a numerical
solution. In order to establish the need for numerical methods we discuss a number of
mathematical problems specifcally selected with a view to convince the learner that
there is a real need for learning numerical methods either because analytical solutions
cannot be found or they are too complex to be of any practical use.
To answer the questions on errors we defne the concept of an error and list a number
of sources of errors. In the sequel we also suggest for each type and source of error
practical steps to be taken to reduce the error and hence its impact on numerical
solution.
Analytic Methods, Numerical Methods and Errors.
(a) Analytic versus numerical methods
What is a numerical solution and how does such a solution differ from an exact (true)
or analytical solution?
An analytic method for solving a given mathematical problem is any method based
on rigorous mathematical analysis and whose application leads to the true (exact)
solution, also known as analytic solution.
A numerical method for solving a given mathematical problem is any method based
on rigorous mathematical analysis whose application, in most cases, can only lead
to an approximate (non-exact) solution, also known as numerical solution. In some
very rare cases, a numerical method may result in an exact solution.

/lr|can v|rrua| un|vers|r, '9
Example 1.1
The exact solutions of the nonlinear equation x
2
5x + 3 = 0 can be obtained using
the well known quadratic formula (analytic method)

x
1, 2
=
b b
2
4ac
2a
.
This gives the analytic solutions x
1, 2
=
5 13
2
.
On the other hand, the iteration formula (numerical method)

x
n+1
= 5x
n
3, n = 0,1, 2,... ; x
0
= 4.5
may also be applied to approximate one of the two solutions of the given quadratic
equation. This method can only give an approximate numerical solution.
DO THIS
Given the numerical integration formulas
Trapezoidal rule: [ ]
0 1 1 0
; ) ( ) (
2
) (
1
0
x x h x f x f
h
dx x f
x
x
= + =

Simpsons rule:
[ ]
0 1 1 2 2 1 0
; ) ( ) ( 4 ) (
3
) (
2
0
x x x x h x f x f x f
h
dx x f
x
x
= = + + =


Verify that:
(i) The trapezoidal rule gives exact values of the integral

1
0
) (
x
x
dx x f for any linear
function b ax x f + = ) ( .
(ii) Simpsons rule gives exact values of the integral

2
0
) (
x
x
dx x f for any cubic
function :
d cx bx ax x f + + + =
2 3
) (
.
In general, the difference between analytical and numerical solutions can be summed
up by the statement: Analytical solutions are exact while numerical methods are
only approximate.
/lr|can v|rrua| un|vers|r, 20
(b) Need for numerical methods
Why should one learn numerical methods? Are numerical methods needed?
Because of the above distinction between analytic and numerical solutions one can
easily be tempted to conclude that one should only use analytic methods in solving
mathematical problems. In other words, there is no need to learn numerical methods
because they can only give approximate solutions. Such a conclusion is misguided.
We need to learn numerical methods for the following three main reasons.
1. For some problems the analytical solution may not be known. A typical examples
is given by the following cases.
x 1.0 1.25 1.5 1.75
2.0
) (x f
0000 . 1 1180 . 1 1180 . 1 3229 . 1 4142 . 1
2. An integral, such as

1
0
2
dx e
x
, is perfectly defned but the antiderivative of the in-
tegrand
2
) (
x
e x f = cannot be expressed using known mathematical functions.
3. In some cases, it may be possible to fnd a mathematical expression for the
analytical solution of a given problem. However, the expression may be com-
putationally too complicated to handle numerically. A typical problem is that of
fnding an antiderivative of the function
3
8
1
) (
x
x f

= .
After some tedious manipulations involving factorization of the denominator fol-
lowed by application of the method of partial fractions, one fnds the general anti
derivative
C
x x
x x x
x F +


+ +
+

+
=

4 4
4 2
ln
24
1
3
1
tan
12
3
) (
2
2
1
where C is an arbitrary constant of integration. This complicated result makes the
evaluation of a typical associated defnite integral


2
1
3
8 x
dx
almost impossible to
carry out with any meaningful degree of accuracy.
/lr|can v|rrua| un|vers|r, 2'
DO THIS
(i) Verify that ) ( x f
dx
dF
= (using the function F in example 3 above).
(ii) By factorizing
3
8 x = ) 4 2 )( 2 (
2
+ + x x x and applying the method of
partial fractions derive the expression for ) (x F as an anti-derivative of ) (x f .
(c) Errors
What are errors in the context of mathematics? What are the main sources of com-
putational errors? How can one eliminate errors or reduce their effect on numerical
solutions?
In the key words section you can fnd defnitions of the key concepts and stated the key
theorems and principles relevant to the topic of numerical methods. This includes the
defnitions of errors, absolute errors, relative errors, initial errors, discretization errors,
truncation errors and rounding errors. For ease of reference we list them here.
Assumption
Let
*
X be an approximation to an exact (true) quantity X . Then,
The absolute error in
*
X is defned by
*
X X .
The error in
*
X is defned by
*
X X
The percentage error in
*
X is defned by
X
X X
*
100

%
Since the exact (true) value X is normally not known, one replaces it with the
approximate value
*
X in the denominator of the expression for the relative and
percentage errors.
Precision and Accuracy
Measurements and calculations can be characterized with regard to their accuracy
and precision.
/lr|can v|rrua| un|vers|r, 22
Precision refers to how big or how small the absolute error
*
X X is. The absolute
error is therefore a measure of the precision of an approximation.
Accuracy refers to how closely the approximation
*
X agrees with the true value X
. Here, what counts is not only the magnitude of the deviation
*
X X

but its size


relative to the true value X . Accuracy is therefore measured by the relative error
X
X X
*

.

(d) Types and Sources of Errors
We now list the sources and types of errors and briefy discuss methods of eliminating
or reducing such errors so that the numerical solution we get is not seriously affected
by them to the extent of rendering it meaningless.
(i) Initial errors
Any mathematical problem meriting to be solved numerically involves some initial
data. Such data may be in the form of coeffcients in a mathematical expression or
entries in a matrix. If this initial data is not exact, then the deviations from their respec-
tive true values are called initial errors. In some problems, uncertainties in the initial
data can have devastating effect on the fnal numerical solution to the problem.
(ii) Discretization error
Most of the literature on the subject of computational errors does not make a distinc-
tion between discretization and truncation errors, the reason being that the two types
of errors are almost inseparable. In this presentation we separate the two because
truncation errors are special types of discretization errors.
The true (exact) solutions of some mathematical problems are continuous functions
) (x f y = of their respective independent variables. In almost all cases, numerical
methods for solving such problems approximate the unknown continuous solution
) (x f by a sequence { } ) (
n
x f of approximate values of the solution at a discrete set of
points { }
n
x in the domain of the solution function ) (x f . For example, the continuous
function
x
e x x f

+ = ) ( is the solution of the initial value problem x y y + = + 1
/
,
1 ) 0 ( = y
/lr|can v|rrua| un|vers|r, 2J
A typical numerical method for solving this problem is given by the recurrence
relation
, 1 , 0
0 0
= = y x

, ) 1 ( ) 1 (
1 1
h x y h y
n n n
+ + = ,... 3 , 2 , 1 = n , h being a
constant distance between two consecutive discrete values of the variable x . The
error resulting from such a discretization process is called discretization error.
(iii) Truncation error
Truncation errors are special types of discretization errors. The term truncation error
refers to the error in a method, which occurs because some infnite process is stopped
prematurely (truncated) to a fewer number of terms or iterations in the process.
Such errors are essentially algorithmic errors and one can predict the extent of the
error that will occur in the method.
Specifcally, the solution obtained using some numerical methods may involve infnite
processes. For instance, this is the case with all convergent iteration methods and
convergent infnite series. Since such infnite processes cannot be carried out indef-
nitely, one is forced to stop (truncate) the process and hence accept an approximate
solution. The error caused though this unavoidable termination of an infnite process
is called a truncation error.
(iv) Rounding error
Rounding errors are errors introduced during numerical calculations due to the ina-
bility of calculating devices to perform exact arithmetic. For example, if we multiply
two numbers, each with six decimal digits, the product will have twelve decimal digits.
Unfortunately some calculating devices may not be able to display all twelve decimal
digits. In such cases one is forced to work with fewer digits thereby necessitating
dropping some of the (less signifcant) digits on the right of the product. The error
so introduced is called a rounding error.
(e) Methods of reducing errors
In the spirit of prevention is better than cure we shall attempt in this section to
give practical suggestions of ways to eliminate or reduce the impact of various types
of computational errors that are encountered in resorting to numerical methods.
(i) How to reduce initial error
Initial errors can have a devastating effect on numerical solutions.
We illustrate a typical case involving an example taken from Francis Sheid, Nume-
rical Analysis, Shaum Outline Series, 1968 page 342 involving the solution of the
following two simultaneous linear equations.
x
-
y
=
1
x
-
y 00001 . 1
=
0
/lr|can v|rrua| un|vers|r, 24
The true (analytical) solution is 001 , 100 = x , 000 , 100 = y . In this example, the
set of initial data consists of the elements of the coeffcient matrix
and the right hand side vector .

However, if the entry 00001 . 1 in the matrix A

is changed
to 99999 . 0 while all other data items remain unchanged, the resulting system of
equations
x
-
y
=
1
x
-
y 99999 . 0
=
0
has the drastically changed exact (analytical) solution 999 , 99 = x , 000 , 100 = y
This somewhat startling result demonstrates how a small change in the initial data
can cause disproportionately large changes in the solution of some problems.
Thus, the only way to reducing or if possible, to eliminate initial errors is by ensuring
that all data given with or computed for use in solving a problem is as accurate
as is humanly possible.
(ii) How to reduce discretization errors
Different numerical methods for approximating the solution of a given mathematical
problem can result in numerical solutions with very different degrees of accuracy
due to the magnitudes of their respective discretization errors. Consider the problem
of evaluating the defnite integral:

+
1
0
2
1 x
dx
. The exact (analytical) value of the integral, correct to six decimal places
is

785398 . 0 ) 1 ( tan
1
=

.
Let us apply the trapezoidal method and Simpsons rule using an interval length
25 . 0 = h . First we evaluate the integrand
2
1
1
) (
x
x f
+
= at the relevant points and
get

=
00001 . 1 1
1 1
A

=
0
1
b
/lr|can v|rrua| un|vers|r, 25
i 0 1 2 3 4
i
x
0 25 . 0 5 . 0 75 . 0 1
) (
i
x f
000000 . 1 941176 . 0 800000 . 0 640000 . 0
500000 , 0
The trapezoidal rule [ ]

+ + + + ) ( ) ( ) ( ) ( 2 ) (
2
4 3 2 1 0
x f x f x f x f x f
h

gives the numerical solution 782794 . 0 .
Simpsons rule [ ] { } ) ( ) ( 2 ) ( ) ( 4 ) (
3
4 2 3 1 0
x f x f x f x f x f
h
+ + + + leads to

the numerical solution 0.785392.
One observes that, while the solution obtained using the trapezoidal rule is correct
to only two decimal places, the solution obtained using Simpsons rule is correct to
four decimal places. This signifcant difference in the accuracy of the two numerical
solutions is caused by the differences in the discretization errors of the two nume-
rical methods. Simpsons rule has a smaller discretization error than the trapezoidal
rule.
In general, discretization errors cannot be avoided. However, one can reduce them
substantially by being careful in selecting a numerical method whose discretization
error is known a priori to be relatively small.
(iii) How to reduce truncation errors
Truncation errors are caused by the unavoidable need to stop a convergent infnite
process in efforts to get a solution. The size of the truncation error will therefore
depend on the particular infnite process (numerical method) being used an on how
far we are prepared to carry on with the infnite process.
The truncation error can be reduced either by
(a) Choosing a numerical method with a small truncation error or
(b) Carrying out the infnite process suffciently far.
/lr|can v|rrua| un|vers|r, 26
Example 1.2
The continuous function 1 3 ) (
2
+ = x x x f has a root which lies in the interval
1 0 < < x (Why?). Using the quadratic formula, the exact value of the root correct
to six decimal places is 381966 . 0 = . A number of iterative methods exist for
approximating such a root. Here we consider two such methods:
The bisection method
x
n+1
=
x
n
x
n1
2
, provided
f (x
n
) f (x
n1
) < 0
.
The Newton-Raphson method
x = x
f (x
n
)
f
/
(x
n
)
, provided f
/
(x
n
) 0.
If one performs only three iterations (truncation after three iterations) with each
method using the starting values 0
0
= x and 1
1
= x for the bisection method and
0
1
= x for the Newton-Raphson method, one gets the following sequence of ap-
proximations for each method.
Method Initial Values
2
x
3
x
4
x
Bisection
0
0
= x
1
1
= x
500000 . 0 250000 . 0 375000 . 0
Newton
Raphson
0
1
= x
333333 . 0 380952 . 0 381966 . 0
These results demonstrate that in stopping the infnite process (iteration) after the
third iteration, the truncation error of the Newton Raphson method is much smaller
than that of the bisection method.
/lr|can v|rrua| un|vers|r, 27
DO THIS
Continue applying the bisect method on the above example until the solution is correct
to three decimal places. How many more iterations did this require?
(iv) How to Reduce Rounding Errors
Before we discuss this important last task in our learning activity we shall frst intro-
duce a few terms that will frequently be mentioned and used in the process.
What are Figures or Digits
In computational mathematics, the words fgure and digit are synonyms. They
are used interchangeably to mean any one of the ten numerals in the set {0, 1, 2, 3,
4, 5, 6, 7, 8, 9}.
In the decimal system of real numbers, a number N is a string or an ordered se-
quence of fgures or digits A typical example is the number
0 0000450700 . 0365 0007392060 = N
A number can be viewed as a measure of the size or magnitude of some real or ima-
ginary quantity. The position of each digit in the string of digits has direct bearing
on the importance or signifcance of that digit (fgure) in the overall measure of the
size or magnitude of the quantity the number represents.
Intuitively we know that the leftmost digit 7 in the number N above is more signi-
fcant than the rightmost digit 7.
Which digits in a number are Signifcant?
The following rules apply in deciding which digits or fgures in a given number are
signifcant.
1. Nonzero integers are always signifcant fgures.
2. Any zeros on the leftmost part of a number are not signifcant.
3. All zero digits positioned between nonzero digits are signifcant.
4. Zeros at the rightmost end of a number are counted as signifcant only if the
number contains a decimal point.
How many Signifcant Figures are in a given Number
The number of signifcant fgures in a given number is found using the following
rule:
Rule 1: The number of signifcant fgures in a purely integer number (with no decimal
digits) is obtained by counting, starting with the leftmost nonzero digit and ending
with the rightmost nonzero digit.
/lr|can v|rrua| un|vers|r, 28
Example 1.3
The number 541500409 has 9 signifcant fgures.
The number 002507030 has 6 signifcant fgures
Rule 2: The number of signifcant fgures in a number having a decimal part is ob-
tained by counting all the digits, starting with the leftmost nonzero digit.
Example 1.4
The number 6.00213 has 6 signifcant fgures.
The number 6.00213000 has 9 signifcant fgures
NOTE: All zero digits at the end of a decimal number are signifcant.
(iv) How to Reduce Rounding Errors
Armed with the concepts of digits/fgures and signifcant fgures in a number we can
now comfortably discuss ways of reducing rounding errors.
One obvious method of dealing with the problem of rounding errors is to work with
the maximum allowable accuracy on our calculating device at each stage in our
calculations.
Example 1.5
Find the sum of the numbers 2.35, 1.48, 4.24 using a calculating device that can only
handle numbers with two signifcant fgures.
The exact sum is 07 . 8 24 . 4 48 . 1 35 . 2 = + + = S
If we neglect the second decimal digit from each term and form their sum we fnd
the approximate sum
9 . 7 2 . 4 4 . 1 3 . 2
1
= + + = S
The absolute error in
1
S is: 17 . 0
1
= S S
A better approximation of S under the same limitations is
1 . 8 2 . 4 5 . 1 4 . 2
2
= + + = S
/lr|can v|rrua| un|vers|r, 29
The absolute error in
2
S is: 03 . 0
2
= S S
This error is signifcantly smaller than that in
1
S .
The immediate question expected to be raised by the learner is How did one arrive
at the two digit terms in the sum
2
S ?
The answer to the above question is simple. Each term has been obtained from its
corresponding three-digit term by rounding.
The learner will soon know how to round numbers
What it means to round a number
To round a number to a fxed number of fgures or digits simply means leaving out
(dropping) all digits on the right hand side of the number beyond a certain posi-
tion.
If a number is rounded simply by dropping all digits beyond a certain position on the
right hand side of the number without making any adjustments to the last retained
digit, then one speaks of rounding off or chopping the number.
Example 1.6
The sum
1
S has been calculated using terms obtained from the original numbers by
rounding off (chopping) the third decimal digit from each term. The term 2.35 was
rounded to 2.3, the term 1.48 was rounded to 1.4 and the term 4.24 was rounded to
4.2. In each case, the last retained digit (the frst decimal place) has not been adjusted
in the process of rounding.
Note
The sum
2
S has also been obtained through rounding. However, the rounding this
time is different. Here, not all the three terms have been rounded off!
The term 2.35 has been rounded to 2.4
The term 1.48 has been rounded to 1.5
The term 4.24 has been rounded to 4.2
We observe that in rounding each of the frst two terms 2.35 and 1.48, the digit occu-
pying the second decimal position has been dropped but the digit occupying the frst
decimal position has been adjusted by increasing it by one (unity). The third digit
4.24 has simply been rounded off.
This practice (or as yet unknown rule for rounding numbers) seems to have some
signifcant advantage over rounding off manifested by the above example in which
2
S is more accurate than
1
S .
/lr|can v|rrua| un|vers|r, J0
Rules for Rounding Numbers
In order to reduce the error in rounding numbers, the rejection of digits beyond some
predetermined position ( n ) is accompanied by making adjustments to the digit re-
tained in position (n-1). The adjustment involves either leaving the digit in position
( n ) unchanged or increasing it by one (unity). The decision to retain or increase by
1 the digit occupying position (n-1) is governed by the following rules.
(a) If the digit in position ( 1 + n ) is greater than 5 then the digit in position ( n )
is increased by 1.
(b) If the digit in position ( 1 + n ) is 5 and at least one other digit to its right is non
zero then the digit in position ( n ) is increased by 1.
(c) If the digit in position ( 1 + n ) is less than 5 then the digit in position ( n ) is
left unchanged.
(d) If the digit in position ( 1 + n ) is 5 and all other digits to the right of position
( 1 + n ) zero, then
(i) The digit in position ( n ) is increased by 1 if it is an odd number ) 9 , 7 , 5 , 3 , 1 ( ;
(ii) The digit in position ( n ) is retained unchanged if it is an even number
) 8 , 6 , 4 , 2 , 0 ( .
Example1.7
Rounding a given number correct to two signifcant fgures
S/N Number Rounded to 2 Signifcant
fgures
Rule Used
1 8.361 8.4 (a)
2 8.351 8.4 (b)
3 8.350 8.4 (d) (i)
4 8.450 8.4 (d) (ii)
5 8.050 8.0 (d) (ii)
6 8.349 8.3 (c)
7 2.55 2.6 (d) (i)
8 2.65 2.6 (d) (ii)
9 0.0557 0.056 (a)
10 0.0554 0.055 (b)
/lr|can v|rrua| un|vers|r, J'
Formative Evaluation: Students should work through this exercise carefully writing
full solutions for each problem. They should check their work thoroughly using the
solutions provided.
Questions
1. (a) Using the method of substitution fnd the exact solution of the linear system
of equations

905 . 16 10 7
075 . 12 7 5
= +
= +
y x
y x
(b) Round the values on the right hand side of each equation to two signifcant fgures
and then fnd the exact solution of the resulting system of linear equation.
(c) Use the solutions obtained from the two systems of equations to explain why
initial errors need to be avoided as much as possible.
2. (a) How many signifcant fgures are in each of the following numbers:
(i) 00001000020000
(ii) 10000200003004
(iii) 000123.0004500
(b) Round each of the following numbers correct to fve signifcant fgures.
(i) 0123.395
(ii) 0123.205
(iii) 0123.206
3. Given the quantity

20
3
11
3
3
1

+ = X , perform the following calculations:


(a) Find the exact value of X correct to fve signifcant fgures.
(b) Approximate value of X using three digit chopping arithmetic (rounding
without making any adjustments).
(c) Approximate value of X using three digit rounding arithmetic.
(d) Calculate the absolute errors and percentage errors in the approximations
obtained in parts (b) and (c).
/lr|can v|rrua| un|vers|r, J2
4. The truncation error ) (x E in linearly interpolating a function ) (x f between two
points
0
x and
1
x , with h x x + =
0 1
, is given by ) ( ) )( (
2
1
) (
//
1 0
f x x x x x E =

where is some point in the interval ) , ( :


1 0
x x I = .
(a) Using the second derivative test, show that

M
h
x E Max
I x
8
) (
2
=

, where

M = Max
x I
f
/ /
(x)
.
(b) If ) sin( ) ( x x f = determine the value of h for which the truncation error
will always be less than 01 . 0 .
5. Assuming that the function ) (x f has a single root lying inside the closed
interval, b x a the bisection method for approximating uses the iteration
formula
2
1 2
+
=
i i
i
x x
x , ,.... 3 , 2 , 1 = i a x =
1
, b x =
0
, 0 ) ( ) (
1 2
<
i i
x f x f
(a) Prove by mathematical induction that the error in the
th
i iterate
i
x is given by
i
i
a b
E
2

= .
(b) If 0 = a and 1 = b , how many bisection iterations will be needed to obtain
an approximation with an error not greater than
3
10

?
Solutions
1. (a) 415 . 2 = x , 0 = y .
(b) 1 = x , 1 = y .
(c) Initial errors must be avoided because the solutions of some problems may
be very sensitive to relatively small initial errors.
2. (a) (i) 6 (b) (i) 123.40
(ii) 14 (ii) 123.20
(iii) 10 (iii) 123.21
/lr|can v|rrua| un|vers|r, JJ
3. (a) Exact value 45606 . 0 = X
(b) Approximate value 455 . 0 =
b
X
(c) Approximate value 456 . 0 =
c
X
(d) Absolute error 00106 . 0 =
b
X X
Absolute error 00006 . 0 =
c
X X
Percentage errors % 23 . 0 100 =


X
X X
b
Percentage errors % 013 . 0 100 =


X
X X
c

4. (a) Consider the function ) )( ( ) (
1 0
x x x x x g = whose frst and second deri-
vatives are: ) ( 2 ) (
1 0
/
x x x x g + = and 2 ) (
//
= x g , respectively. ) (x g has a
single critical point at
2
1 0
x x +
= , and since 0 ) (
//
> g , we conclude that
) ( g = ) )( (
1 0
x x
=

+
1 1 0 0 1 0
2
1
2
1
2
1
2
1
x x x x x x
= ( ) ( )
1 0 0 1
2
1
2
1
x x x x
=
4
2
h


We therefore conclude that and hence the result that
Max E x
h
M | ( ) |=
2
4
.
Max g x
h
| ( ) |=
2
4
/lr|can v|rrua| un|vers|r, J4
(b) With ) sin( ) ( x x f = , we have 1 = M and therefore we need to fnd h such
that 01 . 0
8
2

h
. This leads to the value 3 . 0 08 . 0 < h .
5. (a)Mathematical induction
i
i
a b
E
2

=
Test : Formula is true for 1 = i because the error in the frst bisection is

2
a b
.
Assumption: Let the formula hold for 1 > = k i (fxed). This means

k
k
a b
E
2

= .
Induction: Error in
k k k
E E x
2
1
1 1
= =
+ +

1
2 2 2
1
+


k k
a b a b
= . Q.e.d
(b) If 0 = a and 1 = b , then
i
i
E
2
1
= . This will not exceed
3
10

if .
10
) 2 ln(
) 1000 ln(
= i
/lr|can v|rrua| un|vers|r, J5
Learning Activity 2: Interpolation
Summary
The concept of interpolation is important in any introductory course on numerical
methods. Numerical approximation addresses both the need to approximate numbers
as well as approximating functions. Numerical interpolation approximates functions.
We approximate functions for one or several of the following reasons:
A large number of important mathematical functions may only be known
through tables of their values.
Some functions may be known to exist but are computationally too complex
to manipulate numerically.
Some functions may be known but the solution of the problem in which they
appear may not have an obvious mathematical expression to work with.
Interpolation as it is presented in this Learning Activity will give the Learner an op-
portunity to experience frst hand some practical applications of numerical methods
in solving the mathematical problem of approximating a function ) (x f which is
known only through a set of values at a fnite number of points.
This Learning Activity covers the following subtopics:
Linear interpolation
Lagrange interpolation polynomial
Newtons divided differences interpolation polynomial
Finite differences interpolation polynomials
We start off by defning the concept of interpolation. Linear interpolation is used to
illustrate the concept. This is followed by presenting special interpolation polynomials.
Specifcally, we discuss interpolation polynomials based on Lagrangian interpola-
tion coeffcients, Newtons divided differences and on fnite differences.
Specific Learning objectives
At the end of this Learning Activity the learner will be able to:
Explain why numerical methods are needed in solving interpolation pro-
blems.
/lr|can v|rrua| un|vers|r, J6
Apply Lagrangean interpolation polynomials.
Apply Newtons divided differences interpolation polynomial.
Defne and manipulate fnite difference operators (shift, forward, backward,
central and mean difference operators).
Construct tables of differences for tabulated function values.
Derive and apply Newtons forward, Newtons backward and Stirlings
central difference interpolation polynomials, and fnally
Use fnite difference interpolation polynomials in deriving some numerical
integration methods.
List of required readings
Wikipedia: Interpolation
List of relevant useful links
Wolfram MathWorld (visited 03.04.07)
http://mathworld.wolfram.com
Students should search for the entry covering the unit title. Also, search for
any key words in the text. Mathworld gives a detailed reference in all cases.
Wikipedia (visited 03.04.07)
http://en.wikipedia.org/wiki
As with mathworld, students should search for the entry covering the unit title.
Also, search for any key words in the text. Wikipedia generally gives shorter
and less complete entries. However, they can be easier to read.
MacTutor History of Mathematics (visited 03.03.07)
http://www-history.mcs.standrews.ac.uk/Indexes
The MacTutor Archive is the most comprehensive history of mathematics on
the internet. Students should search for their unit title and read the history of
the subject. This gives a helpful overview of the importance and context of
the topic being studied.
Key Terms and Theorems
Full defnitions are given in the text.
Interpolation: approximation of a function using discrete values.
Interpolation polynomial: a polynomial which interpolates a function using discrete
values provided.
Divided Differences: Differences of the function values provided, related to the
differences between the discrete points provided.
/lr|can v|rrua| un|vers|r, J7
Finite difference operators: Mathematical operators used in constructing the diffe-
rences in the function values.
Finite difference tables: A table showing different orders of the differences in the
function values.
Introduction
How Many Learning Activities are in this Module?
As stated in the summary above, numerical methods are used both for approximating
numbers as well as for approximating functions. The contents of this module are
covered in four Learning Activities. Two of these Learning Activities are on methods
of approximating numbers (the defnite integral and roots of functions). Another
Learning Activity is on errors and a fourth Learning Activity is on numerical methods
for approximating functions.
Why are Polynomials Chosen to Approximate Functions?
Functions are approximated using other functions deemed to be simple to manipulate
numerically. Specifcally, one uses polynomials to approximate other complicated
functions, mainly because polynomials are
Simple to evaluate
Simple to differentiate, and
Simple to integrate.
We begin the presentation by defning the concept of interpolation and establishing
the need for numerical methods for carrying out interpolation. This is followed by
a detailed discussion of the simplest polynomial used in approximating functions,
liner interpolation. Higher order interpolation polynomials are then introduced,
including
Lagrangian interpolation polynomials
Newtons divided differences interpolation polynomials, and fnally
/lr|can v|rrua| un|vers|r, J8
Finite difference interpolation polynomials.
At the end of the Learning Activity we briefy discuss the possible use of interpolation
polynomials in deriving some numerical integration methods such as the Trapezoidal
rule and Simpsons rule.
Learning activity # 2
2.1 Meaning of Interpolation
The mathematical concept of interpolation is concerned with the problem of approxi-
mating a function ) (x f defned over a closed interval ] , [ b a .
The function ) (x f to be approximated is usually defned through a set of its values
at 1 + n distinct points lying in the interval ] , [ b a . Typically one is given the pairs
of values
b x a x n k x f x
n k k
= = = , ; ,..., 2 , 1 , 0 )); ( , (
0
The problem is then to fnd values (or even derivatives) of the function at some non
tabular points lying inside the interval.
These types of problems are quite common in experimental physics and chemistry,
where an algebraic expression for a function may not be known but its values for
different values of its independent variable may be obtained experimentally through
laboratory measurements.
Typical Example (Bajpai et al 1975 pp 205)
In an experiment carried out in a physics laboratory, the length y of a wire was
measured for various loads x suspended from it. The results of the experiment are
as tabulated hereunder:
Table 1: Load versus extension of a wire
: x Load (kg)
0 1 2 3 4 5
: y Length (mm)
2027.1 2029.4 2031.8 2034.1 2036.5 2039.0
/lr|can v|rrua| un|vers|r, J9
From the data obtained above one may wish to know the length of the wire for any
non tabulated load lying inside the range ] 5 , 0 [ . This is known as interpolating
the function ) (x f y = , where the functional dependence of y on the load x is not
explicitly given here. Any attempt to use the data to calculate the length of the wire
for a load outside the given range is called extrapolation.
2.2 Linear interpolation
In linear interpolation we assume that we have two points ) , (
0 0
f x A and ) , (
1 1
f x B
on the curve of a (usually unknown) continuous function ) (x f y = and that we now
wish to approximate the value of the function at a point

) , (
1 0
x x x .
DO THIS
Revisit and learn the various forms of defning a straight line and writing the equation
of the straight line for each form:
Two-points given
A point and a slope is given
Because a straight line is completely defned by giving two points which lie on it,
we approximate the function ) (x f locally over the interval ] , [
1 0
x x by the straight
line through the two given points.
The equation of the straight line can be given in different forms. Here we consider
three forms:
(i) The usual y-intercept - slope or Newtons form.
(ii) The Lagrange form and
(iii) The determinant form
For computational purposes, the determinant form is the best of the three forms given.
/lr|can v|rrua| un|vers|r, 40

+
=
x x f
x x f
x x
iii
f
x x
x x
f
x x
x x
ii
x x
x x
f f
f i
x P
1 1
0 0
0 1
1
0 1
0
0
1 0
1
0
0 1
0 1
0
1
1
) (
) (
) ( ) (
) (
Worked Example 1
Using the data obtained from the laboratory experiment of suspending load from a
wire and measuring its length, apply the determinant form of linear interpolation to
approximate the length of the wire when the load is 2.7 kg
Solution
In this example we substitute the values
7 . 2 , 1 . 2034 , 3 , 8 . 2031 , 2
1 1 0 0
= = = = = x f x f x
into the determinant form of the equation and obtain the value
41 . 2033
3 . 0 1 . 2034
7 . 0 8 . 2031
) 7 . 2 (
1
=

= P
which looks to be quite reasonable in that as may be expected, it is closer to
1
f than
it is to
0
f .
/lr|can v|rrua| un|vers|r, 4'
DO THIS (2.1)
Apply the other two forms of the linear interpolation function ) (
1
x P to approximate
the length of the wire when the load is 1.35 kg
2.3 Error in linear interpolation
We now attempt to answer the question: How big is the error in linear interpola-
tion?
In other words, we wish to know how accurate the answers obtained through the
process of linear interpolation are.
An important feature of interpolation polynomial ) (x P
n
of any degree is that

n k x f x P
k k n
,..., 2 , 1 , 0 ) ( ) ( = = .
For linear interpolation this implies that ) ( ) ( ), ( ) (
1 1 0 0
x f x P x f x P = = .
This further implies that the error ) (x E at any point ] , [
1 0
x x x in linear interpo-
lation must have the form

C x x x x x E ) )( ( ) (
1
=
where C is a constant which is independent of x . In a subsequent section of this Lear-
ning Activity the value of C for a function ) (x f which is assumed to be suffciently dif-
ferentiable is given as ) (
2
1
//
f C =

where ) , , ( ) , , (
1 0 1 0
x x x Max x x x Min < <
With this result, the error in linear interpolation assumes the form

). (
2
1
) )( ( ) (
//
1 0 1
f x x x x x E =
If ) (
//
x f Max M = over the interval ] , [
1 0
x x , then one can show that

2 2
0 1 1
8
1
) (
8
1
) ( Mh x x M x E =
/lr|can v|rrua| un|vers|r, 42
2.4 Interpolation polynomials
As already stated at the beginning of the Learning Activity the main problem of
polynomial interpolation may be stated as follows:
Given the values
k k
f x f = ) ( of some continuous function ) (x f at 1 + n distinct
points n k x
k
,..., 2 , 1 , 0 , = one is required to construct a polynomial ) (x P
n
of
degree n such that it satisfes the following colocation criteria

n k f x P
k k n
,..., 2 , 1 , 0 ; ) ( = =
One can show that this so called Interpolation polynomial does exist and is unique.
However there are different forms of representing the interpolation polynomial. In
this Learning Activity we give four different forms of the interpolation polynomial.
2.5 Lagrangean interpolation polynomial
The Lagrangean form of the interpolation polynomial has the general form

=
= + + + + =
n
i
i i n n n
f x L f x L f x L f x L f x L x P
0
2 2 1 1 0 0
) ( ) ( .... ) ( ) ( ) ( ) (

in which the terms n i x L
i
,..., 2 , 1 , 0 ), ( = are individually polynomials of degree
n in x called are called the Lagrangean interpolation coeffcients.
To ensure that ) (x P
n
satisfes the colocation criteria given above, the Lagrangean
interpolation coeffcients are constructed such that they satisfy the condition

=
= =
j i if
j i if
x L
j i j i
0
1
) (
,

One can verify that the following defnition of ) (x L


i
meets this requirement:
/lr|can v|rrua| un|vers|r, 4J

) )...( )( )...( )( (
) )...( )( )...( )( (
) (
1 1 1 0
1 1 1 0
n i i i i i i i
n i i
i
x x x x x x x x x x
x x x x x x x x x x
x L


=
+
+
With this defnition of the Lagrangian interpolation coeffcients one can now verify
the co-location condition on the interpolation polynomial, for

n j f f f x L x P
j i
n
i
ij
n
i
j j i j n
,..., 2 , 1 , 0 ; ) ( ) (
0 0
= = = =

= =


Worked Example 2
Construct the cubic Lagrangean interpolation polynomial which interpolates the
function ) (x f given by the following table of values:
Table 2
i 0 1 2 3
i
x
1 2 3 4
i
f
1.54 0.58 0.01 0.35
P
3
(x) = 1.54L
0
(x) + 0.58L
1
(x) + 0.01L
2
(x) +

0.35L
3
(x)

where

) 3 )( 2 )( 1 (
6
1
) 3 4 )( 2 4 )( 1 4 (
) 3 )( 2 )( 1 (
) (
) 4 )( 2 )( 1 (
2
1
) 4 3 )( 2 3 )( 1 3 (
) 4 )( 2 )( 1 (
) (
) 4 )( 3 )( 1 (
2
1
) 4 2 )( 3 2 )( 1 2 (
) 4 )( 3 )( 1 (
) (
) 4 )( 3 )( 2 (
6
1
) 4 1 )( 3 1 )( 2 1 (
) 4 )( 3 )( 2 (
) (
3
2
1
0
=


=
=


=
=


=
=


=
x x x
x x x
x L
x x x
x x x
x L
x x x
x x x
x L
x x x
x x x
x L
/lr|can v|rrua| un|vers|r, 44
DO THIS (2.2)
Make use of the above Lagrangean interpolation polynomial to interpolate the func-
tion ) (x f at 6 . 2 = x
Observation
(i) We note that the second form (ii) of the equation of a straight line given in the
DO THIS (2.1) self-exercise problem is a typical example of the Lagrangean
linear interpolation formula.
(ii) In changing from one degree Lagrangian interpolation polynomial to ano-
ther, say from linear to quadratic, all calculations must be done afresh. For
instance, none of the expressions used in the linear approximation case (the
linear Lagrangian coeffcients ) ( ), (
1 0
x L x L ) are useful in the construction of
the quadratic Lagrangian interpolation polynomial.
Because of the second observation, efforts have been made to construct interpola-
tion polynomials that are iterative in the sense that, a higher degree interpolation
polynomial can be got simply by adding higher-degree terms to an existing lower
degree interpolation polynomial. In what follows we shall present two interpolation
polynomials in this category.
2.6 Newtons divided differences
Let the function ) (x f be given at 1 + n distinct points
n
x x x ,..., ,
1 0
such that
n k x f f
k k
,..., 2 , 1 , 0 , ) ( = =
We defne what are known as Newtons divided differences
n k x x x f
k
,..., 2 , 1 , ] ,..., , [
1 0
= as follows

0
1 2 1 0 3 2 1
2 1 0
0 3
2 1 0 3 2 1
3 2 1 0
0 2
1 0 2 1
2 1 0
0 1
0 1
1 0
] ,..., , , [ ] ,..., , , [
] ..., , , [
] , , [ ] , , [
] , , , [
] , [ ] , [
] , , [
] , [
x x
x x x x f x x x x f
x x x x f
x x
x x x f x x x f
x x x x f
x x
x x f x x f
x x x f
x x
f f
x x f
k
k k
k

/lr|can v|rrua| un|vers|r, 45


A typical table of divided differences would look as follows
Table 3: Table of Divided Differences
Divided Differences
x
) (x f
First Second Third Fourth
0
x ) (
0
x f
] , [
1 0
x x f
1
x ) (
1
x f
] , , [
2 1 0
x x x f
] , [
2 1
x x f ] , , , [
3 2 1 0
x x x x f
2
x ) (
2
x f
] , , [
3 2 1
x x x f ] , , , , [
4 3 2 1 0
x x x x x f
] , [
3 2
x x f ] , , , [
4 3 2 1
x x x x f
3
x ) (
3
x f
] , , [
4 3 2
x x x f ] , , , , [
5 4 3 2 1
x x x x x f
] , [
4 3
x x f ] , , , [
5 4 3 2
x x x x f
4
x ) (
4
x f
] , , [
5 4 3
x x x f
] , [
5 4
x x f
5
x
) (
5
x f
Using these divided differences Newton derived the following n-th degree po-
lynomial ) (x P
n
which interpolates the function ) (x f at the 1 + n distinct
collocation points n k x
k
,..., 2 , 1 , 0 , = : (Burden and Faires, 1989 p 113)

=

+
+ =
+
+
+ + + =
n
k
k k n
n n
n
x x x x f x x x x x x x f x P
OR
x x x x f x x x x x x x x
x x x x f x x x x x x
x x x f x x x x x x f x x x f x P
1
1 2 1 0 1 0 0
2 1 0 1 2 1 0
3 2 1 0 2 1 0
2 1 0 1 0 1 0 0 0
] ,... , , [ ) )...( )( ( ) ( ) (
] ,..., , , [ ) )...( )( )( (
... ] , , , [ ) )( )( (
] , , [ ) )( ( ] , [ ) ( ) ( ) (

We shall illustrate this approach on the following example.
/lr|can v|rrua| un|vers|r, 46
Worked Example 3
(i) Construct a table of divided differences for the function ) (x f given by the fol-
lowing data:
Table 4: Tabulated values of a function
x -3 -2 -1 0 1 2 3
f(x) -17 -25 -13 -5 -1 23 115
(ii) Use the resulting table of differences to interpolate ) (x f at:
3 . 2 = x

using Newtons linear, quadratic and cubic interpolation polynomials
based at 3
0
= x
Solution
Table 5: Table of divided differences
Divided Differences
x
) (x f
First Second Third Fourth
-3 -17
-8
-2 -25 10
12 -4
-1 -13 -2 1
8 0
0 -5 -2 1
4 4
1 -1 10 1
24 8
2 23 34
92
3 115
Interpolation based on 0 . 3 = x
/lr|can v|rrua| un|vers|r, 47
Linear Interpolation
Here we take: 3 . 2 , 8 ] , [ , 17 ) ( , 0 . 3
1 0 0 0
= = = = x x x f x f x and we
get 6 . 22 ] , [ ) ( ) ( ) 3 . 2 (
1 0 0 0
= + = x x f x x x f f
Quadratic Interpolation
Because we are interpolating at the same point 3 . 2 = x we only need to consider
the additional term ] , , [ ) )( (
2 1 0 1 0
x x x f x x x x whose value at 3 . 2 = x is
1 . 2 ) 10 )( 3 . 0 )( 7 . 0 ( =
Adding this correction to the value obtained through linear interpolation we get
7 . 24 1 . 2 6 . 22 ) 3 . 2 ( = = f
Cubic interpolation
Again we only need to calculate a correction to be made in the value obtained using quadra-
tic interpolation. The additional term is ] , , , [ ) )( )( (
3 2 1 0 2 1 0
x x x x f x x x x x x
whose value is 092 . 1 ) 4 )( 3 . 1 )( 3 . 0 )( 7 . 0 ( =
.
Making this correction in the value obtained by quadratic interpolation gives
792 . 25 ) 3 . 2 ( = f
DO THIS (2.3)
Using the above table of divided differences
(i) Write down the value of the divided difference ] , , [
4 3 2
x x x f and show exactly
how it has been arrived at.
(ii) Interpolate ) (x f at 3 . 0 = x using a 4-th degree Newtons divided differences
interpolation polynomial based on the point

0 . 1 = x .
Compare your answer with the value of the function 5 4 3 2 ) (
2 3 4
+ + = x x x x x f

at 3 . 0 = x
/lr|can v|rrua| un|vers|r, 48
2.7 Finite Difference Operators
The third and fnal set of interpolation polynomials are closely related to those based
on Newtons divided differences.
The basic assumption here is that
The function values
k k
f x f = : ) ( are given at a number of equally spaced and
distinct points having a constant interval length
k k
x x h =
+1
between consecutive
collocation points.
A systematic introduction of the method of approach involves the introduction of some
difference operators. There are four basic difference operators: The Shift, Forward,
Backward and Central difference operators. These are defned as follows.
The Shift Operator E
The shift operator E is defned through the relation

) ( ) ( h x f x Ef + = in the case of a continuous variable x , and through the relation

1 +
=
k k
f Ef

in the case of a discrete variable


k
x .
Powers of the operator (positive or negative) are defned in a similar manner:

p k k
p p
f f E ph x f x f E
+
= + = ); ( ) (
The Forward Difference Operator
The forward difference operator is defined through the relation
) ( ) ( ) ( x f h x f x f + = in the case of a continuous variable x , and through the
relation
k k k
f f f =
+1

in the case of a discrete variable
k
x . (1)
Powers of the forward difference operator can also be defned

r r k
p
k
p
k
p
f f p f f f = = =
+
+ 0
1
1
,...; 12 , 0

for any value of r .
/lr|can v|rrua| un|vers|r, 49
The Backward Difference Operator
The backward difference operator is defned through the relation
) ( ) ( ) ( h x f x f x f = in the case of a continuous variable x , and through the
relation
1
=
k k k
f f f in the case of a discrete variable
k
x . (2)
Powers of the backward difference operator can also be defned
r r k
p
k
p
k
p
f f p f f f = = =

+ 0
1
1
,...; 12 , 0 for any value of r .
The Central Difference Operator
The central difference operator is defned through the relation
)
2
1
( )
2
1
( ) ( h x f h x f x f + = in the case of a continuous variable x , and
through the relation

f
k
= f
k
f
k 1

in the case of a discrete variable


k
x . (3)
Powers of the central difference operator can also be defned
f
k +
1
2
f
k
1
2

for any value of r . (4)
Relationship between Difference Operators
The defnition of powers of the Shift Operator E enables us to relate the other three
difference operators with one another.
We frst note that:
2
1
2
1
+
=
k
k
f f E ; ;
2
1
2
1

=
k
k
f f E
1
1

=
k k
f f E
Using these three results, all of which are based on the valid defnition of the shift
operator we now establish the following relationships:
Because
k k k k k k
f E f Ef f f f ) 1 (
1
= = =
+

we conclude that
/lr|can v|rrua| un|vers|r, 50
1 1 + E or E

(5)
Again, because
k k k k k k
f E f E f f f f ) 1 (
1 1
1

= = = we conclude that



1
1
1
1
E or E

(6)
Similarly, because
k k k
k k
k
f E E f E f E f f f ) (
2
1
2
1
2
1
2
1
2
1
2
1

+
= = =

we
conclude that
2
1
2
1

E E

(7)
In the case of the central difference operator it is not possible to express the shift
operator E in terms of the central difference operator

alone. However, we shall
do so by involving the other fnite difference operators. Specifcally we can relate the
forward and backward difference operators with one another by involving the shift
and central difference operators.
(i) Multiplying both sides of equation (7) with
2
1
E and taking note of the result in
equation (5) we get

= =

1 ) (
2
1
2
1
2
1
2
1
E E E E E , therefore



2
1
2
1
, E E (8)
(ii) Multiplying both sides of equation (7) with
2
1

E and taking note of the result


in equation (6) we get
= =

1
2
1
2
1
2
1
2
1
1 ) ( E E E E E , therefore


2
1
2
1
, E E (9)
/lr|can v|rrua| un|vers|r, 5'
Having established all these inter-relationships between the operators , , , E one
can now defne any powers of the , ,

operators.
A last useful operator, the Mean (or averaging) Operator is often used in
connection with some interpolation formulas that are based on the central difference
operator .
The mean operator is defned through the relationship

+ =
+
2
1
2
1
2
1
k k
k
f f f

(10)
2.8 Finite Difference Interpolation Polynomials
Armed with the fve difference operators ( E , , , , ) we are now ready
to list (not derive) a number of interpolation polynomials based on their use. Exactly
how they are used will be discussed after introduction of the concept of a table of dif-
ferences. Instead of operating with the variable x , such polynomials are usually written
in terms of a digital variable s obtained from the transformation of variables

( )
0
1
x x
h
s =
(1) Newtons Forward Difference Interpolation Polynomial
0
0
0
3
0
2
0 0
... ) 2 )( 1 (
6
1
) 1 (
2
1
) (
f
k
s
f s s s f s s f s f s P
k
n
k
n

=
+ + + + =

=
(2) Newtons Backward Difference Interpolation Polynomial
n
k
n
k
n n n n n
f
k
k s
f s s s f s s f s f s P

+
=
+ + + + + + + =

=0
3 2
... ) 2 )( 1 (
6
1
) 1 (
2
1
) (

/lr|can v|rrua| un|vers|r, 52
(3) Stirlings Central Difference Interpolation Polynomial
P
n
(s) = f
0
+ s f
0
+
1
2
s
2

2
f
0
+

1
6
s(s
2
1)
3
f
0
+
1
24
s
2
(s
2
1)
4
f
0
+ ..
(4) Bessels Central Difference Interpolation Polynomial
... ) 2 ( ) 1 (
24
1
)
2
1
)( 1 (
6
1
) 1 (
2
1
)
2
1
( ) (
2
1
4 2
2
1
3
2
1
2
2
1
2
1
+
+ + + + =
f s s s
f s s s f s s f s f s P
n



(5) Everetts Central Difference Interpolation Polynomials

....
5
2
3
1
....
5
2
3
1
) (
0
4
0
2
0
1
4
1
2
1
+

+
+

+
+ +
+

+
+

+
+ =
f
t
f
t
tf
f
s
f
s
sf s P
n


where s t = 1
2.9 Tables of Differences
All fve fnite difference interpolation polynomials given above contain forward or
backward or central differences of powers exceeding one. It is therefore important to
know how these quantities can be got. The answer is not diffcult. These quantities
are obtained from tables of differences constructed using the given values of the
function ) (x f at the equidistant collocation points
k
x .
/lr|can v|rrua| un|vers|r, 5J
The tables of values are obtained in a process similar to that taken in constructing the
Newtons divided differences. The only difference here is that only differences of
function values are involved. Such differences are not divided by any quantity.
The following are typical examples of tables of differences.
Table 6: Forward Difference Table
FORWARD DIFFERENCES
x
) (x f
First Second Third Fourth Fifth
0
x
0
f
f
0
1
x
1
f

2
f
0
f
1

3
f
0
2
x
2
f

2
f
1

4
f
0
f
2

3
f
1

5
f
0
3
x
3
f

2
f
2

4
f
1
f
3

3
f
2
4
x
4
f

2
f
3
f
4
5
x
5
f
Observation
Note the forward slopping nature of the entries based at any point
k
x in the table
of forward differences. The Newton Forward Interpolation polynomial uses value
along such a path
/lr|can v|rrua| un|vers|r, 54
Table 7: Backward Difference Table
BACKWARD DIFFERENCES
x
) (x f
First Second Third Fourth Fifth
0
x
0
f
f
1
1
x
1
f

2
f
2
f
2

3
f
3
2
x
2
f

2
f
3

4
f
4
f
3

2
f
4

5
f
5
3
x
3
f

2
f
4

5
f
4
f
4

3
f
5
4
x
4
f

2
f
5
f
5
5
x
5
f
Observation
Note also the backward slopping nature of the entries based at any point
k
x in the
table of backward differences. The Newton Backward Difference Interpolation Po-
lynomial uses values along such a path.
/lr|can v|rrua| un|vers|r, 55
Table 8: Central Difference Table
CENTRAL DIFFERENCES
x
) (x f
First Second Third Fourth Fifth
x
-3
f
-3
f
-2
f
-2
f
-2

2
f
-2
f
-1

3
f
-1
f
-1
f
-1

2
f
-1

4
f
-1
f
-

3
f
-
f

5
-
0
x
0
f

2
f
0

4
f
0
f


3
f


5
f

1
x
1
f

2
f
1

4
f
1
f
1

3
f
1
2
x
2
f

2
f
2
f
2
3
x
3
f
Observation
Note further the horizontal slopping nature of the entries based at any point
k
x in
the table of central differences. Stirlings, Bessels and Everrets formulas use table
entries on and in the neighborhood of such a path.
/lr|can v|rrua| un|vers|r, 56
DO THIS (2.4)
(i) In reference to Table 9 (Page 57) and taking 0 . 0
0
= x give the values of the
following fnite differences:

2 5
4
2
2
2
1
1
1
2
3
, , , , , f f f f f f
(ii) Using appropriate equivalences express
8
6
f in terms of forward and backward
differences.
2.10 Application Of Difference Tables In Interpolation
We are now ready to illustrate both how to construct a table of differences and also
how to use it for interpolation purposes.
Worked Example 4
(i) Construct a table of differences for the function tabulated bellow.
x 0 0.2 0.4 0.6 0.8 1.0
f(x) 1.0000 0.9801 0.9211 0.8253 0.6967 0.5403
(ii) Use the resulting table to interpolate ) (x f
At 1 . 0 = x using Newtons forward difference formula
At 9 . 0 = x using Newtons backward difference formula and
At 5 . 0 = x using Stirlings central difference formula.
/lr|can v|rrua| un|vers|r, 57
Solution
(i)
Table 9: Table of differences
Differences
x f(x) First Second Third Fourth
Fifth
0.0 1.0000
-0.0199
0.2 0.9801 -0.0391
-0.0590 0.0023
0.4 0.9211 -0.0368 0.0017
-0.0958 0.0040
-0.0007
0.6 0.8253 -0.0328 0.0010
-0.1286 0.0050
0.8 0.6967 -0.0278
-0.1564
1.0 0.5403
(ii) Interpolation
Application of Newtons forward difference formula
We take 0 . 0
0
= x . Since the interval length being used is 2 . 0 = h the value of the
parameter s is calculated and found to be 5 . 0
2 . 0
0 . 0 1 . 0
=

= s
Newtons forward difference formula is given by
.. ) 3 )( 2 )( 1 (
24
1
) 2 )( 1 (
6
1
) 1 (
2
1
) (
0
4
0
3
0
2
0 0
+ + + + + = f s s s s f s s s f s s f s f x f
The table entries needed for this calculation are highlighted in the above table of
differences based on 0 . 0
0
= x Substitution of these values and the calculated value
of s gives the following result

9950 . 0 5 0000664062 . 0 00014375 . 0 0048875 . 0 00995 . 0 0000 . 1 ) 1 . 0 ( = + + f

Application of Newtons backward difference formula
We take 0 . 1 =
n
x . Again since the interval length is 2 . 0 = h the value of the para-
meter s is calculated and found to be

5 . 0
2 . 0
0 . 1 9 . 0
=

= s
/lr|can v|rrua| un|vers|r, 58
Newtons backward difference formula is given by
.. ) 3 )( 2 )( 1 (
24
1
) 2 )( 1 (
6
1
) 1 (
2
1
) (
0
4
0
3
0
2
0 0
+ + + + + + + + + + + = f s s s s f s s s f s s f s f x f
The table entries needed for this calculation are highlighted in the above table of
differences based at 0 . 1 =
n
x . Direct substitution of these values and the calculated
value of s gives

6216 . 0 0000390625 . 0 0003125 . 0 003475 . 0 0782 . 0 5403 . 0 ) 9 . 0 ( = + + f


rounded correct to four signifcant fgures.
Application of Stirlings central difference formula
We take 4 . 0
0
= x . Since the interval is 2 . 0 = h the value of the parameter s is
calculated and found to be 5 . 0
2 . 0
4 . 0 5 . 0
=

= s
Stirlings central difference formula is given b
.. ) 1 (
24
1
) 1 (
6
1
2
1
) (
0
4 2 2
0
3 2
0
2 2
0 0
+ + + + + = f s s f s s f s f s f x f
The table entries needed for this calculation are not highlighted in the above table
but are relatively easy to pick up. For the inexperienced learner the teething problem
may lie in fnding the averaged values. To maximize transparency in the calculations
we point out the following:

+ =

+ =

2
1
3
2
1
3
0
3
2
1
2
1 0
2
1
;
2
1
f f f f f f
With this clarifcation we now perform the calculations and fnd

8776 . 0 5 0000132812 . 0 000196875 . 0 0046 . 0 0387 . 0 9211 . 0 ) 5 . 0 ( = = f
/lr|can v|rrua| un|vers|r, 59
DO THIS (2.5)
Using the entries in Table 9 apply Everrets central difference formula based on
4 . 0
0
= x to interpolate the function ) (x f at 45 . 0 = x .
References for the Learning Activity
A.C. Bajpai, I.M. Calus and J.A. Fairley, Numerical Methods for Engineers and
Scientists, Taylor & Francis Ltd., London 1975.
R.L. Burden and D. Faires, Numerical Analysis, PWS-Kent Publishing Co. Boston,
Fifth Edition 1989.
Solutions To Formative Evaluation Questions
DO THIS (2.1)
The load 1.35 kg lies between the loads 1 kg and 2 kg. We therefore take and subs-
titute into the two linear interpolation formulas:
(i) 24 . 2030 ) 35 . 0 )( 4 . 2 ( 4 . 2029 ) ( ) (
0
0 1
0 1
0 1
= + =

+ = x x
x x
f f
f x P
(ii)
24 . 2030 ) 8 . 2031 )( 35 . 0 ( ) 4 . 2029 )( 65 . 0 ( ) (
1
0 1
0
0
1 0
1
1
= + =

= f
x x
x x
f
x x
x x
x P

/lr|can v|rrua| un|vers|r, 60


DO THIS (2.2)

) ( 35 . 0 ) ( 01 . 0 ) ( 58 . 0 ) ( 54 . 1 ) (
3 2 1 0 3
x L x L x L x L x P + + + =
At 6 . 2 = x the values of the Lagrangean coeffcients are found to be
064 . 0 ) 3 6 . 2 )( 2 6 . 2 )( 1 6 . 2 (
6
1
) 6 . 2 (
672 . 0 ) 4 6 . 2 )( 2 6 . 2 )( 1 6 . 2 (
2
1
) 6 . 2 (
448 . 0 ) 4 6 . 2 )( 3 6 . 2 )( 1 6 . 2 (
2
1
) 6 . 2 (
056 . 0 ) 4 6 . 2 )( 3 6 . 2 )( 2 6 . 2 (
6
1
) 6 . 2 (
= =
= =
= =
= =
L
L
L
L

Substitution into the expression for ) 6 . 2 (
3
P gives the result 15792 . 0 ) 6 . 2 (
3
= P .
DO THIS (2.3)
(i) 2 ] , , [
4 3 2
= x x x f
This result is obtained from the definition of divided differences as follows:
2 ) 12 8 (
2
1
) ( ) ( ) ( ) ( 1 ] , [ ] , [
] , , [
2 3
2 3
3 4
3 4
2 4 2 4
3 2 4 3
4 3 2
= =

=
x x
x f x f
x x
x f x f
x x x x
x x f x x f
x x x f
(i) Interpolation of ) (x f at 3 . 0 = x using Newtons 4
th
degree divided differences
interpolation polynomial.
Here 0 . 1
0
= x
/lr|can v|rrua| un|vers|r, 6'
6279 . 0 ] , , , , [ ) )( )( )( (
092 . 1 ] , , , [ ) )( )( (
42 . 0 ] , , [ ) )( (
6 . 5 ] , [ ) (
13 ) (
] , , , , [ ) )( )( )( (
] , , , [ ) )( )( (
] , , [ ) )( (
] , [ ) (
) ( ) (
4 3 2 1 0 3 2 1 0
3 2 1 0 2 1 0
2 1 0 1 0
1 0 0
0
4 3 2 1 0 3 2 1 0
3 2 1 0 2 1 0
2 1 0 1 0
1 0 0
0 4
=
=
=
=
=

+
+
+
+ =
x x x x x f x x x x x x x x
x x x x f x x x x x x
x x x f x x x x
x x f x x
x f
x x x x x f x x x x x x x x
x x x x f x x x x x x
x x x f x x x x
x x f x x
x f x P

We then get the answer

5159 . 6 6279 . 0 092 . 1 42 . 0 6 . 5 0 . 13 ) 3 . 0 (


4
= + + + = P
On the other hand, the function 5 4 3 2 ) (
2 3 4
+ + = x x x x x f is found to have
the same value (-6.5159) at 3 . 0 = x .
DO THIS (2.4)
(i) One fnds
0774 . 0
2
1
, 0007 . 0
, 0391 . 0 , 0590 . 0 , : , 1286 . 0
2
1
1
2
1
2
2 5
4
2
2
2
1
1
1
2
3
=

+ = =
= = =
f f f f
f f existent Non f f

/lr|can v|rrua| un|vers|r, 62


(ii) This is solved using the equivalence relations



2
1
2
1
, E E . One
fnds:

11
6
3 8
6
8
6 3
8
6
2
1
5
6
3 8
6
8
6 3
8
6
2
1
8
6
f f f E f E
f f f E f E f
= = =

=
= = =

=
+


DO THIS (2.5)
Using the entries in Table 9 apply Everrets central difference formula based on
4 . 0
0
= x to interpolate the function ) ( x f at 45 . 0 = x .
We are given the quantities 45 . 0 , 2 . 0 ; 4 . 0
0
= = = x h x and therefore the two pa-
rameters required in the application of the Everret method are
75 . 0 1 , 25 . 0
2 . 0
4 . 0 45 . 0
0
= = =

= s t
h
x x
s

9004 . 0 ... ) 0368 . 0 )( 25 . 0 )( 75 . 0 )( 75 . 1 (


6
1
) 0328 . 0 )( 75 . 0 )( 25 . 0 )( 25 . 1 (
6
1
) 9211 . 0 )( 75 . 0 ( ) 8253 . 0 )( 25 . 0 ( ) 45 . 0 (
= +
+ + + = f



African Virtual University 63
Learning Activity # 3
Numerical Integration
Summary
In this learning activity we focus on numerical integration methods. A major portion
of the presentation is devoted to the Newton-Cotes category of formulae. However,
we also dwell on the more accurate family of numerical integration methods clas-
sifed as Gaussian integration methods. Specifc attention is given to the two best
known Newton Cotes methods: Trapezoidal rule, Simpsons rule and the application
of Richardsons extrapolation technique on both methods in deriving the Romberg
integration method. As for Gaussian integration methods we limit our discussion
to the Gaussian method based on Legendre polynomials. The Learning Activity is
presented under the following headings:
The need for numerical integration
Classifcation of methods
Newton-Cotes formulae
The Trapezoidal Rule
Simpsons rule
Error terms in the Trapezoidal and Simpsons rules
Romberg integration
Gaussian integration methods
At the end of this learning activity the learner will be able to:
1. Classify numerical integration methods
2. Derive and apply the Trapezoidal rule and Simpsons rules.
3. Derive and apply Rombergs integration method based on either the Tra-
pezoidal or Simpsons rule
4. Apply the Gaussian integration method based on Legendre polynomials.
List of relevant readings
Fundamental Numerical Methods and Data Analysis, George W. Collins, chapter 4.
Wikipedia: Numerical Methods/Numerical Integration
African Virtual University 64
List of relevant useful links
Wolfram MathWorld (visited 03.04.07)
http://mathworld.wolfram.com
Students should search for the entry covering the unit title. Also, search for
any key words in the text. Mathworld gives a detailed reference in all cases.
Wikipedia (visited 03.04.07)
http://en.wikipedia.org/wiki
As with mathworld, students should search for the entry covering the unit title.
Also, search for any key words in the text. Wikipedia generally gives shorter
and less complete entries. However, they can be easier to read.
MacTutor History of Mathematics (visited 03.03.07)
http://www-history.mcs.standrews.ac.uk/Indexes
The MacTutor Archive is the most comprehensive history of mathematics on
the internet. Students should search for their unit title and read the history of
the subject. This gives a helpful overview of the importance and context of
the topic being studied.
Key Words
Anti-derivative of f (x)
A function F (x) is called an anti-derivative of another function f (x) if

dF
dx
= f (x).
Order of an integration method
A numerical integration method is said to be of order p if it gives exact values of the
integral for all polynomial functions f (x) of degree m p.
African Virtual University 65
Learning Activity: Numerical Integration

Introduction
In this Learning Activity we give the features that distinguish the family of New-
ton-Cotes methods from the Gaussian integration methods. We use a geometrical
approach to derive the Trapezoidal (Trapezium) rule and Simpsons rule. Because at
this juncture the Learner has not been exposed to the concept of orthogonal polyno-
mials, we have presented without deriving, the Gaussian integration method based
on the Legendre orthogonal polynomials. Illustrative examples are given and solved
to assist the learner experience the applications of the methods presented.
3.1 Need for Numerical Integration Methods
In the frst learning activity (Section 1.6 (b)) we gave two examples to demonstrate
why we need to learn and be able to apply numerical methods in solving some ma-
thematical problems. Part (ii) of the frst Example 1 and the whole of the second
example were purposely chosen to illustrate the need to learn numerical methods for
evaluating some defnite integrals.
3.2 Classification of Numerical Integration Methods.
Numerical methods for approximating the defnite integral f (x)dx
a
b

have the ge-


neral form
f (x)dx W
k
k = 0
n

a
b

f (x
k
) .
The coeffcients W
k
are called weighting coeffcients and x
k
are the abscissas or nodes
taken from the range [a, b] of integration at which the integrand is to be evaluated.
3.3 Order of an integration method
A numerical integration method is said to be of order p if it gives exact values of the
integral for all polynomial functions f (x) of degree m p.
African Virtual University 66
The general numerical integration formula given above has n+1 nodes x
k
and
n+1 corresponding weights, giving a total of 2n+ 2 unknown parameters. Since
a polynomial of degree m is completely determined by giving its values at m+1
distinct points, it follows that the order of the general numerical integration formula
given above is at most 2n+1.
3.4 Newton-Cotes Numerical Integration Methods
The Newton-Cotes integration methods are derived from the general formula by:
(i) Requiring the n+1 nodes x
k
to be uniformly distributed over the range of in-
tegration [a, b] such that x
k
= x
0
+ kh, k = 0,1, 2,...n, where x
0
= a , x
n
= b
and

h =
b a
n
.
(ii) Determining the n+1 weights W
k
such that the formula gives exact values of
the integral for all polynomial functions f (x) of degree at most n.
The Trapezoidal rule and Simpsons rule fall in this category of methods.
(a) The Trapezoidal Rule
DO THIS (3.1)
(i) What kind of a geometrical fgure is a trapezium?
(ii) What sides of a trapezium determine its area?
(iii) How is the area of a trapezium determined?
The Trapezoidal rule (sometimes referred to simply as the Trapezium rule) is the sim-
plest practical numerical integration method. It is based on the principle of fnding
the area of a trapezium. The principle behind the method is to replace the curve
y = f (x) by a straight line (linear approximation) as shown in the fgure 3.1.
African Virtual University 67
Typically, we approximate the area A under the curve ) ( x f y = between the or-
dinates at
0
x and
1
x by ( )
1 0
2
f f
h
A + , where ) (
0 0
x f f = , ) (
1 1
x f f = and
h

is the distance between
0
x and
1
x .
Figure 3.1: Trapezoidal Rule
For the integral

b
a
dx x f ) ( the trapezoidal rule can also be applied by subdividing
the interval ] , [ b a into n subintervals ] , [
1 k k
x x

, n k ,... 3 , 2 , 1 = , of equal length
1
=
k k
x x h , with
0
x a = and
n
x b = , followed by applying the trapezoidal rule
over each subinterval. The area A under the curve ) ( x f y = between the ordinates
at
0
x a = and
n
x b = can then be approximated by the generalized
Trapezoidal rule

=
b
a
dx x f A ) (

( ) ( ) ( ) ( )
n n
f f
h
f f
h
f f
h
f f
h
+ + + + + + + +
1 3 2 2 1 1 0
2
...
2 2 2


( ) [ ]
n n
f f f f f f
h
+ + + + + +
1 3 2 1 0
... 2
2

( )

+ +

=
1
1
0
2
2
n
k
i n
f f f
h


f (x
0
)
f (x
1
)
African Virtual University 68
Observation
In this generalized Trapezoidal Rule, the nodes are chosen to be the equidistant points
n k h k x x
k
,..., 3 , 2 , 1 , ) 1 (
0
= + =

while the weighting coeffcients
k
W have
been determined such that the formula gives exact value of the integral for all linear
functions of the form b ax x f y + = = ) ( . These turn out to be:
h W W W W
h
W W
n n
= = = = = = =
1 3 2 1 0
... ;
2
Example 3.1
Approximate

2
1
x
dx
by the Trapezoidal Rule with 10 = n ( 1 . 0 = h ).
Solution
In this example:
x
x f
1
) ( = and 1 . 0 = h
We evaluate the function at the points, x
i
= 1+ (i 1)0.1, i = 1, 2, 3,...10 and
obtain the pairs of values:
Table 3.1: Value of the function
x
x f
1
) ( =
x
) (x f
x
) (x f
0 . 1 0 . 1 6 . 1 625 . 0
1 . 1
0.9091
7 . 1 5882 . 0
2 . 1
8333 . 0 8 . 1 5556 . 0
3 . 1
7692 . 0 9 . 1 5263 . 0
4 . 1
7143 . 0
0 . 2
0.5
5 . 1
6667 . 0
Direct application of the generalized trapezoidal rule gives the approximate value

[ ] 69377 . 0 5 . 0 ) 1877 . 6 ( 2 0 . 1
2
1 . 0
2
1
= + +

x
dx
African Virtual University 69
(b) Simpsons Rule
To obtain Simpsons rule we subdivide the interval ] , [ b a into only two equal
subintervals using the points
2 1 0
, , x x x , where x
2
x
1
= x
1
x
0
= h, and replace the
curve of the general function ) (x f y = over the interval ] , [
2 0
x x by the quadratic
Lagrangean interpolation polynomial

2
1 2 0 2
1 0
1
2 1 0 1
2 0
0
2 0 1 0
2 1
) )( (
) )( (
) )( (
) )( (
) )( (
) )( (
f
x x x x
x x x x
f
x x x x
x x x x
f
x x x x
x x x x
y


+


+


=

+ =
2 1 0 1 2 0 0 2 1
2
) )( (
2
1
) )( ( ) )( (
2
1 1
f x x x x f x x x x f x x x x
h

The general definite integral f (x)dx
x
0
x
2

is then approximated by the integral


ydx
x
0
x
2

. Without loss of generality, one takes x


0
= 0 and gets the formula

ydx = ydx =
h
3
0
2 h

x
0
x
2

f
0
+ 4 f
1
+ f
2
[ ]
Because the formula uses values at three points (two equal subintervals), a generalized
Simpsons Rule is only possible when the number nof subintervals is even:
[x
0
, x
2
], [x
2
, x
4
], [x
4
, x
6
], ..., [x
n 2
, x
n
].
One applies the formula over each subinterval and adds the results to get the gene-
ralized Simpsons Rule formula
f (x)dx =
h
3
a
b

f
0
+ 4 f
1
+ f
2
[ ]
+ f
2
+ 4 f
3
+ f
4
[ ]
+ ... + f
n 2
+ 4 f
n1
+ f
n
[ ]
=
h
3
f
0
+ 4( f
1
+ f
3
+ ... + f
n1
) + 2( f
2
+ f
4
+ ... + f
n 2
) + f
n
[ ]
=
h
3
( f
0
+ f
n
) + 4 f
2 k 1
k =1
n/ 2

+ 2 f
2 k
k =1
( n 2 ) / 2

African Virtual University 70


Example 3.1
Approximate
dx
x
1
2

using Simpsons rule with n = 10 ( h = 0.1).


Solution
This is the same problem solved above using the Trapezoidal Rule. We certainly can
apply Simpsons Rule because the number of subintervals is even (n = 10). Using
the values given in the Table 3.1 one obtains
dx
x
1
2


0.1
3
1.0 + 4(3.4595) + 2(2.7282) + 0.5 [ ] = 0.693147 .
DO THIS (3.2)
(i) What is the exact value of the integral
dx
x
1
2

?
(ii) Which of the two approximations of the integral obtained using the Trapezoidal
rule and using Simpsons rule is more accurate?
(iii) How is the accuracy of the approximations of either the Trapezoidal Rule or
Simpsons Rule affected by taking a smaller interval h (increasing the number of
subintervals / refning the partitioning of the range of integration)?
3.5 Error Terms in the Trapezoidal Rule and in Simpsons Rule
With an exact value of 0.69314718 which is the value of ln2 , your answers to the
other two questions are expected to have been that Simpsons Rule is more accurate
than the Trapezoidal Rule, and that the accuracy of both methods increases with
decreasing interval length h. These results are made more vivid by the error terms
of the respective methods.
African Virtual University 71
(i) Error Term in the Trapezoidal Rule
For reasonably behaved functions f (x) it can be shown (Fox and Mayers, 1958) that
the exact (true) value I of the integral f (x)dx
a
b

is related to the value T (h) obtained


by the Trapezoidal Rule with an interval of length h through the expression
I T (h) = A
T
h
2
+ B
T
h
4
+ C
T
h
6
+ ...
where A
T
, B
T
, C
T
,... are constants whose values are independent of the
interval length h.
(ii) Error Term in Simpsons Rule
Similarly, the error in Simpsons approximation S(h) of the integral I is given by
I S(h) = A
S
h
4
+ B
S
h
6
+ C
S
h
8
+ ...
where A
S
, B
S
, C
S
,... are again constants whose values do not depend on the
interval length h.
The leading error term in the Trapezoidal Rule is A
T
h
2
while that of the Simpson
Rule is A
S
h
4
. This explains why Simpsons Rule is appreciably more accurate than
the Trapezoidal Rule for the same interval length h.
3.6 Romberg Integration
Strictly speaking, Romberg integration is not a Newton Cotes method. Romberg
integration is a post-processing technique. It is a method which uses previously
computed values to produce more accurate results.
The method takes advantage of the knowledge of the error terms in either the Tra-
pezoidal Rule or the Simpsons Rule to produce a much more accurate approximation
of the integral using previously calculated approximate values.
African Virtual University 72
(a) Romberg Integration Using the Trapezoidal Rule
Let h
1
and h
2
be two different intervals used with the Trapezoidal Rule. From the
above form of the error term for the method we can write

I T (h
1
) = A
T
h
1
2
+ B
T
h
1
4
+ C
T
h
1
6
+ ...

I T (h
2
) = A
T
h
2
2
+ B
T
h
2
4
+ C
T
h
2
6
+ ...
Eliminating the constant A
T
from these two formulae and solving for I we get

I = T (h
2
) +
h
2
2
h
1
2
h
2
2
T (h
2
) T (h
1
) { } B
T
h
1
4
h
2
4
+ ...
Specifcally, if we choose h
2
=
1
2
h
1
(halving the interval) we get

I = T (
1
2
h
1
) +
1
3
T (
1
2
h
1
) T (h
1
)

1
4
B
T
h
1
4
+ ...
The quantity
T (h
1
,
1
2
h
1
) = T (
1
2
h
1
) +
1
3
T (
1
2
h
1
) T (h
1
)

is an approximation of the integral I with a much smaller error than either of the
two approximations T (h
1
) andT (h
2
) . Its value is called the Romberg value of the
integral with respect to the Trapezoidal Rule.
(b) Romberg Integration Using Simpsons Rule
Derivation of a Romberg integration formula based on Simpsons Rule follows the
path as that used in connection with the Trapezoidal Rule.
Let h
1
and h
2
be two different intervals used with Simpsons Rule. From the above
form of the error term for the method we can write
African Virtual University 73

I S(h
1
) = A
S
h
1
2
+ B
S
h
1
4
+ C
S
h
1
6
+ ...

I S(h
2
) = A
S
h
2
2
+ B
S
h
2
4
+ C
S
h
2
6
+ ...
Eliminating the constant A
S
from these two formulae and solving for I we get

I = S(h
2
) +
h
2
4
h
1
4
h
2
4
S(h
2
) S(h
1
) { }
h
1
4
h
2
4
(h
2
2
h
1
2
)
h
1
4
h
2
4
B
S
+ ...

I = S(h
2
) +
h
2
4
h
1
4
h
2
4
S(h
2
) S(h
1
) { }
h
1
4
h
2
4
(h
2
2
h
1
2
)
h
1
4
h
2
4
B
S
+ ...
Specifcally, if we choose h
2
=
1
2
h
1
(halving the interval) we get

I = S(
1
2
h
1
) +
1
15
S(
1
2
h
1
) S(h
1
)

h
6
20
B
S
+ ...

The quantity S(h
1
,
1
2
h
1
) = S(
1
2
h
1
) +
1
15
S(
1
2
h
1
) S(h
1
)

is an approximation of the integral I with a much smaller error than either of the
two approximations S(h
1
) and S(h
2
) . Its value is called the Romberg value of the
integral with respect to Simpsons Rule.
African Virtual University 74
Example 3.3
Approximate

2
1
x
dx

by Romberg integration based on the Trapezoidal Rule with
2 . 0
1
= h and 1 . 0
2
= h
Solution
All the values required for the calculations are given in Table 3.1 One fnds

[ ] 69564 . 0 5 . 0 ) 7282 . 2 ( 2 0 . 1
2
2 . 0
) 2 . 0 ( = + + = T

[ ] 69377 . 0 5 . 0 ) 1877 . 6 ( 2 0 . 1
2
1 . 0
) 1 . 0 ( = + + = T .
Therefore
{ } 693147 . 0 ) 2 . 0 ( ) 1 . 0 (
3
1
) 1 . 0 ( ) 1 . 0 , 2 . 0 ( = + = T T T T
The Romberg value we have obtained by combining two fairly inaccurate values
using the Trapezoidal rule has the same high accuracy as the one obtained using
Simpsons Rule with 1 . 0 = h
DO THIS (3.3)
(i) Is it possible to apply Simpsons Rule on the integral

2
1
x
dx
using the interval
2 . 0 = h ?
(ii) If your answer is YES, apply the method. If your answer is NO explain carefully
why not.
African Virtual University 75
Example 3.4
Construct a table of values of the function
x
x f
1
) ( = at the equidistant points

9 ,..., 3 , 2 , 1 ); 1 ( 125 . 0 1 = + = k k x
k
. Then approximate the integral

2
1
x
dx
by

applying Romberg integration based on Simpsons Rule with interval lengths
25 . 0
1
= h and 125 . 0
2
= h .
Solution
Table 3.2: Value of the function
x
x f
1
) ( =
x
) (x f
x
) (x f
1.0
0 . 1
1.625 0.615385
1.125 0.888889 1.75 0.571429
1.25 0.8 1.875 0.533333
1.375 0.727273 2.0 0.5
1.5 0.666667
With these values one fnds:

[ ] 693254 . 0 5 . 0 ) 666667 . 0 ( 2 ) 371429 . 1 ( 4 0 . 1
3
25 . 0
) 25 . 0 ( = + + + = S
[ ] 693155 . 0 5 . 0 ) 038096 . 2 ( 2 ) 764880 . 2 ( 4 0 . 1
3
125 . 0
) 125 . 0 ( = + + + = S
Using these two Simpson approximations of the integral, Romberg integration leads
to the much more accurate value
. [ ] 6931484 . 0 ) 25 . 0 ( ) 125 . 0 (
15
1
) 125 . 0 ( ) 125 . 0 , 25 . 0 ( = + = S S S S
African Virtual University 76
3.7 Gaussian Integration Methods
Gaussian integration methods are derived from the general integration formula
) ( ) (
0
k
b
a
n
k
k
x f W dx x f


by assuming that all the 2 2 + n parameters in the
formula (the 1 + n nodes
k
x and their corresponding 1 + n weights
k
W ) are to be
determined so that the resulting integration formula gives exact values for all poly-
nomial functions ) (x f of degree at most 1 2 + n .
For functions ) (x f defned over the range ] 1 , 1 [ Gauss developed a numerical
integration formula

=
=
1
1
1
) ( ) (
n
k
k k
x f W dx x f
where the nodes are the roots of some special polynomial (Legendre orthogonal po-
lynomials) which are symmetrically positioned about the origin and all the weighting
coeffcients are positive.
The above mentioned restriction of the range of integration for the Gaussian integra-
tion methods is not a serious one because we can transform any fnite interval ] , [ b a
to ] 1 , 1 [ using the transformation

2
1 +
=

t
a b
a x

or ) 1 (
2
+

+ = t
a b
a x
and hence obtain the transformed integral on the right hand side of the equation

dt t
a b
a f
a b
dx x f
b
a


=
1
1
) 1 (
2 2
) (
on which the Gaussian integration method can be applied.
African Virtual University 77
Extensive tables giving values of the Gaussian nodes and their corresponding weight
for different values of n have been constructed ready for use in solving any given
defnite integral over a fnite range.
We reproduce here a table of the weights and nodes for the Gaussian integration
method based on Legendre polynomials for . 5 , 4 , 3 , 2 , 1 = n
Nodes and Weights for Gauss-Legendre Integration Method
n
Nodes

k
t
Weights
k
W
1

0.577 350 1.000 000
2

0.000 000
0.774 597
0.888 889
0.555 556
3

0.339 981
0.861 136
0.652 145
0.347 855
4

0.000 000
0.538 469
0.906 180
0.568 889
0.478 629
0.236 927
5

0.238 619
0.661 209
0.932 470
0.467 914
0.360 762
0.171 324
Example 3.5
Approximate the integral

+
=
4
2
2
1 x
dx
I by the Gaussian integration method using

the Gauss-Legendre nodes and weights for . 4 = n
Solution
With 2 = a and 4 = b the transformation of variables from ] 4 , 2 [ x to ] 1 , 1 [ t
gives: 3 + = t x and dt dx =
African Virtual University 78


=
+ +
=
+
1
1
1
1
2
4
2
2
) (
) 3 ( 1 1
dt t F
t
dt
x
dx

Direct calculations yield the following values:
568889 . 0
0
= W ; 1 . 0 ) 0 ( = F

0568889 . 0 ) 0 (
0
= F W
; 478629 . 0
1
= W 073960 . 0 ) 538469 . 0 ( = + F ; 141660 . 0 ) 538469 . 0 ( = F

[ ] 1032020 . 0 ) 538469 . 0 ( ) 538469 . 0 (
1
= + F F W
; 236927 . 0
2
= W 061507 . 0 ) 906180 . 0 ( = + F ; 185733 . 0 ) 906180 . 0 ( = F

[ ] 0585778 . 0 ) 906180 . 0 ( ) 906180 . 0 (
2
= + F F W
Adding the three products together gives the value

218667 . 0 = I
This is an astonishingly accurate result for, the true value of the integral is
218669 . 0 107149 . 1 325818 . 1 ) 2 ( tan ) 4 ( tan
1 1
= =

DO THIS (3.4)
Approximate the integral dx x e
x

2
1
) cos( by the Gaussian integration method
using the Gauss-Legendre nodes and weights for 4 n = .
African Virtual University 79
References for the Learning Activity
Fox, L. and Mayers, D.F., Computing Methods for Scientists and Engineers, - Oxford
University Press, London (1958).
Solutions To Formative Evaluation Questions
DO THIS (3.1)
(i) A trapezium is a quadrilateral which has a pair of parallel sides.
(ii) The sides of a trapezium that determine its area are the pair of parallel sides.
(iii) The area of a trapezium is given by: [ ]
2 1
2
L L
h
A Area + = , where
2 1
, L L
are the lengths of the parallel sides and h is the perpendicular distance between
them.
DO THIS (3.2)
(i) The exact value of the integral

2
1
x
dx
is 693147 . 0 ) 2 ln( = .
(ii) The approximation obtained using Simpsons rule is more accurate (has a smaller
error) than that obtained using the trapezoidal (trapezium) rule.
(iii) The accuracy of both the trapezoidal rule and Simpsons rule become more
accurate as the interval length h gets smaller.
DO THIS (3.3)
(i) It is not possible to apply Simpsons rule on the integral

2
1
x
dx
using the interval
2 . 0 = h .
(ii) The reason why it is not possible is because with 2 . 0 = h the number of subin-
tervals over the range ] 2 , 1 [ of integration would be odd (5) while Simpsons rule
can only be applied when the number of subintervals is even.
African Virtual University 80
DO THIS (3.4)
The integral dx x e
x
) cos(
2
1

is frst transfor-
med into

1
1
) ( dt t F

using the change of variables:
dt dx t t t F t x
2
3
, 1 ) 1 (
2
3
cos ) 1 (
2
3
1 exp ) ( ; 1 ) 1 (
2
3
=

+ = + =
One uses the following nodes and weighting coeffcients

861136 . 0 , 861136 . 0 , 347855 . 0
339981 . 0 , 339981 . 0 , 652145 . 0
2 2 2
1 1 1
= = =
= = =
t t W
t t W
One fnds
( ) ( ) [ ] 967614 . 1 ) ( ) ( ) ( ) (
2
3
) cos(
2 2 2 1 1 1
2
1
= + + + =

W t F t F W t F t F dx x e
x
African Virtual University 81
Learning Activity # 4
Roots of Functions
Summary
This is the fourth and fnal learning activity for this module. In this learning activity
we shall discuss a frequently occurring problem in mathematics: the root fnding
problem for either a nonlinear equation
0 ) ( = x f
involving a single independent variable x or for a coupled system of two nonlinear
equations
0 ) , ( = y x f , 0 ) , ( = y x g
in two independent variables ) , ( y x .
At the end of this learning activity the learner is expected to be able to derive, apply
and prove that the bisection method always converges; derive and apply both the
Secant method and the Regula Falsi method; derive and apply the Newton Raphson
method and also derive and apply Newtons method for a coupled system of nonlinear
equations. At the end of our presentation we discuss briefy the concept of fxed points
of a function and the theorems which guarantee their existence and uniqueness and
relate these results to the root fnding problem in a manner which allows the learner
to derive her/his own convergent iteration methods.
List of required readings
Wikipedia: Numerical Methods/Equation Solving
List of relevant useful links
Wolfram MathWorld (visited 03.04.07)
http://mathworld.wolfram.com
Students should search for the entry covering the unit title. Also, search for
any key words in the text. Mathworld gives a detailed reference in all cases.
Wikipedia (visited 03.04.07)
http://en.wikipedia.org/wiki
As with mathworld, students should search for the entry covering the unit title.
Also, search for any key words in the text. Wikipedia generally gives shorter
and less complete entries. However, they can be easier to read.
African Virtual University 82
MacTutor History of Mathematics (visited 03.03.07)
http://www-history.mcs.standrews.ac.uk/Indexes
The MacTutor Archive is the most comprehensive history of mathematics on
the internet. Students should search for their unit title and read the history of
the subject. This gives a helpful overview of the importance and context of
the topic being studied.
Key Words, Theorems
[Full defnitions are given in the text]
Root or zero of a function: A value of x at which the function has a value of zero.
Fixed-points of a function: A value of x for which the function has the same value
of x (e.g. f(2)=2)
Intermediate value theorem for continuous functions: A continuous function takes
all values lying between two values of the function.

African Virtual University 83
Learning Activity : Roots of Functions
4.1 Introduction
Five numerical methods for fnding roots of functions will be presented in this lear-
ning activity. The frst four methods are for solving the nonlinear equation 0 ) ( = x f
The ffth method is for solving a coupled system of two nonlinear equations in two
variables 0 ) , ( , 0 ) , ( = = y x g y x f .
The bisection method will be derived. We prove that the method is always convergent.
This will be followed by the method of Regula Falsi, which has a signifcant simi-
larity with the bisection method but converges slightly faster. The Secant method is
immediately presented after the Regula Falsi method because the two methods share
a common mathematical formula. However, the Secant method is computationally
more effcient. The Newton-Raphson method is presented last and is shown to be a
generalized form of the Secant and Regula Falsi methods.
4.2 Roots or Zeros of a Function
For a function of a single independent variable ) (x f y = , a point = x is called
a root or a zero of ) (x f if the value of the function is zero at the point, meaning.
0 ) ( = f

In Figure 4.1 the points
3 2 1
, , x x x x x x = = = are all roots of
the function ). (x f

x
1
x
2
x
3

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

) (x f y =
y
x
Figure 4.1: Roots of a Function ) (x f
African Virtual University 84
4.3 Numerical Methods
(a) The Bisection Method
The bisection method for approximating roots of functions is a typical example of
an iteration method.
In its simplest form, an iteration method may be defned as a repetitive process of
applying a function ) (x g on one or several previous approximate values
1 n
x to
produce a new and hopefully more accurate approximation
n
x of the specifc quantity
being sought. In mathematical symbolism we write

,...) , , (
3 2 1
=
n n n n
x x x g x
The bisection method is based on the intermediate value theorem for continuous
functions. If ) (x f is continuous on an interval ] , [ b a and if the values ) (a f and
) (b f differ in sign, ( 0 ) ( ) ( < b f a f ), then the equation 0 ) ( = x f has at least one
real root

] , [ b a .
Assuming that the points a and b were chosen to contain only one root we can
bisect the interval ] , [ b a into two halves at the point ) (
2
1
b a c + = and conclude
that the root lies either in the interval ) , ( c a or in the interval ) , ( b c provided that
0 ) ( c f , in which case c is the required root.
The Bisection method repeats the process of bisecting the interval which contains the
root until we are satisfed that we are close enough to the root.
The above process can be summed up by the following algorithm (Kendal E. Atkin-
son, 1989 pp 56).
African Virtual University 85

Algor ithm Bisect ( , , , ), ( b a x f )

Steps:
1. Set a x = :
1
and b x = :
2

2. Define [ ]
2 1 3
2
1
x x x + =
3. If
3 2
x x , then accept
3
x = and exit.
4. If 0 ) ( ) (
3 2
x f x f then
3 1
: x x = ; otherwise
3 2
: x x = .
5. Go back to step 2.

Convergence of the Bisection Method
Convergence of any iteration method implies that the error in the approximation is
tending to zero as the number of iteration increases.
For the Bisection method, the absolute value of the error is bounded by the length of
the interval in which the root lies at that particular stage.
Error bound after 1
st
bisection [ ] a b x =
2
1
1 3
.
Error after 2
nd
bisection
2
2 4
2 2 2
1 a b a b
x

=


=
Error after 3
rd
bisection
3 2
3 5
2 2 2
1 a b a b
x

=


=
Error after
th
n bisection
n n
n
a b a b
x
2 2 2
1
1
6

=


=


Because 0
2
lim lim =


=

n
n
n
n
a b
we conclude that the bisection method always

converges.
Example 4.1
Verify that the function 10 4 ) (
2
+ = x x x f has a root inside the interval ) 2 , 1 ( and
use the limits of the interval as starting values of the bisection method to approximate
the root in 10 bisections.
lim
n

n
African Virtual University 86
Solution
We evaluate the function at the two end points of the given interval and fnd 5 ) 1 ( = f
and 2 ) 2 ( = f . Since ) (x f is a continuous function and 0 ) 2 ( ) 1 ( < f f , the interme-
diate value theorem asserts that f has at least one root in the interval 2 1 x . We
can therefore carry out the bisection method to fnd the results tabulated hereunder.
Table 4.1: Bisection Method for the function 10 4 ) (
2
+ = x x x f
n
a
) (a f
b
) (b f
c
) (c f
1 -5 2 2 1.5 -1.75
1 1.5 -1.75 2 1.5 1.75 0.0625
2 1.5 -1.75 1.75 0.0625 1.625 -0.859375
3 1.625 -0.859375 1.75 0.0625 1.6875 -0.402344
4 1.6875 -0.402344 1.75 0.0625 1.71875 -0.170898
5 1.71875 -.170898 1.75 0.0625 1.734375 -0.054443
6 1.734375 -0.054443 1.75 0.0625 1.742188 0.003971
7 1.734375 -0.054443 1.742188 0.003971 1.738282 -0.025248
8 1.738282 -0.025248 1.742188 0.003971 1.740235 -0.010642
9 1.740235 -0.010642 1.742188 0.003971 1.741212 -0.003333
10 1.741212 -0.003333 1.742188 0.003971 1.741700 0.000319
The sequence of values under the c-column in the table is convergent. The true
value of the root being approached by this sequence (use the quadratic formula) is
... 741657 . 1 =
DO THIS (4.1)
Verify that the function ) cos( ) ( x x x f = has a root in the interval ] 1 , 0 [ and hence
apply the bisection method, in only fve iterations, to approximate the root.
(b) The Regula Falsi Method
The Bisection method we have just presented was a bit wasteful. In it one spends
great efforts at calculating values of the function f at two points which are only
used for deciding in which subinterval the root lies but are never used in the actual
calculation of the approximate value of the root.
African Virtual University 87
The method known as Regula Falsi (or rule of false position) rectifes this anomaly.
The method retains the principle of enclosure characteristic of the Bisection method
but also makes direct use of the function values at the two points which enclose the
root of the function.
The general approach for this and subsequent methods (Secant method and the Newton
Raphson method) is to replace the curve of ) (x f y = in the interval where the root
lies by the straight line joining the two points.
Specifcally, let the root lie in the interval ] , [
2 1
x x . The equation of the secant line
joining the two points ) , (
1 1
f x A and ) , (
2 2
f x B is
. ) (
1
1 2
1 2
1
x x
x x
f f
f y

+ =
Figure 4.2 Regula Falsi Method

y
x
1
x
2
x
Secant
3
x
A
B
This line intersects the x-axis at the point with coordinates ) 0 , (
3
x where

African Virtual University 88
1 2
1 2 2 1
1
1 2
1 2
1 3
f f
f x f x
f
f f
x x
x x

=
Unlike the Bisection method, the Regula Falsi assumes that the two values
1
x and
2
x enclose the root being sought by requiring that 0
2 1
< f f and at the same time
involves the same function values in calculating a new approximation to the root.
The above process can be repeated several times in an iterative process using the
following algorithm.
Algorithm Regula Falsi ( , , , ), ( b a x f )
Steps:
1. Deine
1
1 2
1 2
1 3
f
f f
x x
x x

=
2. If
3 1
x x and
3 2
x x then accept
3
x = and exit.
3. If 0
3 2
f f then
3 1
: x x = ; otherwise
3 2
: x x = .
4. Go back to step 1.
Example 4.2
Starting with the values 2 , 1
2 1
= = x x apply the Regula Falsi method on the function
10 4 ) (
2
+ = x x x f to obtain an approximate value of the root enclosed in the
interval ) , (
2 1
x x in only four (4) iterations.
Table 4.2: The Regula Falsi Method for the function 10 4 ) (
2
+ = x x x f


1 -5 2 2 1.714286 -0.204080
1 1.714286 -0.204080 2 2 1.740741 -0.006857
2 1.740741 -0.006857 2 2 1.741627 -0.000227
3 1.741627 -0.000227 2 2 1.741656 -0.000010
4 1.741656 -0.000010 2 2 1.741657 -0.000003
n
1
x
) (
1
x f
2
x
) (
2
x f
1 2
1 2 2 1
3
f f
f x f x
x

=
) (
3
x f
African Virtual University 89
Examination of the values of
3
x against the background of the exact value of the
root ... 741657387 . 1 = demonstrates the faster convergence of the Regula Falsi
method compared to the Bisection method.
Observation
The requirement in both the Bisection and the Regula Falsi methods that the two
values involved in the calculations,
2 1
, x x must enclose the root is computationally
very restrictive and signifcantly reduce the effciency of both methods. In a pro-
grammed algorithm, the process of checking whether or not 0 ) ( ) (
2 1
< x f x f is time
consuming. As a result, efforts have been made to do without it. Our next method
achieves just that.
(c) The Secant Method
The Secant method is essentially the same as the Regula Falsi method. The only dif-
ference is that in the Secant method the requirement that the two values
1
x and
2
x
must enclose the root is dropped. All one needs is to require the two values used in
the computation be close enough to the required root. The algorithm for the Secant
method is as given hereunder.
Algorithm Secant Method ( , , , ), ( b a x f )
Steps:
1. Defne
1
1 2
1 2
1 3
f
f f
x x
x x

=
5. If
3 1
x x and
3 2
x x

then accept
3
x = and exit.
6. Otherwise set
2 1
: x x = and
3 2
: x x =
7. Go back to step 1.

African Virtual University 90
DO THIS (4.2)
Starting with 1 , 0
1 0
= = x x , perform 5 iterations using the secant method to ap-
proximate the root of the function

) cos( ) ( x x x f = .

(d) The Newton-Raphson Method
The Newton Raphson method is by far the most popular numerical method for
approximating roots of functions. The method assumes that the function ) (x f
is differentiable in the neighborhood of the root and that the derivative is not zero
anywhere in that neighborhood.
Assuming that
0
x is a point which is suffciently close to the root of the function,
the graph of the function ) (x f y = is approximated by the tangent to the curve at
the point.

y
x
1
x
2
x
Tangent
Fig ure 4.3: Newton -Rap hson M ethod
The equation of the tangent through point )) ( , (
0 0
x f x on the curve ) (x f y = is
) ( ) (
0
/
0 0
x f x x f y + =
This tangent intersects with the x - axis at the point
1
x whose value is

) (
) (
0
/
0
0 1
x f
x f
x x =
African Virtual University 91
The value
1
x is then accepted as a new approximation to the root. The point
)) ( , (
1 1
x f x can be taken as a new point to draw a tangent through. Its intersection
with the x - axis, given by
) (
) (
1
/
1
1 2
x f
x f
x x = is also accepted as a new approximation

to the root. This process can be repeated over and over, leading to the iteration method
given by the
Newton-Raphson formula ,... 2 , 1 , 0 ,
) (
) (
/
1
= =
+
n
x f
x f
x x
n
n
n n
Each iteration using the Newton Raphson method requires one function evaluation
and one frst derive evaluation. Compared to the previous three numerical methods,
the Newton Raphson method converges very rapidly to the root.
Example 4.3
Starting with 1
0
= x approximate a root of the function 10 4 ) (
2
+ = x x x f correct
to 6 decimal places.
Solution
10 ) 4 ( 10 4 ) (
2
+ = + = x x x x x f
4 2 ) (
/
+ = x x f
The requirement that we obtain an answer correct to 6 decimal places simply means
that we carry out the iteration until the 7
th
decimal digit in the values being calculated
is no longer changing.
African Virtual University 92
Table 4.3: The Newton-Raphson Method for the function 10 4 ) (
2
+ = x x x f
n
n
x ) (
n
x f
10 ) 4 ( +
n n
x x
) (
/
n
x f
4 2 +
n
x ) (
) (
/
1
n
n
n n
x f
x f
x x =
+
0 1 -5 6 1.833 333 3
1 1.833 333 3 0.6944442 7.6666666 1.742 753 6
2 1.742 753 6 0.0082045 7.4855072 1.741 657 5
3 1.741 657 5 0 7.483315 1.741 657 5
Because the value of the function at
3
x is for all purposes zero, we can conclude that
the required approximation is 741657 . 1 = x rounded to six decimal places. The true
value of the root to the same degree of accuracy is 741657 . 1 =
DO THIS (4.3)
Starting with 0
0
= x apply the Newton-Raphson method in only four iterations to
approximate the root of the function ) cos( ) ( x x x f = .
4.4 Newtons Method for a Coupled System
Our ffth and last numerical method will focus on solving a system of two simulta-
neous nonlinear equations of the general form
0 ) , ( , 0 ) , ( = = y x g y x f .
A typical example of such a system is to fnd the coordinates of the point in the frst
quadrant where the parabola 7 2
2
= x y intersects with the circle 6
2 2
= + y x .
Here, we are looking for the pairs of values ) , ( y x which satisfy the two nonlinear
equations
0 6 ) , ( , 0 7 2 ) , (
2 2 2
= + = y x y x g y x y x f
African Virtual University 93
To obtain a Newton-Raphson type method for approximating the solution of the ge-
neral problem stated above, we let ) , (
0 0
y x be an approximation to the exact solution
) , (

of the coupled system. To obtain an improved solution ) , (
1 1
y x we assume
that the exact coordinates of the point are obtained by making adjustments h and k
to our initial values, such that

h x + =
0
; k y + =
0
.
and hence, 0 ) , (
0 0
= + + k y h x f 0 ) , (
0 0
= + + k y h x g .
Expanding f and g in a Taylor Series about the point ) , (
0 0
y x one gets
... ) , ( ) , ( ) , ( ) , ( 0
... ) , ( ) , ( ) , ( ) , ( 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
+

+ = + + =
+

+ = + + =
y x
y
g
k y x
x
g
h y x g k y h x g
y x
y
f
k y x
x
f
h y x f k y h x f
where we have deliberately left out all higher order terms and retained only the terms
linear in the increments h and k .
If we truncate the series on the right hand side of each equation after the linear terms
we still get

0 ) , ( ) , ( ) , ( ) , (
0 ) , ( ) , ( ) , ( ) , (
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
=

+ = + +
=

+ = + +
y x
y
g
k y x
x
g
h y x g k y h x g
y x
y
f
k y x
x
f
h y x f k y h x f
but + h x
0
and

+ k y
0
. We denote the values of x and y which satisfy
the above pair of equations with
h x x + =
0 1
; k y y + =
0 1
.
African Virtual University 94
Solving the resulting system of two linear equations:


0 ) , ( ) , ( ) , (
0 ) , ( ) , ( ) , (
0 0 0 0 0 0
0 0 0 0 0 0
=

+
=

+
y x
y
g
k y x
x
g
h y x g
y x
y
f
k y x
x
f
h y x f
for the unknown value h and k
The values of h and k are found to be

D
D
k
D
D
h
k h
= = ,
where
k h
D D D , , are the three determinants
g
x
g
f
x
f
D
y
g
g
y
f
f
D
y
g
x
g
y
f
x
f
D
h h

= ; ;

in which all the quantities (function values and partial derivatives) which appear
therein are evaluated at the point ). , (
0 0
y x
Once these quantities have been calculated, the values of the new approximate solu-
tion can be calculated .
The above analysis carried out using the initial approximate solution

(x
1
, y
1
) can now
be repeated using the new pair ) , (
2 1
y x to lead to a new approximate solution ) , (
2 2
y x ,
and so on, and so on in an obvious iterative manner,
) , (
1 1
y x
African Virtual University 95
The method described above is known as Newtons method for a system of simulta-
neous nonlinear equations. Its speed of convergence is the same as its counterpart in
solving the single nonlinear equation 0 ) ( = x f .

Example 4.4
(a) Using analytical methods fnd the true solutions of the coupled system of equa-
tions
0 6 ) , ( , 0 7 2 ) , (
2 2 2
= + = y x y x g y x y x f
(b) Perform two iterations with Newtons method to approximate a solution of the
coupled pair of equations which is believed to lie close to the point ) 1 , 2 ( .
Solution

(a) Solving the equation 0 ) , ( = x g for
2
x one gets
2 2
6 y x = , and substituting this
expression of
2
x into the equation 0 ) , ( = y x f one gets [ ] 0 7 6 2
2
= y y

This leads to the quadratic equation
0 5 2
2
= + y y

Whose roots are

850781 . 1 , 350781 . 1
) 2 ( ) 1 (
= = y y

The corresponding values for x are found to be
604559 . 1 ; 043377 . 2
) 2 ( ) 1 (
= = x x
(b) 6 ) , ( ; 7 2 ) , (
2 2 2
+ = = y x y x g y x y x f
. 2 ; 2 ; 1 ; 4 y
y
g
x
x
g
y
f
x
x
f
=


African Virtual University 96
First Iteration
1 , 2
0 0
= = y x

1 ) , ( , 8 ) , ( , 0 ) , (
0 0 0 0 0 0
=

= y x
y
f
y x
x
f
y x f
2 ) , ( , 4 ) , ( , 1 ) , (
0 0 0 0 0 0
=

= y x
y
g
y x
x
g
y x g

8 , 1 , 20 = = =
k h
D D D


0.05, 0.4
h k
D D
h k
D D
= = = =
4 . 1 , 05 . 2
0 1 0 1
= + = = + = k y y h x x

Second Iteration
4 . 1 , 05 . 2
1 1
= = y x

1 ) , ( , 2 . 8 ) , ( , 005 . 0 ) , (
1 1 1 1 1 1
=

= y x
y
f
y x
x
f
y x f

8 . 2 ) , ( , 1 . 4 ) , ( , 1625 . 0 ) , (
1 1 1 1 1 1
=

= y x
y
g
y x
x
g
y x g

312 . 1 , 1765 . 0 , 06 . 27 = = =
k h
D D D

0.006523, 0.048485
h k
D D
h k
D D
= = = =

351515 . 1 , 043477 . 2
1 2 1 2
= + = = + = k y y h x x



African Virtual University 97
DO THIS (4.4)
Perform 2 iterations with Newtons method to approximate the solution of the coupled
system of equations
0
0
2 2
2 2
= +
=
y x y
y x x
that lies near the point with coordinates ) 4 . 0 , 8 . 0 ( .
(4.5) Fixed-Point Iterations
Defnition
A number is called a fxed point of a function ) (x g if = ) ( g .
The mathematical problem of fnding values of x which satisfy the equation
) (x g x = is called the fxed point problem.

(a) Existence Theorem
If ) (x g is continuous over ] , [ b a and

] , [ ] , [ ) ( b a x b a x g , then ) (x g has
at least one fxed point in ] , [ b a
To prove this theorem we need the Intermediate Value Theorem for continuous
functions.
Proof
If a a g = ) ( or b b g = ) ( then the proof is complete because then, a or b , or both are
fxed points of ) (x g . However, if a a g ) ( and b b g ) ( then from the assumption
] , [ ) ( b a x g

made above, the function ) (x g satisfes b x g a < < ) ( . We defne
a function x x g x h = ) ( ) ( for

] , [ b a x . Like ) (x g , the function ) (x h is also
continuous over ] , [ b a . By evaluating ) (x h at a x = and b x = we fnd
0 ) ( ) ( > = a a g a h , 0 ) ( ) ( < = b b g b h .
The intermediate value theorem asserts that the function ) (x h must vanish (have
zero value) at an intermediate point ) , ( b a . At such a point = x we have,
0 ) ( ) ( = = g h

which implies = ) ( g a result which implies that ) (x g
has a fxed point ) , ( b a .
African Virtual University 98
(b) Uniqueness Theorem
The above theorem establishes the existence of at least one fxed point. There could
therefore be several fxed points. To guarantee that there is only one fxed point we
have the following theorem.
If in addition to the assumptions made above, the function ) (x g is differentiable in
) , ( b a and its derivative satisfes the condition
1
) , (
< = K
dx
dg
Max
b a
Then, ) (x g has a unique fxed point in ) , ( b a .

Proof
Assume that ) (x g has two different fxed points:
1
,
2


with
2 1
. Then,
1 1
) ( = g

and
2 2
) ( = g .
Through subtraction and using the Mean Value Theorem for differentiation we get
) )( ( ) ( ) (
1 2
/
1 2 1 2
= = g g g , where

(
1
,
2
)

By taking absolute values on both sides of this equation and observing the above
condition on ) (
/
x g we fnd

1 2 1 2 1 2
/
1 2
)( ( < = K g
This is a contradiction which can only result from the assumption we made that
2 1
. We therefore conclude that under the stated assumptions, the function
) (x g has a unique (only one) fxed point.
(c) Relationship between Root -fnding and Fixed -point Problems
We introduced the concept of a fxed point for the purpose of using it in solving our
root-fnding problem. The relationship between the two problems is simple.
African Virtual University 99
In the root-fnding problem we want to fnd all values of x which satisfy the equa-
tion 0 ) ( = x f .
Let us assume that we are able to express (split) the function ) (x f in the form
) ( ) ( x g x x f = .
It is obvious that this splitting can be done in many ways. The particular choice of
) (x g will be critical in converting the root-fnding problem into a useful fxed-point
problem.
If is a root (zero) of ) (x f then

= = = = ) ( 0 ) ( 0 ) ( ) ( g g g f
This result implies that the roots of ) (x f are the fxed points of ) (x g .
What we now need to do is to fnd the best splitting of the function ) (x f .
Such a splitting must result in a function ) (x g which has a unique fxed point in a
given interval. We shall demonstrate the splitting process on a typical example.
Example 4.5
Consider the root-fnding problem

0 10 4 ) (
2
= + x x x f . Using the Intermediate
Value Theorem we can show that ) (x f has roots in the intervals ] 2 , 1 [ , ] 5 , 6 [
For our purposes we shall be interested in fnding the root that lies in ] 2 , 1 [ .
The equation 0 10 4
2
= + x x can be written in many different ways. The following
are but a few alternate ways of expressing the equation.

2
2
10 4 ) (
10 ) 4 ( ) (
4 10 ) (
x x iii
x x ii
x x i
=
= +
=

African Virtual University 100
We solve each of these three equations for x and get
) ( :
4
10
) (
) ( :
4
10
) (
) ( : 4 10 ) (
3
2
2
1
x g
x
x iii
x g
x
x ii
x g x x i
=

=
=
+
=
= =

These are three possible fxed-point problems for the given root-fnding problem
given above. The question is which one of these fxed-point problems is most suited
for solving the root-fnding problem?
To answer this question we find which of the three fixed-point functions
) ( ), ( ), (
3 2 1
x g x g x g satisfes the criteria stated by the uniqueness theorem with
respect to the root in ] 2 , 1 [ . Using direct substitution we fnd that

50 . 1 ) 2 ( , 25 . 2 ) 1 (
67 . 1 ) 2 ( , 00 . 2 ) 1 (
41 . 1 ) 2 ( , 45 . 2 ) 1 (
3 3
2 2
1 1
= =
= =
= =
g g
g g
g g
From the above results we conclude that, only ) (
2
x g satisfes the existence criteria.
Questions
Why do the other two functions fail the test?
Does ) (
2
x g satisfy the uniqueness criteria?
The Learner is expected to answer the frst question by checking whether or not
) ( , ) (
3 1
x g x g meet the existence criterion for possessing a fxed point in ] 2 , 1 [ . To
answer the second question we note that
28 . 0 ) 2 ( , 40 . 0 ) 1 ( ;
) 4 (
10
) (
/
2
/
2
2
/
2
= =

+
= g g
x
x g
African Virtual University 101
Since 1 4 . 0
2
) 2 , 1 (
< =
dx
dg
Max we conclude that ) (
2
x g has a unique fxed
point ) 2 , 1 ( which is automatically a root of the function ) (x f .
Approximation of the root
The root can be approximated iteratively using the iteration
n n
x
x g x
n
n n
..., , 2 , 1 , 0 ;
4
10
) (
1
=
+
= =
+

for any starting value
0
x taken
from the interval ). 2 , 1 ( The following ten iterates were obtained using the starting
value 0 . 1
0
= x
n
n
x ) (
2 n
x g
0 1.000 000 2.000 000
1 2.000 000 1.666 667
2 1.666 667 1.764 706
3 1.764 706 1.734 694
4 1.734 694 1.743 772
5 1.743 772 1.741 016
6 1.741 016 1.741 852
7 1.741 852 1.741 598
8 1.741 598 1.741 675
9 1.741 675 1.741 652
10 1.741 652 1.741659
We note that the last value 741659 . 1 ) (
10 2
= x g

is very close to the true value of the
root of ) (x f which is 741657 . 1 = rounded to 6 decimal places.
x
n+1
= g
2
(x
n
) =
10
4 + x
n
African Virtual University 102
DO THIS (4.5)
(i) Show that the function ) cos( ) ( x x g = satisfes the conditions for the existence
of a unique fxed point inside the interval ] 1 , 0 [ .
(ii) Use the result obtained in part (a) to fnd in only ten iterations, the point of in-
tersection of the two curves ) cos( , x y x y = = . Start the iteration process
with 1
0
= x .
Reference for the Learning Activity
Kendall E. Atkinson, An Introduction to Numerical Analysis, - John Wiley & Sons,
Second Edition (1989).
African Virtual University 103
Solutions To Formative Evaluation Questions
DO THIS (4.1)
Application of the bisection method in 5 iterations on

) cos( ) ( x x x f =
459698 . 0 ) 1 ( , 1 ) 0 ( = = f f . Because ) (x f is continuous over ] 1 , 0 [ and
0 ) 1 ( ) 0 ( < f f , then by the Intermediate Value Theorem for continuous functions it
follows that ) (x f has at least one root in the interval ). 1 , 0 ( The bisection method
gives the following iterates:
0
0
= x 0 ) (
0
< x f
1
1
= x 0 ) (
1
> x f
5 . 0
2
= x 0 ) (
2
< x f
75 . 0
3
= x 0 ) (
3
> x f
625 . 0
4
= x 0 ) (
4
< x f
6875 . 0
5
= x
5
( ) 0 < f x
71875 . 0
6
= x 0 ) (
6
< x f
DO THIS (4.2)
Application of the secant method in 5 iterations on ). cos( ) ( x x x f =
Formula to be used:
1
1
1
1 1

=
n
n n
n n
n n
f
f f
x x
x x
Starting values given: 459698 . 0 , 1 ; 1 , 0
1 0 1 0
= = = = f f x x
One obtains the following iterates:
African Virtual University 104

000000 . 0 , 739085 . 0
000683 , 0 , 738677 . 0
007979 . 0 , 743847 . 0
505751 . 0 , 410979 . 0
089300 . 0 , 685073 . 0
6 6
5 5
4 4
3 3
2 2
+ = =
= =
+ = =
= =
= =
f x
f x
f x
f x
f x
DO THIS (4.3)
Application of Newton-Raphsons method in three iterations on ) cos( ) ( x x x f =
Formula to be used is
) (
) (
/
1
n
n
n n
x f
x f
x x =
+
.
Starting value given 0
0
= x ; ) sin( 1 ) (
/
x x f + =
One gets the iterates
000047 . 0 ) ( , 739113 . 0
681905 . 1 ) ( , 018923 . 0 ) ( , 750364 . 0
841471 . 1 ) ( , 459698 . 0 ) ( , 000000 . 1
000000 . 1 ) ( , 000000 . 1 ) ( , 000000 . 0
3 4
2
/
2 2
1
/
1 1
0
/
0 0
+ = =
= + = =
= + = =
= = =
x f x
x f x f x
x f x f x
x f x f x
DO THIS (4.4)
y g x g y x y y x g
y f x f y x x y x f
y x
y x
2 1 , 2 , ) , (
2 , 2 1 , ) , (
2 2
2 2
+ = = + =
= = =
Starting values
4 . 0 , 8 . 0
0 0
= = y x
African Virtual University 105
First iteration
420339 . 0 , 772881 . 0
1 1
= = y x
Second iteration
419644 . 0 , 771846 . 0
2 2
= = y x
DO THIS (4.5)
Given: ] 1 , 0 [ , ) cos( ) ( = x x x g
Checking existence of a fxed point
) ( x g is continuous over ] 1 , 0 [ .
] 1 , 0 [ ] 1 , 0 [ ) ( ; 459698 . 0 ) 1 ( , 1 ) 0 ( = = x x g g g
Therefore the existence criterion is fulflled.
Checking uniqueness of a fxed point
) sin( ) (
/
x x g =


| g
/
(x) |<1 x [0,1]




Therefore the uniqueness criterion is fulflled.
Computations
) cos( ) (
1 n n n
x x g x = =
+

Starting value: 0 . 1
0
= x

The following iterates are obtained

African Virtual University 106
744237 . 0 ) cos(
731404 . 0 ) cos(
750418 . 0 ) cos(
722102 . 0 ) cos(
763960 . 0 ) cos(
701369 . 0 ) cos(
793480 . 0 ) cos(
654290 . 0 ) cos(
857553 . 0 ) cos(
540302 . 0 ) cos(
9 10
8 9
7 8
6 7
5 6
4 5
3 4
2 3
1 2
0 1
= =
= =
= =
= =
= =
= =
= =
= =
= =
= =
x x
x x
x x
x x
x x
x x
x x
x x
x x
x x
African Virtual University 107
XI. Compiled List of all Key Concepts
(Glossary)
Key Concepts
Each of the (four) learning activities has key concepts, theorems and principles specifc
to its contents. However, to give the learner an opportunity to have a glimpse at what
lies ahead in terms of the general framework and contents of the module we list here,
a priori, all the key concepts, theorems and principles relevant to the module.
Reproduction of these concepts under their respective learning activities is meant
to enhance the learners understanding and appreciation of their importance in the
overall understanding of the course.
1. Error in an approximation
Let X be the exact (true) value of some quantity Q and
*
X be an approximate value
of Q obtained through some numerical process. The difference (deviation) between
the exact value X and its approximation
*
X is called the error in
*
X , and is denoted
by Error (
*
X ) =
*
X X
2. Absolute error
The error in an approximation may be positive or negative, depending on whether
one has underestimated or overestimated the true value of the quantity Q being ap-
proximated. In practice, what matters more is the size of the error rather than its sign.
In order to ignore the sign and concentrate on the size of the error, one introduces the
concept of absolute error, which is defned by: Absolute error in
*
X =
*
X X .
3. Relative error
The absolute error gives the size of the error and thereby serves as a measure of the
accuracy of the approximation
*
X . However, by not relating the error to the true value
being approximated one may not be able to gauge the seriousness of the error. To
achieve this one introduces the concept of relative error or percentage error. This is
defned by: Relative error in (
*
X ) =
X
X X
*

provided that 0 X . Percentage


African Virtual University 108
error in (
*
X ) =
X
X X
*
100

%provided that

0 X .
Since the true value X is normally not known, one replaces it with the approximate
value
*
X in the denominator of the relative (percentage) error.
4. Arithmetic progression
An arithmetic progression (AP) is a special sequence { } ,... 2 , 1 , 0 : = n a
n
of numbers.
The essential elements of such a sequence are its frst element
0
a and a constant dif-
ference d . Except for the frst element, the th k

element of the sequence is given
as d k a a
k
) 1 (
0
+ = , ,... 3 , 2 , 1 = k
The sum of the frst n terms of an AP is easily shown to be

S
n
= na
0
+
1
2
n(n1)

5. Geometric progression.
A geometric progression (GP) is a special sequence { } ,... 2 , 1 , 0 : = n a
n
of numbers.
The essential elements of such a sequence are its frst element
0
a and a constant
multiplication factor

1 r . Except for the frst element, the th k

element of the
sequence is given by
1
0

=
k
k
r a a , ,... 3 , 2 , 1 = k
The sum of the frst n terms of a GP is

= =

=

1
1
0
1
1
0
r
r
a r a S
n
k
n
k
n
6. Limit of a function
A function ) (x f is said to approach the value (have the limit) L as x approaches
a value c in the domain of f , and we write
lim
x c
f (x) = L
if for every choice of a
small positive number one can fnd a corresponding small positive number ) (
such that whenever
x c < ()
then
f (x) L <
. Essentially this statement
African Virtual University 109
implies that values of the function ) (x f will be arbitrarily close to the number L
provided the corresponding values of x are close enough to point c .
7. Continuity
A function ) (x f is said to be continuous at a point c x = if the limit of the values
) (x f is the value ) (c f , that is if
lim
x c
f (x) = f (a)
. Essentially what this defnition
of continuity implies is that, for ) (x f to be continuous at point c x = the following
three conditions must hold:
(i) The function must be defned at the point: ) (c f must exist.
(ii) The function must have a limit at the point:
lim
x c
f (x) = L

(iii) The limit must be equal to the function value: L c f = ) (
8. Derivative
The derivative of a function ) (x f at an arbitrary point x in its domain is the limit
of the difference quotient
x
x f x x f
x
f

+
=

) ( ) (
as the change x in x tends
to zero, that is

+

x
x f x x f
x
) ( ) (
lim
0
. If the limit exists one denotes it by
dx
df
or ) (
/
x f and calls it the frst derivative of f .
9. Anti-derivative
An anti-derivative of a function ) (x f is itself a function ). (x F The function
F has the property that its derivative must be the function ) (x f , meaning that
) ( ) (
/
x f x F = .
Essentially, the process of fnding an anti-derivative of ) (x f is the reverse process
to that of differentiating a function. For this reason, one also speaks of anti-differen-
tiation when fnding ) (x F . Symbolically one writes

= dx x f x F ) ( ) ( .
African Virtual University 110
10. Convergence of a sequence
A sequence of numbers, written { }
n
a is a well defned and ordered fnite or infnite
set of numbers. The individual members (elements) of the set must be unambiguously
defned. Essentially a set is a special function defned over the set of natural (counting)
numbers N or over a subset of N . A set { }
n
a is said to converge to a limit L if
for every 0 > one can fnd a corresponding positive integer number ) ( N such
that < L a
n
if only ) ( N n > .
11. Fixed point of a function
Given a continuous function ) (x g over a closed interval ] , [ b a any value = x
which satisfes the relation = ) ( g is called a fxed point of the function ) (x g
. The process of fnding fxed points of a function is closely related to that of deter-
mining roots of functions.
12. Secant line
A secant is a line which passes through two given points ) , (
1 1
y x P and ) , (
2 2
y x Q
and is given by the equation ) (
1
1 2
1 2
1
x x
x x
y y
y y

= . The secant equation is



used in deriving the Regula Falsi and the Secant methods for approximating roots
of functions.
African Virtual University 111
Key Theorems and Principles
1. Intermediate Value Theorem
If f is continuous on a closed interval ] , [ b a and if k is any number lying between
the two values ) (a f and ) (b f , then there is at least one number c in ) , ( b a such
that . ) ( k c f = This theorem is the basis upon which two important numerical
methods for fnding roots of a function ) (x f , the bisection method and the Regula
Falsi (Rule of false position).
2. Mean Value Theorem of Differentiation (MVT)
If f is a continuous function on the closed interval ] , [ b a and is differentiable on
the open interval ) , ( b a , then there exists at least one value of ) , ( b a c x = such
that
a b
a f b f
c f

=
) ( ) (
) (
/
.
3. Taylors Theorem
Let f be a function whose frst n derivatives are continuous on the closed interval
] , [ h c c + (or ] , [ c h c + if h is negative) and assume that
) 1 ( + n
f exists in ] , [ h c c +
(or ] , [ c h c + if h is negative). Then, there exists a number , with 1 0 < <

such that
) , ( ) (
!
) (
1
) (
0
h c f
k
h
h c f
Rn
k
n
k
k
+
=
+ = +

, ) (
)! 1 (
) , (
) 1 (
1
1
h c f
n
h
c
n
n
n R
+
+
=
+
+
+
4. Fundamental Theorem of Calculus
If f is continuous on [ , ] a b and ( ) ( )
x
a
F x f t dt =

for each x in [ , ] a b , then ( ) F x


is continuous on [ , ] a b and differentiable on ( , ) a b and
African Virtual University 112
( )
dF
f x
dx
= . In other words, ( ) F x is an anti-derivative of ( ) f x .

Corollary: If ( ) f x is continuous on a closed and bounded interval [ , ] a b , and

'
( ) g x = ( ) f x , then

( ) ( ) ( )
b
a
f x dx g b g a =

.
5. Fixed Point Theorem
If the function ) (x g is continuous over b x a and ] , [ ) ( b a x g ] , [ b a x

then there exists at least one fxed point ] , [ b a x = such that = ) ( g .
If, in addition to the above assumptions, ) (x g is differentiable in b x a < < and
1 < L
dx
dg
for all ) , ( b a x , then ) (x g has a unique (only one) fxed point

). , ( b a
African Virtual University 113
XII. Compiled List Of Compulsory Readings
Wikipedia: Numerical Analysis
Wikipedia: Interpolation
Fundamental Numerical Methods and Data Analysis, George W. Collins, II, chapter
4. (see: http://bifrost.cwru.edu/personal/collins/numbk/)
Wikipedia: Numerical Methods/Numerical Integration
Wikipedia: Numerical Methods/Equation Solving
African Virtual University 114
XIII. Compiled List of (Optional) Multimedia
Resources
Reading # 1: Wolfram MathWorld (visited 03.11.06)
Complete reference : http://mathworld.wolfram.com
Abstract : Wolfram MathWorld is a specialised on-line mathematical encyclopedia.
Rationale: It provides the most detailed references to any mathematical topic. Stu-
dents should start by using the search facility for the module title. This will fnd a
major article. At any point students should search for key words that they need to
understand. The entry should be studied carefully and thoroughly.
Reading # 2: Wikipedia (visited 03.11.06)
Complete reference : http://en.wikipedia.org/wiki
Abstract : Wikipedia is an on-line encyclopedia. It is written by its own readers.
It is extremely up-to-date as entries are contunally revised. Also, it has proved to be
extremely accurate. The mathematics entries are very detailed.
Rationale: Students should use wikipedia in the same way as MathWorld. However,
the entries may be shorter and a little easier to use in the frst instance. Thy will,
however, not be so detailed.
Reading # 3: MacTutor History of Mathematics (visited 03.11.06)
Complete reference :http://www-history.mcs.standrews.ac.uk/Indexes
Abstract : The MacTutor Archive is the most comprehensive history of mathematics
on the internet. The resources are organsied by historical characters and by historical
themes.
Rationale: Students should search the MacTutor archive for key words in the topics
they are studying (or by the module title itself). It is important to get an overview
of where the mathematics being studied fts in to the hostory of mathematics. When
the student completes the course and is teaching high school mathematics, the cha-
racters in the history of mathematics will bring the subject to life for their students.
Particularly, the role of women in the history of mathematics should be studied to
help students understand the diffculties women have faced while still making an
important contribution.. Equally, the role of the African continent should be studied
to share with students in schools: notably the earliest number counting devices (e.g.
the Ishango bone) and the role of Egyptian mathematics should be studied.
African Virtual University 115
XIV. Synthesis of the Module
Completion of the fourth learning activity marks the end of this module. At this
juncture, and before presenting oneself for the summative evaluation, it is desirable
and appropriate that the learner refects back on the mission, objectives, activities
and attempts to form a global picture of what he/she is expected to have achieved as
a result of the collective time and efforts invested in the learning process.
As laid out in the module overview in Section 6, the learner is expected to have
acquired knowledge of the basic concepts relating to numerical approximation of
numbers and functions.
The learner is now expected to be able to comfortably defne the concept of an er-
ror in mathematics, identify the sources of errors, the different types of errors and
methods of reducing the impact of errors on our fnal numerical approximation to a
mathematical problem.
After the opening learning activity on errors three substantive learning activities on
the core issue of approximation were presented. One of these three core learning ac-
tivity was on numerical approximation of functions using interpolation polynomials.
Specifcally the learner is now expected to be reasonably comfortable in using linear
interpolation in its various forms and derive an error bound for linear interpolation. The
activity also presents the important topic of interpolation polynomials, concentrating
on Lagrangean, Newtons divided differences and the all important fnite difference
interpolation polynomials.
The remaining two core learning activities (the third and fourth) are on numerical
methods for approximating numbers (roots of functions and values of defnite inte-
grals). In this regard the learner is expected to have appreciated the need for resorting
to numerical methods, but also be able to apply the methods learnt, including the
Bisection, Regula-Falsi, Secant and the Newton-Raphson methods for approximating
roots of a non-linear function of a single variable. One is also expected to solve a
evaluate limits of functions, sequences and infnite series. One is also expected to be
able to apply Newtons method to approximate solutions of a couples system of two
nonlinear equations in two variables.
The module has been structured with a view to escorting and guiding the learner
through the material with carefully selected examples and references to the core
references. A reasonable number of worked out examples have been included in
every learning activity to serve as beacons of reference both in understanding the text
before them as well as serving as points of reference while solving related formative
evaluation problems that appear in the text in the form of DO THIS. The degree of
mastery of the module contents will largely depend on the learners deliberate and
planned efforts to monitor his/her progress by solving the DO THIS problems.
African Virtual University 116
XV. Summative Evaluation
Questions
1. (a) Defne the concept of an error in mathematics.
(b) Give the main types of mathematical errors and mention their sources.
(c) Distinguish between absolute and relative errors and attempt to relate them
to the concepts of accuracy and precision.
2. (a) The error ) (x E in linear interpolation of a function ) (x f using
the values ) ( , ) (
1 1 0 0
x f f x f f = = where h x x =
0 1

is given by
) (
2
1
) )( ( ) (
//
1 0
f x x x x x E = , where ) , (
1 0
x x . Derive an upper bound
for E .
(b) Use the error bound obtained in part (a) to determine the smallest interval
size h for which linear interpolation of ) cos(x will give approximate values
with errors not exceeding

01 . 0 .

3. The following table gives values of a function ) (x f at a number of equally
spaced points
k
x .

x 0.0 0.125 0.25 0.375 0.5
f(x) 1.000000 0.984615 0.941176 0.876712 0.800000
x 0.625 0.75 0.875 1.0
f(x) 0.719101 0.640000 0.566372 0.500000
Approximate ) (x f by a quadratic Lagrangean interpolation polynomial using the
points ) 876712 . 0 , 375 . 0 ( , ) 941176 . 0 , 25 . 0 ( , ) 984615 . 0 , 125 . 0 ( and hence,
interpolate ) (x f at 3 . 0 = x .
African Virtual University 117
4. (a) Construct a table of fnite differences for the function ) (x f tabulated in
Question 3 (a).
(b) With the aid of the table of fnite differences interpolate the function at 4 . 0 = x
using Bessels interpolation formula centered at 375 . 0
0
= x

... ) 2 )( 1 (
24
1
)
2
1
)( 1 (
6
1
) 1 (
2
1
)
2
1
( ) (
2
1
4 2
2
1
3
2
1
2
2
1
2
1
+ =
+ + + + =
f s s s
f s s s f s s f s f s f


where ) (
1
0
x x
h
s =
5. Apply Newtons interpolation based on divided differences to interpolate the
function tabulated in Question 4 at the point 4 . 0 = x
6. (a ) Derive a Newton-Raphson iteration formula for approximating the
th
r root
of a positive real number A.
(b) If 7 = A apply the formula you have derived to approximate the square root
of 7 correct to six decimals. Start the iteration with . 2
0
= x
7. (a) Defne the concept of a fxed point for a function ) (x g which is known to be
continuous over ] , [ b a and differentiable in ). , ( b a
(b) State without proof, the existence and uniqueness theorem for fxed points
of ). (x g
(c) Discuss whether or not the function
g(x) =
4
6 x
has a unique fxed
point in the interval ] 1 , 0 [ .
African Virtual University 118
8. (a) Using an analytical method calculate all the solutions of the coupled system
2 2 , 5 2
2 2 2 2
= = + y x y x

correct to 6 decimal places.
(b) Starting with 5 . 0 , 5 . 1
0 0
= = y x approximate one of the solutions by
carrying out two iterations with Newtons method for systems of nonlinear
equations.
9. (a) Find the anti-derivative ) (x F of the function
2 3
) (
2
+ +
=
x x
x
x f and use
it to evaluate the integral dx
x x
x

+ +
1
0
2
2 3
correct to 6 decimals.

(b) Evaluate the above integral using the Newton-Cotes formula
[ ] ) ( ) ( 3 ) ( 3 ) (
8
3
) (
3 2 1 0
3
0
x f x f x f x f
h
dx x f
x
x
+ + + =


with
6
1
= h .
10. (a) Evaluate the integral ( )dx x e
x


1
0
) cos( analytically correct to 6 decimal
places accuracy.
(b) Tabulate values of the integrand in (a) at the points k x
k
125 . 0 =
8 ,... 2 , 1 , 0 = k and use the values obtained with the Trapezoidal rule to
approximate the integral, taking 25 . 0 = h and 125 . 0 = h , respectively.
(c ) Apply Romberg integration on the two Trapezoidal values obtained in (b)
to obtain a better approximation of the integral in (a).
African Virtual University 119
SOLUTIONS
1. (a) If
*
X is an approximation to an exact (true) quantity X , then the deviation
*
X X

is called the error in the approximation
*
X .
(b) The main types of mathematical errors are:
Initial errors. These are errors in the initial data supplied with a mathematical
problem.
Discretization errors. These are errors caused by the process of converting
a mathematical problem having a continuous solution to a numerical model
whose solution is a discrete function in the form of a sequence of numbers.
Truncation errors. These are errors introduced through unavoidable termina-
tion (truncation) of an otherwise infnite process such an infnite series or a
convergent iteration.
Rounding errors. These are errors introduced because of limitations on the
part of the instruments we use in performing arithmetic operations (addition,
subtraction, multiplication or division).
(c) The absolute error is the magnitude or size of an error. The absolute error, denoted
by
*
X X is always non-negative.
The relative error is the ratio between the absolute error and the absolute value
of the true (exact) quantity being approximated. The relative error is denoted by
X
X X
*

.
The absolute error is a measure of the accuracy in the approximation, while the relative
error is a measure of the precision and relates to the seriousness of the error.
2. (a) To obtain a bound on the error ) (x E in linear interpolation one needs to
fnd the maximum value of the functions ) )( ( ) (
1 0
x x x x x g = and ) (
//
f
over the interval
1 0
x x x < < . With ) ( 2 ) (
0 0
/
x x x x g + = we fnd that ) (x g
has a critical point at ) (
2
1
1 0
*
x x x + = , and because 2 ) (
//
= x g is always
positive we conclude that
4
) (
4
1
) (
2
2
0 1
*
h
x x x g = =

Assuming that
African Virtual University 120
M x f Max = ) (
//
over the interval in question we can then write
[ ]
8
) ( ) (
2
M h
x g Max M x E =
(b) The function being approximated is ). cos( ) ( x x f = In this case, ) cos( ) (
//
x x f =
and in this case 1 = M . We now must determine the step length h such that
01 . 0
8 8
2 2
=
h Mh
. This gives the result 3 . 0 h
3. The quadratic Lagrangean interpolation polynomial passing through three points
) , ( ), , ( ), , (
2 2 1 1 0 0
f x f x f x is given by the expression

2 2 1 1 0 0 2
) ( ) ( ) ( ) ( f x L f x L f x L x P + + = where ) ( ), ( ), (
2 1 0
x L x L x L are theLa-
grangean coeffcients of degree 2. In this case we have the following values:

) )( (
) )( (
) ( , 876712 . 0 , 375 . 0
) )( (
) )( (
) ( , 941176 . 0 , 250 . 0
) )( (
) )( (
) ( , 984615 . 0 , 125 . 0
1 2 0 2
1 0
2 2 3
2 1 0 1
2 0
1 1 1
2 0 1 0
2 1
0 0 0
x x x x
x x x x
x L f x
x x x x
x x x x
x L f x
x x x x
x x x x
x L f x


= = =


= = =


= = =
With 3 . 0 = x , direct substitution of the various values of involved into the expressions
for the Lagrangean coeffcients gives:
28 . 0 ) 3 . 0 ( , 84 . 0 ) 3 . 0 ( , 12 . 0 ) 3 . 0 (
2 1 0
= = = L L L ,
results which lead to the solution
917913 . 0 ) 876712 . 0 )( 28 . 0 ( ) 941176 . 0 )( 84 . 0 ( ) 984615 . 0 )( 12 . 0 (
) 3 . 0 ( ) 3 . 0 ( ) 3 . 0 ( ) 3 . 0 (
2 2 1 1 0 0 2
= + + =
+ + = f L f L f L P

African Virtual University 121
4. (a) Table of Differences
Differences
x f(x) First Second Third Fourth
0.000 1.000000
-0.015385
0.125 0.984615 -0.028054
-0.043439 0.007029
0.250 0.941176 -0.021025 0.001748
-0.064464 0.008777
0.375 0.876712 -0.012248 -0.000716
-0.076712 0.008061
0.500 0.800000 -0.004187 -0.005672
-0.080899 0.002389
0.625 0.719101 -0.001798 0.001286
-0.079101 0.003675
0.750 0.640000 -0.005473 -0.005458
-0.073628 -0.001783
0.875 0.566372 -0.007256
-0.066372
1.000 0.500000
(b) Since
0
0.375, 0.4, 0.125 = = = x x h , then value of the parameter

1
(0.4 0.375) 0.2
0.125
= = s
African Virtual University 122
With the aid of the table of fnite differences interpolate the function at 4 . 0 = x
using Bessels interpolation formula:

0000459936 . 0 ) 006388 . 0 (
2
1
) 0144 . 0 ( ) 2 )( 1 (
24
1
000064488 . 0 ) 008061 . 0 )( 008 . 0 ( )
2
1
)( 1 (
6
1
0006574 . 0 ) 012248 . 0 004187 . 0 (
2
1
) 08 . 0 0 ( ) 1 (
2
1
0230136 . 0 ) 076712 . 0 )( 3 . 0 ( )
2
1
(
838356 . 0 ) (
2
1
2
1
4 2
2
1
3
2
1
2
2
1
0 1
2
1
= =
= =
= =
= =
= + =
f s s s
f s s s
f s s
f s
f f f


Addition of all these terms leads to the answer 862137 . 0 ) 4 . 0 ( = P .
5. First one constructs the table of Newtons divided differences. Then one applies
the interpolation polynomial

... ] , , [ ) )( ( ] , [ ) ( ) (
2 1 0 1 0 1 0 0 0
+ + + = x x x f x x x x x x f x x f x P
n


Table of Newtons Divided Differences
Divided Differences
x f(x) First Second Third Fourth
0.0 1.000000
-0.12308
0.125 0.984615 -0.897728
-0.347512 0.599808
0.25 0.941176 -0.672800 0.298326
-0.515712 0.748971
0.375 0.876712 -0.391936 -0.122198
-0.613696 0.687872
0.5 0.800000 -0.133984 -0.354304
-0.647192 0.510720
0.625 0.719101 0.057536 -0.394240
-0.632808 0.0.313600
0.75 0.640000 0.175136 -1.251670
-0.589024 -0.312235
0.875 0.566372 0.058048
-0.530976
1.0 0.500000
African Virtual University 123
Direct application of the formula based on 375 . 0
0
= x and using the values of va-
rious divided differences highlighted in the table together with the value 4 . 0 = x
gives the following results:
000077616 . 0 ] , , , , [ ) )( )( )( (
00028728 . 0 ] , , , [ ) )( )( (
00033496 . 0 ] , , [ ) )( (
0153424 . 0 ] , [ ) (
876712 . 0 ) (
4 3 2 1 0 3 2 1 0
3 2 1 0 2 1 0
2 1 0 1 0
1 0 0
=
=
=
=
=
x x x x x f x x x x x x x x
x x x x f x x x x x x
x x x f x x x x
x x f x x
x f

Therefore
= + + + 000078 . 0 000287 . 0 000335 . 0 015342 . 0 876712 . 0 ) 4 . 0 (
4
P , 0.862070
6. (a) If
r
A x = then, 0 = A x
r
.
One may therefore take the function whose roots are being sought to
be A x x f
r
= ) ( .
The derivative of ) (x f is

1 /
) (

=
r
rx x f .
Substituting these quantities into the Newton-Raphson formula

) (
) (
/
1
n
n
n n
x f
x f
x x =
+

we obtain the general Newton-Raphson formula

+ =

+
=
+
=


+
1
1 1 1
1
) 1 (
1
) 1 ( 1
r
n
n
r
n
r
n
r
n
r
n
r
n
r
n
r
n
n n
x
A
x r
r
x
A x r
r
rx
A x rx
rx
A x
x x

African Virtual University 124
(b) The Newton-Raphson formula for fnding the square root of a number 7 = A
and 2 = r . This gives the special formula

+ =
+
n
n n
x
x x
7
2
1
1
.
Taking 0 . 2
0
= x the following iterates are obtained from the formula:

6457513 . 2
6457513 . 2
6457520 . 2
6477273 . 2
75 . 2
0 . 2
6
5
4
3
1
0
=
=
=
=
=
=
x
x
x
x
x
x


Since the 7
th
decimal digit remains constant in the last two iterates we accept
645751 . 2 = x as the desired approximation of 7 correct to 6 decimals.
7. (a) A number

is said to be a fxed point of a function ) (x g if = ) ( g .
(b) If ) (x g is a function which satisfes the conditions
) (x g is continuous over a closed interval ] , [ b a
] , [ ] , [ ) ( b a x b a x g
) (x g is differentiable in ) , ( b a
) , ( 1 ) (
/
b a x L x g Max < =
Then ) (x g has a unique fxed point ) , ( b a .
(c) Consider the function
g(x) =
4
6 x
over the interval ] 1 , 0 [ .
Since the only point of discontinuity for the function is 6 = x , the function is
defnitely continuous over the interval ] 1 , 0 [ .
African Virtual University 125
With both
6
4
) 0 ( = g and
5
4
) 1 ( = g lying in ) 1 , 0 ( we also note that all the function

values lie inside the given interval.
The function is also differentiable and
g(x) =
4
(6 x)
2
. The maximum value of .
g
/
(x) = g
/
(0) =
4
36
=
1
9
<1
This result proves that the function has a unique fxed
point in the interval 1 0 < < x .
8. (a) Analytical Solution
To obtain the true (analytical) solution one eliminates one of the variables and
solves the resulting quadratic equation in the retained variable.
From the frst equation one fnds

2 2
2 5 x y =

We use this result to eliminate y from the second equation.

=
+ =
= = = =
549193 . 1
549183 . 1
4 . 2 12 5 2 ) 2 5 ( 2
2
1
2 2 2
x
x
x x x x

The corresponding values of y is obtained from the relation

=
+ =
= = =
447213 . 0
447213 . 0
2 . 0 2 5
2
1
2
y
y
x y

The four possible solutions to the coupled system are

) 447213 . 0 , 549183 . 1 ( , ) 447213 . 0 , 549163 . 1 (
) 447213 . 0 , 549183 . 1 ( , ) 447213 . 0 , 549183 . 1 (



African Virtual University 126
(b) Approximation of the roots using Newtons method
Let

0 2 2 ) , (
0 5 2 ) , (
2 2
2 2
=
= +
y x y x g
y x y x f
The partial derivatives of ) , ( y x f and ) , ( y x g are

y g
y
g
x g
x
g
y f
y
f
x f
x
f
y x
y x
4 ; 2
2 ; 4
= =

= =

= =

= =

Newtons method states t that, starting from an approximate solution ) , (


n n
y x an
improved approximation ) , (
1 1 + + n n
y x can be obtained by setting
n n n n n n
k y y h x x + = + =
+ + 1 1
, .
The increments
n n
k h , are obtained by solving the linear system of equations

g
f
k
h
g f
g f
n
n
y y
x x
Application of Newtons method:
First Iteration
0 . 2 , 0 . 3 , 25 . 0
0 . 1 , 0 . 6 , 25 . 0
5 . 0 , 5 . 1
0
0
0 0
= = =
= = =
= =
y x
y x
g g g
f f f
y x

African Virtual University 127
Substituting these quantities into the linear system and solving the resulting system
one gets 083333 . 0 , 083333 . 0
0 0
= = k h

and therefore
416667 . 0 , 583333 . 1
0 0 1 0 0 1
= + = = + = k y y h x x
Second Iteration

666668 . 1 , 166666 . 3 , . 159721 . 0
833334 . 0 , 333333 . 6 , . 187498 . 0
416667 . 0 , 583333 . 1
1
1
1 1
= = =
= = =
= =
y x
y x
g g g
f f f
y x


Substituting these quantities into the linear system and solving the resulting system
one gets 031667 . 0 , 033772 . 0
1 1
= = k h and therefore
448334 . 0 , 549561 . 1
1 1 2 1 1 2
= + = = + = k y y h x x
9. (a) The anti-derivative of the function
2 3
) (
2
+ +
=
x x
x
x f


t Cons
x
x
x x
dx
x x
x x
x x
dx
x x
x x d
x x
dx
dx
x x
x
dx
x x
x
x x
xdx
tan
2
1
ln
2
3
) 2 3 ln(
2
1
2
1
1
1
2
3
) 2 3 ln(
2
1
) 2 )( 1 ( 2
3
2 3
) 2 3 (
2
1
2 3 2
3
2 3
3 2
2
1
2 3
3 3 2
2
1
2 3
2
2
2
2
2 2 2 2
+

+
+
+ + =

+
+ + =
+ +

+ +
+ +
=
+ +

+ +
+
=
+ +
+
=
+ +





Therefore, dx
x x
x

+ +
1
0
2
2 3
=

[ ] 117783 . 0 431523 . 0 549306 . 0
2
1
ln
3
2
ln
2
3
) 2 ln( ) 6 ln(
2
1
= =


African Virtual University 128
(b) To approximate the same integral dx
x x
x
I

+ +
=
1
0
2
2 3

using the special
Newton-Cotes formula [ ] ) ( ) ( 3 ) ( 3 ) (
8
3
) (
3 2 1 0
3
0
x f x f x f x f
h
dx x f
x
x
+ + + =


One frst tabulates the function:

k
x
0
0
= x
6
1
1
= x
6
2
2
= x
6
3
3
= x
6
4
4
= x
6
5
5
= x
0 . 1
6
= x
k
f
0 . 0 065934 . 0 107143 . 0 133333 . 0
15 . 0
160428 . 0 166667 . 0
While the given formula involves values of the function over three consecutive inter-
vals, the specifed interval length
6
1
= h results in a pair of such consecutive intervals,
] , , , [
3 2 1 0
x x x x and ] , , , [
6 5 4 3
x x x x . Therefore, the integral will be approximated by
the expression
( ) ( ) { } 117741 . 0 3 3 3 3
8
3
6 5 4 3 3 2 1 0
= + + + + + + + = f f f f f f f f
h
I

10. (a) The value of the integral ( )dx x e
x


1
0
) cos( is
[ ] [ ] 876811 . 0 ) 0 sin( ) 1 sin(
0 1
= e e

(b) Table of values of the integrand ) cos( ) ( x e x f
x
=

for values at the
equidistant points: 0 . 1 ) 125 . 0 ( 0 . 0 = x :

) 177980 . 2 , 0 . 1 ( , ) 757878 . 1 , 875 . 0 ( , ) 385311 . 1 , 75 . 0 (
) 057283 . 1 , 625 . 0 ( , ) 771139 . 0 , 5 . 0 (
) 524484 . 0 , 375 . 0 ( ), 315113 . 0 , 25 . 0 ( , ) 140951 . 0 , 125 . 0 ( , ) 0 . 0 , 0 . 0 (

African Virtual University 129

With the aid of the extended trapezoidal rule one fnds:
880144 . 0 ) 125 . 0 ( , 890138 . 0 ) 25 . 0 ( = = T T
(c) Application of Romberg integration on the two Trapezoidal values obtained
above gives
[ ] 876813 . 0 ) 25 . 0 ( ) 125 . 0 (
3
1
) 125 . 0 ( ] 125 . 0 , 25 . 0 [ = + = T T T R
African Virtual University 130
XVI. References
G. Stephenson, 1973, Mathematical Methods for Science Students Second Edition,
Pearson Education Ltd.
Brian Bradie, A friendly Introduction to Numerical Analysis, Pearson Education
International.
A.C. Bajpai, I.M. Calus and J.A. Fairley, 1975, Numerical Methods for Engineers
and Scientists, Taylor & Francis Ltd., London.
Burden and Faires, 1985, Numerical Analysis Fifth Edition, PWS KENT Pu-
blishing Company.
Fox, L. and Mayers, D.F., 1958, Computing Methods for Scientists and Engineers,
- Oxford University Press, London.
Kendall E. Atkinson, 1987, An Introduction to Numerical Analysis, John Wiley &
Sons.
M.K. Jain, S.R.K. Iyengar & R.K. Jain, 1993, Numerical Methods Problems and
Solutions, Wiley Eastern Ltd.
Walter Jennings, 1964. First Course in Numerical Methods, Collier Macmillan
Ltd.
Lay, 2002, Linear Algebra and its Applications Third Edition, Addison Wesley.
African Virtual University 131
XVII. Author of the Module
Dr. Ralph W.P. Masenge is Professor of Mathematics in the Faculty of Science,
Technology and Environmental Studies at the Open University of Tanzania. A graduate
in Mathematics, Physics and Astronomy from the Bavarian University of Wuerzburg
in the Federal Republic of Germany in 1968, Professor Masenge obtained a Masters
degree in Mathematics from Oxford University in the United Kingdom in 1972 and
a Ph. D in Mathematics in 1986 from the University of Dar Es Salaam in Tanzania
through a sandwich program carried out at the Catholic University of Nijmegen in
the Netherlands.
For almost 33 years (May 1968 October 2000) Professor Masenge was an acade-
mic member of Staff in the Department of Mathematics at the University of Dar Es
Salaam during which time he climbed up the academic ladder from Tutorial Fellow
in 1968 to full Professor in 1990. From 1976 to 1982, Professor Masenge headed
the Department of Mathematics at the University of Dar Es Salaam. He also served
as Associate Dean in the Faculty of Science and was Acting Chief Administrative
Offcer of the University of Dar e salaam for one year (1995).
Born in 1940 at Maharo Village situated on the slopes of Africas tallest mountain,
The Killimanjaro, Professor Masenge retired in 2000 and left the services of the
University of Dar Es Salaam to join the Open University of Tanzania where he
now heads the Directorate of Research and Postgraduate Studies as well as being in
charge of a number of Mathematics Courses in Calculus, Mathematical Logic and
Numerical Analysis.
Professor Masenge is married and has four children. His main hobby is working on
his small banana and coconut farm at Mlalakuwa Village, situated some 13 km from
the City Centre on the outskirts of Dar Es Salaam, the commercial capital of the
United Republic of Tanzania.

You might also like