You are on page 1of 32

Unit 1 Errors and Approximations

UNIT 1

ERRORS
ERRORS AND APPROXIMATIONS
APPROXIMATIONS

Structure Page No.


No.

1.1 Introduction 9
Objectives
1.2 Essential Preliminaries 10
1.3 Round-off Error 21
1.4 Truncation Error 25
1.5 Summary 33
1.6 Solutions / Answers 34

1.1 INTRODUCTION
Any mathematical problem can either be solved by an analytical method or a
numerical method. Mostly, the analytical solutions are expressed in the closed
forms and are exact. However, most of the numerical methods give answers
that are approximations to the desired solutions. In such situations, it is
important to measure the accuracy of the approximate solution compared to
the actual solution. To find the accuracy we must have an idea of the possible
errors that can arise in computational procedures. In this unit, we shall
introduce you to different forms of errors which are common in numerical
computations.

You are already familiar with some fundamental theorems about continuous
functions from your calculus course (BMTC-131). Here we shall review some
of the theorems given in that course, namely, Intermediate value theorem,
Rolle’s theorem and Lagrange’s mean value theorem etc. We shall discuss
some more theorems about the roots of the polynomial equation from the
course calculus. As you go along the course, you will be using these concepts,
therefore we will discuss these theorems in Sec.1.2 under the heading
essential preliminaries. We shall also discuss a few basic ideas and concepts
regarding errors considerations, absolute and relative errors, round-off errors
and truncation errors. We shall discuss round-off error and truncation error in
Sec.1.3 and Sec.1.4, respectively.

The basic ideas and results that we have illustrated in this unit will be used
often throughout this course. So, we suggest you go through this unit very
carefully.
9
Block 1 Solution of Nonlinear Equations in One Variable
Now we will list the objectives of this unit. After going through the unit, please
read this list again and make sure that you have achieved the objectives.

Objectives
After studying this unit you should be able to
• apply intermediate value theorem, Rolle’s theorem, Lagrange’s mean
value theorem, Taylor’s theorem and other theorems wherever applicable
for continuous functions defined on closed intervals;
• define the term ‘error’ in approximation;
• distinguish between round-off error and truncation error and calculate
these errors as the situation demands.

1.2 ESSENTIAL PRELIMINARIES


We shall begin the unit with a brief discussion on some fundamental theorems
in calculus, namely, intermediate value theorem, Rolle’s theorem, Lagrange’s
mean value theorem, Taylor’s theorem and some other theorems. You may
recall from your knowledge of the course calculus (BMTC-131) that these
theorems use properties of continuous functions defined on closed intervals
[a , b ] .

Let us discuss these theorems one by one. We begin with intermediate value
theorem.

According to intermediate value theorem, if a function f is continuous on a


closed interval [a , b], then it takes on every intermediate value, i.e., every
value lying between f (a ) and f (b), if f (a ) ≠ f (b), at some point within the
interval.

Formally, we can state the theorem as follows:

Theorem 1(Intermediate Value (IV) Theorem): Let f be a function defined


on a closed interval [a , b] satisfying the following properties;
a) f is continuous on the interval [a , b].
b) c be a number lying between f (a ) and f (b) (i.e., f (a ) < c < f (b) if
f (a ) < f (b) or f (b) < c < f (a ), if f (b) < f (a ) ).

Then there exists at least one point x 0 ∈ [a , b] such that f ( x 0 ) = c .

You can visualise the geometrical view of the theorem in Fig. 1.

10 Fig. 1
Unit 1 Errors and Approximations
From Fig. 1, it is clear that f (a ) > f (b) and f (a ) > c > f (b). You can also
observe that the points (a , f (a )) and (b, f (b)) lie on the opposite sides of the
line y = c . Further f is continuous, which implies that the graph crosses the
line y = c at some point, which is ( x 0 , c).

We now illustrate examples based on IV theorem here.

Example 1: Check whether the equation x 3 + 2x 2 − x + 3 = 8 has a solution in


the interval [1, 2] .

Solution: Let f ( x ) = x 3 + 2x 2 − x + 3. We can then write the given equation


as f ( x ) = 8 and the following holds for f :
i) f is continuous on [1, 2] being a polynomial in x.
ii) f (1) = 5, f (2) = 17 and 8 lies between f (1) and f (2) .

Thus, f satisfies all the conditions of Theorem 1. Therefore, there exists a


number x 0 between 1 and 2 such that f ( x 0 ) = 8 . That is, the equation
x 3 + 2x 2 − x + 3 = 8 has solution in the interval [1, 2] .
***
1
Example 2: Find the value of x in 0 ≤ x ≤ π for which cos x = .
2
1
Solution: Let f ( x ) = cos x. We can write the given equation as f ( x ) =
2
and f holds the following:
i) The function f is continuous on [0, π] .

1
ii) f (0) = 1 and f (π) = −1 , we have f (π) < < f (0).
2
Thus, f satisfies all the conditions of Theorem 1. Therefore, there exists at
1
least one value of x , say x 0 , such that f ( x 0 ) = , that is, the theorem
2
1
guarantees that there exists a point x 0 such that cos(x 0 ) = . Let us try to
2
locate this point on the graph of cos x in the interval [0, π] (see Fig. 2).

Fig. 2 11
Block 1 Solution of Nonlinear Equations in One Variable
1
From Fig. 2, you can see that the line y = cuts the graph at the point
2
π 1  π
 ,  . Hence, there exists a point x 0 = in [0, π] such that
4 2 4
1
cos ( x 0 ) = .
2
***

Thus, we saw that Theorem 1 enables us in establishing the existence of the


solutions of certain equations of the type f ( x ) = 0 without actually solving
them. In other words, if you want to find an interval in which a solution (or
root) of f ( x ) = 0 exists, then find two numbers a , b such that f (a ) f (b) < 0 .
Theorem 1, then states that the solution lies in [ a , b]. We shall then need
some numerical methods for finding the actual solution. We shall study the
problem of finding solutions of the equation f ( x ) = 0 more elaborately in
Unit 2 onwards in this block.

Now let us discuss Rolle’s theorem. The theorem is named after the
seventeenth century French mathematician Michel Rolle (1652-1719).

Theorem 2 (Rolle’s Theorem): Let f be a function defined on [a , b] and


satisfies the following properties:
a) f is continuous on the interval [a , b]
b) f is differentiable on the interval ]a , b[
c) f (a ) = f (b)

Michel Rolle Then there exists a number x 0 in ]a , b[ such that f ′( x 0 ) = 0.


(1652-1719)
Geometrically, we can interpret the theorem easily. You can observe the
smooth curve of the function f as shown in Fig. 3.

Fig. 3

From Fig. 3, it is clear that the function f being a continuous on [a , b] is a


smooth curve. You know that the derivative f ′( x 0 ) at some point x 0 gives the
slope of the tangent at ( x 0 , f ( x 0 )) to the curve y = f ( x ) . The end values f (a )
12
Unit 1 Errors and Approximations
and f (b) are equal, then there exists a point x 0 in ] a , b [ such that the slope
of the tangent at the point P(x 0 , f ( x 0 )) is zero, that is, the tangent at the point
P is parallel to x -axis as shown in Fig. 3. However, there may be situations
where f ′(x 0 ) = 0 at more than one point. Thus, the number x 0 in Theorem 2
may not be unique.

We now illustrate the theorem in the following example.

Example 3: Use Rolle’s theorem to show that there is a solution of the


equation x − 1 + tan x = 0 in ] 0,1[.
Solution: Here we have to solve the equation x − 1 + tan x = 0. We rewrite it as
( x − 1) cos x + sin x ( x − 1) cos x + sin x = 0
= 0. Solving the equation in ]0,1[ is
cos x cos x
same as solving the equation ( x − 1) cos x + sin x in ]0,1[.

Now we shall see whether we can find a function f which satisfies the
conditions of Rolle’s theorem and for which f ′(x ) = ( x − 1) cos x + sin x.

From our experience of differentiating the product of two functions, we may try
the function f where f ( x ) = (x − 1) sin x.

Here,
i) f is continuous in [0,1].
ii) f is differentiable in ] 0,1[
iii) f (0) = 0 = f (1)

