..... Numarical Analaysis PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 69

B.

Tech 4th Semester MATHEMATICS-IV

UNIT-1

NUMERICAL METHOD

We use numerical method to find approximate solution of problems by numerical calculations with aid of
calculator. For better accuracy we have to minimize the error.

Error = Exact value – Approximate value

Absolute error = modulus of error

Relative error = Absolute error / (Exact value)

Percentage error = 100 X Relative error

The error obtained due to rounding or chopping is called rounding error.

For example π = 3.14159 is approximated as 3.141 for chopping (deleting all decimal)

or 3.142 for rounding up to 3 decimal places.

Significant digit:

It is defined as the digits to the left of the first non-zero digit to fix the position of decimal point.

For example each of following numbers has 5 significant digits.

0.00025610, 25.610, 25601, 25610

Solution of Equations by Iteration:

Intermediate value Theorem: If a function f(x) is continuous in closed interval [a,b] and satisfies f(a)f(b) < 0
then there exists atleast one real root of the equation f(x) = 0 in open interval (a,b).

Algebraic equations are equations containing algebraic terms ( different powers of x). For example x2-7x+6=0

Transcendental equations are equations containing non-algebraic terms like trigonometric, exponential,
logarithmic terms. For example sin x – ex = 0

A. Fixed point iteration method for solving equation f(x) = 0


Procedure

Step-I We rewrite the equation f(x) = 0 of the form x = h(x), x=g(x), x = D(x)

We find the interval (a,b) containing the solution (called root).

Step-II We choose that form say x = h(x) which satisfies I h΄(x) I < 1 in interval (a,b) containing the
solution (called root).

Step-III We take xn+1 = h(xn) as the successive formula to find approximate solution (root) of the
equation f(x) = 0

Step-III Let x=x0 be initial guess or initial approximation to the equation f(x) = 0
Then x1=h(x1) , x2=h(x2) , x3=h(x3) and so on.We will continue this process till we get solution (root) of
the equation f(x) = 0 up to desired accuracy.

Convergence condition for Fixed point iteration method

If x=a is a root of the equation f(x) = 0 and the root is in interval (a, b). The function h΄(x) and h(x)
defined by x = h(x) Is continuous in (a,b) .Then the approximations x1=h(x1) , x2=h(x2) , x3=h(x3) .......
converges to the root x=a provided I h΄(x) I < 1 in interval (a,b) containing the root for all values of x.

Problems

1. Solve x3 - sin x -1 =0 correct to two significant figures by fixed point iteration method correct up
to 2 decimal places.

Solution: x3 - sin x -1 =0........ ......... ........ ........ ...(1)

Let f(x) = x3-sin x -1

f(0) = -1, f(1)= - 0.8415, f(2)=6.0907

As f(1)f(2)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 1 and 2

Let us rewrite the equation f(x) = 0 of the form x = h(x)

x= (1 + Sin x)1/3 = h1(x) and x = Sin-1(x3 - 1)= h2(x)

We see that I h1΄(x) I < 1 in interval (1,2) containing the root for all values of x.

We use xn+1= (1 + Sin xn)1/3 as the successive formula to find approximate solution (root) of the
equation (1).

Let x0 =1.5 be initial guess to the equation (1).

Then x1= (1 + Sin x0)1/3 = (1 + Sin 1.5)1/3 = 1.963154

x2= (1 + Sin x1)1/3 = (1 + Sin 1.963154)1/3 = 1.460827

x3= (1 + Sin x2)1/3 = (1 + Sin 1.460827)1/3 = 1.440751

x4= (1 + Sin x3)1/3 = (1 + Sin 1.440751)1/3 = 1.441289

which is the root of equation (1) correct to two decimal places.

Newton Raphson Method

Procedure

Step-I We find the interval (a,b) containing the solution (called root) of the equation f(x) = 0 .

Step-II Let x=x0 be initial guess or initial approximation to the equation f(x) = 0
Step-III We use xn+1 =xn - [f(xn) / f΄(xn)] as the successive formula to find approximate solution (root)
of the equation f(x) = 0

Step-III Then x1 , x2 , x3 ............ and so on are calculated and we will continue this process till we get
root of the equation f(x) = 0 up to desired accuracy.

2. Solve x - 2sin x - 3 = 0 correct to two significant figures by Newton Raphson method correct up
to 5 significant digits.

Solution: x - 2sin x - 3 = 0........ ......... ........ ........ ...(2)

Let f(x) = x-2sin x - 3

f(0) = -3, f(1)= -2 - 2 Sin 1 , f(2)= -1 - 2 Sin 2 ,f(3)= - 2 Sin 3, f(4)= 1- 2 Sin 4

f(-2)= -5 + 2 Sin 2 ,f(-1)= -4 + 2 sin 1

As f(3)f(4)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 3 and 4

Let Let x0 =4 be the initial guess to the equation (2).

Then x1= x0 - [f(x0) / f΄(x0)] = 2- f(2)/ f΄(2) = 3.09900


=
x2= x1 - [f(x1) / f΄(x1)] - 1.099- f(- 1.099)/ f΄(- 1.099) = 3.10448

x3= x2 - [f(x2) / f΄(x2)] = 3.10450

x4= x3 - [f(x3) / f΄(x3)] = 3.10451

which is the root of equation (2) correct to five significant digits.

Secant Method

Procedure

Step-I We find the interval (a,b) containing the solution (called root) of the equation f(x) = 0 .

Step-II Let x=x0 be initial guess or initial approximation to the equation f(x) = 0

Step-III We use xn+1 = xn - [ (xn - xn-1 )f(xn)] / [f(xn) - f(xn-1)] as the successive formula to find
approximate solution (root) of the equation f(x) = 0

Step-III Then x1 , x2 , x3 ............ and so on are calculated and we will continue this process till we get
root of the equation f(x) = 0 up to desired accuracy.

3 . Solve Cos x = x ex correct to two significant figures by Secant method correct up to 2 decimal
places.

Solution: Cos x = x ex ........ ......... ........ ........ ...(3)

Let f(x) = Cos x – x ex


f(0) = 1, f(1)= Cos 1 – e = - 2 .178

As f(0)f(1)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 0 and 1

Let Let x0 = 0 and x1 = 1 be two initial guesses to the equation (3).

Then

x1  x0  f ( x1 ) 1  0 f (1) 2.178


x2  x1  1  1  0.31465
f ( x1 )  f ( x0 ) f (1)  f (0)  3.178

f(x2)= f (0.31465)= Cos (0.31465) - 0.31465 e0.31465 = 0.51987

x3  x 2 
x2  x1  f ( x2 )  0.31465 0.31465 1 f (0.31465)  0.44672
f ( x2 )  f ( x1 ) f (0.31465)  f (1)

 x3  x 2  f ( x 3 )
x 4  x3   0.64748
f ( x3 )  f ( x 2 )

 x 4  x3  f ( x 4 )
x5  x 4   0.44545
f ( x 4 )  f ( x3 )

which is the root of equation (3) correct to two decimal places.

4. Solve x4 - x - 7 = 0 correct to two significant figures by Newton- Raphson method correct up to


6 significant digits.

Solution: x4 - x - 7 = 0........ ......... ........ ........ ...(4)

Let f(x) = x4 - x - 7

f(0) = -7, f(1)= -7 , f(2)= 5

As f(1)f(2)< 0 by Intermediate value Theorem the root of real root of the equation f(x) = 0 lies
between 1 and 2

Let Let x0 = 1.5 be the initial guess to the equation (2).

Then x1= x0 - [f(x0) / f΄(x0)] = 1.5 - f(1.5)/ f΄(1.5) = 1.78541


=
x2= x1 - [f(x1) / f΄(x1)] 1.7854- f1.7854)/ f΄(1.7854) = 1.85876

x3= x2 - [f(x2) / f΄(x2)] = 1.85643

x4= x3 - [f(x3) / f΄(x3)] = 1.85632

which is the root of equation (2) correct to 6S.


INTERPOLATION

Interpolation is the method of finding value of the dependent variable y at any point x using the
following given data.

x x0 x1 x2 x3 .. .. .. xn

y y0 y1 y2 y3 .. .. .. yn

This means that for the function y = f(x) the known values at x = x0 , x1 , x2 ,........., xn are respectively

y = y0 ,y1 , y2 ,.........,yn and we want to find value of y at any point x.

For this purpose we fit a polynomial to these datas called interpolating polynomial. After getting the
polynomial p(x) which is an approximation to f(x), we can find the value of y at any point x.

Finite difference operators

Let us take equispaced points x0 , x1 , x2 ,........., xn

i.e. x1 = x0 + h, x2 = x1 + h, ......................, xn = xn - 1 + h

Forward difference operator Δ yn = yn + 1 - yn

Backward difference operator  yn = yn - yn - 1

Central difference operator δyi = yi + 1/2 - yi – ½

Shift Operator E yi = yi+1

Newton’s Forward difference Interpolation formula

Let us take the equi-spaced points x0 , x1 = x0 + h, x2 = x1 + h, ......................, xn = xn - 1 + h

Then Δ yn = yn + 1 - yn is called the first Forward difference

i.e. Δ y0 = y 1 - y0 , Δ y1 = y 2 - y1 and so on.

Δ2 yn = Δ yn + 1 - Δ yn is called the second Forward difference

i.e. Δ2 y0 = Δ y 1 - Δ y0 , Δ2 y1 = Δ y 2 - Δ y1 and so on.

Newton’s Forward difference Interpolation formula is

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ ...................... + [ p(p – 1) (p – 2).......(p-n-1)/n! ] Δ ny0

Where p = (x - x0)/h
Problems

5. Using following data find the Newton’s interpolating polynomial and also find the value of y at x=5

x 0 10 20 30 40

y 7 18 32 48 85

Solution

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40,

x1 - x0= 10 = x2 - x1 = x3 - x2 = x4 - x3

The given data is equispaced.

As x= 5 lies between 0 and 10 and at the start of the table and data is equispaced, we have to use
Newton’s forward difference Interpolation.

Forward difference table

x y Δy Δ2 y Δ3 y Δ4 y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Here x0 = 0, y0 = 7, h= x1 - x0 = 10-0 = 10

Δ y0 = 11 , Δ2 y0 =3 ,

Δ3 y0 = 2, Δ4 y0 =10

p = (x - x0)/h = (x - 0)/10 = 0.1x

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ [ p(p – 1) (p – 2)(p-3)/4! ] Δ 4y0


= 7 + 0.1x (11) + [0.1x(0.1x - 1)/2! ] (3) + [0.1x(0.1x - 1) (0.1x - 2)/3! ] (2)

+ [0.1x(0.1x - 1) (0.1x - 2) (0.1x - 3)/4! ] (10)

= 7 + 1.1x + (0.01x2 - 0.1x)1.5 + (0.001x3 - 0.03x2 +0. 2x)/3

+ 0.416 ( 0.0001x4 - 0.006x3 +0. 11x2 -0.6x)

Pn (x) = 0.0000416 x4 - 0.0022 x3 +0.05x2 + 1.26 x +7

Is the Newton’s interpolating polynomial

To find the approximate value of y at x=5 we put x=5 in the interpolating polynomial to get

y(5)=Pn (5) = 0.0000416 (5)4 - 0.0022 (5)3 +0.05(5)2 + 1.26 (5) +7 = 14.301

6. Using following data find the Newton’s interpolating polynomial and also find the value of y at x=24

x 20 35 50 65 80

y 3 11 24 50 98

Solution

Here x0 = 20, x1 = 35, x2 = 50, x3 = 65, x4 = 80,

x1 - x0= 15 = x2 - x1 = x3 - x2 = x4 - x3

The given data is equispaced.

As x= 24 lies between 20 and 35 and at the start of the table and data is equispaced, we have to use
Newton’s forward difference Interpolation.

Here x0 = 20, y0 = 3, h= x1 - x0 = 35 - 20 = 15

Δ y0 = 8 , Δ2 y0 = 5 ,

Δ3 y0 = 8, Δ4 y0 = 1

p = (x - x0)/h = (x - 20)/15 = 0.0666 x - 1.333333


Forward difference table

x y Δy Δ2 y Δ3 y Δ4 y

20 3

