18
 Chapter 2 Solution of Equations in One Variable 2.1 Introduction In Applied Mathematics, the most frequent problem is to find the values of  x to satisfy the equation 0 ) ( =  x  f . Such values are called the roots of the equation and also known as the zeros of ) (  x  f . Some equations are easy to solve. The linear equation such as 0 2 3 =  x  can be solved easily. Quadratic equations can be solved by factorization or by the standard formula. It is possible to solve polynomial equations of higher degree, if they are factorisable, otherwise it is difficult to solve. Many equations involve sines, cosines, exponential and other transcendental functions and it i s difficult to solve them precisely. In fact, majority of equations cannot be solved in any precise manner and so we have to solve them by using iterative procedures. An iterative procedure is a repeative process that produces a sequence of approximations to the equation. In this chapter, we shall consider some of the important approximate methods in finding the roots of the equations in one variable. 2.2 Roots and its Location A polynomial in x of degree n is of the form n n  x a  x a  x a a  x  p + + + + = 2 2 1 0 ) ( where a’s are constants and n is a positive integer. A polynomial equation 0 ) ( =  x  p of degree n has exactly n roots. Some of them are real and others are complex. For a non polynomial equation 0 ) ( =  x  f , there is no such rule of finding the number of roots. Geometrically, if the graph of ) (  x  f  y = crosses the  x-axis at a  x = , then a  x = is a real root of 0 ) ( =  x  f . Now we shall consider graphically to find the the number of real roots and its location. 2.2.1 Number of Real Roots by Graphical Method Rewrite the equation 0 ) ( =  x  f as ) ( ) ( 2 1 x  f  x  f = . At the point of intersection 1  x  x = (say) of the graphs of ) ( 1 x  f  y = and ) ( 2 x  f  y =  we have ) ( ) ( 1 2 1 1 x  f  x  f =  Thus the number of intersections of the two graphs will be the number of real roots of 0 ) ( =  x  f .

Soln. of Eqn. in 1 Variable

Embed Size (px)

Citation preview

Page 1: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 1/18

 

Chapter 2

Solution of Equations in One Variable

2.1 Introduction

In Applied Mathematics, the most frequent problem is to find the values of  x to satisfy the

equation 0)( = x f  . Such values are called the roots of the equation and also known as the

zeros of )( x f  . Some equations are easy to solve. The linear equation such as 023 =− x  

can be solved easily. Quadratic equations can be solved by factorization or by the standard

formula. It is possible to solve polynomial equations of higher degree, if they arefactorisable, otherwise it is difficult to solve. Many equations involve sines, cosines,

exponential and other transcendental functions and it is difficult to solve them precisely. In

fact, majority of equations cannot be solved in any precise manner and so we have to solve

them by using iterative procedures. An iterative procedure is a repeative process that

produces a sequence of approximations to the equation. In this chapter, we shall consider

some of the important approximate methods in finding the roots of the equations in one

variable.

2.2 Roots and its Location

A polynomial in x of degree n is of the formn

n xa xa xaa x p +⋅⋅⋅+++= 2210)(

where a’s are constants and n is a positive integer.

A polynomial equation 0)( = x p of degree n has exactly n roots. Some of them are real

and others are complex. For a non polynomial equation 0)( = x f  , there is no such rule of 

finding the number of roots. Geometrically, if the graph of  )( x f  y = crosses the x-axis at

a x = , then a x = is a real root of 0)( = x f  . Now we shall consider graphically to find the

the number of real roots and its location.

2.2.1 Number of Real Roots by Graphical Method

Rewrite the equation 0)( = x f  as )()( 21 x f  x f  = . At the point of intersection 1 x x = (say)of the graphs of 

)(1 x f  y = and )(2 x f  y =  

we have

)()( 1211 x f  x f  =  

Thus the number of intersections of the two graphs will be the number of real roots of 

0)( = x f  .

Page 2: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 2/18

14 NUMERICAL METHODS WITH EXCEL 

y

O α 

c

 x 

 b a

Fig. Bisection Method

2.2.2 Location of Roots

To locate the roots of  0)( = x f  first study the graph of  )( x f  y = as shown below. If we

can find two values of  x, one for which )( x f  is positive, and one for which )( x f  is

negative, then the curve must have crossed the x-axis and so must have passed through a

root of the equation 0)( = x f  .

In general, if )( x f  is continuous in ],[ ba and )(a f  and )(b f  are opposite in signs i.e.

0)()( <b f a f  , then there exists odd number of real roots (at least one root) of  0)( = x f  in

),( ba .

But the only exception where it does not work is where the graph looks like one of the

following:

Graph 1 Graph 2

In Graph 1, there is a root of  0)( = x f  at P but 0)( > x f  to the left and to the right of P.

In Graph 2, 0)( < x f  to both sides of the root at Q. In both the cases, the tangents at the

root are the  x-axis and hence 0)( =′ x f  For this case, the existence of a root can be

determined by studying the signs of  )( x f ′ in the interval ),( ba containing the root and it

will satisfy the condition 0)()( <′′ b f a f  .

2.3 Method of Bisection

Let )( x f  be continuous in ],[ ba and 0)()( <b f a f  , then there exists a real root of 

0)( = x f  in ],[ ba . In this method we assume the mid-point 2 / )( bac += is the

approximation to the root.

If  0)( =c f  , we conclude that c is a root of 0)( = x f  . If  0)( ≠c f  and

(i) if  0)()( <c f a f  , the root is in ),( ca or

(ii) if  0)()( <b f c f  , the root is in ),( bc .

To continue the process , relabel the new interval

],[ ba and repeat the process until the desired degree of accuracy is achieved.

The following notation is used to keep the tract in the process:

y

yx

x

Q

P

O

O

 x

 y

O−

++

Page 3: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 3/18

CHAPTER 2: Solutions of Equations in One Variable 15 

y

 x α 

))(,( a f a  

O

))(,( b f b  

 x0a

b  

Fig. False Position Method

],[ 00 ba is the starting interval and2

000

ba x

+= is the midpoint.

],[ 11 ba is the second interval which brackets the root and 1 x is the midpoint.

At each step relabel the interval which brackets the root and find the midpoint by

using

2

nn

n

ba

 x

+

= .

2.4 False Position Method

This method is also known as the Regula Falsi or Linear Approximation. The method is

very similar to Bisection method. In bisection method midpoint of the interval ],[ ba is

used for the next iterate. In this method we replace the midpoint formula by the value of 

the x-intercept of the line joining the points ))(,( a f a and ))(,( b f b .

The straight line through ))(,( a f a and ))(,( b f b is

)()()(

)( a xab

a f b f a f  y −−

=−  

On the x-axis 0= y and let 0 x x = , then

)()()(

)( 0 a xab

a f b f a f  −

−=−  

Solving for 0 x ,

)()()(

)(0 a f 

a f b f 

aba x

−−= .

Also note that )()()(

)(0 b f 

a f b f 

abb x

−−= .

If  0)( 0 = x f  , then 0 x is the root. Otherwise the root lies either between 0 x and b or

between a and 0 x depending on whether )()( 0 x f a f  is positive or negative. By designatingthe new interval of root as ],[ 11 ba , we can then calculate the next iterate 1 x by the formula

similar to above. Repeat the process until ε ≤−+ nn x x 1 , where ε  is the specified

accuracy.

2.5 Order of Convergence

Let nε  be the error in the nth iteration for a root α of  0)( = x f  , then

α ε  −= nn x  

If 

=+

∞→ Rn

n

n ε 

ε  1lim const

then the order of convergence of the sequence }{ n x is R.

In special case,

If  1= R , the convergence is called linear.

If 2= R , the convergence is called quadratic.

If 21 << R , the convergence is superlinear.

Page 4: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 4/18

16 NUMERICAL METHODS WITH EXCEL 

))(,( 11 x f  x  

))(,( 00 x f  x  

α 

y

O  x 2  x1  x0

Fig. The Secant Method

 x2

))(,( 00 x f  x  

y

 x O α   x1  x0

Fig. Newton-Raphson Method

2.6 The Secant Method

The Secant method is similar to that of the false position

method. In this method, to find a root of 0)( = x f  with

two points near the root is approximated by the x-intercept

of the secant line (chord) joining the two points.

Let 0 x and 1 x be the starting values of  x , then the first

approximation 2 x of the root is given by

)()()(

)(1

01

0112 x f 

 x f  x f 

 x x x x

−−=  

The estimated value will be closer to the root than

either of the two initial points. We continue the

process to get better approximation of the root by

using the last two computed points using the iteration formula

)()()(

)(

1

11 n

nn

nnnn x f 

 x f  x f 

 x x x x

−+

−−= , 1≥n  

Here it is not necessary that the interval ],[ 1 nn x x − should contain the root i.e.0)()( 1 <− nn x f  x f  .

In selecting, 0 x and 1 x care should be taken so that 1 x is closer to the root than 0 x in

order to get rapid convergence. This can be achieved by selecting 0 x and 1 x such that

)()( 01 x f  x f  <  

Secant method at a simple root, the error terms satisfy the relationship R

nn A ε ε  =+1  

where the order of convergence

618.1)1( 2 / 1 ≈+= R R .

(The proof can be found in advanced texts on numerical analysis).

2.7 Newton-Raphson Method

The procedure known as Newton’s method is also called Newton-Raphson method. In

this method, the root of the equation 0)( = x f  is approximated by the  x-intercept of the

tangent line through a guess value 0 x near the root.

The equation of the tangent through ))(,( 00 x f  x is

)()()( 000 x x x f  x f  y −′=−  

On the x-axis 0= y and let 1 x x = , then

)()()(0100

x x x f  x f  −′=−  

Solving for 1 x ,

)(

)(

0

001

 x f 

 x f  x x

′−=  

The process can be repeated with the new estimate of  x until we reach the required degree

of accuracy.

In general, the iterative formula for the process can be expressed as

⋅⋅⋅=′

−=+ ,3,2,1,0,)(

)(1 n

 x f 

 x f  x x

n

nnn  

Page 5: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 5/18

CHAPTER 2: Solutions of Equations in One Variable 17 

2.7.1 Order of Convergence of the Newton-Raphson process.

Let nε  be the error in the nth iteration, that is

α ε  −= nn x  

where α is a root of the equation 0)( = x f  .

From the Newton-Raphson formula. we have

α α  −′

−=−+)(

)(1

n

nnn

 x f 

 x f  x x  

or)(

)(1

n

nnn

 x f 

 x f 

′−=+ ε ε  (1)

Taylor’s expansion of 0)( =α  f  about n x gives

0)()()()()( 2

2

1 =⋅⋅⋅+′′−+′−+ nnnnn x f  x x f  x x f  α α   

From which we get

⋅⋅⋅+

′′−−−=

′ )(

)()()(

)(

)( 2

21

n

nnn

n

n

 x f 

 x f  x x

 x f 

 x f α α   

)(

)(2

2

1

n

nnn

 x f 

 x f 

′′−≈ ε ε   

Substituting in (1), we have

)(

)(2

2

11

n

nnn  x f 

 x f 

′′≈+ ε ε   

i.e. 1+nε  ∝ 2

nε   

Thus for a simple root the convergence of the Newton-Raphson method is of order two.

2.7.2 Starting Value for Iteration

If the starting value is reasonably close to the root, the number of iterations needed will be

less and calculation time will be saved. Use specified starting value, if stated. Otherwise,

first find an interval in which a root lies and then choose as a starting value, 0 x , either

(i) one of the end-points of the interval where the magnitudes of the value of the

function is small., or

(ii) guess an internal point of the interval closer to the root.

2.8 Multiple Roots

Equal (repeated) roots are known as the multiple roots. If the root α of 0)( = x f  is a

repeated root, then we may write

0)()()( =−= xg x x f m

α   

where )( xg is bounded and 0)( ≠α g .

The root α is called a multiple root of multiplicity m. We obtain from the above equation

0)()()()1( ==⋅⋅⋅=′= −α α α 

m f  f  f  , 0)(

)( ≠α m

 f   

Page 6: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 6/18

18 NUMERICAL METHODS WITH EXCEL 

For a multiple root, the order of convergence is reduced, but the order may be increased by

modifying the methods discussed. If the multiplicity m of the root is known in advance,

then some of the methods can be modified so that they have the same rate of convergence

as that for simple roots.

2.8.1 Modified Newton-Raphson Method

For a multiple root the order of convergence of the Newton-Raphson formula is linear.

The order can be increased by the modified formula

⋅⋅⋅=′

−=+ ,3,2,1,0,)(

)(1 n

 x f 

 x f m x x

n

nnn  

where m is the multiplicity of the root.

The order of convergence of the above is two as that of the simple root.

When the multiplicity of the root is not known in advance, we may proceed as follows;

The function

)(

)()(

 x f 

 x f  xu

′=  

has a simple root α regardless of the multiplicity of the root of 0)( = x f  .

When the Newton-Raphson method is applied to the simple root α of 0)( = xu , we have

)(

)(1

n

nnn

 xu

 xu x x

′−=+  

or

)()()]([

)()(

21

nnn

nnnn

 x f  x f  x f 

 x f  x f  x x

′′−′

′−=+ .

2.9 Fixed Point Iteration MethodA fixed point of a function )( xg is a real number α such that )(α α  g= . This means α is

a root of the equation )( xg x = .

In order to find a root of the equation 0)( = x f  by an iterative method, first rearrange the

equation into a form

).( xg x =  

The function )( xg is called the iteration function. Note that there is no unique form

)( xg x = into which the equation can be rearranged.

An iteration formula is then

⋅⋅⋅==+ ,3,2,1,0),(1 n xg x nn  

If  x0 is an approximation close to a root of 0)( = x f  and )(1 nn xg x =+ is an iterative

formula used to find the root of the equation near x0, then

(i) if  1)( 0 <′ xg , the sequence ⋅⋅⋅,,, 321 x x x will converge to the root. In particular,

(a) if 0)(1 0 <′<− xg , the sequence will oscillates and converge to the root

(b) if 1)(0 0 <′< xg , the sequence will converge to the root without oscillating.

(ii) if  1)( 0 ≥′ xg , the sequence ⋅⋅⋅,,, 321 x x x will diverge.

Without proof, the above possibilities are explained by an example.

Page 7: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 7/18

CHAPTER 2: Solutions of Equations in One Variable 19 

Example 2.1

The equation 0523 =−+ x x has a root near .4.1= x Using following iteration formulae,

perform few iterations and comment on the rerults.

(a) )5(2

1 31 nn x x −=+ (b) ( ) 3 / 1

1 25 nn x x −=+ (c)23

52

2

3

1+

+=+

n

nn

 x

 x x  

The equation can be rearranged as52

3 +−= x x  

or 522333 +=+ x x x  

52)23(32 +=+ x x x  

23

522

3

+

+=

 x

 x x  

and this arrangement gives the iteration formula (c).

The calculation using the three iteration formulae are as follows:

n Formula Formula Formula

(a) (b) (c)

0 1.4 1.4 1.4

1 1.128 1.300591 1.330964

2 1.782375 1.338646 1.328273

3 -0.331181 1.324336 1.328269

4 2.518162 1.329753 1.328269

5 -5.484009 1.327708 1.328269

6 84.96401 1.328481 1.328269

7 -306670.2 1.328189 1.328269

8 1.44E+16 1.328299 1.328269

9 -1.5E+48 1.328257 1.328269

10 1.7E+144 1.328273 1.328269  The iteration function in (a) is

)5(2

1)( 3 x xga −= and 2

2

3)( x xga −=′  

With 4.10 = x , 94.2)4.1( −=′ag .

So 1)4.1( >′ag and the sequence will not converge to the root as shown in the above table.

The iteration function in (b) is

( ) 3 / 125)( x xgb −= and

3 / 2)25(

1

3

2)(

 x xgb

−−=′  

With 4.10 = x , 394.0)4.1( −=′bg .

Since )4.1(bg′ is negative and 1)4.1( <′bg , the sequence will converge to the root with

oscillation as shown in the above table.

The iteration function in (c) is

23

52)(

2

3

+

+=

 x

 x xgc and

22

3

)23(

)52(6)(

+

−+=′

 x

 x x x xgc  

With 4.10 = x , 0736.0)4.1( =′cg .

Since )4.1(cg ′ is positive and 1)4.1( <′cg with small value, the sequence will converge

rapidly to the root without oscillation as shown in the above table.

Page 8: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 8/18

20 NUMERICAL METHODS WITH EXCEL 

2.10 A Test for Order of Convergence

Consider the convergence of the iteration formula )(1 nn xg x =+ for the root α of the

equation 0)( = x f  .

Let nε  be the error in the nth iteration, that is,

)(1 nn g ε α α ε  +=++  

Expanding )( ng ε α + in Taylor series about α, we get

⋅⋅⋅+′′+′+=+ )(!2

)(!1

)()(

2

α ε 

α ε 

α ε α  gggg nnn  

Since α is a root of the equation 0)( = x f  , we have )(α α  g= , and hence

⋅⋅⋅+′′+′=+ )(!2

)(!1

2

1 α ε 

α ε 

ε  gg nnn  

If  0)( ≠′ α g , then 1+nε   ∝  nε  and we have the first order convergence. If  0)( =′ α g and

0)( ≠′′ α g , then 1+nε   ∝ 2

nε  and we have the second order convergence and so on.

We summarize the results as follows:

The order of convergence is the order of the lowest non-zero derivative of the

iterative function )( xg at the root α of  0)( = x f   

Example 1.1 

Given that  x x x f  −+= 22cos2)( .

(a) Find the number of real roots of the equation 0)( = x f  .

(b) Show that the equation 0)( = x f  has a root in )2.1,1( . Use the false position

(Regula Falsi) method to estimate this root correct to 4 decimal places,

(c) The equation 0)( = x f  has a root in the interval )6.2,4.2( . Use Newton-

Raphson formula to estimate this root correct to 5 decimal places with a suitable

starting value.

(d) An iterative formula )2cos1(2)1(1 nnn xk  xk  x ++−=+ can be used to estimate

the root of 0)( = x f  . Find the range of values of k for which the iterative formula

will converge to the root near 6.3 .

Use this iterative formula with a suitable value of k to estimate the root correct to

3 d.p.

Solution

(a) The equation 0)( = x f  i.e. 022cos2 =−+ x x can be written as

22cos2 −= x x  

The graphs of   x y 2cos2= and 2−= x y are shown below.

Page 9: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 9/18

CHAPTER 2: Solutions of Equations in One Variable 21 

- 2 2 4 6

- 4

- 2

2

4

 

The two curves intersect at three points and hence the number of real roots is 3.

(b) It can be seen that

16771.0)1( = f   

67479.0)2.1( −= f   

Here 0)2.1()1( < f  f  . Thus a root lies in )2.1,1( .

Applying false position method on )2.1,1( , we have

0398.103981.1)67479.0(16771.0

)67479.0(1)16771.0(2.11 ≈=

−−

−−= x  

Now 01411.0)03981.1( −= f   and 16771.0)1( = f  as the root lies in (1, 1.0367)

Using false position method again

0367.103672.1)01411.0(16771.0

)01411.0(1)16771.0(03981.12 ≈=

−−

−−= x  

Again 00021.0)03672.1( −= f   

16771.0)1( = f   

and hence 0367.103667.1)00021.0(16771.0

)00021.0(1)16771.0(03672.13 ≈=

−−

−−= x  

Thus x2 and x3 are same to 4 d.p. Hence the root correct to 4 d.p. is 1.0367.

(c) When Newton-Raphson method applied to the equation, we have x x x f  −+= 22cos2)(

12sin4)( −−=′ x x f   

Here 225.0)4.2( −= f  and 337.0)6.2( = f  and we may take a starting value 5.20 = x .

Using Newton-Raphson formula we may proceed as follows:

5.20 = x  

067324.0)5.2()( 0 == f  x f   

835697.2)5.2()( 0 =′=′ f  x f   

47626.2476258.2835697.2

067324.05.2

)(

)(

0

001 ≈=−=

′−=

 x f 

 x f  x x  

47647.2476468.2885231.2

000607.0476258.2)(

)(

1

112 ≈=−−=

′−=

 x f 

 x f  x x  

47647.2476468.2884831.2

1036.1476468.2

)(

)( 7

2

223 ≈=

×−−=

′−=

 x f 

 x f  x x  

The root correct to 5 d.p. is 2.47647.

(d) In this case the iterative function )( xg is given by

)2cos1(2)1()( xk  xk  xg ++−=  

Page 10: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 10/18

22 NUMERICAL METHODS WITH EXCEL 

 xk k  xg 2sin41)( −−=′  

and k g 175.41)6.3( −=′  

The iterative formula will converge to the root near 3.6 if 

1)6.3( <′g or 1175.41 <− k   

1175.411 <−<− k   

0175.42 <−<− k  (adding 1− to each expression)0175.42 >> k  (multiplying by 1− )

04896.0 >> k  (dividing by 4.175)

which gives the range of values of k .

A suitable choice of k is

0175.41 ≈− k  which gives 24.02395.0175.4

1≈==k  .

With 24.0=k  , the iteration formula becomes

)2cos1(48.076.0)2cos1)(24.0(2)24.011 nnnnn x x x x x ++=++−=+  

With 6.30 = x , the successive iterates are given below:

n   xn  xn (to 4 d.p.)

0 3.6 3.60001 3.50801 3.5080

2 3.50286 3.5029

3 3.50224 3.5022

4 3.50216 3.5022

The root correct to 4 d.p. is 3.5022.

Example 1.2

. Equation  x tan x = 4 has infinite number of roots. To find the root near  x = 1.3, we

may use an iteration formula  xn+1 = arctan (4/  xn). Show that the process is linearly

convergent.Starting with x0 = 1.3, estimate 4 x rounded to 3 decimal places.

Show that 4 x   is correct to 3 decimal places.

Solution

In this case the iterative function g( x) is

( ) x

 xg 41tan)(−=  

Differentiating16

44

) / 4(1

1)(

222 +−=⎟⎟

 ⎠

 ⎞⎜⎜⎝ 

⎛ −

+=′

 x x x xg  

Therefore 0)(≠′ xg

for all real values of x and hence it is linearly convergent.

Starting with 3.10 = x we have the successive iterated values as follows:

2566.11 = x , 2663.12 = x , 2642.13 = x , 265.12647.14 ≈= x  

Comparing 4 x with 3 x we cannot conclude that 4 x is correct to 3 d.p, Next iteration

gives

265.12646.15 ≈= x  

Comparison of  4 x and 5 x shows that 4 x is correct to 3 d.p.

Page 11: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 11/18

CHAPTER 2: Solutions of Equations in One Variable 23 

Alternatively, if  4 x is correct to 3 d.p. the root α must satisfy the condition

3

213

21 10265.110265.1

−− ×+<<×− α  i.e. 2655.12645.1 <<α   

Using 4tan)( −= x x x f  . we find

0016.0)2645.1( −= f  and 0156.0)2655.1( = f   

This shows that4

 x is correct to 3 d.p.

Page 12: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 12/18

24 NUMERICAL METHODS WITH EXCEL 

2.11 Solution Using MS Excel

2.11.1 Number of Real Roots by Graphical Method

For example, consider the number of real roots of the equation021cos7 =+− x x  

The equation can be written as  x x 21cos7 −= .

Now consider the graphs of   x x f  cos7)(1 = and  x x f  21)(2 −= .

Excel Worksheet Entry for data values Creating Chart (Graph)

A B C 1 Tabulate the data values.

1 x f1(x) f2(x) 2 Select data range (cells A2:C14)

2 -6 =7*cos(A2) =1-2*A2 3 In the Insert menu, select Chart

3 -5 4 In the Chart Wizard, select Char type:

4 XY (Scatter) and in Chart sub-type :

5 Select Finish to complete the diagram.

Excel Results 6 Change the size of the diagram by dragging

A B C and change the background color (optional)

1 x f1(x) f2(x) 7 Place the diagram in the desired location2 -6 6.721192 13 by dragging.

3 -5 1.985635 11

4 -4 -4.575505 9

5 -3 -6.929947 7

6 -2 -2.913028 5

7 -1 3.782116 3

8 0 7 1

9 1 3.782116 -1

10 2 -2.913028 -3

11 3 -6.929947 -5

12 4 -4.575505 -7

13 5 1.985635 -9 There are three intersections and hence

14 6 6.721192 -11 the number of real roots is three.

-15

-10

-5

0

5

10

15

-8 -6 -4 -2 0 2 4 6 8

 

Intervals of roots of width 0.5 for 021cos7)( =+−= x x x f  .

A B

1 x f(x) 1 Enter the range of values of the variable x

2 -2 -7.913028 in column A.

3 -1.5 -3.50484 2 In cell B2 enter the formula

4 -1 0.782116 =7*cos(a2)-1+2*a2

5 0 6 and drag down the column.

6 1 4.782116

7 2 0.086972 From the table8 2.5 -1.608005 (i) f(-1.5) f(-1) < 0 A root is in ( -1.5, -1).

9 3 -1.929947 (ii) f(2) f(2.5) < 0 A root is in ( 2, 2.5).

10 3.5 -0.555197 (i) f(3.5) f(4) < 0 A root is in ( 3.5, 4).

11 4 2.424495

 

Page 13: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 13/18

CHAPTER 2: Solutions of Equations in One Variable 25 

2.11.2 Solution by Bisection Method

To determine a root of  0)( = x f  in ),( ba such that 0)()( <b f a f  , set

aa =0 and bb =0 .

The approximation to the root is obtained by

2

nnn

ba x

+=   L,2,1,0=n  

Now if  0)()( <nn x f a f  , then set

nn aa =+1 and nn xb =+1  

else set

nn xa =+1 and nn bb =+1 .

A B C D E F G

1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by Bisection Method

2 n an

xn

bn

f(an

) f(xn

) f(bn

)3 0 -1.5 -1.25 -1 -3.5048396

4 1 -1.25 -1.25

5 2

6  

7

8

A B C D E F G

1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by Bisection Method

2 n an xn bn f(an) f(xn) f(bn)

3 0 -1.5 -1.25 -1 -3.5048396 -1.292743 0.7821164 1 -1.25 -1.125 -1 -1.2927435 -0.231764 0.782116

5 2 -1.125 -1.0625 -1 -0.2317644 0.281828 0.7821166 3 -1.125 -1.09375 -1.0625 -0.2317644 0.026601 0.281828

7 4 -1.125 -1.109375 -1.09375 -0.2317644 -0.102201 0.0266018 5 -1.109375 -1.101563 -1.09375 -0.1022013 -0.037704 0.0266019 6 -1.101563 -1.097656 -1.09375 -0.0377036 -0.005527 0.02660110 7 -1.097656 -1.095703 -1.09375 -0.005527 0.010543 0.02660111 8 -1.097656 -1.09668 -1.095703 -0.005527 0.00251 0.01054312 9 -1.097656 -1.097168 -1.09668 -0.005527 -0.001508 0.00251

13 10 -1.097168 -1.096924 -1.09668 -0.0015084 0.000501 0.00251

B3*21cos(B3)*7 +−=D3)/2(B3 +=

C3)B3,0,E3*IF(F3 <= C3)D3,0,G3*IF(F3 <=

 

Page 14: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 14/18

26 NUMERICAL METHODS WITH EXCEL 

2.11.3 Solution by False Position (Regula Falsi) Method

The False Position method is very similar to Bisection method. Here replace the iterative

formula by

)()()(

n

nn

nnnn a f 

b f a f 

baa x

−−= .

Replace the formula of cell C3 in Bisection method by

=B3-(D3-B3)*E3/(G3-E3)  A B C D E F G

1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by False Position Method

2 n an xn bn f(an) f(xn) f(bn)

3 0 -1.5 -1.09122 -1 -3.5048396 0.04738 0.7821164 1 -1.5 -1.096673 -1.09122 -3.5048396 0.002566 0.047385 2 -1.5 -1.096968 -1.096673 -3.5048396 0.000138 0.0025666 3 -1.5 -1.096984 -1.096968 -3.5048396 7.43E-06 0.0001387 4 -1.5 -1.096985 -1.096984 -3.5048396 3.99E-07 7.43E-06

8 5 -1.5 -1.096985 -1.096985 -3.5048396 2.15E-08 3.99E-07  

2.11.4 Solution by Secant Method

To determine a root of  0)( = x f  given two values 0 x , 1 x that are near the root, proceed as

follows:

If  )()( 10 x f  x f  < , swap 0 x and 1 x and contitnue the process by using the iterative

formula

)()()( 1

1

1 nnn

nn

nnx f 

 f  x f 

 x x x x

+ −

−−= .

Initialization of data:

x f(x) Here ⏐f(-1.5)⏐ > ⏐f(-1)⏐ and thus use

-1.5 -3.50484 x0 = -1.5

-1 0.782116 x1 = -1

A B C D E F G

1 Solution of f(x) = 7 cos(x) - 1 + 2x = 0 by Secant Method

2 n xn f(xn)

3 0 -1.5 -3.50484 In cell C3 enter the formula

4 1 -1 0.782116 =7*cos(B3) - 1 +2*B35 2 -1.09122 0.04738 and copy down the column.6 3 -1.097103 -0.000972  

7 4 -1.096985 1.09E-06 In cell B5 enter the formula8 5 -1.096985 2.51E-11 =B4 - (B4 - B3)*C4/(C4 -C3)9 6 -1.096985 0 and copy down the column.  

Page 15: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 15/18

CHAPTER 2: Solutions of Equations in One Variable 27 

2.11.5 Solution by Newton (Newton-Raphson) Method

In Newton-Raphson method, the iterative formula is expressed as

⋅⋅⋅=′

−=+ ,3,2,1,0,)(

)(1 n

 x f 

 x f  x x

n

nnn  

For example,

Solution of 7 cos(x) - 1 + 2x = 0 by Newton-Raphson MethodHere f(x) = 7 cos x - 1 + 2x

f'(x) = - 7 sin x +2

Estimation of starting valuex f(x)

-1.5 -3.50484 Root is closer to x = -1.

-1 0.782116 Comparing the magnitudes, assume xo = - 1.1.

A B C D

1 Solution by Newton-Raphson Method

2 n xn f(xn) f'(xn)

3 0 -1.1

4 1 =B3-C3/D3

5 2

A B C D

1 Solution by Newton-Raphson Method

2 n xn f(xn) f'(xn)

3 0 -1.1 -0.024827 8.238452  4 1 -1.096986 -1.44E-05 8.228855

5 2 -1.096985 -4.92E-12 8.228849

6 3 -1.096985 0 8.228849  7 4 -1.096985 0 8.228849

8 5 -1.096985 0 8.228849

B3*21cos(B3)*7 +−=

2sin(B3)*7 +−=

 

Page 16: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 16/18

28 NUMERICAL METHODS WITH EXCEL 

Exercise 2

1.  Given the following equations:

(i) 034

3 =−+x x (ii) 072

24 =−+x x (iii) 072

2 =−−xe

 x

 (iv) 1)35(

2 =− xe x  (v) 021cos7 =+− x x   (vi) 042sin2

2 =−+ x x  

(vii) 025)2ln( =+− x x   (viii) 01sin =+− x x (ix) 02.1ln =− x x  

(x) 0cos13 =−− x x   (xi) 01tan42 =−− x x in )2 / ,2 / ( π π −  

(a) Find the number of real roots and in each case find an interval where the root lies.

(b) Use Bisection method to find a root of the equation correct to 1 decimal place.

(c) Use the false position method (Regula Falsi) method to find a root, correct to 2

decimal places.

(d) Use Secant method to find a root of the equation correct to 2 decimal places.

(e) Use Newton-Raphson method to find a root of the equation correct to 3 decimal

places.

2. Given that 010)( 2 =−−= x xee x f  .

(a) Find the number of real roots of the equation 0)( = x f  and locate them with an

interval of width 1.

(b) Use the Bisection method thrice to find the new interval where the roots lie.

(c) Use the Secant method on the interval obtained in (b) to estimate the roots

correct to 3 decimal places.

3. Show that the equation 043cos3)( =−+= x x x f  has a root in [1, 2].

Find the root correct to 3 significant figures using

(i) Bisection method(ii) False position method

(iii) Secant method and

(iv) Newton-Raphson method.

Compare the number of iterations required and the computational effort in each case.

4. The equation f ( x) = 0 has a real root α, and x1 is an approximation to α, where α =

 x1 - ε and ε is small. Write down the first two terms of Taylor’s series, in powers of 

ε, for )( 1 ε − x f  . Hence obtain the Newton-Raphson approximation to α.

Solve the equation 3 x – cos x – 1 = 0 by Newton-Raphson method.

5. Given that  x x x x f  cossin)( += .

(a) Show that the equation 0)( = x f  has a real root α in the interval ]3,2[ .

(b) Use the Secant method twice on the above interval to obtain an approximation to

α rounded to 2 decimal places.

(c) Use Newton-Raphson method twice starting with the estimated value obtained

in (b) to find a second approximation 2 x to α, giving your answer to 5 decimal

places.

(d) Show that 2 x is correct to 5 decimal places.

Page 17: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 17/18

CHAPTER 2: Solutions of Equations in One Variable 29 

6. The equation 0324423704923 =+−+ x x x has a double root near  x = 1. Use

modified Newton-Raphson method to find the root correct to 3 decimal places.

7. The equation 043 46 =+− x x has two double roots. One near 5.1−= x and another

near 5.1= x . Find the roots correct to 5 decimal places using the Newton-Raphson

method.

8. The equation 0625100045027 24 =−+− x x x has a multiple root of multiplicity three

near  x = 2. Use Newton-Raphson method to find the root correct to 5 decimal

places.

9. Consider the solution of  09523 =−+ x x in [1, 2] based on the following iterative

formulae

(a) 59

21 −=+

n

n x

 x (b)

2 / 13

15

9

⎟⎟

 ⎠

 ⎞

⎜⎜

⎝ 

⎛  −=+

nn

 x x (c)

2 / 1

15

9⎟⎟ ⎠

 ⎞⎜⎜⎝ 

⎛ 

+=+

n

n x

 x  

Perform few iterations and comment on the different iterative formulas.

10. The equation 2 cos x – x = 0 has a root near x = 1.1. Among others, the following

iteration formulae are suggested to estimate the root.

(i) nn x x cos21 =+ (ii) nnn x x x2

1cos1 +=+ (iii) )(cos

3

21 nnn x x x +=+  

Apply an appropriate test to determine, for each rearrangement, whether or not the

corresponding iteration converges to the root.

Using whichever of these iteration formulae you consider most appropriate, find the

root correct to 4 significant figures.

11. The equation 0345 23 =−+− x x x has a root near 4= x , which is to be computed

by the iteration

 x x xk  x nnn

n

32

15)4(3 −+−+

=+ and 40 = x  

(i)  Determine which value of k will give the fastest convergence.

(ii) Using this value of k, iterate three times and estimate the error in 3 x .

12. Given that 2)( 2 −+= x xe x f x

.

(a) Show that the equation 0)( = x f  has only two real roots.

(b) Use the false position method twice in [0, 1] to find the root of  0)( = x f  to 2

decimal places.

(c) Use Newton-Raphson method thrice to find the root in ]1,2[ −− of the equation0)( = x f  giving your answer to 3 decimal places. Asses the accuracy of the root

without further calculation.

(d) An iterative formula )2(2

1 −++=+ n x

nnn xe xk  x x n , k  ≠ 0, can be used to

estimate the roots of   f ( x) = 0. Find the range of values of  k for which the

iterative formula will converge to the root near 0.7.

Use this iterative formula with a suitable value of k to estimate the root correct to

3 d.p.

Page 18: Soln. of Eqn. in 1 Variable

8/8/2019 Soln. of Eqn. in 1 Variable

http://slidepdf.com/reader/full/soln-of-eqn-in-1-variable 18/18

30 NUMERICAL METHODS WITH EXCEL 

13. The following iterative formulae can be used to estimate the value of  √ a . In each

case find the order of convergence of the sequence.

(i) )1(22

11

n x

ann x x +=+ (ii) )4(

2

31

1a

 x x x n

nn −=+ (iii) ][2

21

36

8

1

a

 x

 x

a x x n

n

nn −+=+  

With an iterative formula above, estimate the value of  11 correct to 5 decimal

places.

14. Equation  f ( x) = 0 has a root  x = α . Show that rewriting the equation as x = x + λ 

 f ( x), where λ is a constant, yields a convergent iteration for α if λ = -1/  f ′   ( x0) and  x0 

is sufficiently close to α.

Use this method to derive an iteration formula for the root of the equation

 x xe x

cos= .

Hence estimate the root near 8.1−= x correct to 2 decimal places.