Thus, f satisfies all the conditions of Rolle’s theorem. Hence, there exists a
point x 0 in ] 0,1[, such that f ′(x 0 ) = (x 0 − 1) cos x 0 + sin x 0 = 0.

This shows that a solution to the equation x − 1 + tan x = 0 exists in ] 0,1[.


***

Let us look again at Fig.3 carefully. You can see that the line joining (a , f (a ))
and (b, f (b)) is parallel to the tangent at ( x 0 , f ( x 0 )) . Does this property hold
when f (a ) ≠ f (b) also? In other words, does there exist a point x 0 in ] a , b [
such that the tangent at ( x 0 , f ( x 0 )) is parallel to the line joining (a , f (a )) and
(b, f (b)) ? The answer to this question is the content of the well-known
theorem, “Lagrange’s mean value theorem”, which we discuss next. This
theorem was first proved by the French mathematician Joseph Louis Lagrange Joseph-Louis
(1736-1813). Lagrange
(1736-1813)
Theorem 3 (Lagrange’s Mean Value Theorem): Let f be a function defined
on [a , b] and satisfies the following properties:
i) f is continuous on the interval [a , b]
ii) f is differentiable on the interval ]a , b[

Then, there is a number x 0 in ]a , b[ such that


f ( b ) − f (a )
f ′(x 0 ) =
b−a 13
Block 1 Solution of Nonlinear Equations in One Variable
Equivalently, there is a number x 0 in ] a , b [ such that

(b − a )f ′( x 0 ) = f (b) − f (a ).

The geometric view of the theorem is shown in Fig. 4.

Fig. 4

In Fig. 4, you can see that the straight line joining the end points (a , f (a )) and
(b, f (b)) of the graph is parallel to some tangent to the curve at an
intermediate point P( x 0 , f (x 0 )).

Remark 1: You may note that Rolle’s theorem is a special case of mean value
theorem. Suppose f is a function defined on [a , b] which satisfies all the
conditions of Lagrange’s mean value theorem. Then there exists a point x 0 in
f ( b ) − f (a )
] a , b [ such that f ′(x 0 ) = .
b−a

In particular, if f satisfies the condition that f (a ) = f (b) , i.e., f (b) − f (a ) = 0 ,


then we get from above f ′(x 0 ) = 0 . This is what the Rolle’s theorem states.
Hence, we deduce that, in the statement of Lagrange’s mean value theorem, if
we put the extra condition that f (a ) = f (b) , then we get the Rolle’s theorem.

We shall illustrate how to use this theorem with the help of the following
examples.

Example 4: Consider the function f ( x ) = (x − 1) (x − 2) ( x − 3) in [0, 4] . Find a


f ( 4) − f ( 0)
point x 0 in ] 0, 4[ such that f ′(x 0 ) = .
4−0
Solution: We rewrite the function f ( x ) as given below.

f ( x ) = (x − 1) ( x − 2) ( x − 3) = x 3 − 6 x 2 + 11x − 6
We know that
i) f is continuous on [0, 4] , since f is a polynomial in x .

ii) The derivative f ′( x ) = 3x 2 − 12 x + 11 exists in ] 0, 4[ .


14
Unit 1 Errors and Approximations
Thus, f satisfies all the conditions of the Lagrange’s mean value theorem.
Therefore, there exists a point x 0 in ] 0, 4[ such that
f ( 4) − f ( 0)
f ′(x 0 ) =
4−0
6 − (−6)
3x 20 − 12 x 0 + 11 = = 3 [Substituting the values of f ′( x 0 ), f (4) and f (0) ]
4−0
3x 20 − 12 x 0 + 8 = 0
6+2 3
This is a quadratic equation in x 0 . The roots of this equation are and
8
6−2 3
.
8
Taking 3 = 1.732 , we see that there are two values for x 0 namely 1.183 and
0.317 both of these lie in the interval ] 0, 4[ .
***

Remark 2: Example 4 shows that the number x 0 in Theorem 3 may not be


unique. Again you may note that the mean value theorem guarantees the
existence of a point only.

Example 5: Does the mean value theorem holds for the function f defined by
f ( x ) = x in [0, 2]? Justify.

Solution: The function f given by f ( x ) = x satisfies the following


properties:
i) f is continuous on [0, 2]
1
ii) f is differentiable in ] 0, 2[ , and f ′( x ) = .
2 x
Therefore by Theorem 3, there exists a point x 0 in ] 0, 2[ such that

f (2) − f (0) = f ′( x 0 ) (2 − 0)
1 1
 2 −0= (2) [Q f (2) = 2 , f (0) = 0 and f ′(x 0 ) = ].
2 x0 2 x0
1 1
i.e., x 0 = and x 0 = .
2 2
1
Since 0 < < 2, therefore, the mean value theorem is verified.
2
***

Next we shall consider an example which shows another application of mean


value theorem.

3
Example 6: Find an approximate value of 26 using the mean value
theorem.

Solution: Consider the function f defined by f ( x ) = x 1 / 3 . Then,


f (26) = 3 26 . The number nearest to 26 for which the cube root is known is
27 , i.e., f (27) = 3 27 = 3 . We shall now apply the mean value theorem to the
function f defined by f ( x ) = x 1 / 3 in the interval ] 26, 27 [ . 15
Block 1 Solution of Nonlinear Equations in One Variable
The following holds for the function f
i) f is continuous on [26, 27]
1
ii) f is differentiable on ] 26, 27[ and the derivative is f ′(x ) = .
3x 2 / 3

Therefore, there exists a point x 0 between 26 and 27 such that

1
3
27 − 3 26 = (27 − 26) [using f (b) − f (a ) = f ′( x 0 )(b − a )]
3x 02 / 3
3 1
i.e., 26 = 3 − 2 / 3
3x 0
1  1 1 
3
26 ≈ 3 − Q 2 / 3 ≈ , as x 0 is close to 27
27  3x 0 27 
= 2.963
You may note that in writing the value of 3 26 we have rounded-off the
number after three decimal places. Using calculator we can find the exact
value of 3 26 , which is 2.9624961 .
***

The mean value theorem has got many other applications which you will come
across in later units.

You may now try some exercises on your own to check your understanding of
these theorems discussed above.

E1) Show that the following equations have a solution in the interval given
alongside.

a) x 3 − x − 5 = 0, [0, 2] .

 π
b) sin x + x = 1, 0,  .
 6

E2) Use Rolle’s theorem to show that there is a solution of the equation
 π
cot x = x in  0,  .
 2