35 11 05

13 08

50 24 13 01

26 9

65 50 22

48

80 98

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ [ p(p – 1) (p – 2)(p-3)/4! ] Δ 4y0

= 3 + 8 (0.0666 x - 1.333333) + 5[(0.0666 x - 1.333333) (0.0666 x - 2.333333)/2! ]

+ 8[ (0.0666 x - 1.333333) (0.0666 x - 2.333333) (0.0666 x - 3.333333) /3! ]

+ [ (0.0666 x - 1.333333) (0.0666 x - 2.333333) (0.0666 x - 3.333333) (0.0666 x - 4.333333) /4! ]

= 3 + 0.53333333 x - 10.666666 + 0.01111x2 -0.16666666 x + 7.777777

+ [ (0.5333333 x - 10.66666) (0.0666 x - 2.333333) (0.011111 x - 0.5555555) ]

+ [ (0.0666 x - 1.333333) (0.0666 x - 2.333333) (0.011111 x - 0.5555555) (0.01666 x - 1.083333)]

Is the Newton’s interpolating polynomial

To find the approximate value of y at x = 24 we put x = 24 in the interpolating polynomial to get

y(24) = Pn (24) = 3 + (0.53333333)24 - 10.666666 + 0.01111(242) – (0.16666666)24 + 7.777777

+ [ (0.5333333(24) - 10.66666) (0.0666 (24) - 2.333333) (0.011111 (24) - 0.5555555) ]

+ [ (1.59999 - 1.333333)( 1.59999 - 2.333333) (0.266666 - 0.5555555) (0.399999 - 1.083333)]


Newton’s Backward difference Interpolation formula

Let us take the equi-spaced points x0 , x1 = x0 + h, x2 = x1 + h, ......................, xn = xn - 1 + h

Then  yn = yn - yn - 1 is called the first backward difference

i.e.  y1 = y 1 - y0 ,  y2 = y 2 - y1 and so on.

 2yn =  yn -  yn - 1 is called the second backward difference

i.e.  2y1 =  y 1 -  y0 ,  2y2 =  y 2 -  y 1 and so on.

Newton’s backward difference Interpolation formula is

Pn (x) = yn + p  yn + [ p(p + 1)/2! ]  2yn + [ p(p + 1) (p + 2)/3! ]  3yn

+ ...................... + [ p(p + 1) (p+ 2).......(p +n - 1)/n! ]  nyn

Where p = (x - xn)/h

7. Using following data to find the value of y at x = 35

x 0 10 20 30 40

y 7 18 32 48 85

Solution :

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40,

x1 - x0= 10 = x2 - x1 = x3 - x2 = x4 - x3

The given data is equispaced.

As x= 35 lies between 3 0 and 40 and at the end of the table and given data is equispaced ,we have
to use Newton’s Backward difference Interpolation.

Here x = 35, xn = 40, yn = 87, h= x1 - x0 = 10-0 = 10

 yn= 36 ,  2yn = 17 ,

 3yn= 12,  4yn=10

p = (x - xn)/h = (35 - 40)/10 = -0.5


Backward difference table

x y Δy Δ2 y Δ3 y Δ4 y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Pn (x) = yn + p  yn + [ p(p + 1)/2! ]  2yn + [ p(p + 1) (p + 2)/3! ]  3yn

+ [ p(p + 1) (p+ 2)(p +3)/4! ]  4yn

= 87 + (-0.5) (36) + (-0.5) (-0.5+1) (17) /2! + (-0.5) (-0.5+1) (-0.5+2) (12) /3!

+ (-0.5) (-0.5+1) (-0.5+2) (-0.5+3) (10) /4!

= 87 – 18 – 0.25(8.5) - 0.25(18)/6 – 0.25(15)(2.5)/24

= 65.734375

This is the approximate value of y at x=35

y(35)=Pn (35) = 65.734375

Inverse Interpolation

The process of finding the independent variable x for given values of f(x) is called Inverse
Interpolation .
8. Solve ln x = 1.3 by inverse Interpolation using x= G(y) with G(1)=2.718 ,G(1.5)= 4.481 , G(2)=
7.387 ,G(2.5)= 12.179 and find value of x

Forward difference table

y x Δy Δ2 y Δ3 y

1 2.718

1.763

1.5 4.481 1.143

2.906 0.743

2 7.387 1.886

4.792

2.5 12.179

Here y0 = 1, h=y1 - y0 = 1.5 - 1 = 0.5

x0 = 2.718, Δ x0 = 1.763 , Δ2 x0 = 1.143 ,

Δ3 x0 = 0.743

p = (y - y0)/h = (1.3 - 1)/0.5 = 0.6

Newton’s Forward difference Interpolation formula is

Pn (y) = x0 + p Δx0 + [ p(p – 1)/2! ] Δ 2x0 + [ p(p – 1) (p – 2)/3! ] Δ 3x0

= 2.718 + 0.6 (1.763)+ 0.6(0.6-1)1.143/2 + 0.6(0.6-1) (0.6-2)0.743/6

= 3.680248

Lagrange Interpolation (data may not be equispaced)

Lagrange Interpolation can be applied to arbitrary spaced data.

Linear interpolation is interpolation by the line through points (x1,y1) and (x0,y0)

Linear interpolation is P1(x)= l0 y0 + l1 y1

Where l0 = (x- x1) /( x0- x1) and l1 = (x- x0) /( x1- x0)
Quadratic Lagrange Interpolation is the Interpolation through three given points (x2,y2) , (x1,y1) and
(x0,y0) given by the formula

P2(x)= l0 y0 + l1 y1 + l2 y2

Where l0 
x  x2 x  x1  , x  x2 x  x0  x  x1 x  x0 
l1  and l 2 
x0  x2 x0  x1  x1  x2 x1  x0  x2  x1 x2  x0 

9. Using quadratic Lagrange Interpolation find the Lagrange interpolating polynomial P2(x)

and hence find value of y at x=2 Given y(0) = 15, y(1) = 48, y(5) = 85

Solution :

Here x0 = 0, x1 = 1, x2 = 5 and y0 = 15, y1 = 48, y2 = 85

x1 - x 0 = 1 ≠ x2 - x1 = 4

The given data is not equispaced.

x  x2 x  x1  x  5x  1 x 2  6 x  5
l0   
x0  x2 x0  x1  0  50  1 5

l1 
x  x2 x  x0 

x  5x  0  x 2  5 x 
x1  x2 x1  x0  1  51  0  4
x  x1 x  x0  x  1x  0 x 2  x 
and l 2   
x2  x1 x2  x0  5  15  0 20

y  l0 y0  l1 y1  l 2 y 2 
x 2
 6x  5 
15 

x 2  5x 
48 

x2  x
85

5  4 20
  4.75x 2  37.75x  15

Which is the Lagrange interpolating polynomial P2(x)

Hence at x=2 the value is P2(2) = - 4.75(22)+37.75(2)+15 = 71.5

General Lagrange Interpolation is the Interpolation through n given points (x0,y0), (x1,y1) ,
(x2,y2)....................... , (xn,yn) given by the formula

Pn(x)= l0 y0 + l1 y1 + l2 y2 + ................ + ln yn

x  xn ................x  x2 x  x1 
Where l0 
x0  xn ................x0  x2 x0  x1 
x  xn ................x  x2 x  x0 
l1 
x1  xn ................x1  x2 x1  x0 
x  xn ...................x  x1 x  x0 
l2 
x2  xn .................x2  x1 x2  x0 
.........
...........
x  xn1 ...................x  x1 x  x0 
and l n 
xn  xn1 .................x2  x1 x2  x0 

10. Using Lagrange Interpolation find the value of y at x=8

Given y(0) = 18, y(1) = 42, y(7) = 57 and y(9) = 90

Solution :

Here x0 = 0, x1 = 1, x2 = 7, x3 = 9 and y0 = 26, y1 = 40, y2 = 75, y3 = 90

x1 - x 0 = 1 ≠ x2 - x1 = 6

The given data is not equispaced.

x  x3 x  x2 x  x1  8  98  7 8  1   7  1


l0  
x0  x3 x0  x2 x0  x1  0  90  7 0  1  63 9
x  x3 x  x2 x  x0  8  98  7 8  0   8  1
l1  
x1  x3 x1  x2 x1  x0  1  91  7 1  0 48 6
x  x3 x  x1 x  x0  8  98  18  0   56  2
l2  
x2  x3 x2  x1 x2  x0  7  97  17  0  84 3
x  x2 x  x1 x  x0  8  7 8  18  0  56  7
and l3  
x3  x2 x3  x1 x3  x0  9  7 9  19  0 144 18

y  l 0 y 0  l1 y1  l 2 y 2  l3 y3 
1
18  1 42  2 57  7 90
9 6 3 18
 2  7  38  35  82

Which is the value of y at x=8


Newton divided difference Interpolation (data may not be equispaced)

Newton divided difference Interpolation can be applied to arbitrary spaced data.

The first divided difference is f [x0 , x1 ] = (y1 - y0 )/ (x1 - x0)

f [x1 , x2 ] = (y2 - y1 )/ (x2 - x1)

The second divided difference is

f [ x 1 , x 2 ] - f [ x 0 , x1 ]
f [ x 0 , x1 , x 2 ] 
x 2  x0
f [ x 2 , x3 ] - f [ x1 , x 2 ]
f [ x1 , x 2 , x 3 ] 
x 3  x1

The third divided difference is

f [ x 1 , x 2 , x 3 ] - f [ x 0 , x1 , x 2 ]
f [ x 0 , x1 , x 2 , x 3 ] 
x 3  x0

The nth divided difference is

f [ x 1 , x 2 , x 3 ,......., x n ] - f [ x 0 , x1 , x 2 ,......., x n -1 ]
f [ x 0 , x1 , x 2 , x 3 ,......., x n ] 
x n  x0

Newton divided difference Interpolation formula is

Y = y0 + (x-x0) f [x0 , x1 ] + (x-x0) (x-x1) f [x0 , x1 , x2] + ............

+ (x-x0) (x-x1) .......... (x-xn-1) f [x0 , x1 , x2. ,............,x n ]

Problems

11. Using following data find the Newton’s divided difference interpolating polynomial and also
find the value of y at x= 15

x 0 6 20 45

y 30 48 88 238
Newton’s divided difference table

x y First divided Second divided Third divided

difference difference difference

0 30

(48-30)/6=3

6 48 (8-3)/11=0.45

(88-48)/5=8 (0.1 -0.45)/26 = -0.0136

11 88 (10-8)/20=0.1

(238-88)/15=10

26 238

Y = y0 + (x-x0) f [x0 , x1 ] + (x-x0) (x-x1) f [x0 , x1 , x2]

+ (x-x0) (x-x1)(x-x2) f [x0 , x1 , x2. ,x 3 ]

= 30 + 3x + x(x-6) (0.45) + x(x-6)(x-11)( -0.0136)


The value of y at x= 15

= 30 +3(15) +15(9)(0.45)+ 15(9)(4)(-0.0136) = 128.406

NUMERICAL DIFFERENTIATION

When a function y = f(x) is unknown but its values are given at some points like (x0 , y0 ), (x1, y1 ),

.......... (x n , yn ) or in form of a table, then we can differentiate using numerical differentiation.

Sometimes it is difficult to differentiate a composite or complicated function which can be done easily
in less time and less number of steps by numerical differentiation.

We use following methods for numerical differentiation.

(i) Method based on finite difference operators

(ii) Method based on Interpolation


(i) Method based on finite difference operators

Newton’s forward difference Interpolation formula is

Pn (x) = y0 + p Δy0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0 + ....................

where p = (x - x0)/h

Newton’s backward difference Interpolation formula is

Pn (x) = yn + p  yn + [ p(p + 1)/2! ]  2yn + [ p(p + 1) (p + 2)/3! ]  3yn

+ ...................... + [ p(p + 1) (p+ 2).......(p +n - 1)/n! ]  nyn

where p = (x - xn)/h

Using forward difference the formula for numerical differentiation is

y΄ (x0) = (1/h) [ Δy0 - Δ 2y0 /2 + Δ 3y0 /3 + .................... ]

y΄΄ (x0) = (1/h2) [ Δ 2y0 - Δ 3y0 + (11/12) Δ 4y0 .............. ]

Using backward difference the formula for numerical differentiation is

y΄ (x n)= (1/h) [  yn +  2yn /2 +  3yn /3 + .................... ]

y΄΄ (x n)= (1/ h2) [  2yn +  3yn + (11/12)  4yn ................ ]

If we consider the first term only the formula becomes

y΄ (x0) = (1/h) [ Δy0 ] = (y1 - y0 )/ h

y΄΄ (x0) = (1/h2) [ Δ 2y0 ] = (Δ y1 - Δ y0 )/ h2

= [ (y2 - y1 )-(y1 - y0 ) ]/ h2 = [ y2 - 2y1 + y0 ] / h2

12. Using following data find the first and second derivative of y at x=0

x 0 10 20 30 40

y 7 18 32 48 85

Solution

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40


Forward difference table

x y Δy Δ2 y Δ3 y Δ4 y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Here x0 = 0, y0 = 7, h= x1 - x0 = 10-0 = 10

Δ y0 = 11 , Δ2 y0 =3 ,

Δ3 y0 = 2, Δ4 y0 =10

p = (x - x0)/h = (4 - 0)/10 = 0.4

y΄ (x0) = (1/h) [ Δy0 - Δ 2y0 /2 + Δ 3y0 /3 - Δ 4y0 /4 + .................... ]

=0.1 [ 11 – 3/2 + 2/3 – 10/4 ] = 0.7666

y΄΄ (x0) = (1/h2) [ Δ 2y0 - Δ 3y0 + (11/12) Δ 4y0 .............. ]

= (1/100) [ 3 - 2 + (11/12) 10 ] = 0.10166

(ii) Method based on Interpolation

Linear Interpolation

y( x 1 ) - y ( x 0 ) y  y0
y ( x 0 )   1
x 1  x0 x 1  x0

Quadratic Interpolation

y΄ (x0) = ( -3y0 + 4 y1 – y2 ) /(2h)

y΄ (x1) = (y2 - y0 ) /(2h)


y΄ (x2) = ( y0 - 4 y1 + 3 y2 ) /(2h)

The second derivative is constant i.e. same at all points because of quadratic
interpolation and the interpolating polynomial is of degree two. Hence we must have

y΄΄(x0) = ( y0 -2 y1 + y2 ) /(2h)

y΄΄ (x1) = ( y0 -2 y1 + y2 ) /(2h)

y΄΄ (x2) = ( y0 -2 y1 + y2 ) /(2h)

Problems

13. Using following data find the value of first and second derivatives of y at x=30

x 10 30 50

y 42 64 88

Solution

Here x0 = 10, x1 = 30, x2 = 50, h= x1 - x0 = 30 - 10 = 20

y0 = 42, y1 = 64, y2 = 88

Linear Interpolation

y( x 1 ) - y( x 0 ) y  y0 64  42
y ( x 0 )   1   1.1
x 1  x0 x 1  x0 30  10

Quadratic Interpolation

y΄ (x0) = ( -3y0 + 4 y1 – y2 ) /(2h) = [ -3(42) + 4 (64) – 88 ] /40 = 1.05

y΄ (x1) = (y2 - y0 ) /(2h) = (88 - 42 ) / 40 = 1.15

y΄ (x2) = ( y0 - 4 y1 + 3 y2 ) /(2h) = ( 42 - 256 + 264 ) / 40 = 1.25

y΄΄(x0) = ( y0 -2 y1 + y2 ) /(2h) = ( 42 - 128 + 88 ) / 40 = 0.05

14. Using following data find the value of first and second derivatives of y at x=12

x 0 10 20 30 40

y 7 18 32 48 85
Solution

Here x0 = 0, x1 = 10, x2 = 20, x3 = 30, x4 = 40,

Forward difference table

x y Δy Δ2 y Δ3 y Δ4 y

0 7

11

10 18 03

14 02

20 32 05 10

19 12

30 51 17

36

40 87

Here x0 = 0, y0 = 7, h= x1 - x0 = 10-0 = 10

Δ y0 = 11 , Δ2 y0 =3 ,

Δ3 y0 = 2, Δ4 y0 =10

p = (x - x0)/h = (x - 0)/10 = 0.1x

Pn (x) = y0 + p Δ y0 + [ p(p – 1)/2! ] Δ 2y0 + [ p(p – 1) (p – 2)/3! ] Δ 3y0

+ [ p(p – 1) (p – 2)(p-3)/4! ] Δ 4y0

= 7 + 0.1x (11) + [0.1x(0.1x - 1)/2! ] (3) + [0.1x(0.1x - 1) (0.1x - 2)/3! ] (2)

+ [0.1x(0.1x - 1) (0.1x - 2) (0.1x - 3)/4! ] (10)

= 7 + 1.1x + (0.01x2 - 0.1x)1.5 + (0.001x3 - 0.03x2 +0. 2x)/3

+ 0.416 ( 0.0001x4 - 0.006x3 +0. 11x2 -0.6x)

y= Pn (x) = 0.0000416 x4 - 0.0022 x3 +0.05x2 + 1.26 x +7 ...........................(1)

Differentiating (1) w.r. to x we get

y΄= 0.0001664 x3 - 0.0066 x2 +0.1 x + 1.26 .................................... (2)

y΄(12) = 1.7971392 at x =12


Differentiating (2) w.r. to x we get

y΄΄= 0.0004992 x2 - 0.0132 x +0.1

y΄΄(12) = 0.0134848 at x =12

NUMERICAL INTEGRATION

Consider the integral I =  f ( x) dx


a

Where integrand f(x) is a given function and a, b are known which are end points of the interval [a, b]

Either f(x) is given or a table of values of f(x) are given.

Let us divide the interval [a, b] into n number of equal subintervals so that length of each subinterval

is h = (b – a)/n

The end points of subintervals are a=x0, x1, x2, x3, ............. , xn = b

Trapezoidal Rule of integration

Let us approximate integrand f by a line segment in each subinterval. Then coordinate of end points
of subintervals are (x0, y 0), ( x1, y1 ) , (x2, y2), ............. ,( xn , yn ). Then from x=a to x=b the area under
curve of y = f(x) is approximately equal to sum of the areas of n trapezoids of each n subintervals.

So the integral I =  f ( x) dx = (h/2)[ y


a
0 + y1 ] +(h/2)[ y 1 + y2 ] +(h/2)[ y 2 + y3 ]

+ .................. +(h/2)[ y n-1 + yn ]

= (h/2)[ y 0 + y1 + y 1 + y2 + y 2 + y3 + .................. + y n-1 + yn ]

= (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

Which is called trapezoidal rule.

ba 2
The error in trapezoidal rule is  h f ( ) where a < θ <b
12

Simpsons rule of Numerical integration (Simpsons 1/3rd rule)

Consider the integral I =  f ( x) dx


a

Where integrand f(x) is a given function and a, b are known which are end points of the interval [a, b]

Either f(x) is given or a table of values of f(x) are given.


Let us approximate integrand f by a line segment in each subinterval. Then coordinate of end points
of subintervals are (x0, y 0), ( x1, y1 ) , (x2, y2), ............. ,( xn , yn ).

We are taking two strips at a time Instead of taking one strip as in trapezoidal rule. For this reason the
number of intervals in Simpsons rule of Numerical integration must be even.

The length of each subinterval is h = (b – a)/(2m)

The formula is

I=  f ( x) dx = (h/3) [ y
a
0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + .......... + y 2m-2) ]

ba 4 v
The error in Simpson 1/3rd rule is  h f  ( ) where a < θ <b
180

Simpsons rule of Numerical integration (Simpsons 3/8th rule)

Consider the integral I =  f ( x) dx


a

Where integrand f(x) is a given function and a, b are known which are end points of the interval [a, b]

Either f(x) is given or a table of values of f(x) are given.

We are taking three strips at a time Instead of taking one strip as in trapezoidal rule. For this reason
the number of intervals in Simpsons 3/8th rule of Numerical integration must be multiple of 3.

The length of each subinterval is h = (b – a)/(3m)

The formula is

I=  f ( x) dx = (3h/8) [ y
a
0 + y3m + 3(y1 + y2 + y4 + y5 + ....... + y 3m - 1 ) + 2( y3 + y6 + ....... + y 3m – 3 ) ]

ba 4 v
The error in Simpson 1/3rd rule is  h f  ( ) where a < θ <b
80

15. Using Trapezoidal and Simpsons rule evaluate the following integral with number of subintervals n =6

e
( x2 )
dx
0

Solution:

Here integrand y = f(x) = exp(-x2)

a=0, b=6, h= (b-a)/n= (6-0)/6=1


x 0 1 2 3 4 5 6
Y= 1 e-1 e- 4 e- 9 e- 16 e- 25 e- 36
exp(-x2)

y0 y1 y2 y3 y4 Y5 y6

(i) Using Trapezoidal rule

I = (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

= (1/2)[ y 0 + y6 + 2(y1 + y2 + y3 +y4+ y 5 ) ]

= 0.5 [ 1+ e- 36 + 2(e-1 + e- 4+ e- 9+ e- 16 + e- 25) ]

(ii) Using Simpsons rule

I = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + .......... +


y 2m-2) ]

= (h/3) [ y 0 + y6 + 4(y1 + y3 + y5 ) + 2( y2 + y4 ) ]

= (1/3) [ 1+ e- 36 + 4 (e-1 + e- 9+ e- 25) + 2(e- 4 + e- 16 ) ]

(iii) Using Simpsons 3/8th rule

I = (3h/8) [ y 0 + y3m + 3(y1 + y2 + y4 + y5 + ....... + y 3m - 1 ) + 2( y3 + y6 +


....... + y 3m – 3 ) ]

= (3h/8) [ y 0 + y6 + 3(y1 + y2 + y4 + y5 ) + 2( y3 ) ]

= (3/8) [ 1+ e- 36 + 3 (e-1 + e- 4 + e- 16 + e- 25) + 2(e- 9 ) ]

16. Using Trapezoidal and Simpsons rule evaluate the following integral with number of subintervals n =8

and compare the result

0 .8
dx
4 x
0
2

Solution:
Here integrand y = f(x) = ( 4 + x2)-1

a=0, b= 0.8 , h= (b-a)/n= (0.8-0)/8= 0.1

x 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8

Y= 1/4 1/4.01 1/4.04 1/4.09 1/4.16 1/4.25 1/4.36 1/4.49 1/4.64

( 4 + x2)-1

y0 y1 y2 y3 y4 Y5 y6 Y7 y8

(i) Using Trapezoidal rule

I = (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

= (0.1/2)[ y 0 + y8 + 2(y1 + y2 + y3 +y4+ y 5 + y6+ y 7) ]


= 0.05 [ 0.25+ 1/4.64+ 2(1/4.01+ 1/4.04+ 1/4.09+1/4.16+ 1/4.25+ 1/4.36+1/4.49 ) ]

(ii) Using Simpsons rule

I = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + .......... +


y 2m-2) ]

= (h/3) [ y 0 + y8 + 4(y1 + y3 + y5 + y7) + 2( y2 + y4 + y6 ) ]

= (0.1/3) [0.25+ 1/4.64+ 4(1/4.01+ 1/4.09+ 1/4.25+ 1/4.49)


+2(1/4.04+1/4.16+ 1/4.36) ]

By direct integration we get

 
0.8
1 x
0.8
dx
0 4  x 2   2 tan
1
 0.5 tan 1 0.4  tan 1 0  0.5 tan 1 0.4
2  0

=10.900704743176

Comparing the result we get error in Trapezoidal and Simpsons rule.


17. Using Trapezoidal and Simpsons rule evaluate the following integral with number of subintervals n =6

0 .6
dx
I= 0 1 x

Solution:

1
Here integrand y = f(x) =
1 x

a=0, b= 0.6 , h= (b-a)/n = (0.6-0)/6 = 0.1

x 0 0.1 0.2 0.3 0.4 0.5 0.6

Y= 1 1 1 1 1 1 1
1 .1 1 .2 1 .3 1 .4 1 .5 1 .6
1
1 x =0.953462 =0.912871 =0.877058 =0.845154 =0.816496 =0.790569