1 3
E3) Let f ( x ) = x + 2 x . Find a number x 0 in ] 0, 3[ such that
3
f (3) − f (0)
f ′( x 0 ) = .
3− 0

E4) Find all the numbers x 0 in the interval ] − 2, 1[ for which the tangent to
the graph of f ( x ) = x 3 + 4 is parallel to the line joining the end points
(−2, f (−2)) and (1, f (1)) .

16 Now we will discuss another theorem, called Taylor’s theorem.


Unit 1 Errors and Approximations
You are familiar with polynomial equations of the form
f ( x ) = a 0 + a 1x + L + a n x n , where a 0 , a 1 , K, a n are real numbers. We can
easily compute the value of a polynomial at any point x = x 0 by using the four
basic operations of addition, multiplication, subtraction and division. On the
other hand there are functions like e x , cos x , ln x etc. which occur frequently
in all branches of mathematics which cannot be evaluated in the same
manner. For example, evaluating the function f ( x ) = cos x at x = 0.524 is not
so simple. To evaluate such functions we try to approximate them by Brook Taylor
(1685-1731)
polynomials which are easier to evaluate. Taylor’s theorem gives us a simple
method for approximating such functions f by polynomials. Taylor’s theorem
is due to an English mathematician, Brook Taylor (1685-1731).

Let f be a real-valued function defined on R, which has continuous


derivatives upto (n + 1) th order on an interval around x 0 . We can approximate
f about x 0 by a polynomial Pn ( x ) of degree n. For different values of n, the
function f can be approximated by the polynomials of different degrees.
• For n = 0, consider P0 ( x 0 ) = f ( x 0 ), which is the best constant
approximation near x 0 .

• For n = 1, consider the function P1 ( x ) = f (x 0 ) + ( x − x 0 ) f ′(x 0 ), which is


the best linear approximation about x 0 . Now P1 (x ) is a polynomial of
degree 1 in x and P1 ( x 0 ) = f (x 0 ) and P1′( x 0 ) = f ′(x 0 ) . The polynomial
P1 (x ) is called the first order Taylor polynomial of f(x) at x 0 .
• For n = 2, consider another function
(x − x 0 ) 2
P2 ( x ) = f ( x 0 ) + (x − x 0 ) f ′(x 0 ) + f ′′( x 0 ), which is the best
2!
quadratic approximation about x 0 , and is called the second order Taylor
polynomial of f ( x ) at x 0 . You may note that P2 ( x 0 ) = f ( x 0 ),
P2′ ( x 0 ) = f ′( x 0 ) and P2′′ ( x 0 ) = f ′′( x 0 ) .
• Continuing this process, we can define the nth order Taylor polynomial
of f(x) at x 0 , which is given by

f ( n ) (x 0 )
Pn (x ) = f ( x 0 ) + ( x − x 0 ) f ′( x 0 ) + L + (x − x 0 )n (1)
n!
You may note that Pn ( x 0 ) = f ( x 0 ), P1′ (x 0 ) = f ′( x 0 ),K , and
Pn( n ) ( x 0 ) = f ( n ) ( x 0 )

We are now ready to state the Taylor’s theorem.

Theorem 4 (Taylor’s Theorem): Let f be a real valued function having


(n + 1) continuous derivatives on ] a , b [ for some n ≥ 0. Let x 0 be any point
in the interval ] a , b [ . Then for any x ∈ ] a , b[ , we have

(x − x 0 ) ( x − x 0 ) ( 2)
f ( x ) = f (x 0 ) + f ′( x 0 ) + f (x 0 ) + L
1! 2! 17
Block 1 Solution of Nonlinear Equations in One Variable
(x − x 0 ) n ( n )
L+ f ( x 0 ) + R n +1 ( x ) (2)
n!
( x − x 0 ) n +1 ( n +1)
R n+1 ( x ) is the error term and is equal to f (c) , where c is a
(n + 1)!
point between x 0 and x .

The series given in Eqn. (2) is called the nth order Taylor’s expansion of
f(x) at x 0 .

We rewrite Eqn. (2) in the form

f ( x ) = Pn ( x ) + R n +1 (x )

where Pn ( x ) is the nth order Taylor polynomial of f ( x ) about x 0 and

( x − x 0 ) n+1 ( n+1)
R n +1 ( x ) = f (c ) .
(n + 1) !
R n+1 ( x ) depends on x , x 0 and n . R n+1 ( x ) is called the remainder (or error)
of the nth Taylor’s expansion after n + 1 terms. We shall discuss this error in
detail in Sec. 1.4

Suppose we put x 0 = a and x = a + h, where h > 0, in Eqn. (2). Then any


point between a and a + h will be of the form a + θh , 0 < θ < 1 .

Therefore, Eqn. (2) becomes

h2 hn h n +1 ( n +1)
f (a + h ) = f (a ) + hf ′(a ) + f ′′(a ) + L + f ( n ) (a ) + f (a + θh ) (3)
2! n! n + 1!

Let us now make some remarks on the Taylor’s theorem.

Remark 3: Suppose that the function f in Theorem 4 is a polynomial of


degree m. Then f ( r ) ( x ) = 0 for all r > m . Therefore, R n +1 ( x ) = 0 for all n ≥ m .
Thus, in this case, the mth Taylor expansion of f ( x ) about x 0 will be
(x − x 0 ) (x − x 0 ) m (m)
f (x) = f (x 0 ) + f ′( x 0 ) + L + f (x 0 ) .
1! m!
You may note that the right hand side of the above equation is simply a
polynomial in ( x − x 0 ) . Therefore, finding Taylor’s expansion of a polynomial
function f ( x ) about x 0 is the same as expressing f ( x ) as a polynomial in
( x − x 0 ) with coefficients from R .

Remark 4: You can see that the mean value theorem as a special case of
Taylor’s theorem. Suppose we put x 0 = a , x = b and n = 0 in Eqn. (2). Then
Eqn. (2) becomes
f (b) = f (a ) + f ′(c) (b − a )
or equivalently
f (b) − f (a ) = f ′(c) (b − a ) , which is the result of Lagrange’s mean value
18 theorem.
Unit 1 Errors and Approximations
Let us consider an example.

Example 7: Find the fourth order Taylor polynomial of f ( x ) = ln x about


x0 =1.
Solution: The fourth order Taylor polynomial of f ( x ), about x 0 = 1 is given by
( x − 1) 2 ( x − 1) 3 (3) ( x − 1) 4 ( 4)
P4 ( x ) = f (1) + ( x − 1) f ′(1) + f ′′(1) + f (1) + f (1) [Using Eqn. (1)]
2! 3! 4!
Now, f ( x ) = ln x f (1) = ln(1) = 0
1
f ′( x ) = f ′(1) = 1
x
 1 
f ′′( x ) =  − 2  f ′′(1) = −1
 x 
2
f ( 3) ( x ) = 3 f ( 3) (1) = 2
x
−6
f (4) (x) = 4 f ( 4) (1) = −6
x
Substituting the values of f (1), f ′(1), f ′′(1), f ′′′(1) and f ( 4 ) (1) in P4 ( x ), we get
(x − 1) 2 ( x − 1) 3 ( x − 1) 4
P4 ( x ) = ( x − 1) − + − , which is the fourth order
2 3 4
Taylor’s polynomial of f ( x ) = lnx about x 0 = 1.
***
You may try some exercises.

E5) If Pn denotes the nth order Taylor polynomial then show that
Pn (x 0 ) = f ( x 0 ), Pn′ ( x 0 ) = f ′( x 0 ), K, Pn(1) ( x 0 ) = f ( n ) ( x 0 ).

E6) Obtain the third Taylor polynomial of f ( x ) = e x about x = 0 .

We shall recall few more theorems from the course BMTC-131, which are
related to finding roots of the polynomial equations. You will see that we will
use these theorems to locate the root in Unit 2 onwards in this block.

Theorem 5: Suppose that z = a + ib is a root of the polynomial equation


P( x ) = 0. Then the conjugate of z , namely z = a − ib is also a root of the
equation P( x ) = 0, i.e. complex roots occur in pairs.

We next give an important Theorem due to the mathematician Rene


Descartes (1596-1650).

Theorem 6 (Descarte’s Rule of Signs): A polynomial equation P( x ) = 0


cannot have more positive roots than the number of changes in sign of its
coefficients. Similarly P( x ) = 0 cannot have more negative real roots than the
number of changes in sign of the coefficients of P( −x ) . We denote by P( −x )
the polynomial obtained by replacing x by − x in P(x ).

For example, let us consider the polynomial equation P( x ) = 0, where


P( x ) = x 4 − 15x 2 + 7 x − 11 19
Block 1 Solution of Nonlinear Equations in One Variable

= 1x 4 − 15x 2 + 7 x − 11

We count the changes in the sign of the coefficients. Going from left to right
there are changes between 1 and − 15 , between − 15 and 7 and between 7
and − 11 . The total number of changes is 3 and hence it can have at most 3
positive roots.

Now we consider
P(− x ) = (− x ) 4 − 15(− x ) 2 + 7(−x ) − 11
= x 4 − 15x 2 − 7 x − 11
Here is only one change between 1 and − 15 and hence the equation cannot
have more than one negative root.

We now give another theorem for locating the real roots of polynomial
equation.