y0 y1 y2 y3 y4 Y5 y6

(i) Using Trapezoidal rule

I = (h/2)[ y 0 + yn + 2(y1 + y2 + y3 + .................. + y n-1 ) ]

= (0.1/2)[ y 0 + y6 + 2(y1 + y2 + y3 +y4+ y 5 ) ]

= 0.05 [ 1+ 0.790569+ 2(0.953462 + 0.912871 + 0.877058+0.845154+0.816496 ) ]

(ii) Using Simpsons rule

I = (h/3) [ y 0 + y2m + 4(y1 + y3 + ............ + y 2m-1 ) + 2( y2 + y4 + .......... +


y 2m-2) ]

= (h/3) [ y 0 + y6 + 4(y1 + y3 + y5 ) + 2( y2 + y4 ) ]

= (0.1/3) [ 1+ 0.790569+ 4(0.953462 + 0.877058+0.816496)+2(0.912871 + 0.845154 )]


(iii) Using Simpsons 3/8th rule

I = (3h/8) [ y 0 + y3m + 3(y1 + y2 + y4 + y5 + ....... + y 3m - 1 ) + 2( y3 + y6 +


....... + y 3m – 3 ) ]

= (3h/8) [ y 0 + y6 + 3(y1 + y2 + y4 + y5 ) + 2( y3 ) ]

= (0.3/8) [ 1+ 0.790569+

3(0.953462 + 0.912871 + 0.845154 +0.816496)+2(0.877058 )]

UNIT-II

Linear System: Solution by iteration

Gauss-Seidal iteration method

This is an iterative method used to find approximate solution of a system of linear equations.

Some times in iterative method convergence is faster where matrices have large diagonal
elements. In this case Gauss elimination method require more number of steps and more row
operations. Also sometimes a system has many zero coefficients which require more space to
store zeros for example 30 zeros after or before decimal point. In such cases Gauss-Seidal
iteration method is very useful to overcome these difficulties and find approximate solution of
a system of linear equations.

Procedure:

We shall find a solution x of the system of equations Ax=b with given initial guess x0.

A is an n x n matrix with non-zero diagonal elements

Step-I Rewrite the given equations in such a way that in first equation coefficient of x1 is
maximum, in second equation coefficient of x2 is maximum, in third equation coefficient of
x3 is maximum and so on.

Step-II From first equation write x1 in terms of other variables x2 , x3 , x4 etc.

From the second equation write x2 in terms of other variables x1 , x3 , x4 etc.

From third equation write x3 in terms of other variables x1 , x2 , x4 etc.

And so on write all equations in this form.

Step-III

If initial guess is given we take that value otherwise we assume X = (1, 1, 1) as initial guess.

Put x2 = 1, x3 = 1 in first equation to get x1 ........................................(1)


Put x3 = 1 and put value of x1 obtained in (1) in the second equation to get value of x2. ...........(2)

Put values of x1 , x2 obtained in (1) and (2) in the third equation to get value of x3.

Step-IV

We repeat this procedure up to desired accuracy and up to desired number of steps.

18. Solve following linear equations using Gauss-Seidal iteration method starting from 1, 1, 1

x1 + x2 + 2 x3 = 8

2x1 + 3 x2 + x3 = 12

5x1 + x2 + x3 = 15

Solution Rewrite the given equations so that each equation for the variable that has coefficient largest we get

5x1 + x2 + x3 = 15 ..........................................................(1)

2x1 + 3 x2 + x3 = 12 ..........................................................(2)

x1 + x2 + 2 x3 = 10 ..........................................................(3)

From equation (1) we get x1 in terms of other variables x2 and x3 as

5x1 = 1 5 - x2 - x3

x1 = (1 5 - x2 - x3 )/5 = 3 – 0.2 x2 – 0.2 x3 ..........................................................(4)

From equation (2) we get x2 in terms of other variables x1 and x3 as

2x1 + 3 x2 + x3 = 12

x2 = 4 - (2x1 + x3 )/3 ..........................................................(5)

From equation (3) we get x3 in terms of other variables x1 and x2 as

x1 + x 2 + 2 x3 =10

x3 = 5 - 0.5 x1 - 0.5 x2 ..........................................................(6)

Step-1

Putting x2 = 1, x3 = 1 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2 – 0.2 = 2.6

Putting x1 = 2.6, x3 = 1 in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – (5.2+1)/3 = 1.93333


Putting x2 = 1.93333, x1 = 2.6 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 (2.6) - 0.5 (1.93333) = 2.73333

Step-2

Putting x2 = 1.93333, x3 = 2.73333 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2(1.93333) – 0.2 (2.73333 )= 2.066666

Putting x1 = 2.06666, x3 = 2.73333 in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – (4.13333 + 2.73333 )/3 = 1.71111

Putting x2 = 1.71111, x1 = 2.066666 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 ( 2.066666 ) - 0.5 (1.71111) = 3 .11111

Step-3

Putting x2 = 1.71111, x3 = 3 .11111 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2(1.71111) – 0.2 (3 .11111 )= 2.035555

Putting x1 = 2.035555 , x3 = 3 .11111in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – ( 4.07111 + 3 .11111)/3 = 1.605925

Putting x2 = 1.605925, x1 = 2.035555 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 (2.035555) - 0.5 (1.605925) = 3 .17926

Step-4

Putting x2 = 1.605925, x3 = 3 .17926 in equation (4) we get

x1 = 3 – 0.2 x2 – 0.2 x3 = 3 – 0.2(1.605925) – 0.2 (3 .17926)= 2.042962

Putting x1 = 2.042962, x3 = 3 .17926 in equation (5) we get

x2 = 4 - (2x1 + x3 )/3 = 4 – ( 4.08592 + 3 .17926)/3 = 1.57827

Putting x2 = 1.57827, x1 = 2.042962 in equation (6) we get

x3 = 5 - 0.5 x1 - 0.5 x2 = 5 - 0.5 (2.042962) - 0.5 (1.57827) = 3 .18938


Eigen values and Eigen vectors by Power method

This is an iterative method used to find approximate value of Eigen values and Eigen vectors
of an n x n non-singular matrix A.

Procedure:

We start with any non-zero vector x0 of n components and compute followings.

x1 = Ax0

x2 = A x1

x3 = A x2

..........................

..........................

..........................

xn = A xn-1

For any n x n non-singular matrix A we can apply this method and we get a dominant

eigen value λ such that absolute value of this eigen value λ is greater than that of other
eigen values.

Theorem: Let A be an n x n real symmetric matrix. Let x ≠ 0 be any real vector with n
components. Let y=Ax, m0 = xT x, m 1=xTy, m2=yTy

Then the ratio r = m1 / m0 called Rayleigh quotient is an approximate eigen value λ of A.

m2
Assuming r = λ - ϵ we have I ϵ I   r2
m0

where ϵ is the error of ratio r = m1 / m0

6 3 
19 . Find the eigen values and eigen vectors of the matrix   by Power method
3 2
taking x0= [ 1 1 ]T

6 3  T
Solution Let A =   . Given x0= [ 1 1 ]
 3 2 

x1 = Ax0

6 3 1 9   1 
=     =  = 9 
3 2 1 5  5 / 9
 1 
Dominated eigen value is 9 and and eigen vector is  
5 / 9

x2 = A x1

6 3  1  7.666  1 
= 3 2 5 / 9 =  4.111 = 7.666 0.536
      

 1 
Dominated eigen value is 7.666 and and eigen vector is  
0.536

x3 = A x2

6 3  1  7.608  1 
= 3 2 0.536 = 4.072 = 7.608 0.535
      

 1 
Dominated eigen value is 7.608 and and eigen vector is  
0.535

6 3 1 
 
20 . Find the eigen values and eigen vectors of the matrix 3 2 0 by Power method
 
1 4 5 
taking x0= [ 1 1 1 ]T

6 3 1 
 
Solution Let A = 3 2 0 . Given x0= [ 1 1 1]T
 
1 4 5 

x1 = Ax0

6 3 1  1 10 1


 
= 3 2 0  1 =
 5   100.5
   
1 4 5  1 10  1 

 1 
 
Dominated eigen value is 10 and and eigen vector is  0 .5 
 1 

x2 = A x1

6 3 1   1  8.5  1 
    4   8.50.4705
=  3 2 0   0 .5  =    
1 4 5   1   8   0.9411
 1 

Dominated eigen value is 8.5 and and eigen vector is 0.4705

 
 0.9411

x3 = A x2

6 3 1   1  8.3526  1 
 
= 3 2 0 0.4705 =
  3.941   8.35260.4718
      
1 4 5   0.9411 7.5875 0.9084

 1 

Dominated eigen value is 8.3526 and and eigen vector is 0.4718

 
0.9084
Unit III: Solution of IVP by Euler’s method, Heun’s method and Runge-Kutta fourth order
method. Basic concept of optimization, Linear programming, simplex method, degeneracy,
and Big-M method.

Numerical Solution of Differential Equation:


Introduction:
We consider the first order differential equation

y   f ( x, y )

With the initial condition

y (xo) = y0

The sufficient conditions for the existence of unique solution on the interval [x0 , b] are the
well-known Lipschitz conditions. However in ‘Numerical Analysis’, one finds values of y at
successive steps, x = x1 , x2 , … , xn with spacing h. There are many numerical methods
available to find solution of IVP, such as : Picards method, Euler’s method, Taylor’ series
method, Runge-Kutta method etc.

In the present section we will solve the ode

y   f ( x, y ), y ( x 0 )  y 0 in the interval I  ( x0 , x n ) (1)

using a numerical scheme applied to discrete node xn = x0 + nh, where h is the step-size by
Euler’s method, Heun’s method and Runge-Kutta method.

 In Euler’s method we use the slope evaluated at the current level ( x n , y n ) and use
that value as an approximation of the slope throughout the interval ( x n , x n 1 ) .
 Hune’ method samples the slope at beginning and at the end and uses the average
as the final approximation of the slope. It is also known as Runge-kutta method of
order-2.
 Runge-kutta method of order-4 improve on Euler’ s method looking at the slope at
multiple points.

The necessary formula for solution of (1) by Euler’ s method is:

y j 1  y j  hf ( x j , y j ) , j = 0, 1, 2, … n - 1.

The necessary formula for solution of (1) by Hune’ s method is:

1
y j 1  y j  (k1  k 2 ) , j = 0, 1, 2, … n - 1.
2

Where k1  hf ( x j , y j ), k 2  hf ( x j  h, y j  k1 )

The necessary formula for solution of (1) by Runge – Kutta method of order-4 is:

1
y j 1  y j  (k1  2k 2  2k 3  k 4 ) , j = 0, 1, 2, …, n – 1.
6

Where k1  hf ( x j , y j )

1 1
k 2  hf ( x j  h , y j  k1 )
2 2
1 1
k 3  hf ( x j  h, y j  k 2 )
2 2
k 4  hf ( x j  h, y j  k 3 )

Example : Use the Euler method to solve numerically the initial value problem

u   2tu 2 , u (0)  1

With h = 0.2 on the interval [0, 1]. Compute u (1.0)

We have
2
u j 1  u j  2 ht j u j , j  0,1,2,3,4. [Here x and y are replaced by t and u

respectively]

With h=0.2. The initial condition gives u0=1

For j = 0: t0 = 0, u0 = 1

u (0.2) = u1 = u0 – 2ht0u02 = 1.0.

For j = 1: t1 = 0.2, u1 = 1

u (0.4) = u2= u1 – 2ht1u12 = 0.92.

For j = 2: t2 = 0.4, u2 = 0.92

u (0.6) = u3 = u2-2ht2u22 = 0.78458.

For j = 3: t3 = 0.6, u3 = 0.78458

u(0.8) = u4 = 0.63684.

Similarly, we get

u(1.0) = u5 = 0.50706.

Note: In the similar way IVP can be solved by Heun’s method and Runge-Kutta fourth order
method.

Optimization
Optimization is the means by which scarce resources can be utilized in an efficient manner
so as to maximize the profit or minimize the loss.

Basic components of an optimization problem:


An objective function expresses the main aim of the model which is either to be minimized
or maximized. For example, in a manufacturing process, the aim may be to maximize the
profit or minimize the cost. In comparing the data prescribed by a user-defined model with
the observed data, the aim is minimizing the total deviation of the predictions based on the
model from the observed data. In designing a bridge, the goal is to maximize the strength and
minimize size.
A set of unknowns or variables control the value of the objective function. In the
manufacturing problem, the variables may include the amounts of different resources used or
the time spent on each activity. In fitting-the-data problem, the unknowns are the parameters
of the model. In the pier design problem, the variables are the shape and dimensions of the
pier.

A set of constraints are those which allow the unknowns to take on certain values but
exclude others. In the manufacturing problem, one cannot spend negative amount of time on
any activity, so one constraint is that the "time" variables are to be non-negative. In the pier
design problem, one would probably want to limit the breadth of the base and to constrain its
size.

The optimization problem is then to find values of the variables that minimize or maximize
the objective function while satisfying the constraints.
Objective Function

As already stated, the objective function is the mathematical function one wants to maximize
or minimize, subject to certain constraints. Many optimization problems have a single
In the present context we will apply the optimization technique to Linear programming
problem.
The general form of a linear programming problem is:

Maximize(Minimize) z = c1x1 + c2x2 + …. + cnxn

Subject to the constraints:


c11x1 + c12 x2 + …. + c1nxn ≤ / ≥ / = b1
c21x1 + c22 x2 + …. + c2nxn ≤ / ≥ / = b2

…. …. ….

cm1x1 + cm2 x2 + …. + cmnxn ≤ / ≥ / = bm


x1, x2, …. xn ≥ 0
In short, Maximize(Minimize) Z = CX …. (1)
Subject to the constraints: AX ≤ / ≥ / = B …. (2)
X≥0 …. (3)
Where the expression under (1), (2) and (3) are known as objective function, constraints and
non-negativity restrictions respectively.
The problem definition and formulation includes the steps: identification of the decision
variables; formulation of the model objective(s) and the formulation of the model constraints.
In performing these steps the following are to be considered.

1. Identify the important elements that the problem.


2. Determine the number of independent variables, the number of equations required to
describe the system, and the number of unknown parameters.
Graphical Method

To solve Linear Programming problem (LPP), Graphical method helps to visualize the
procedure explicitly. It also helps to understand the different terminologies associated with
the solution of LPP. Let us discuss these aspects with the help of an example. However, this
visualization is possible for a maximum of two decision variables. Thus, a LPP with two
decision variables is opted for discussion. However, the basic principle remains the same for
more than two decision variables also, even though the visualization beyond two-dimensional
case is not easily possible.
Let us consider the same LPP (general form) discussed in previous class, stated here once
again for convenience.
Maximize Z = 6x +5y
subject to 2x −3y ≤ 5 (C −1)
x +3y ≤11 (C − 2)
4x + y ≤15 (C −3)
x, y ≥ 0 (C − 4) & (C −5)

First step to solve above LPP by graphical method, is to plot the inequality constraints one-
by-one on a graph paper. Fig. 1a shows one such plotted constraint.

1
0
-2 -1 0 1 2 3 4 5
-1
-2 2x −3y ≤ 5

Fig. 1a Plot showing first constraint ( 2x −3y ≤ 5 )

Fig. 1b shows all the constraints including the nonnegativity of the decision variables (i.e., x
≥ 0 and y ≥ 0 ).
5
x +3y ≤11
4 4x + y ≤15

3
x≥0
2

1 y≥0

0
-2 -1 0 1 2 3 4 5
-1
2x −3y ≤ 5
2

Fig. 1b Plot of all the constraints

Common region of all these constraints is known as feasible region (Fig. 1c). Feasible region
implies that each and every point in this region satisfies all the constraints involved in the
LPP.

2 Feasible
region
1

0
-2 -1 0 1 2 3 4 5
-1

-2

Fig. 1c Feasible region

Once the feasible region is identified, objective function ( Z = 6x + 5y ) is to be plotted on it.

As the (optimum) value of Z is not known, objective function is plotted by considering any

constant, k (Fig. 1d). The straight line, 6x + 5 y = k (constant), is known as Z line (Fig. 1d).

This line can be shifted in its perpendicular direction (as shown in the Fig. 1d) by changing

the value of k.. Note that, position of Z line shown in Fig. 1d, showing the intercept, c, on the
y axis is 3. If, 6x +5yy = k => 5y = −6x + k => y = −6 x + k , i.e., m = −6 and
5 5 5
k
c= = 3 => k =15 .
5

0
-2 -1 0 1 2 3 4 5
-1

-2 Z Line

Fig. 1d Plot of Z line and feasible region

5
Z Line
4 Optimal
Point
3

0
-2 -1 0 1 2 3 4 5
-1

-2

Fig. 1e Location of Optimal Point

Now it can be visually noticed that value of the objective function will be maximum when it
passes through the intersection of x + 3y =11 and 4x + y =15 (straight lines associated with the
second and third inequality constraints). This is known as optimal point (Fig. 1e). Thus the
* *
optimal point of the present problem is x = 3.091 and y = 2.636 . And the optimal solution is
* *
= 6x +5y = 31.727
Visual representation of different cases of solution of LPP

A linear programming problem may have i) a unique, finite solution, ii) an unbounded

solution iii) multiple (or infinite) number of optimal solutions, iv) infeasible solution and v) a

unique feasible point. In the context of graphical method it is easy to visually demonstrate the

different situations
ns which may result in different types of solutions.

Unique, finite solution

The example demonstrated above is an example of LPP having a unique, finite solution. In

such cases, optimum value occurs at an extreme point or vertex of the feasible region.

Unbounded solution

If the feasible region is not bounded, it is possible that the value of the objective function

goes on increasing without leaving the feasible region. This is known as unbounded solution

(Fig 2).

3
Z Line
2

0
-2 -1 0 1 2 3 4 5
-1

-2

Fig. 2 Unbounded Solution


Multiple (infinite) solutions

If the Z line is parallel to any side of the feasible region all the points lying on that side

constitute optimal solutions as shown in Fig 3.

5 Parallel
4

0
-2 -1 0 1 2 3 4 5
-1

-2 Z Line

Fig. 3 Multiple (infinite) Solution

Infeasible solution

Sometimes, the set of constraints does not form a feasible region at all due to inconsistency in

the constraints. In such situation the LPP is said to have infeasible solution. Fig 4 illustrates

such a situation.

1
Z Line
0
-2 -1 0 1 2 3 4 5
-1

-2

Fig. 4 Infeasible Solution


Unique feasible point

This situation arises when feasible region consist of a single point. This situation may occur

only when number of constraints is at least equal to the number of decision variables. An

example is shown in Fig 5. In this case, there is no need for optimization as there is only one

solution.

4
Unique
3
feasible point
2

0
-2 -1 0 1 2 3 4 5
-1

-2

Fig. 5 Unique feasible point


Simplex method

Recall from the previous discussion that the optimal solution of a LPP, if exists, lies at
one of the vertices of the feasible region. Thus one way to find the optimal solution is to
find all the basic feasible solutions of the standard form and investigate them one-by-
one to get at the optimal. However, again recall thatt, for m equations with n variables
there exists a huge number ( n cm ) of basic feasible solutions. In such a case, inspection
of all the solutions one-by-one is not practically feasible. However, this can be
overcome by simplex method. Conceptual principle of this method can be easily
understood for a three dimensional case (however, simplex method is applicable for any
higher dimensional case as well).

Imagine a feasible region (i.e., volume) bounded by several surfaces. Each vertex of
this volume, which is a basic feasible solution, is connected to three other adjacent
vertices by a straight line to each being the intersection of two surfaces. Being at any
one vertex (one of the basic feasible solutions), simplex algorithm helps to move to
another adjacent vertex which is closest to the optimal solution among all the adjacent
vertices. Thus, it follows the shortest route to reach the optimal solution from the
starting point. It can be noted that the shortest route consists of a sequence of basic
feasible solutions which is generated by simplex algorithm.
Simplex algorithm
Simplex algorithm is discussed using an example of LPP. Let us consider the
following problem.

Maximize Z  4x1 − x2  2x3

subject to 2x1  x2  2x3 ≤ 6


x1 − 4x2  2x3 ≤ 0
5x1 − 2x2 − 2x3 ≤ 4
x1 , x2 , x3 ≥ 0
Simplex algorithm is used to obtain the solution of this problem. First let us transform
the LPP to its standard form as shown below.
Maximize Z  4x1 − x2  2x3

subject to 2x1  x2  2x3  x4  6


x1 − 4x2  2x3  x5  0
5x1 − 2x2 − 2x3  x6  4
x1 , x2 , x3 , x4 , x5 , x6 ≥ 0

It can be recalled that x4 , x5 and x6 are slack variables. Above set of equations, including the
objective function can be transformed to canonical form as follows:

− 4x1  x2 − 2x3  0x4  0x5  0x6  Z 0


2x1  x2  2x3  1x4  0x5  0x6 6
x1 − 4x2  2x3  0x4  1x5  0x6 0
5x1 − 2x2 − 2x3  0x4  0x5  1x6 4

The basic solution of above canonical form is x4  6 , x5  0 , x6  4 , x1  x2  x3  0 and

Z  0 . It can be noted that, x4 , x5 and x6 are known as basic variables and x1 , x2 and x3 are
known as nonbasic variables of the canonical form shown above. Let us denote each equation
of above canonical form as:

Z − 4x1  x2 − 2x3  0x4  0x5  0x6 Z 0


 x4  2x1  x2  2x3  1x4  0x5  0x6 6
 x5  x1 − 4x2  2x3  0x4  1x5  0x6 0
 x6  5x1 − 2x2 − 2x3  0x4  0x5  1x6 4

For the ease of discussion, right hand side constants and the coefficients of the variables are
symbolized as follows:

The left-most column is known as basis as this is consisting of basic variables. The
coefficients in the first row ( c1 Λ c6 ) are known as cost coefficients. Other subscript
notations are self explanatory and used for the ease of discussion. For each coefficient, first
subscript indicates the subscript of the basic variable in that equation. Second subscript
indicates the subscript of variable with which the coefficient is associated. For example, c52 is
the coefficient of x2 in the equation having the basic variable x5 with nonzero coefficient (i.e.,
c55 is nonzero).

This completes first step of calculation. After completing each step (iteration) of calculation,
three points are to be examined:
1. Is there any possibility of further improvement?

2. Which nonbasic variable is to be entered into the basis?

3. Which basic variable is to be exited from the basis?

The procedure to check these points is discussed next.

4. Is there any possibility of further improvement?

If any of the cost coefficients is negative, further improvement is possible. In


other words, if all the cost coefficients are nonnegative, the basic feasible
solution obtained in that step is optimum.

5. Which nonbasic variable is to be entered?

Entering nonbasic variable is decided such that the unit change of this variable
should have maximum effect on the objective function. Thus the variable having
the coefficient which is minimum among all the cost coefficients is to be
entered, i.e., xS is to be entered if cost coefficient cS is minimum.

6. Which basic variable is to be exited?

After deciding the entering variable xS , xr (from the set of basic variables) is
b
r
decided to be the exiting variable if is minimum for all possible r, provided
c
rs

crs is positive.

It can be noted that, crs is considered as pivotal element to obtain the next
canonical form.

In this example, c1  −4 is the minimum. Thus, x1 is the entering variable for the next step
b
4 6
c
of calculation. r may take any value from 4, 5 and 6. It is found that 41  2  3 ,

b5 0 b 4 b
  0 and 6   0.8 . As, 5 is minimum, r is 5. Thus x5 is to be exited and c51 is
c c c
51 1 61 5 51

the pivotal element and x5 is replaced by x1 in the basis. Set of equations are transformed
through pivotal operation to another canonical form considering c51 as the pivotal element.
The procedure of pivotal operation is already explained in first class. However, as a refresher
it is explained here once again.
1. Pivotal row is transformed by dividing it with the pivotal element. In this case, pivotal
element is 1.

2. For other rows: Let the coefficient of the element in the pivotal column of a particular row
be “l”. Let the pivotal element be “m”. Then the pivotal row is multiplied by l / m and then
subtracted from that row to be transformed. This operation ensures that the coefficients of
the element in the pivotal column of that row becomes zero, e.g., Z row: l = -4 , m = 1. So,
pivotal row is multiplied by l / m = -4 / 1 = -4, obtaining