Theorem 7: Let P( x ) = 0 be a polynomial equation of degree n ≥ 1 . Let a


and b be two real numbers with a < b . Further, suppose that P(a ) ≠ 0 and
P(b) ≠ 0 . Then,
i) if P(a ) and P(b) have opposite signs, the equation P( x ) = 0 has an
odd number of real roots between a and b .
ii) If P(a ) and P(b) have likes signs, then P( x ) = 0 either has no root or
an even number of real roots between a and b .

In this theorem, multiplicity of the root is taken into consideration i.e., if a is a


root of multiplicity k, it has to be counted k times.

As a corollary of Theorem 7, we have the following results.

Corollary 1: An equation of odd degree with real coefficients has at least one
real root whose sign is opposite to that of the last term.

Corollary 2: An equation of even degree whose constant term has the sign
opposite to that of the leading coefficient, has at least two real roots one
positive and the other negative.

The relationship between roots and coefficients of a polynomial equation is


given below.

Theorem 8: Let α1 , α 2 , K , α n be n roots (n ≥ 1) of polynomial equation

P( x ) = a n x n + a n −1x n −1 + L + a1x + a 0 = 0, where a i ' s are reals.


− a n −1
Then α1 + α 2 + L + α n =
an
a n−2
α1α 2 + α 2 α 3 + L + α n −1α n =
an
.........................................................
.........................................................
a
α1 α 2 K α n = (−1) n 0 .
an

Now, you can try to solve some problems using the above theorems.
20
Unit 1 Errors and Approximations

E7) How many negative roots does the equation


3x 7 + x 5 + 4 x 3 + 10x − 6 = 0 have? Also, determine the number of
positive roots, if any.

E8) Show that the biquadratic equation P( x ) = x 4 + x 3 − 2x 2 + 4 x − 24 = 0


has at least two real roots one positive and the other negative.

In numerical analysis we are concerned with developing a sequence of


calculations that will give a satisfactory answer to a problem. Since this
process involves a lot of computations, therefore, there is a chance for the
presence of some errors in these computations. In the next section, we shall
introduce you to the concept of ‘errors’ that arise in numerical computations.

1.3 ROUND-OFF ERROR


From your school arithmetic, you are already familiar with the rounding-off a
number which has non-terminal decimal expansion. For example, we use
3.1425 for 22 / 7 . These rounded-off numbers are approximations of the
actual values. In any computational procedure we make use of these
approximate values instead of the true values. Let x T denote the true value
and x A denote the approximate value of a quantity x. How do we measure
the goodness of an approximation x A to x T ? The simplest measure which
naturally comes to our mind is the difference between x T and x A . This
measure is called the ‘error’.

Formally, we define error as a quantity which satisfies the following identity:

True value ( x T ) = Approximate value ( x A ) + error.


or error = True value (x T ) − Approximate value ( x A )

Error can be positive or negative. We want to find the error which is close to
the true value. Therefore, it can be on either side of the true value. So, we are
interested in absolute value of the error which is defined as
error = | True value (x T ) − Approximat e value (x A ) |
Now if an ‘error’ in approximation is considerably small, then we say that ‘ x A
is a good approximation to x ’.

Sometimes, when the true value is very large or very small we prefer to study
the error by comparing it with the true value. This is known as Relative error
and we define this error as

error | Ture value(x T ) − Approximat e value(x A ) |


Relative error = =
True value ( x T ) True value ( x T )

Let us consider an example.

Example 8: The true value of π is 3.14159265K . In some mensuration


problems the value 22 / 7 is commonly used as an approximation to π . What
is the relative error in this approximation? 21
Block 1 Solution of Nonlinear Equations in One Variable
Solution: In order to find the relative error we first need to find the error in the
approximate value of x. The true value of π is
x T = 3.14159265K

Now, we convert 22 / 7 in to decimal form, so that we can find the difference


between the approximate value and true value. The approximate value of π is
22
xA = = 3.14285714 K
7

Therefore,
error = x T − x A = 3.14159265K − 3.14285714 K
= − 0.00126449... = 0.00126449...
0.00126449K
Re lative error = = 0.00040249966 K
3.14159265K
***

In numerical calculations, you will encounter mainly two types of errors:


round-off error and truncation error. We shall discuss round-off error in this
section and truncation error in the next section.

Let us look at Example 8 again. You can see that the numbers appearing in
x T , x A and error consist of 8 digits after the decimal point followed by dots.
The line of dots indicates that the digits continue and we are not able to write
all of them. That is, these numbers cannot be represented exactly by a
terminating decimal expansion. Whenever we use such numbers in
calculations we have to decide how many digits we are going to take into
account. For example, consider again the approximate value of π . If we
approximate π using 2 digits after the decimal point (say), chopping off the
other digits, then we have

π ≈ 3.14

The error in this approximation is


error = | X T − X A | = | 3.14159265K − 3.14 | = 0.00159265K (4)

If we use 3 digits after the decimal point, then using chopping we have
π ≈ 3.141
In this case the error is given by

error = | 3.14159265K − 3.141 | = 0.00059265K (5)

Now, suppose we consider the approximate value rounded-off to three


decimal places. You already know how to round-off a number which has non-
terminal decimal expansion. Then the value of π rounded-off to 3 digits is
3.142 . The error in this case is
error = | 3.14159265K − 3.142 | = 0.00040734K

Here, 0.00040734 < 0.00059265. This means the error is smaller in case of
rounding-off. Therefore, in general whenever we want to use only a certain
22
Unit 1 Errors and Approximations
number of digits after the decimal point, then it is always better to use the
value rounded-off to that many digits because in this case the error is usually
small. The error involved in a process where we use rounding-off
method is called round-off error. Errors given by Eqns.(4) and (5) are
round-off errors.

We now discuss the concept of floating point arithmetic to see how number of
digits after decimal point relates with the round-off error.

In scientific computations a real number x is usually represented in the form


x = ± (0.d1d 2 Kd n ) 10 m
where d 1 , d 2 , K , d n are the digits from 0 to 9 and m is an integer called
exponent. Writing a number in this form is known as floating point
representation. We denote this representation by fl( x ). Such a floating point
number is said to be normalized if d1 ≠ 0. To convert a number into floating
point representation we use two methods: rounding and chopping.

For example, we give in Table 1 below the representation of the number 537
in the normalized floating point representation for n = 1, 2 and 3.

Table 1

Number of Representation of the number 537 Round-off Chopping


digits (n) in the normalized floating point error error
form (fl(537))
n-digit chopping n-digit
rounding
1 0.5 × 10 3 0.5 × 10 3 0.037 0.037
2 0.53 × 10 3 0.54 × 103 0.003 0.017
3 3
3 0.537 × 10 0.537 × 10 0.000 0.000

The number n in the floating point representation is called precision.

The difference between the true value of a number x and rounded-off fl( x ) is
the round-off error. You may observe from Table 1, as the value of
n increases, the round-off error decreases.

Mathematically we defined these concepts as follows:


Definition: Let x be a real number and x * be a its non-terminal decimal
expansion. We say that x * represents x rounded to k decimal places if
1
| x − x * | ≤ 10 − k , where k > 0 is a positive integer.
2

Next definition gives us a measure by which we can conclude that the round-
off error occurring in an approximation process is negligible or not.

Definition: Let x be a real number and x * be an approximation to x . Then


*
we say that x is accurate to k decimal places if 23
Block 1 Solution of Nonlinear Equations in One Variable
1 −( k +1) 1
10 ≤ | x − x * | ≤ 10 −k (6)
2 2

We now illustrate these definitions through examples.

Example 9: Find out to how many decimal places the value of 22 / 7 obtained
in Example 8 is accurate as an approximation to π = 3.14159265K ?
Solution: We have already seen in Example 8 that
22
π− = 0.00126449K
7

Now 0.0005 < 0.00126 K < 0.005


1 −3 1
or, 10 < 0.00126 K < 10 −2
2 2

Therefore the inequality (6) is satisfied for k = 2 .

Thus, we conclude that the approximation is accurate to 2 decimal places.


***

Example 10: Find f (100000) using a six-digit rounding-off, where


f ( x ) = x ( x + 1 − x ).

(
Solution: We have f (100000) = 100000 100001 − 100000 . )
The value of 100001 using six-digit rounding-off is

100001 ≈ 316.229347
= 0.316229347 × 10 3.
Therefore,

( )
fl 100001 = 0.316229 × 10 3. [rounded-off to six-digits]

Similarly,

( )
fl 100000 = 0.316228 × 103. [rounded-off to six-digits]

The six-digit rounded approximation of the difference between these two


numbers is

(( ) ( ))
fl fl 100001 − fl 100000 = 0.1× 10 −2
Thus,
fl(f (100000) = fl(100000) × (0.1× 10 −2 )
= (0.1× 10 6 ) × (0.1× 10 −2 )
= 100.
24 ***
Unit 1 Errors and Approximations
Now we make an important remark.

Remark 5: Round-off errors can create serious difficulties in lengthy


computations. Suppose we have a problem which involves a long-calculation.
In the course of these computation many rounding errors (some positive, and
some negative) may occur in a number of ways. At the end of the calculations
these errors will get accumulated and we don’t know the magnitude of this
error. Theoretically it can be large. But, in reality, some of these errors
(between positive and negative errors) may get cancelled so that the
accumulated error will be much smaller.

Here is an exercise for you.

355
E9) In some approximation problems, the value is used as an
133
approximation to π = 3.14159265K . To how many decimal places the
355
value is accurate as an approximation to π ?
133

E10) Consider the numbers x = 0.66662 × 105 and y = 0.66649 × 105. Find the
difference x − y using floating point representation correct upto four
decimal places by (i) rounding-off and (ii) chopping. Also, compare the
results.

We discussed round-off error which is due to the approximate representation


of a number. Sometimes there is a need to use a mathematical
series/procedure upto a limited number of terms/steps, in that case, the error
is due to truncating the series/procedure. Such error is called ‘Truncation
error’. We will discuss truncation error in the following section.

1.4 TRUNCATION ERROR


1 1 1 1 1
Consider an infinite series + + + + + .... .
2 4 8 16 32
1
This series is an infinite geometric series with common ratio , which is less
2
than 1. We get the sum of this infinite series as 1. But, if we truncate the
1 1 1
series only to first three terms, we get + + = 0.5 + 0.25 + 0.125 = 0.875.
2 4 8
This produces an error of 1 − 0.875 = 0.125. This error is called the ‘truncation
error’. Therefore, truncation error is the difference between a truncated value
and the actual value of a function.

As you have seen above the truncation error occurs due to the truncated
terms. That is, the terms which are excluded. Let us now try to estimate this
error.

Consider the nth order Taylor polynomial expansion of f about x 0 which is


f ( x ) = Pn ( x ) + R n+1 ( x ) as we discussed in Theorem 4. 25
Block 1 Solution of Nonlinear Equations in One Variable
Then, R n +1 ( x ) = f ( x ) − Pn ( x ), and is called truncation error.
Thus, Truncation error = R n +1 ( x )
( x − x 0 ) n +1 ( n +1)
= f (c), where 0 < c < x.
(n + 1) !
If lim R n +1 (x ) = 0 for some x , then for that x
n→∞

we say that we can approximate f ( x ) by Pn ( x ) and we write f ( x ) as the


infinite series.
f ( 2) ( x 0 )
f ( x ) = f ( x 0 ) + f ′( x 0 ) ( x − x 0 ) + (x − x 0 ) 2 + L
2!
f (n ) (x 0 )
L+ (x − x 0 ) n
n!

f (n) (x 0 )
= (x − x 0 ) n . (7)
n=0 n!

This series is called Taylor’s series of f ( x ) . If we put x 0 = 0 in Eqn. (7) then


the series


f ( n ) ( 0) n
f (x) =  n!
x (8)
n =0

is called Maclaurin’s series.

If the remainder R n +1 ( x ) satisfies the condition that | R n +1 ( x ) | < M for some n


at some fixed point x = c , then M is called the bound of the error at x = c .

In this case, we have