− 4x1  16x2 − 8x3  0x4 − 4x5  0x6  0

This is subtracted from Z row obtaining,

0x1 − 15x2  6x3  0x4  4x5  0x6  Z 0

The other two rows are also suitably transformed.

After the pivotal operation, the canonical form obtained is shown below.

Z 0x1 − 15x2  6x3  0x4  4x5  0x6  Z 0


 x4  0x1  9x2 − 2x3  1x4 − 2x5  0x6 6
 x1  1x1 − 4x2  2x3  0x4  1x5  0x6 0
 x6  0x1  18x2 − 12x3 − 0 x4 − 5x5  1x6 4

The basic solution of above canonical form is x1  0 , x4  6 , x6  4 , x3  x4  x5  0 and

Z  0 . However, this is not the optimum solution as the cost coefficient c2 is negative. It is

observed that c2 (= -15) is minimum. Thus, s  2 and x2 is the entering variable. r may take
any value from 4, 1 and 6. However, c12  −4 is negative. Thus, r may be either 4 or 6. It is
b b
found that, 4
 6  0.667 , and 6
 4  0.222 . As b6 is minimum, r is 6 and x6 is to
c c c
942 62 18 62

be exited from the basis. c62 (=18) is to be treated as pivotal element. The canonical form for
next iteration is as follows:

1 5 10
Z 0x1  0x2 − 4x3  0x4 − x5  x6  Z 
6 6 3
1 1
 x4  0x1  0x2  4x3  1x4  x5 − x6 4
2 2

 x1  1x1  0x2 − 2 x3  0x4 − 1 x5  2 x6 


8
3 9 9 9
 x2  2
0x1  1x2 − x3  0 x4 − 5 1
x5  x6 2

3 18 18 9
8 2
The basic solution of above canonical form is x  , x  , x  4 , x  x  x  0 and
1 2 4 2 3 5
9 9
10
Z .
3

It is observed that c3 (= - 4) is negative. Thus, optimum is not yet achieved. Following similar

procedure as above, it is decided that x3 should be entered in the basis and x4 should be

exited from the basis. Thus, x4 is replaced by x3 in the basis. Set of equations are

transformed to another canonical form considering c43 (= 4) as pivotal element. By doing so,
the canonical form is shown below.

1 1 22
Z 0x1  0x2  0x3  1x4  x5  x6  Z 
3 3 3
1 1 1
 x3  0x1  0x2  1x3  x  x5 − x6 1
4 4 8 8
1 1 5 14
 x1  1x1  0x2  0x3  x4 − x5  x 
6 36 36 6 9
1 7x 1x 8
 x2  0x1  1x2  0x3  6 x4 − 36 5 − 36 6 9

The basic solution of above canonical form is x  14 , x  8 , x  1, x  x  x  0 and


1 2 3 4 5 6
9 9
22
Z .
3
It is observed that all the cost coefficients are positive. Thus, optimum is achieved. Hence, the
optimum solution is
22
Z 3  7.333 x1

14
 9  1.556

8
x2  9  0.889
x3  1
The calculation shown above can be presented in a tabular form, which is known as Simplex
Tableau. Construction of Simplex Tableau will be discussed next.
Construction of Simplex Tableau

Same LPP is considered for the construction of simplex tableau. This helps to compare the
calculation shown above and the construction of simplex tableau for it.
After preparing the canonical form of the given LPP, simplex tableau is constructed as
follows.

Variables br
b
Iteration Basis Z x x x x r c
rs
1 x2 3 x4 5 6

Z 1 -4 1 -2 0 0 0 0 --

x4 0 2 1 2 1 0 0 6 3
1
x
5 0 1 -4 2 0 1 0 0 0
4
x6 0 5 -2 -2 0 0 1 4
5

Pivotal Row Pivotal Column


Pivotal Element

After completing each iteration, the steps given below are to be followed.
Logically, these steps are exactly similar to the procedure described earlier. However, steps
described here are somewhat mechanical and easy to remember!

Check for optimum solution:

1. Investigate whether all the elements in the first row (i.e., Z row) are nonnegative
or not. Basically these elements are the coefficients of the variables headed by
that column. If all such coefficients are nonnegative, optimum solution is
obtained and no need of further iterations. If any element in this row is negative,
the operation to obtain simplex tableau for the next iteration is as follows:
Operations to obtain next simplex tableau:

2. The entering variable is identified (described earlier). The corresponding column


is marked as Pivotal Column as shown above.

3. The exiting variable from the basis is identified (described earlier). The
corresponding row is marked as Pivotal Row as shown above.

4. Coefficient at the intersection of Pivotal Row and Pivotal Column is marked as


Pivotal Element as shown above.

5. In the basis, the exiting variable is replaced by entering variable.

6. All the elements in the pivotal row are divided by pivotal element.

7. For any other row, an elementary operation is identified such that the coefficient in
the pivotal column in that row becomes zero. The same operation is applied for all
other elements in that row and the coefficients are changed accordingly. A similar
procedure is followed for all other rows.

For example, say, (2 x pivotal element + pivotal coefficient in first row) produce zero
in the pivotal column in first row. The same operation is applied for all other
elements in the first row and the coefficients are changed accordingly.

Simplex tableaus for successive iterations are shown below. Pivotal Row, Pivotal Column
and Pivotal Element for each tableau are marked as earlier for the ease of understanding.

Variables br
Iteration Basis Z br c
x1 x2 x3 x4 x5 x6 rs

Z 1 0 -15 6 0 4 0 0 --

x4 0 0 9 -2 1 -2 0 6 13
2
x
1 0 1 -4 2 0 1 0 0 --
x6 0 0 18 -12 0 -5 1 4 29

……continued to next page


……continued from previous page

Variables br
Iteration Basis Z br c
x1 x2 x3 x4 x5 x6 rs

1 5 10
Z 1 0 0 -4 0 −6 6 3 --

1 1
x4 0 0 0 4 1 − 4 1
2 2
3
2 1 2 8
x1 0 1 0 − 0 − --
3 9 9 9

2 5 1 2
x2 0 0 1 − 0 − --
3 18 18 9

Z 1 0 0 0 1 1 1 22
3 3 3

x3 0 0 0 1 1 1 −1 1
4 8 8
4
1 1 2 14
x1 0 1 0 0 −
6 36 9 9

1 7 1 8
x2 0 0 1 0 − −
6 36 36 9

Optimum value of Z
Value of x3

All the coefficients are


nonnegative. Thus optimum
solution is achieved.
Value of x1
Value of x2
As all the elements in the first row (i.e., Z row), at iteration 4, are nonnegative, optimum
solution is achieved. Optimum value of Z is 22/3 as shown above. Corresponding

14 8
values of basic variables are x1  9  1.556 , x2  9  0.889 , x3  1 and those of

nonbasic variables are all zero (i.e., x4  x5  x6  0 ).

It can be noted that at any iteration the following two points must be satisfied:

1. All the basic variables (other than Z) have a coefficient of zero in the Z row.

2. Coefficients of basic variables in other rows constitute a unit matrix.

If any of these points are violated at any iteration, it indicates a wrong calculation. However,
reverse is not true.
Big-M method

Introduction

In the previous lecture the simplex method was discussed with required transformation of
objective function and constraints. However, all the constraints were of inequality type with
‘less-than-equal-to’ ( ≤ ) sign. However, ‘greater-than-equal-to’ ( ≥ ) and ‘equality’ (  )
constraints are also possible. In such cases, a modified approach is followed, which will be
discussed in this lecture. Different types of LPP solutions in the context of Simplex method
will also be discussed. Finally, a discussion on minimization vs maximization will be
presented.

Simplex Method with ‘greater-than-equal-to’ ( ≥ ) and equality (  ) constraints

The LP problem, with ‘greater-than-equal-to’ ( ≥ ) and equality (  ) constraints, is


transformed to its standard form in the following way.

• One ‘artificial variable’ is added to each of the ‘greater-than-equal-to’ ( ≥ ) and equality


(  ) constraints to ensure an initial basic feasible solution.

• Artificial variables are ‘penalized’ in the objective function by introducing a large


negative (positive) coefficient M for maximization (minimization) problem.

• Cost coefficients, which are supposed to be placed in the Z-row in the initial simplex
tableau, are transformed by ‘pivotal operation’ considering the column of artificial
variable as ‘pivotal column’ and the row of the artificial variable as ‘pivotal row’.

• If there are more than one artificial variable, step 3 is repeated for all the artificial
variables one by one.

Let us consider the following LP problem

Maximize Z  3x1  5x2


subject to x1  x2 ≥ 2
x2 ≤ 6
3x1  2x2  18
x1 , x2 ≥ 0
After incorporating the artificial variables, the above LP problem becomes as follows:

Maximize Z  3x1  5x2 − Ma1 − Ma2


subject to x1  x2 − x3  a1  2 x2 
x4  6
3x1  2x2  a2  18
x1 , x2 ≥ 0

where x3 is surplus variable, x4 is slack variable and a1 and a2 are the artificial variables. Cost

coefficients in the objective function are modified considering the first constraint as follows:

Z − 3x1 − 5x2  Ma1  Ma2  0  E1 


x1  x2 − x3  a1 2  E2  Pivotal Row

Pivotal Column

Thus, pivotal operation is E1 − M  E2 , which modifies the cost coefficients as follows:

Z − 3  M x1 − 5  M x2  Mx3  0 a1  Ma2  −2M

Next, the revised objective function is considered with third constraint as follows:

Z − 3  M x1 − 5  M  x2  Mx3  0 a1  Ma2  −2M  E3 


3 x1  2 x2  a2  18  E4  Pivotal Row

Pivotal Column

Obviously pivotal operation is E3 − M  E4 , which further modifies the cost coefficients as


follows:

Z − 3  4M x1 − 5  3M x2  Mx3  0 a1  0 a2  −20M

The modified cost coefficients are to be used in the Z-row of the first simplex tableau.

Next, let us move to the construction of simplex tableau. Pivotal column, pivotal row and
pivotal element are marked (same as used in the last class) for the ease of understanding.
Variables br
Iteration Basis Z br c
x x rs
1 x2 3 x4 a1 a2
Z 1 − 3 − 4M − 5 − 3M M0 0 0 − 20M--
a
1 0 1 1 -1 0 1 0 2 2
1
x4 0 0 1 0 1 0 0 6 --

a2 0 3 2 0 0 0 1 18 6

Note that while comparing − 3 − 4M  and − 5 − 3M  , it is decided that


− 3 − 4M   − 5 − 3M  as M is any arbitrarily large number.
Successive iterations are shown as follows:

Variables br
Iteration Basis Z br c
x1 x2 x3 x4 a1 a2 rs

Z 1 0 − 2  M − 3 − 3M0 3  4M0 6 − 12M--


x
1 0 1 1 -1 0 1 0 2 --
2
x4 0 0 1 0 1 0 0 6 --

a2 0 0 -1 3 0 -3 1 12 4

……continued to next page


continuing from previous page

Variables br
Iteration Basis Z br c
x1 x2 x3 x4 a1 a2 rs

Z 1 0 -3 0 0 M1  M18 --

x1 2 1
0 1 0 0 0 6 9
3 3
3
x4 0 0 1 0 1 0 0 6 6

x3 0 0 −1 1 0 -1 1 4 --
3 3

Z 1 0 0 0 3 M1  M36 --
2
x1 0 1 0 0 − 0 1 2 --
4 3 3
x2 0 0 1 0 1 0 0 6 --

1 1
x3 0 0 0 1 -1 6 --
3 3

It is found that, at iteration 4, optimality has reached. Optimal solution is Z  36 with x1  2

and x2  6 . The methodology explained above is known as Big-M method. Hope, reader has

already understood the meaning of the terminology!

‘Unbounded’, ‘Multiple’ and ‘Infeasible’ solutions in the context of Simplex Method

As already discussed in lecture notes 2, a linear programming problem may have different
type of solutions corresponding to different situations. Visual demonstration of these
different types of situations was also discussed in the context of graphical method. Here, the
same will be discussed in the context of Simplex method.
Unbounded solution