| R n+1 ( x ) | = | f ( x ) − Pn ( x ) | < M

 − M < (f ( x ) − Pn ( x ) ) < M

 Pn ( x ) − M < f (x ) < Pn ( x ) + M

 f ( x ) ∈ ] Pn ( x ) − M, Pn ( x ) + M [ .

Now, if M is considerably small for some n , then this interval becomes very
small. In this case, we say that f ( x ) is approximately equal to the value of
the nth Taylor polynomial with error M . Thus, we use remainder to determine
a bound for the accuracy of the approximation.

There are some functions whose Taylor’s expansion is used very often. Using
Theorem 4, we shall list their expansions here.

x x2 xn x n +1 c
ex = 1+ + +L + + e K (9)
1! 2! n ! (n + 1)!

x3 x5 (−1) n −1 x 2n −1 (−1) n x 2n +1
sin x = x − + +L + + cos (c) (10)
3! 5! (2n − 1)! (2n + 1)!
26
Unit 1 Errors and Approximations
2 4 n 2n n +1 2n + 2
x x (−1) ( x ) (−1) x
cos x = 1 − + −L + + cos (c) (11)
2! 4! ( 2n ) ! (2n + 2)!

1 x n+1
= 1+ x + x 2 +L + x n + (12)
1− x (1 − c) n+ 2

where c , in each expansion, is as given in Taylor’s theorem.

Let us understand it with the help of the following examples.

Example 11: Find the nth Taylor expansion of ln (1 + x ) about x = 0 for


x ∈ ] − 1, 1[ . Also, find the remainder term in the expansion.

Solution: You may note that the point x = 0 lies in the given interval. Further,
the function f ( x ) = ln (1 + x ) has continuous derivatives of all orders in the
interval ] − 1, 1[. The derivatives are given by
1
f ′( x ) = , f ′(0) = 1
1+ x
−1
f ′′( x ) = , f ′′(0) = −1
(1 + x ) 2
(−1) 2 2 !
f (3) ( x ) = , f ( 3 ) ( 0) = 2
(1 + x ) 3
K
K
K
(−1) n−1 (n − 1) !
(n )
f (x ) = , f ( n ) (0) = (−1) n −1 (n − 1) !
(1 + x ) n

Now, we apply Taylor’s theorem and obtain that for any x ∈ ] − 1, 1[ ,

x2 x3 x 4 (−1) n −1 x n
ln (1 + x ) = x − + − +L+ + R n +1 ( x )
2 3 4 n
(−1) n n !x n +1
where R n +1 ( x ) = , and 0 < c < x.
(n + 1)!(1 + c) n +1

Let us now consider the behaviour of the remainder in a small interval, say,
[0, 0.5] . Then for x in [0, 0.5] , we have

(−1) n n !x n +1
R n +1 ( x ) = , where 0 < c < x .
(n + 1)! (1 + c) n +1

Since, | x | < 1, | x |n +1 < 1 for any positive integer n .

1
Also, since, c > 0 , < 1, and we get
(1 + c) n +1
1
| R n +1 ( x ) | <
n +1
27
Block 1 Solution of Nonlinear Equations in One Variable
1
Now can be made as small as we like by choosing n sufficiently large
n +1
1
i.e., lim = 0 . This shows that lim | R n+1 ( x ) | = 0 .
n →∞ n + 1 n →∞

The above example shows that if n is sufficiently large, the value of the nth
Taylor polynomial Pn ( x ) at any point x 0 will be approximately equal to f ( x 0 ),
the value of the given function f at x 0 . In fact, the remainder R n+1 ( x ) tells us
how close the value Pn ( x 0 ) is to f ( x 0 ) .
***

Example 12: Find the 2nd order Taylor’s expansion of f ( x ) = 1 + x in ] − 1, 1[


about x = 0 . Also, find the bound of the error at x = 0.2 .

Solution: Since, f ( x ) = 1 + x , we have f (0) = 1

1 1
f ′( x ) = , f ′(0) =
2 1+ x 2
1 1
f ′′( x ) = − (1 + x ) −3 / 2 , f ′′(0) = −
4 4
3 3
f ′′′( x ) = (1 + x ) −5 / 2 , f ′′′(0) = .
8 8

we apply Taylor’s theorem for f ( x ) and get

1 1 1
1 + x = 1 + x − x 2 + x 3 (1 + c) −5 / 2 ,
2 8 16
where c is a point lying between 0 and x .

x3
The error is given by R 3 ( x ) = (1 + c) −5 / 2
16

When x = 0.2 , we have

(0.2) 3
R 3 ( 0. 2) = , where 0 < c < 0.2, Since, c > 0 we have
16(1 + c)5 / 2
1
< 1.
(1 + c) 5 / 2

Hence,
(0.2)3
| R 3 (0.2) | ≤ = 0.0005 = 0.5 × 10 −3
16

Hence, the bound of the error for second order Taylor’s expansion about
x = 0.2 is 0.0005.
***

Example 13: Using Taylor’s expansion for sin x about x = 0 , find the
28 approximate value of sin 10 o with error less than 10 −7.
Unit 1 Errors and Approximations
Solution: The nth Taylor expansion for sin x about x = 0 given in Eqn. (10) is

x3 x5 (−1) n −1 x 2n −1 (−1) n x 2n +1
sin x = x − + +L + + cos (c) , (13)
3! 5! (2n − 1)! (2n + 1)!
where x is the angle measured in radians.

π
Now, in radian measure, we have 10 o = radians.
18
π
Therefore, by putting x = in Eqn. (13) we get
18
3 5
π π 1 π 1 π π
sin = −   +   + L + R n +1  
18 18 3!  18  5!  18   18 
π
where R n +1   is the remainder after (n + 1) terms.
 18 
2 n +1
π (−1) n  π 
Now, R n +1   =   cos c .
 18  (2n + 1)!  18 
π π
If we approximate sin by Pn   , then the error introduced will be less
18  18 
−7
than 10 , i.e.,

π π π


sin   − Pn   = R n +1   < 10 −7
 18   18   18 
2 n +1
(−1) n  π 
   cos c < 10 −7
(2n + 1) !  18 

Maximizing cos c , we require that

2 n +1
1 π
  < 10 −7 (14)
(2n + 1) !  18 

Using the calculator, we find that the value of left hand side of Ineqn. (14) for
various n as given in Table 2.

Table 2

n 1 2 3
Left hand side of Ineqn. (14) 0.89 × 10 −3
0.13 × 10 −5
0.99 × 10 −9

From the table we find that the ineqn. (14) is satisfied for n = 3 . Hence, the
required approximation is

3 5
π π 1π 1π
sin   = −   +   = 0.1745445
 18  18 3!  18  5!  18 

with error less than 1.0 × 10 −7 .


***

Let us now find the approximate value of e using Taylor’s theorem. 29


Block 1 Solution of Nonlinear Equations in One Variable
Example 14: Using Maclaurin’s series for e x , show that e ≈ 2.71806 with
error less than 0.001 . (Assume that e < 3) .

Solution: The Maclaurin’s series for e x is


x x2
ex = 1+ + +L
1! 2!
Putting x = 1 in the above series, we get
1 1
e = 1+1+ + +L
2! 3!
Now we have to find n for which

| e − Pn (1) | = | R n +1 (1) | < 0.001 .


1
Now | R n +1 (1) | = e c
(n + 1) !
We have chosen x 0 = 0 and x = 1 , the value c lies between 0 and 1, i.e.,
0 < c < 1 . Since, e c < 3 , we get

3
| R n +1 (1) | ≤
(n + 1)!

The bound for R n +1 (1) for different n is given in Table 3.

Table 3

n 1 2 3 4 5 6
Bounds for R n +1 1.5 0.5 0.125 0.025 0.004 0.0006

From this table, we see that


R n +1 < 0.001 if n = 6

Thus, P6 (1) is the desired approximation to e . i.e.

1 1 1 1 1 1957
e ≈ 1+1+ + + + + = ≈ 2.71806
2 6 24 120 720 720
***

Theoretically we can use this formula for truncation error for any sufficiently
differentiable function. But practically it is not easy to calculate the nth
derivative of many functions. Because of the complexity in differentiation of
such functions, it is better to obtain indirectly their Taylor polynomials by using
one of the standard expansions.

2
For example, consider the function f ( x ) = e x . It is difficult to calculate the nth
derivative of this function. Therefore, for convenience, we obtain Taylor’s
2
expansion of e x using Taylor’s expansion of e y by putting y = x 2 . We shall
illustrate this in the following example.
2
Example 15: Calculate a bound for the truncation error in approximating e x
by
30
Unit 1 Errors and Approximations
4 6 8
2 x x x
ex ≈ 1+ x 2 + + + for x ∈ ] − 1, 1[ .
2! 3! 4!
2
Solution: Put u = x 2 . Then, e x = e u . Now, we apply the Taylor’s theorem to
the function f (u ) = e u about u = 0 . Then, we have

u u2 u3 u4 ec u 5
e = 1+ u + + + + R 5 (u ) , where R 5 (u ) = ,
2! 3! 4! 5!

and 0 < c < u. Since, | x | < 1, u = x 2 < 1 i.e., c < 1 . Therefore, e c < e < 3 . Thus
3u 5 3 1
| R 5 (u ) | ≤ < = = 0.025
5! 5! 40
2
Hence, the truncation error in approximating e x by the above expression is
less than 0.25 × 10 −1.
***

Remark 6: If the absolute value of the TE is less, then we say that the
approximation is good.

In the practical situations we should be able to find out the value of n for
which the summation Σa n x n gives a good approximation to f ( x ) . For this we
always specify the accuracy (or error bound) required in advance. Then we
find n such that the absolute error | R n +1 ( x ) | is less than the specified
accuracy. This gives the approximation within the prescribed accuracy.

Let us consider an example.

Example 16: Find an approximate value of the integral


1

 e dx with an error less than 0.025 .


2
x

Solution: In Example 15 we observed that


2

x2 x2 x4 x6 x8 e x x 10
e ≈ 1+ + + + with TE = .
1! 2! 3! 4! 5!
Now we use this approximation to calculate the integral. We have
1 1
 x4 x6 x8 
  
x2
e dx ≈  1 + x 2
+ + +  dx (15)
0 0
2 ! 3! 4! 
1 2
e x x 10
with the truncation error TE =  5!
dx .
0
1 2 1 2
e x x10 | e x | | x |10 3
We have | TE | =  dx ≤  dx ≤ = 0.25 × 10−1
0
5! 0
5! 5!

Integrating the right hand side of Eqn. (15), we get the required approximate
value of the integral as

1
1
x2  x 4 x 6 x8 
1
 x3 x5 x7 x9 
  
 
2
e dx ≈ 1 + x + + + dx =  x + + + +
0 0
2! 3! 4 !   3 5 × 2! 7 × 3! 9 × 4! 0 31
Block 1 Solution of Nonlinear Equations in One Variable
1
 x3 x5 x7 x9 
= x + + + +
 3 10 42 216  0

1 1 1 1
=1+ + + +
3 10 40 216
= 0.0048.
***

Here is an important remark.

Remark 7: The magnitude of the truncation error could be reduced within any
prescribed accuracy by retaining sufficiently large number of terms. Likewise
the magnitude of the round-off error could be reduced by retaining additional
digits.

See if your can do the following exercises.

1  1 
E11) Obtain the nth Taylor expansion of the function f ( x ) = in  − , 1 
1+ x  2 
about x 0 = 0 .

E12) Does f ( x ) = x have a Taylor series expansion about x = 0 ? Justify


your answer.

E13) Obtain the 8th order Taylor expansion of the function f ( x ) = cos x in
 π π
 − 4 , 4 
about x 0 = 0 . Obtain a bound for the error R 9 ( x ) .

E14) Using Maclaurin’s expansion for cos x , find the approximate value of
π
cos with the error bound 10 −5 .
4

E15) How many terms n be chosen in Maclaurin’s expansion for e x to have


| e x − Pn ( x ) | ≤ 10 −5 , − 1 ≤ x ≤ 1 .

E16) a) Calculate a bound for the truncation error in approximating


x3 x5 x7
f ( x ) = sin x by sin = 1 − + + where − 1 ≤ x ≤ 1 .
3! 5! 7 !
b) Using the approximation in (a), calculate an approximate value of
1
sin x
the integral  x
dx with an error less than 10 −4 .
0

2
E17) a) Calculate the truncation error in approximating e − x by
x4
1− x2 + , −1 ≤ x ≤ 1.
2
b) Using the approximation in (a) calculate an approximate value of
0.1

e
−x 2
dx .
0

32
Unit 1 Errors and Approximations
We end this unit by summarising what we have learnt in this unit.

1.5 SUMMARY
In this unit we have covered the following points:

1. Four important theorems in calculus are stated as given below:


i) Intermediate value theorem
Let f be a function defined on a closed interval [a , b] satisfying
the following properties;
a) f is continuous on the interval [a , b].
b) c be a number lying between f (a ) and f (b) (i.e.,
f (a ) < c < f (b) if f (a ) < f (b) or f (b) < c < f (a ), if
f (b) < f (a ) ).

Then there exists at least one point x 0 ∈ [a , b] such that


f (x 0 ) = c .

ii) Rolle’s theorem


Let f be a function defined on [a , b] and satisfies the following
properties:
a) f is continuous on the interval [a , b]
b) f is differentiable on the interval ]a , b[
c) f (a ) = f ( b )

Then there exists a number x 0 in ]a , b[ such that f ′( x 0 ) = 0.

iii) Lagrange’s mean value theorem


Let f be a function defined on [a , b] and satisfies the following
properties:
a) f is continuous on the interval [a , b]
b) f is differentiable on the interval ]a , b[

Then, there is a number x 0 in ]a , b[ such that


f ( b ) − f (a )
f ′(x 0 ) =
b−a
Equivalently, there is a number x 0 in (a , b) such that
(b − a )f ′( x 0 ) = f (b) − f (a ).

iv) Taylor’s theorem


Let f be a real valued function having (n + 1) continuous
derivatives on ] a , b [ for some n ≥ 0. Let x 0 be any point in the
interval ] a , b [ . Then for any x ∈ ] a , b[ , we have

(x − x 0 ) ( x − x 0 ) ( 2)
f ( x ) = f (x 0 ) + f ′( x 0 ) + f (x 0 ) + L
1! 2!
33
Block 1 Solution of Nonlinear Equations in One Variable
(x − x 0 ) n ( n )
L+ f ( x 0 ) + R n +1 ( x )
n!
( x − x 0 ) n +1 ( n +1)
R n +1 ( x ) is the error term and is equal to f (c ) ,
(n + 1)!
where c is a point between x 0 and x .

2. Descarte’s rule of sign related to the roots of the polynomial equation is


defined as:
A polynomial equation P( x ) = 0 cannot have more positive roots than
the number of changes in sign of its coefficients. Similarly P( x ) = 0
cannot have more negative real roots than the number of changes in
sign of the coefficients of P( − x ) . We denote by P( − x ) the polynomial
obtained by replacing x by − x in P(x ).

3. The term ‘error’ occurring in numerical computations is defined as the


absolute value of the difference between the true value and approximate
value of any quantity
error = X T − X A .

4. The two types of errors are:


i) Round-off error: Error occurring in computations where we use
rounding off method to represent a number is called round-off
error.
ii) Truncation error: Error occurring in computations where we
truncate any series/mathematical procedure.

1.6 SOLUTIONS/ANSWERS
E1) a) The given equation is of the form f ( x ) = c , where,
f ( x ) = x 3 − x − 5 and c = 0 . f is a continuous function in the
interval [0, 2] and f (0) = −5 and f (2) = 1 . Then, 0 lies between
f (0) and f (2) . Therefore, by Theorem 1, the equation f ( x ) = 0
has a solution in the interval ]0,2[.

b) Here, the equation is of the form f ( x ) = c where f ( x ) = sin x + x


π 
and c = 1 . f is a continuous function on 0, and f (0) = 0 and
6  
 π 1 π π
f   = + = 0.5 + 0.523 = 1.023 . Then f (0) < 1 < f   .
6 2 6 6
Therefore, by Theorem 1, the result follows.

E2) Here we have to solve the equation cot x − x = 0 . We rewrite cot x − x


cos x − x sin x cos x − x sin x  π
as . Solving the equation = 0 in  0,  is
sin x sin x  2
 π
same as solving the equation cos x − x sin x = 0 in  0, . Now we shall
 2
see whether we can find a function f which satisfies the conditions of
Rolle’s theorem and for which f ′(x ) = cos x − x sin x . Our experience in
34
Unit 1 Errors and Approximations
differentiation suggests that we try f ( x ) = x cos x . f is continuous in
 π  π
0, 2  , differentiable in 0, 2  and the derivative
 π
f ′(x ) = cos x − x sin x . Also, f (0) = 0 = f   . Thus, f satisfies all the
2
conditions of Rolle’s theorem. Hence, there exists a point x 0 in ] a , b [
such that f ′(x 0 ) = cos x 0 − x 0 sin x 0 = 0 . This shows that a solution to
 π
the equation cot x − x = 0 exists in  0,  .
 2

E3) Note that f is a continuous function in [0, 3] and differentiable in ] 0, 3[


and f ′( x ) = x 2 + 2
Therefore, by Lagrange’s mean value theorem there exists a point x 0 in
f (3) − f (0)
] 0, 3[ such that f ′(x 0 ) =
3
15 − 0
 x 02 + 2 = = 5 [Q f ′(x 0 ) = x 02 + 2 and f (3) = 15 and f (0) = 0 .]
3
2
i.e., x 0 = 3, x 0 = ± 3.
Since x 0 is a point in ] 0, 3[ , we consider only the positive value,
therefore, x 0 = 3.

E4) f ( x ) = x 3 + 4 satisfies the conditions of Lagrange’s mean value theorem


in the interval ] − 2, 1[ . Therefore, there exists a point x 0 in ] − 2, 1[
such that the slope f ′(x 0 ) of the tangent line at x 0 is the same as the
slope of the line joining (−2, f (−2)) and (1, f (1)) .
f (−2) − f (1)
i.e., f ′( x 0 ) =
− 2 −1
− 4 − 5
 3x 20 = =3 [Q f ′( x 0 ) = 3x 02 , f (−2) = −4, f (1) = 5]
−3
i.e., x 20 = 1 or x 0 = ±1
Since x 0 lies in ] − 2, 1[ , we don’t consider the positive value.
Therefore there exists only one point x 0 = −1 satisfying the theorem.

E5) Put x = x 0 in Pn ( x 0 ) , then we get


Pn (x 0 ) = f (x 0 )
To calculate, Pn′ ( x 0 ) , we differentiate both sides of Eqn. (1). Then we
have
2f ′′( x 0 ) ( x − x 0 ) 3f ′′′(x 0 ) (x − x 0 ) 2
Pn′ (x ) = f ′(x 0 ) + + +L (16)
2! 3!
Putting x = x 0 on both sides of the above expression, we get

Pn′ ( x 0 ) = f ′( x 0 ) + 0 + 0 K = f ′( x 0 ) .

Note that apart from the first term, all other terms in the R.H.S. contain
the factor ( x − x 0 ) and therefore when we put x = x 0 , there terms
35
vanish.
Block 1 Solution of Nonlinear Equations in One Variable
By differentiating Eqn. (16) further, we get Pn(i ) ( x 0 ) = f ( i ) (x 0 ), i = 2, K , r .

E6) The 3rd Taylor polynomial of f ( x ) = e x about x = 0 is