If at any iteration no departing variable can be found corresponding to entering variable, the
value of the objective function can be increased indefinitely, i.e., the solution is unbounded.

Multiple (infinite) solutions

If in the final tableau, one of the non-basic variables has a coefficient 0 in the Z-row, it
indicates that an alternative solution exists. This non-basic variable can be incorporated in the
basis to obtain another optimal solution. Once two such optimal solutions are obtained,
infinite number of optimal solutions can be obtained by taking a weighted sum of the two
optimal solutions.

Consider the slightly revised above problem,

Maximize Z  3x1  2x2


subject to x1  x2 ≥ 2
x2 ≤ 6
3x1  2x2  18
x1 , x2 ≥ 0

Curious readers may find that the only modification is that the coefficient of x2 is changed
from 5 to 2 in the objective function. Thus the slope of the objective function and that of third
constraint are now same. It may be recalled from lecture notes 2, that if the Z line is parallel to
any side of the feasible region (i.e., one of the constraints) all the points lying on that side
constitute optimal solutions (refer fig 3 in lecture notes 2). So, reader should be able to
imagine graphically that the LPP is having infinite solutions. However, for this particular set
of constraints, if the objective function is made parallel (with equal slope) to either the first
constraint or the second constraint, it will not lead to multiple solutions. The reason is very
simple and left for the reader to find out. As a hint, plot all the constraints and the objective
function on an arithmetic paper.

Now, let us see how it can be found in the simplex tableau. Coming back to our problem,
final tableau is shown as follows. Full problem is left to the reader as practice.
Final tableau:
Variables
b
r
Iteration Basis Z br c
x x rs
x1 2 3 x4 a1 a2
Z 1 0 0 0 0 M1  M18 --
2 1
x1 0 1 0 0 0 6 9
x 3 3
3 4 0 0 1 0 1 0 0 6 6
x3 0 0 −1 1 0 -1 1 4 --
3 3
Coefficient of non-basic variable x2 is zero

As there is no negative coefficient in the Z-row the optimal is reached. The solution is Z  18
with x1  6 and x2  0 . However, the coefficient of non-basic variable x2 is zero as shown in

the final simplex tableau. So, another solution is possible by incorporating x2 in the basis.
br 4
Based on the , x will be the exiting variable. The next tableau will be as follows:
c
rs

Variables br
Iteration Basis Z br c
x x a a rs
1 2 x3 x4 1 2

Z 1 0 0 0 0 M1  M18 --
x1 0 1 0 0 −2 0
1
2 --
x 3 3
4 2 0 0 1 0 1 0 0 6 6
x 1 1
3 0 0 0 1 3 -1 3 6 18

Coefficient of non-basic variable x4 is zero

Thus, another solution is obtained, which is Z  18 with x1  2 and x2  6 . Again, it may be

noted that, the coefficient of non-basic variable x4 is zero as shown in the tableau. If one

more similar step is performed, same simplex tableau at iteration 3 will be obtained.
Thus, we have two sets of solutions as and . Other optimal solutions will be obtained
0 6

6 2
as β  1− β
 
where, β ∈ 0,1 . For example, let β  0.4 , corresponding solution is


0 6
3.6
, i.e., x1  3.6 and x2  3.6 . Note that values of the objective function are not changed
3.6

for different sets of solution; for all the cases Z  18 .

Infeasible solution

If in the final tableau, at least one of the artificial variables still exists in the basis, the
solution is indefinite.

Reader may check this situation both graphically and in the context of Simplex method by
considering following problem:

Maximize Z  3x1  2x2


subject to x1  x2 ≤ 2
3x1  2x2 ≥ 18
x1 , x2 ≥ 0

Minimization versus maximization problems


As discussed earlier, standard form of LP problems consist of a maximizing objective
function. Simplex method is described based on the standard form of LP problems, i.e.,
objective function is of maximization type. However, if the objective function is of
minimization type, simplex method may still be applied with a small modification. The
required modification can be done in either of following two ways.

1. The objective function is multiplied by −1 so as to keep the problem identical and


‘minimization’ problem becomes ‘maximization’. This is because of the fact that
minimizing a function is equivalent to the maximization of its negative.

2. While selecting the entering nonbasic variable, the variable having the maximum
coefficient among all the cost coefficients is to be entered. In such cases, optimal
solution would be determined from the tableau having all the cost coefficients as non-

positive ( ≤ 0 )
Still one difficulty remains in the minimization problem. Generally the minimization problems consist of
constraints with ‘greater-than-equal-to’ ( ≥ ) sign. For example, minimize the price (to compete in the
market); however, the profit should cross a minimum threshold. Whenever the goal is to minimize some
objective, lower bounded requirements play the leading role. Constraints with ‘greater-than-equal-to’ ( ≥ )
sign are obvious in practical situations.

To deal with the constraints with ‘greater-than-equal-to’ ( ≥ ) and  sign, Big-M method is to be
followed as explained earlier.
UINT - IV

1 Data: Representation, Average, Spread


Data can be represented numerically or graphically in various ways. For instance, your
daily newspaper may contain tables of stoke prces and money exchange rates, curves or
bar of charts illustrating economical or political developments, or pie charts showing how
your tax dollar is spent. And there are numerous other representations of data for special
purposes.
In this section we discuss the use of standard representations of data in statistics.
We explain corresponding concepts and methods in terms of typical examples begin-
ning with
89 84 87 81 89 86 91 90 78 89 87 99 83 89. (1)

These are n = 14 measurements of the tensile strength of sheet steel in kg/mm2 recorded
in the order obtained and rounded to integer values. To see what is going on, we aort
these data, that is, we order them by size

78 81 83 84 86 87 87 89 89 89 89 90 91 99. (2)

Graphical Representation of Data


We shall now discuss standard graphical representations used in statistics for obtaining
information on properties of data.
Stem and Leaf Plot
This is one of the simplest but most useful representations of data. For data (1) it is
shown below.
Leaf unit =1.0
1 4 8
4 8 134
11 8 6779999
13 9 01
14 9 9

1
The numbers in (1) range from 78 to 99. We divide these numbers into 5 groups,
75 − 79, 80 − 84, 85 − 89, 90 − 94, 95 − 99. The integers in the tens position of the groups
are 7, 8, 8, 9, 9. These form the stem. The first leaf is 8. The second leaf is 134(representing
81, 83, 84), and so on.
The number of times a value occurs is called its absolute frequency. Thus 78 has
absolute frequency 1, the value 89 has absolute frequency 4 etc. The column to the
extreme left shows the cummulative absolute frequency, that is the sum of the absolute
frequencies of the values up to the line of the leaf. Thus the number 4 in the second line
on the left shows that (1) has 4 values up to and including 84. The number 11 in the
next line shows that there are 11 values not exceeding 89, etc. Dividing the cummulative
absolute frequencies by n(= 14) gives the cummulative relative frequencies.
Histogram
For large sets of data, histograms are better in displayng the distribution of data than
stem-and-leaf plots.
Center and Spread of data: Median
As a center of the location of data values we can simply take the median, the data
value that falls in the middle when the values are ordered. In (2) we have 14 values.
The seventh of them is 87, the eighth is 89, and we the split the difference, obtaining the
median 88.
Mean, Standard deviation, Variance
The average size of the data values can be measured in a more refined way by the
mean
1∑
n
1
x= xj = (x1 + x2 + · · · + xn ). (3)
n j=1 n

This is the arithmetic mean of the data values, obtained by taking their sum and dividing
by the data size n. Thus in (1),

1 611
x= (89 + 84 + · · · + 89) = ≈ 87.3.
14 7

Similarly, the spread of the data values can be measured in a more refined way by the
standard deviation s or by its square, the variance

1 ∑
n
1
2
s = (xj − x)2 = [(x1 − x)2 + (x2 − x)2 + · · · + (xn − x)2 ].
n − 1 j=1 n−1

Thus to obtain the variance of the data, take the difference xj − x of each data value from

2
the mean, square it, take the sum of these n squares, and divide it by n − 1. To get the
standard deviation s, take the square root of s2 .
For example, using x = 611/7, we get the data (1) the variance

1 611 2 611 2 611 2 176


s2 = [(89 − ) + (84 − ) + · · · + (89 − ) ]= ≈ 25.14.
13 7 7 7 7

2 Experiments, Outcomes, Events


An experiment is a process of measurement or observation, in a labortory, in a factory,
on the street, in nature or wherever; so “experiment” is used in a rather general sense.
Our interest is in experiments that involve “randomness”, chance effects, so that we
can not predict a result exactly.
A “trail” is a single performance of an experiment. Its result is called an “outcomes”
or a “sample point”. n trails then give a “sample” of “size n” consisting of n sample
points.
The “sample space S” of an experiment is the set of all possible outcomes.
Examples are:
(1) Inspecting a lightbulb. S = {Defective, Nondefective}.
(2) Rolling a die. S = {1, 2, 3, 4, 5, 6}.
(3) Measuring tensile strength of wire. S the numbers in some interval.
(4) Measuring copper content of brass. S: 50% to 90%.
(5) Counting daily traffic accidents in New York. S the integers in some interval.
The subsets of S are called “events” and the outcomes “simple events”.

3 Probability
The “probability” of an event A in an experiment is supposed to measure how frequenty
A is about to occur if we make any trials.
Defination 1. Probability
If the sample space S of an experiment consists of finitely many outcomes that are
equally likely, then the probability P (A) of an event A is

Number of points in A
P (A) = .
Number of points in S

3
Thus in particular,
P (S) = 1.

Defination 2. Probability
Given a sample space S, with each event A of S there is associated a number P (A),
called the probability of A, such that the following axioms of probability are satisfied.
1. For every A in S,
0 ≦ P (A) ≦ 1.

2. The entire sample space S has the probability

P (S) = 1.

3. For mutually exclusive events A and B(A ∩ B = ∅) then

P (A ∪ B) = P (A) + P (B).

4 Random variables, Probability Distributions


A probability distribution shows that the probabilities of events in an experment. The
quantity that we observe in an experiment will be denoted by X and is called a ran-
dom variable because the value it will assume in the next trial depends on chance, on
randomness.
If we count (cars on the road, deaths by cancer, etc), we have a discrete random
variable and distribution. If we measure (electric voltage, rainfall, hardness of steel), we
have a continuous random variable and distribution.
In both the cases the distribution of X is determined by the distribution function

F (x) = P (X ≦ x); (4)

this is the probability that X will assume any value not exceeding x. From (4) we obtain
the fundamental formula for the probability corresponding to an interval a < x ≦ b,

P (a < X ≦ b) = F (b) − F (a).

Discrete random variabls and Distributions


A random variable X and its distribution are discrete if X assumes only finitely many