x2 x3
P3 (x ) = f (0) + xf ′(0) + f ′′(0) + f ′′′(0) .
2! 3!
Here f ( x ) = e x ,
f ′(x ) = e x , f ′′′( x ) = e x and f ′′′( x ) = e x .
Therefore, f (0) = e 0 = 1 , f ′(0) = 1, f ′′(0) = 1 and f ′′′(0) = 1 .
x2 x3
Therefore, P3 ( x ) = 1 + x + + .
2 ! 3!

E7) P( x ) = 3x 7 + x 5 + 4x 3 + 10x − 6 = 0 ,
P(− x ) = −3x 7 − x 5 − 4x 3 − 10x − 6 = 0 ,
P( x ) = 0 has no negative real root, as there is no change in the sign of
the coefficients in P(− x ). There is only one change in the sign of the
coefficients in P( x ) = 0, therefore, P( x ) = 0 can take at most one
positive real root.
Here, f (0) = −6 < 0
f (1) = 12 > 0
Thus, the equation p( x ) = 0 has one positive root lying between 0 and
1, using Theorem 1.

E8) P( x ) = x 4 + x 3 − 2 x 3 + 4x − 24 = 0.
Here the sign of the constant term is negative where as the sign of
leading coefficient is positive. Therefore, using corollary 2 of Theorem 7,
P( x ) = 0 has two real roots, one positive and the other negative.

355
E9) = 3.14159292K and
113
π = 3.14159265K
355
| error | = π − = 0.00000027
113
1 1
Then 10 −7 < 0.00000027 < × 10 −6
2 2
Therefore the approximation is accurate to 6 decimal places.

E10) Here x = 0.66662 × 105 and y = 0.66649 × 105

i) Incase of round-off upto four places


x = 0.6666 × 105
y = 0.6665 × 105
x − y = 0.0001 × 105
= 0.1 × 102

ii) In case of chopping upto four places


36 x = 0.6666 ×105
Unit 1 Errors and Approximations
5
y = 0.6664 × 10
x − y = 0.0002 × 105
= 0.2 × 102

The exact value of x − y is 0.00013 × 105 = 0.13 × 102 , which is more


close to the value in case of round-off.

1
E11) f ( x ) = , f ( 0) = 1
1+ x
−1
f ′( x ) = , f ′(0) = −1
(1 + x ) 2
(−1) (−2)
f ′′( x ) = , f ′′(0) = 2
(1 + x ) 3
(−1) (−2) (−3)
f ′′′(x ) = , f ′′′(0) = (−1) 3 3!
(1 + x ) 4
..................................................................
..................................................................

(−1) (−2) K (−n ) n


f ( n ) (x ) = n +1
, f (0) = (−1) n n!
(1 + x )
The function f ( x ) and its derivatives of different orders are continuous
 1 
in  − , 1 . Therefore, by Taylor’s theorem
 2 
2 2 (−1) n n ! n (−1) n +1 (n + 1) !
f (x) = 1 − x + x + L + x +
2! n! (n + 1)!(1 + c) n+1

2 3 (−1) n +1 n n
= 1 − x + x − x + L + (−1) x +
(1 + c) n +1

E12) No. Because the derivatives of f ( x ) are not defined at x = 0 .

E13) 8th order Taylor expansion of f ( x ) = cos x about x 0 = 0 is

x x2 x3 x4
cos x = cos 0 − sin 0 − cos 0 + sin 0 + cos 0
1! 2! 3! 4!

x5 x6 x7 x8 x9
− sin 0 − cos 0 + sin 0 + cos 0 − sin c
5! 6! 7! 8! 9!

x2 x4 x6 x8 x9
= 1− + − + − sin c
2 ! 4! 6! 8! 9 !
The remainder is given by

x9
R 9 (x ) = − sin c
9! 37
Block 1 Solution of Nonlinear Equations in One Variable
 π π π
Since, x lies in  − , , and we have | x | ≤ < 1,
 4 4 4
therefore, we get
1
| R 9 (x ) | ≤ = 0.00000275573 .
9!

E14) We have seen in E12) that the remainder in the 8th order Taylor
expansion of cos x is such that

| R 9 (x ) | ≤ 10 −5

i.e., | cos x − P9 ( x ) | ≤ 10 −5 [Q f ( x ) = Pn (x ) + R n+1 ( x )]


x2 x4 x6 x8
where P9 (x ) = 1 − + − +
2 ! 4 ! 6 ! 8!
This shows that we can approximate f ( x ) by the 8th order Taylor
polynomial with error bound 10 −5 i.e.,

x2 x4 x6 x8
cos x ≈ 1 − + − +
2! 4 ! 6 ! 8!
π
Putting x = , we get
4
2 4 6 8
π π π  π
       
π
cos ≈ 1 −  4
+  4
−  4
+  .
4
4 2! 4! 6! 8!

x n +1 c
E15) | R n +1 | = | e x − Pn ( x ) | = e
(n + 1)!
where c lies between 0 and x .
x n +1e c e
Therefore, | R n +1 | = ≤ [Q| x | ≤ 1 and | e c | ≤ e.]
(n + 1)! (n + 1)!
e
Now, we have to find an integer n such that ≤ 10 −5 .
(n + 1)!
e
This is satisfied if n = 8 because ≈ 0.749 × 10 −5 .
9!
Therefore, n = 8 is the required number.

E16) a) We apply Taylor’s theorem to the function f ( x ) = sin x in ] − 1, 1[


about x = 0 . Then for n = 7 , we have

x3 x5 x7
sin x = x − + − + R 8 (x ) ,
3! 5! 7 !

x8 1
where | R 8 (x ) | = sin (c) ≤ = 0.000024802
8! 8!
Therefore, the truncation error T.E. = R 8 ( x ) = 0.24802 × 10 −4.

x3 x5 x7
b) sin x = x − + − + R 8 (x )
38 3! 51 7 !
Unit 1 Errors and Approximations
Hence,

sin x x 2 x 4 x 6 R 8 (x )
=1− + − +
x 3! 5! 7 ! x

R 8 ( x ) x 8 sin c x 7
where = = sin (c)
x 8! x 8!
Thus,
1
sin x
1
 x2 x4 x6  1
R (x)
 x
dx =  1 −
 3!
+
5 !
− dx +  8
7 !  x
dx
0 0 0

1 1
R 9 (x ) x7
Now  x dx =  8!
sin (c) dx
0 0

1
1 1
≤  x 7 dx = ≤ 0.24802 × 10 −4
8! 0 8 × 8!
1
x7 
1
sin x x3 x5
Therefore, we have  x
dx ≈ x − + − 
3! 3 5! 5 7! 7  0
0

1 1 1
= 1− + −
3! 3 5! 5 7 ! 7
= 0.946
with an error less than 0.25 × 10−4.

2
E17) a) Put u = − x 2 . Then e − x = e u . We consider the 2nd order Taylor
expansion of e u given by

u2
eu = 1 + u + + R 3 (u )
2
ecu 3
where R 3 (u ) =
3!

ec u 3 | e c | | u |3
| R 3 (u ) | = ≤
3! 3!

1 1
Since, u ≤ 0, e c ≤ 1 . Hence | R 3 (u ) | ≤ =
3! 6

−x 2 x4 2
b) From (a) we have e =1− x + + R 3 (−x 2 ) .
2
Hence,
0.1
−x 2
0.1
 x4 
0.1

e  1 − x + dx +  R 3 (− x 2 ) dx
2
dx =
0 0  2 0

0.1 0.1 2
e−x x 6
R 
2
Now, 3 (− x )dx ≤ dx
0 0
3!
39
Block 1 Solution of Nonlinear Equations in One Variable
0.1
x7 
0.1
x6
≤  3!
dx = 
3! 7  0
0

(0.1) 7
= 10 −7
3! 7
Therefore,
0.1
0.1
−x 2
0.1
 x4  x3 x5 
e dx ≈  1 − x 2 +  dx = x − +  = 0.099667666
 2  3 10  0
0 0

40

You might also like