4
or at most countably many values x1 , x2 , · · · , called the probability values of X, with
positive probabilities p1 = P (X = x1 ), p2 = P (X = x2 ), · · · , whereas the probability of
P (X ∈ I) is zero for any interval I containing no possible value.
Obviously, the discrete distribution is also determined by the probability function f (x)
of X, defined by {
pj if x = xj , (j = 1, 2, · · · )
f (x) =
0 otherwise .

From this we get the values of the distribution function F (x) by takng sums,

∑ ∑
F (x) = f (xj ) = pj .
xj ≦x xj ≦x

where for any given x we sum all the probabilities pj for which xj is smaller that or equal
to that x.
For the probability corresponding to intervals we have


P (a < X ≦ b) = pj .
a<xj ≦b

This is the sum of all probabilities pj for which xj satisfies a < xj ≦ b.



Note: pj = 1.
j
Continuous random variabls and Distributions
A random variable X and its distribution are of continuous type or, briefly, continuous,
if its distribution function F (x) can be given by an integral
∫ x
F (x) = f (v)dv,
−∞

whose integrand f (x), called the density of the distribution.


Differentiating gives the relation of f to F as

f (x) = F ′ (x)

for every x at which f (x) is continuous.


For the probability corresponding to an interval:
∫ b
P (a < X ≦ b) = F (b) − F (a) = f (v)dv.
a

5
Note: ∫ ∞
f (v)dv = 1.
−∞

Example
Let the random variable X =Sum of the two numbers when two dice turn up. The
probability function and the distribution function are as follows:
x 2 3 4 5 6 7 8 9 10 11 12
1 2 3 4 5 6 5 4 3 2 1
f (x) 36 36 36 36 36 36 36 36 36 36 36
1 3 6 10 15 21 26 30 33 35 36
F (x) 36 36 36 36 36 36 36 36 36 36 36
Example {
0.75(1 − x2 ) if − 1 ≦ x ≦ 1,
Let X have the density function f (x) = Find the
0 otherwise .
distribution function. Find the probability P (− 21 ≦ X ≦ 21 ) and P (− 14 ≦ X ≦ 2). Fnd x
such that P (X ≦ x) = 0.95.
Solution:
From the defination, it is clear that F (x) = 0 if x ≦ −1,
∫ x
F (x) = 0.75 (1 − v 2 )dv = 0.5 + 0.75x − 0.25x3 , −1 < x ≦ 1,
−1

and F (x) = 1 for x > 1.


∫ 1/2
1 1 1 1
P (− ≦ X ≦ ) = F ( ) − F (− ) = 0.75 (1 − v 2 )dv = 68.75%
2 2 2 2 −1/2
∫ 2
1 1
P ( ≦ X ≦ 2) = F (2) − F ( ) = 0.75 (1 − v 2 )dv = 31.64%
4 4 1/4

Finally,
P (X ≦ x) = F (x) = 0.5 + 0.75x − 0.25x3 = 0.95.

Algebraic simplification gives 3x − x3 = 1.8. A solution is x = 0.73, approximately.

5 Mean and variance of a distribution


The mean µ and variance σ 2 of a random variable X and its distribution are the theoretical
counterparts of the mean x and variance s2 of a frequency distribution. The mean µ is
defined by

6
 ∑

 xj f (xj ) (Discrete distribution),

µ= ∫j ∞


 xf (x)dx (Continuous distribution),
−∞

and the varance σ 2 is defined by


 ∑

 (xj − µ)2 f (xj ) (Discrete distribution),

σ2 = ∫j ∞


 (x − µ)2 f (x)dx (Continuous distribution),
−∞

σ is called the standard deviation of X and its distribution. f is the probability func-
tion (or probability mass function) or the density function, respectively, in discrete and
continuous distribution.

6 Binomial Distribution
Consider a set of n independent trials (n being finite) in which the probability p of success
in any trail is constant for each trial, then q = 1 − p, is the probability of failure in any
trail.
A random variable X is said to follow binomial distribution if it assumes only non-
negative values and its probability mass function is given by:
{ (n )
x
px q n−x x = 0, 1, 2, · · · , n; q = 1 − p, ,
P (X = x) = p(x) =
0 otherwise,

The mean of the binomial distribution is

µ = np

and the variance is


σ 2 = npq.

Example:
Ten coins are thrown simultaneously. Find the probability of getting at least seven
heads.
Solution: Here p= Probability of gettng a head = 12
q= Probability of not gettng a head = 12

7
∴ Probability of getting at least seven heads is given by :
P (X ≥ 7) = p(7) + p(8) + p(9) + p(10) = 176
1024
.

7 Poisson Distribution
A random variable X is said to follow Poisson distribution if it assumes only non-negative
values and its probability mass function is given by:
 −λ x
 e λ x = 0, 1, 2, · · · ; λ > 0
P (X = x) = p(x, λ) = x!

0 otherwise,

Here λ is known as the parameter of the distribution.


Here the mean and varance of the Poisson distribution are each equal to λ. It can be
proved that this distribution is obtained as limting case of the binomial distribution, if
we let p → 0 and n → ∞ so that the mean np = λ is a finite value.
Example
If on the average, 2 cars enter a certain parking lot per minute, what is the probability
that during any given minute, 4 or more cars will enter the lot?
Solution:
To understand that the Poisson distribution is a model of the situation, we imagine
the minute to be divided into very many short time intervals, let p be that probability
that a car will enter the lot during any such short interval, and assume independence of
the events that happens during those intervals.
Then we are dealing with binomial distributionwith very large n and very small p,
which we can approximate by the Poisson distribution with λ = np = 2.
Thus the complementary event “3 cars or fewer enter the lot” has the probability:
( )
−2 20 21 22 23
P (X = 0) + P (X = 1) + P (X = 2) + P (X = 3) = e + + + = 0.857.
0! 1! 2! 3!

∴ P (4 or more cars will enter the lot) = 1 − 0.857 = 0.143

8 Normal Distribution
A random variable X is said to have a normal distribution with parameters µ (called
mean) and σ 2 (called variance) if its probability density function (pdf) is given by the

8
probability law:
[ ( )2 ]
1 1 x−µ
f (x) = √ exp − , −∞ < x < ∞, −∞ < µ < ∞, σ > 0.
σ 2π 2 σ

Remark: When a r.v. X is normally distributed with mean µ and standard deviation
σ, it is customary to write X as distributed as N (µ, σ 2 ) and is expressed as X ∼ N (µ, σ 2 ).
Distribution function F (x)
The normal distribution has the distribution function
∫ [ ( )2 ]
1 x
1 v−µ
F (x) = √ exp − dv.
σ 2π −∞ 2 σ

For the corresponding standardized normal distribution with mean 0 and standard
deviation 1 we denote F (x) by
∫ x
1
e−u
2 /2
Φ(z) = √ du.
2π −∞

Result 1
The distribution function F (x) of the normal distribution with any µ and σ s related
to the standardized distribution function Φ(z) by the formula
( )
x−µ
F (x) = Φ .
σ

Result 2
The probability that a normal random variable X with mean µ and standard deviation
σ assume any value in an interval a < x ≦ b is
( ) ( )
b−µ a−µ
P (a < x ≦ b) = F (b) − F (a) = Φ −Φ .
σ σ

9 Regression Analysis
Regression analysis is a mathematical measure of the average relationship between two
or more variables in terms of the original units of the data.
Linear regression
If the variables in a bivariate distribution are related, we will find the points in the
scatter diagram will cluster arround some curve called the “curve of regression”. If the
curve is a straight line, it is called the line of regression and there is said to be linear

9
regression between two variables, otherwise regression is said to be curvilinear.
The line of regression is the line which gives the best estimate to the value of one
variable for any specific value of other variable. Thus the line of regression is the line of
“best fit” and is obtained by the principle of least squares.
Let us suppose that in the bivariate distribution (xi , yi ); = 1, 2, · · · , n; Y is dependent
variable and X is independent variable. Let the line of regression of Y on X be

y = a + bx.

The above equation represents a family of straight lines for different values of the arbitrary
constants a and b. The problem is to determine a and b so that the line y = a + bx is the
line of “best fit”.
Using Least square method, we get the line of regression of Y on X passes through
the point (x, y) as
y − y = k1 (x − x),

where x and y are the means of the x− and y− values in our sample, and the slope k1 is
called the regression coefficient, is given by

sxy
k1 = ,
s2x

with the “sample covariance” sxy given by


[∑ ( n )( ∑ )]
1 ∑ 1 ∑
n n n
1
sxy = (xj − x)(yj − y) = xj yj − xj yj ,
n − 1 j=1 n − 1 j=1 n j=1 j=1

and the “sample variance of the x-values” s2x is given by


[∑ ( n )2 ]
1 ∑ 1 ∑
n n
1
s2x = (xj − x) =
2
x −
2
xj .
n − 1 j=1 n − 1 j=1 j n j=1

Example Obtain the line of regression of Y on X for the following data.


X: 65 66 67 67 68 69 70 72
Y : 67 68 65 68 72 72 69 71
Solution: Here x = 68, y = 69, sx = 2.12, sy = 2.35, sxy = 2.9892.

10
∴ Equation of line of regression of Y on X is:

2.9892
y − 69 = (x − 68) ⇒ y = 0.665x + 23.78
(2.12)2

10 Correlation Analysis
Correlation analysis is concerned with the relation between X and Y in a two-dimensional
random variable (X, Y ). A sample consists of n ordered pairs of values (x1 , y1 ), · · · ,
(xn , yn ), we shall use the sample means x and y, the sample variances s2x and s2y and the
sample covariance sxy .
The sample correction coefficient is

sxy
r= .
sx sy

Remarks:
1. The correction coefficient r satisfies −1 ≦ r ≦ 1, and r = ±1 if and only if the sample
values lie on a straight line.
2. Two independent variables are uncorrelated.
3. Correlation coefficient is independent of change of origin and scale.

11 Tests of Significance
A very important aspect of the sampling theory is the study of the tests of significance,
which enables us to decide on the basis of sample results, if
(i) the deviation between the observed sample statistic and the hypothetical parameter
values.
(ii) the deviation between two independent sample statistics; is significant or might be
attributed to chance or the fluctuations of sampling.

11.1 Null and Alternative hypopthesis


For applying the test of significance we first set up a hypopthesis- a definite statement
about the population parameter. Such a hypothesis, which is usually a hypothesis of no
difference, is called “null hypopthesis” and usually denoted by H0 .
Any hypopthesis which is complementary to the null hypopthesis is called an “alter-
native hypopthesis” and usually denoted by H1 . For example if we want to test the null

11
hypopthesis that the population has a specifiedmean µ0 , (say), i.e., H0 : µ = µ0 then the
alternative hypopthesis could be:

H1 : µ ̸= µ0 (i.e., µ > µ0 or µ < µ0 ) (ii)H1 : µ > µ0 (iii)H1 : µ < µ0

The alternative hypopthesis in (i) is known as a “two-tailed alternative” and the alterna-
tives in (ii) and (iii) are known as “right-tailed” and “left-tailed alternatives” respectively.

11.2 Critical values or significant values


The value of test statistics which separates the critical (or rejection) region and the
acceptance region is called the critical value or significant value. It depends upon:
(i) The level of significance used, and
(ii) The alternative hypopthesis, whether it is two-tailed or single-tailed.

11.3 Procedure for testing of hypothesis


We now summarize below the various steps in testing of a statistical hypopthesis in a
systematic manner.
1. Null hypopthesis. Set up the null hypopthesis H0 .
2. Alternative hypopthesis. Set up the alternative hypopthesis H1 . This will enable us
to decide whether we have to use a single-tailed test or right-tailed test.
3. Level of significance. Choose the appropriate level of significance (α) depending on
the reliability of the estimates and permission risk. This is to decided before sample is
drawn.
4. Test statistic. Compute the test statistic.
5. Conclusion. We compare the computed value in step 4 with significant value (tabulated
value) at the given level of significance. If the calculated value in in modulus is less than
tabulated value, then the null hypopthesis is accepted.

11.3.1 Test of significance for single proportion

If X is the number of successes in n independent trials with constant probability P of


success for each trial, then set the statistic as

p−P
Z=√ , where p = X/n, Q = 1 − P.
P Q/n

12
11.3.2 Test of significance for dfference of proportions

Suppose we want to compare two distinct populations with respect to the prevalence of
a certain attribute, say A, among theirs members. Let X1 and X2 be the number of
persons possessing the given attributes A n random samples of sizes n1 and n2 from two
populations respectively. Then the sample proportions are given by : p1 = X1 /n1 and
p2 = X2 /n2 .
Under H0 : P1 = P2 , the test statistic for difference proportions is given by

p1 − p2 n1 p1 + n2 p2
z=√ , where Pb = , b = 1 − Pb.
Q
PbQ(
b 1 +
n1
1
n2
) n1 + n2

11.3.3 Test of significance for single mean

Here the statistic is


x−µ
z= √ ,
σ/ n
where n is the sample size with mean x from a normal population with mean µ and
standard deviation σ.

11.3.4 Test of significance for difference of means

Let x1 be the mean of a sample of size n1 from a population with mean µ1 and variance
σ12 and let x2 be the mean of an independent random sample of size n2 from another
population with mean µ2 and variance σ22 .
Here the test statistic becomes

x1 − x2
z=√ 2 .
(σ1 /n1 ) + (σ22 /n2 )

For more details about the theory, workout examples and questions, see the
book:
“Fundamentals of Mathematical Statistics” by S.C. Gupta and V.K. Kapoor.

13

You might also like