0% found this document useful (0 votes)
27 views49 pages

Numerical Analysis Edited

The document provides a comprehensive overview of the Gaussian elimination method for solving systems of linear equations, including multiple examples with detailed solutions. It also introduces iterative methods such as the Jacobi and Gauss-Seidel methods, explaining their processes and providing examples for clarity. Each method is illustrated with step-by-step calculations to demonstrate how to arrive at the solutions.

Uploaded by

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

Numerical Analysis Edited

The document provides a comprehensive overview of the Gaussian elimination method for solving systems of linear equations, including multiple examples with detailed solutions. It also introduces iterative methods such as the Jacobi and Gauss-Seidel methods, explaining their processes and providing examples for clarity. Each method is illustrated with step-by-step calculations to demonstrate how to arrive at the solutions.

Uploaded by

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

NUMERICAL ANALYSIS

GAUSSIAN ELIMINATION METHOD


Given a system of equations
a11x1 + a12x2 + - - - - - - - - - - + a1nxn = b1
a21x1 + a22x2 + - - - - - - - - - - + a2nxn = b2
a31x1 + a32x2 + - - - - - - - - - - + a3nxn = b3
----------------------------
----------------------------
an1xn + an2xn + - - - - - - - - - - + annxn = bn
Example 1:
Solve the set of equations using Gaussian Elimination Method
x1 + 2x2 – 3x3 = 3 - - - - - - - - - - - - (1)
2x1 – x2 – x3 = 11 - - - - - - - - - - - - (2)
3x1 + 2x2 + x3 = -5 - - - - - - - - - - - - - (3)
Solution

Multiply equation (1) by (2⁄1) and subtract from equation (2)

-5x2 + 5x3 = 5 - - - - - - - - - - - - - - - - (4)

Multiply equation (1) by (3⁄1) and subtract from equation (3)

-4x2 + 10x3 = -14 - - - - - - - - - - - - - (5)

Multiply equation (4) by 4⁄5 and subtract from equation (5)

6x3 = -18

X3 = −18⁄6 = -3

Substituting the value of X3 into equation (5), we have


-4x2 + 10(-3) = -14
X2 = -4
Substituting the value of x2 and x3 into equation (1), we have
X1 + 2(-4) – 3(-3) = 3
X1 – 8 + 9 = 3
X1 = 2
X1 = 2, X2 = -4, X3 = -3

1
Example 2
Solve the set of equations using Gaussian Elimination method

2 x1  3x 2  2 x3  9            (1)
3x1  2 x 2  x3  4            (2)
x1  4 x 2  2 x3  6            (3)

Solution

3
Multiply equation (1) by ( ) and subtract from equation (2)
2
13  19
x 2  4 x3           (4)
2 2
5 3
x 2  x3             (5)
2 2

 5
Multiply equation (4) by   and subtract from equation (5)
 13 
7  56
x3 
13 26
x3  4

Substitute the value of x3 into equation (5) we have

5 3
x2  4 
2 2
5 5
x2 
2 2
x2  1

Substitute the value of x2 and x3 into equation (1) we have

2 x1  3(1)  2(4)  9
2 x1  4
x1  2
x1  2, x 2  1, x3  4

Example 3
Solve the set of equations using Gaussian Elimination method

2
x1  3x 2  2 x3  8        (1)
2 x1  x 2  x3  9        (2)
3x1  2 x 2  3x3  5        (3)

Solution

Multiply equation (1) by (2/1) and subtract from equation (2)

5 x2  3x3  7        (4)

Multiply equation (1) by (3/1) and subtract from equation (3)

11X2 – 3x3 = - 19 ------------------------------ (5)

Multiply equation (4) by (11/5) and subtract from equation (5)

18 18
x3  
5 5
x3  1

Substituting the value of x3 into equation (5), we have

11x 2  3 1  19


11x 2  22
x 2  2

Substitute the value of x2 and x3 into equation (1), we have

x1  3 2   2 1  8
x1  4  8
x1  4
x1  4, x 2  2, x3  1

Example 4
Solve using Gaussian Elimination method, the set of equation. Leave your answer to two decimal places
(2 d. p)
5.22X1 + 3.9X2 – 1.38X3 = 3.41
1.26X1 – 4.33X2 – 2.75X3 = 11.18
1.53X1 + 2.84X2 + 6.16X3 = 7.34
Solution
1.26
Multiplying equation (1) by 5.22 and subtract from equation (2), we have

3
-5.274X2 – 2.417X3 = 10.357 - - - - - - - - - - - (4)
1.53
Multiplying equation (1) by 5.22
and subtract from equation (3), we have

1.694X2 + 6.565X3 = 6.341 - - - - - - - - - - - - (5)


5.788X3 = 9.670
X3 = 1.671
Substitute the value of X3 into equation (5). We have
1.694X2 + 6.565X3 = 6.341
1.694X2 + 6.565(1.671) = 6.341
X2 = -2.733
Substitute the value of X2 and X3 into equation (1). We have
5.22X1 + 3.9X2 – 1.38X3 = 3.41
5.22X1 + 3.9(-2.733) – 1.38(1.671)
X1 = 3.142
X1 = 3.142, X2 = -2.733, X3 = 1.671
Example 5

Solve the following system of Linear equations by Gaussian Elimination method


X1 + X2 + X3 = 2 (1)
2X1 + 3X2 - X3 = 9 (2)
X1 + 3X2 + 2X3 = 5 (3)

Solution

Multiply equation (1) by (2⁄1) and subtract from equation (2)

X2- 3x3 = 5

Multiply equation (1) by (1⁄1) and subtract from equation (3)

2x2+x3 = 3
Multiply equation (4) by (2⁄1) and subtract from equation (5)
7x3 = -7
X3 = -1

Substituting the value of x3 into equation (5), we have

2x2-1 = 3
X2 = 2

Substitute the value of x2 and x3 into equation (1), we have

4
X1+2-1 = 2
X1 = 1
X1= 1, X2 = 2, X3 = -1

Example 6
Solve the set of equations using Gaussian Elimination method

3X1 – 2X2 + 2X3 = 9 (1)


X1 – 2X2 + X3 =5 (2)
2X1 –X2 -2X3 = -1 (3)
Solution

Multiply equation (1) by (1⁄3) and subtract from equation (2)

−𝟒𝒙𝟐 𝒙𝟑
+ = 𝟐 … … … … … … … … … … … … … … … … … … . (𝟒)
𝟑 𝟑
Multiply equation (1) by (2⁄3) and subtract from equation (3)

𝑥2 10𝑥3
− = −7 … … … … … … … … … … … … … .5
3 3
Multiply equation (1) by (−1⁄4) and subtract from equation (5)

−39𝑥3 −13
=
12 2
𝑥3 = 2

Substituting the value of x3 into equation (5), we have

𝑥2 10(2)
− = −7
3 3

𝑥2=−1

Substituting the value of x2 and x3 into equation (1), we have

3𝑥1 − 2(−1) + 2(2) = 9

𝑥1=1

XI = 1, X2 = -1, X3 = 2

5
ITERATIVE METHODS FOR SOLVING LINEAR SYSTEMS OF EQUATIONS
- The Jacobi Iterative method
- The Gauss-Seidel iterative method

JACOBI METHOD (ITERATIVE PROCESS)


Jacobi method consists of using the first equation to express the first unknown in terms of the other
unknowns, the second to express the second unknown in terms of the other unknowns and so on. Starting
with trial solution X1 = X2 ………. = Xn= 0. We obtain a new set of values for X1, X2, ……..Xn. The set of
values become the second trial solution and so on. Always arrange the equations in order to have a strong
leading diagonal.
Example 1
Solve the set of equations below using Jacobi Method and gave your answers to 2 d.p
10X1 - 3X2 + X3 +4X4 = 23
2X1 + 9X2 - 3X3 + X4 = 15
3X1 + 2X2 + 12X3 + 2X4 = 51
X1 - 3X2 + 4X3 +10X4 = 47
Solution
1
X1 = 10[23 + 3X2 – X3 – 4X4]
1
X2 = [15 - 2X1 + 3X3 – X4]
9
1
X3 = 12[51 - 3X1 - 2X2 - 2X4]
1
X4 = 10[47 - X1 + 3X2 - 4X3]

First Iteration
Start with the trial solution, X1 = X2 = X3 = X4 = 0. We have
X1 = 2.300, X2 = 1.666, X3 = 4.250, X4 = 4.700
Second Iteration
X1 = 0.495, X2 = 2.050, X3 = 2.614, X4 = 3.270
Third Iteration
X1 = 1.346, X2 = 2.065, X3 = 3.240, X4 = 4.220
Fourth Iteration
X1 = 0.908, X2 = 1.979, X3 = 2.866, X4 = 3.889
Fifth Iteration
X1 = 1.052, X2 = 1.988, X3 = 3.045, X4 = 4.057

6
Sixth Iteration
X1 = 0.969, X2 = 1.998, X3 = 2.979, X4 = 3.973
Seventh Iteration
X1 = 1.012, X2 = 2.003, X3 = 3.013, X4 = 4.011
Eighth Iteration
X1 = 0.995, X2 = 2.000, X3 = 2.995, X4 = 3.995
Ninth Iteration
X1 = 1.0025, X2 = 2.000, X3 = 3.0021, X4 = 4.0025
Tenth Iteration
X1 = 0.9988, X2 = 1.9999, X3 = 2.9990, X4 = 3.9989

X1 = 1.00, X2 = 2.00, X3 = 3.00, X4 = 4.00

THE GAUSS-SEIDEL METHOD (ITERATIVE PROCESS)


This method is very similar to Jacobi method with a little modification
Example 2
Solve the above set of equations using Gauss-Seidel method and give your answer to 2 d.p
Solution
1
X1 = [23 + 3X2 – X3 – 4X4]
10
1
X2 = [15 - 2X1 + 3X3 – X4]
9
1
X3 = 12[51 - 3X1 - 2X2 - 2X4]
1
X4 = [47 - X1 + 3X2 - 4X3]
10

First Iteration
X1 = X2 = X3 = X4 = 0
1
X1 = [23 + 3(0)– 0– 4(0)] = 2.300
10

Using X1 = 2.300, X3= 0, X4 = 0


1
X2 = 9[15 – 2(2.300)+ 3(0)– (0)] = 1.156

Using X1 = 2.300, X2 = 1.156, X4 = 0


1
X3 = 12[51 - 3(2.300)– 2(1.156)– 2(0)] = 3.482

7
1
X4 = [47 - 2.300+ 3(1.156)– 4(3.482)] = 3.424
10

Second Iterations: The new trial solution


X1 = 2.300, X2 = 1.156, X3 = 3.482, X4 = 3.424
Using these values above;
X1 = 0.929, X2 = 2.240, X3 = 3.074, X4 = 4.050
Third Iterations; with the new set of values;
X1 = 1.045, X2 = 2.009, X3 = 2.979, X4 = 4.007
Fourth Iteration;
X1 = 1.002, X2 = 1.992, X3 = 3.000, X4 = 3.997
Sixth Iteration
X1 = 0.999, X2 = 2.001, X3 = 3.001, X4 = 4.000
Seventh Iteration
X1 = 1.000, X2 = 2.000, X3 = 3.000, X4 = 4.000
Taking the answers to 2d.p,

X1 = 1.00, X2 = 2.00, X3 = 3.00, X4 = 4.00

Example 3
Consider the following set of equations using Jacobi method and Gauss-Seidel method
10X1 – X2 + 2X3 =6
-X1 + 11X2 – X3 + 3X4 = 25
2X1 – X2 + 10X3 – X4 = -11
3X2 – X3 + 8X4 = 15
Solution
1
X1 = [6 + X2 – 2X3]
10
1
X2= 11[25 + X1 + X3 – 3X4]
1
X3= 10[-11 - 2X1+ X2– X4]
1
X4= 8[15 - 3X2 + X3]

First iteration; trial solution


X1 = X2 = X3 = X4 = 0
X1 = 0.6000, X2 = 2.2727, X3 = -1.1000, X4 = 1.8750

8
Second Iteration
X1 = 1.0473, X2 = 1.7159, X3 = -0.8052, X4 = 0.8852
Third Iteration
X1 = 0.9326, X2 = 2.0530, X3 = -1.0493, X4 = 1.1309
Fourth Iteration
X1 = 1.0152, X2 = 1.9537, X3 = -0.9681, X4 = 0.9739
Fifth Iteration
X1 = 0.9890, X2 = 2.0114, X3 = -1.0103, X4 = 1.0214
Sixth Iteration
X1 = 1.0032, X2 = 1.9922, X3 = -0.9945, X4 = 0.9944
Seventh Iteration
X1 = 0.9981, X2 = 2.0023, X3 = -1.0020, X4 = 1.0036
Eighth Iteration
X1 = 1.006, X2 = 1.9987, X3 = -0.9990, X4 = 0.9989
Ninth Iteration
X1 = 0.9997, X2 = 2.0004, X3 = -1.0004, X4 = 1.0006
Tenth Iteration
X1 = 1.0001, X2 = 1.9998, X3 = -0.9998, X4 = 0.9998

X1 = 1.00, X2 = 2.00, X3 = -1.00, X4 = 1.00

Using the Gauss-Seidel iterative method


1
X1 = 10[6 + X2 – 2X3]
1
X2= 11[25 + X1 + X3 – 3X4]
1
X3= 10[-11 - 2X1+ X2+X4]
1
X4= [15 - 3X2 + X3]
8

First iteration; trial solution


X1 = X2 = X3 = X4 = 0
1
X1 = [6 + 0 – 2(0)] = 0.6000
10

X1 = 0.6000, X2 = 0, X3 = 0, X4 = 0

9
1
X2= 11[25 + 0.6000+0– 3(0)] = 2.3273

X1 = 0.6000, X2 = 2.3273, X3 = 0, X4 = 0
1
X3= 10[-11 – 2(0.6000)+ 2.3273+ 0] = -0.9873
1
X4= 8[15 – 3(2.3273)+ 0.9873] = 0.8789

Second Iteration
Using the value; X1 = 0.6000, X2 = 2.3273, X3 = -0.9873, X4 = 0.8789
X1 = 1.030, X2 = 2.037, X3 = -1.014, X4 = 0.9844
Third Iteration
X1 = 1.0065, X2 = 2.0036, X3 = -1.0025, X4 = 0.9983
Fourth Iteration
X1 = 1.0009, X2 = 2.0003, X3 = -1.0003, X4 = 0.9999
Fifth Iteration
X1 = 1.0001, X2 = 2.0000, X3 = -1.0000, X4 = 1.0000
To two decimal places,

X1 = 1.00, X2 = 2.00, X3 = -1.00, X4 = 1.00

Example 4
Consider the three-by-three system using Jacobi method
2X1– X2 + X3 = -1
X1+ 2X2 –X3 = 6
X1– X2 + 2X3 = -3
Ax = B, Convert to X = Cx + d
Ax = B =>Cx + d
1
X1= 2[-1 + X2 - X3]
1
X2= 2[6 – X1 + X3]
1
X3= 2[-3 – X1 + X2]

First Iteration: trial solution; X1 = X2 = X3 =0


1
X1= 2[-1 + 0- 0] = -0.5000

10
1
X2= 2[6 – 0+ 0] = 3.0000
1
X3= 2[-3 – 0+ 0] = -1.5000

X1 = -0.5000, X2 = 3.0000, X3 = -1.5000


Second Iteration
X1 = 1.7500, X2 = 2.5000, X3 = 0.2500
Third Iteration
X1 = 0.6250, X2 = 2.2500, X3 = -1.1250
Fourth Iteration
X1 = 1.1875, X2 = 2.1250, X3 = -0.6875
Fifth Iteration
X1 = 0.9063, X2 = 2.0625, X3 = -1.0313
Sixth Iteration
X1 = 1.0469, X2 = 2.0313, X3 = -0.9219
Seventh Iteration
X1 = 0.9766, X2 = 2.0156, X3 = -1.0078
Eighth Iteration
X1 = 1.0117, X2 = 2.0078, X3 = -0.9805
Ninth Iteration
X1 = 0.9941, X2 = 2.0039, X3 = -1.0020
Tenth Iteration
X1 = 1.0029, X2 = 2.0020, X3 = -0.9951

X1 = 1.00, X2 = 2.00, X3 = -1.00,


Example 5
Solve using Gauss-Seidel method and leave your answer to 2 d.p
4X1 + 3X2 = 24
3X1 + 4X2 – X3 = 30
- X2 + 4X3 = 24
Solution
Convert fromAx = B to X = Cx + d

11
1
X1= [24- 3X2]
4
1
X2 = 4[30- 3X1 + X3]
1
X3 = 4[-24 + X2]

First Iteration: starting with trial solution; X1 = X2 = X3 =0


1
X1= 4[24– 3(0)] = 6.0000

X1 = 6.0000, X2 = 0, X3 =0
1
X2 = 4[30– 3(6)+ 0] = 3.0000
1
X3 = 4[-24 + 3] = -5.2500

X1 = 6.0000, X2 = 3.0000, X3= -5.2500


Second Iteration
X1 = 3.7500, X2 = 1, X3= -5.2500
Third Iteration
X1 = 4.7344, X2 = 3.3750, X3= -5.5781
Fourth Iteration
X1 = 3.4688, X2 = 2.5547, X3= -5.1563
Fifth Iteration
X1 = 4.0840, X2 = 3.6093, X3= -5.3613
Sixth Iteration
X1 = 3.2930, X2 = 3.0967, X3= -5.0977
Seventh Iteration
X1 = 3.6775, X2 = 3.7558, X3= -5.2258
Eighth Iteration
X1 = 3.1832, X2 = 3.4354, X3= -5.0611
Ninth Iteration
X1 = 3.4235, X2 = 3.8473, X3 = -5.1412
Tenth Iteration
X1 = 3.1144, X2 = 3.6471, X3 = -5.0381

X1 = 3.00, X2 = 4.00, X3 = -5.00

12
NEWTON-RAPHSON METHOD

It isn’t always possible to find interactive formulae of the type

Xn  1  g ( Xn)

That will find the solution of every equation another interactive method that is useful is called the
Newton-Raphson method.

To carry out the iterations we need to find the point where the tangents meet the X-axis.

Figure 1: Newton-Raphson
𝑡ℎ𝑒 𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑦
The gradient of the tangent: 𝑡ℎ𝑒 𝑐ℎ𝑎𝑛𝑔𝑒 𝑖𝑛 𝑥

dy y0
 atx0 
dx x0  x1

dy y0
We have atx0  and we need to find x1.
dx x0  x1

dy
Using y0 and atx0 in the formulae isn’t very convenient, so, since y  f ( x) wehave
dx

dy y0
y 0  f ( x0 )and atx0   f 1 ( x0 )
dx x0  x1
then,
f ( x0 )
f 1 ( x0 ) 
x0  x1

13
Rearranging:

f ( x0 ) f (x )
x0  x1  1
 x1  x0  1 0
f ( x0 ) f ( x0 )
so,
f ( x0 )
x1  x0 
f 1 ( x0 )

We just need to alter the subscripts to find x2:

f ( x0 )
x2  x1 
f 1 ( x0 )

In general, we have

f ( xn)
Xn  1  Xn 
f 1 ( xn)

SUMMARY

To use the Newton- Raphson method to estimate a root of an equation:

1. Rearrange the equation into the form f(x)=0


2. Differentiate f(x) to find F1(x)
3. Substitute f(x) and F1(x) into the formulae
f ( xn)
Xn+1 = Xn -
f 1 ( xn)

4.Choose a suitable starting value for X0

5.Carry out the iteration process

Example 1
Using the Newton – Raphson Method. Obtain the root of the equation at approximate x = 2 (i.e. xo = 2)

x 3 − 3x − 4 = 0
Solution
f(x) = x 3 − 3x − 4

f ′ (x) = 3x 2 − 3

xo = 2, then
f(xo ) = f(2) = 23 − 3(2) − 4 = −2

f ′ (x0 ) = f ′ (2) = 3(2)2 − 3 = 9

14
f(xn )
xn+1 = xn − ,n = 0
f ′ (xn )
f(xo )
x1 = xo −
f ′ (xo )
(−2)
x1 = 2 − = 2.22
9
f(x1 ) = f(2.22) = 0.281
f ′ = f 1 (2.22) = 11.785
f(x1 )
x2 = x1 −
f ′ (x1 )
(0.281)
x2 = 2.22 − = 2.196
11.785
f(x2 ) = f(2.196) = (2.196)3 − 3(2.196) − 4

f ′ (x2 ) = f 1 (2.196) = 3(2.196)2 − 3 = 11.467


f(x2 )
x3 = x2 −
f ′ (x2 )
0.00203
x3 = 2.196 − = 2.19602
11.467
x2 = x3 = 2.19602 ⇒ x = 2.196 (3 D. P)
Example 2
Using the Newton – Raphson method, obtain the root of the equation at approximate x = 1

x 3 + 2x 2 − 2 = 0
Solution
f(x) = x 3 + 2x 2 − 2
f ′ (x) = 3x 2 + 4x
xo = 1
f(xo ) = f(1) = 13 + 2(1)2 − 2 = 1

f ′ (xo ) = f ′ (1) = 3(1)2 + 4(1) = 7


f(xn )
xn+1 = xn − ,n = 0
f ′ (xn )
f(xo )
x1 = xo −
f ′ (xo )
1 6
x1 = 1 − = = 0.857143
7 7

15
f(x1 ) = f(0.857143) = (0.857143)2 + 2(0.857143)2 − 2
f ′ (x1 ) = f ′ (0.857143) = 3(0.857143)2 + 4(0.857143) = 5.632654367
f(x1 )
x2 = x1 −
f ′ (x1 )
0.099126169
x2 = 0.857143 − = 0.839545
5.632654367
f(x2 ) = f(0.839545) = (0.839545)3 + 2(0.857143)2 − 2 = 0.061129622
f ′ (x2 ) = f ′ (0.839545) = 3(0.839545)2 + 4(0.839545) = 5.472687421
f(x2 )
x3 = x2 −
f ′ (x2 )
0.061129622
x3 = 0.839545 − = 0.828375
5.472687421
f(x3 ) = f(0.828375) = (0.828375)3 + 2(0.828375)2 − 2 = 0.059154536
f ′ (x3 ) = f ′ (0.828375) = 3(0.828375)2 + 4(0.828375) = 5.372115422
f(x3 )
x4 = x3 −
f ′ (x3 )

(−0.059154536)
x4 = 0.828375 − = 0.839386404
5.372115422
f(x4 ) = f(0.839386) = (0.839386)3 + 2(0.839386)2 − 2 = 0.0005429485904
f ′ (x4 ) = f ′ (0.839386) = 3(0.839386)2 + 4(0.893386) = 5.471250571
f(x4 )
x5 = x4 −
f ′ (x4 )
0.0005429485904
x5 = 0.839386 − = 0.839287
5.471250571
f(x5 ) = f(0.8392987) = (0.839287)3 + 2(0.839287)2 − 2 = 0.000001339065412
f ′ (x5 ) = f ′ (0.839287) = 3(0.839287)2 + 4(0.839287) = 5.470356005
x6 = 0.839287
x5 = x6 = 0.839287
x = 0.839287

Example 3
Using the Newton – Raphson method, obtain the root of the equation at xo= 3

16
x 4 + x 2 − 80
Solution

f(x) = x 4 + x 2 − 80
f ′ (x) = 4x 3 + 2x
xo = 3
f(xo ) = f(3) = 34 + 32 − 80 = 10
f ′ (xo ) = f ′ (3) = 4(3)3 + 2(3) = 114
f(xo )
x1 = xo −
f ′ (x0 )
10
x1 = 3 − = 2.9123
114
f(x1 ) = f(2.9123)4 + (2.9123)2 − 80 = 0.417185792
f ′ (x1 ) = f ′ (2.9123) = 4(2.9123)3 + 2(2.9123) = 17.4738
f(x1 )
x2 = x1 −
f ′ (x1 )
0.417185792
x2 = 2.9123 − = 2.9083
17.4738
f(x) = f(2.9083) = (2.9083)4 + (2.9083)2 − 80 = 0.000493483125
f ′ (x) = f ′ (2.9083) = 4(2.9083)3 + 2(2.9083) = 104.2126357
0.000493483125
x3 = 2.9083 − = 2.9083
104.2126357
x2 = x3 = 2.9083
x = 2.9083

Example 4
Use the Newton – Raphson method to estimate the root of the following equation

y = x 3 + 2x 2 − 5x − 1 with xo = −1.9
Solution

y = f(x) = x 3 + 2x 2 − 5x − 1 (xo = −1.9)


dy
= f ′ (x) = 3x 2 + 4x − 5
dx
f(xo ) = f(−1.9) = (−1.9)3 + 2(−1.9)2 − 5(−1.9) − 1 = 9.861
f ′ (xo ) = f ′ (−1.9) = 3(−1.9)2 + 4(−1.9) − 5 = −1.77

17
f(xo )
x1 = xo −
f ′ (xo )

(9.861)
x1 = −1.9 − = 3.106215
−1.77
f(x1 ) = f(3.106215) = 3(3.106215)2 + 2(3.106215)2 − 5(3.106215) − 1
= 32.37057488

f ′ (x1 ) = f ′ (3.106215) = 3(3.106215)2 + 4(3.106215) – 5


= 36.37057488
f(x1 )
x2 = x1 −
f ′ (x1 )
32.73660617
x2 = 3.106215 − = 2.206130
36.37057488
f(x2 ) = f(2.206130) = (2.206130)2 + 2(2.206130)2 − 5(2.206130) − 1
= 8.440624992

f ′ (x2 ) = f ′ (2.206130) = 3(2.206130)2 + 4(2.206130) − 5 = 18.42554873


f(x2 )
x3 = x2 −
f ′ (x2 )
8.440624992
x3 = 2.206130 − = 1.748036
18.42554873
f(x3 ) = f(1.748036) = (1.748036)3 + 2(1.748036)2 − 5(1.748036) − 1
= 1.71243070

f ′ (x3 ) = f ′ (1.748036) = 3(1.748036)2 + 4(1.748036) − 5 = 11.1590335

f(x3 )
x4 = x3 −
f ′ (x3 )
1.712430708
x4 = 1.748036 − = 1.5945791
11.15903357
f(x4 ) = f(1.594579) = (1.594579)3 + 2(1.594579)2 − 5(1.594579) − 1
= 0.166976993
f ′ (x4 ) = f ′ (1.594579) = 3(1.594579)2 + 4(1.594579) − 5 = 9.006363562
f(x4 )
x5 = x4 −
f ′ (x4 )

18
0.166976993
x5 = 1.594579 − = 1.57603911
9.006362562
x5 = 1.576039
f(x5 ) = f(1.576039) = (1.576039)3 + 2(1.576039)2 − 5(1.576039) – 1
= 0.002324444025
f ′ (x5 ) = f ′ (1.576039) = 3(1.576039)2 + 4(1.576039) − 5
= 8.755852789
f(x5 )
x6 = x5 −
f ′ (x5 )
0.002324444025
x6 = 1.576039 − = 1.576
8.755852789
x5 = x6 = 1.576
x = 1.576 (3 D. P)
Example 5
Solve the equation x 3 + 5x − 7 = 0 using Newton Raphson method
Solution
f(x) = x 3 + 5x − 7
f ′ (x) = 3x 2 + 5

f(0) = 03 + 5(0) − 7 = −7
f(1) = 13 + 5(1) − 7 = −1
f(2) = 23 + 5(2) − 7 = 11
Hence, there will be a root between x = 1 and x = 2; so take x = 1
Therefore, xo = 1, n = 0
f(xo )
x1 = x0 −
f ′ (xo )
f(xo ) = f(x1 ) = 13 + 5(1) − 7 = −1
f ′ (xo ) = f ′ (1) = 3(1)2 + 5 = 8
−1 9
x1 = 1 − ( ) = = 1.125
8 8
f(x1 ) = f(1.125) = (1.125)3 + 5(1.125) − 7 = 0.048828128

f ′ (x1 ) = f ′ (1.125) = 3(1.125)2 + 5 = 8.796875


f(x1 )
x2 = x1 −
f ′ (x1 )

19
0.048828125
x2 = 1.125 − = 1.119449378
8.796875
x2 = 1.1194
f(x2 ) = f(1.1194) = (1.1194)3 + 5(1.1194) − 7 = −0.0003287106
f ′ (x2 ) = f ′ (1.1194) = 3(1.1194)2 + 5 = 8.75916908
f(x2 )
x3 = x2 −
f ′ (x2 )
−0.000328710616
x3 = 1.1194 − ( ) = 1.1194
8.75916908
x2 = x3 = 1.1194 (4 D. P)
The nth root of a given number
n
x ≅ √N
n
Then x + h = √N
(x + h)n = N
N − xn
h =
nx n − 1
n N − xn
√N + x +
nx n − 1
Find the square root of 10 to 3 D.P

√10 ≅ 3 = x1
N − xn 10 − 32 1
h = n − 1
= 2 − 1
= = 0.01667
nx 2(3 ) 6
Since N = 10, x = 3, n = 2
x2 = x1 + h = 3 + 0.1667 = 3.1667
10 − (3.1667)2
h = = −0.0044192
2 × 3.1667
x3 = x2 + h
x3 = 3.1667 − 0.0044192 = 3.16228
x4 = x3 + h
10 − (3.16228)2
h = = −0.0000023
2 × 3.16228
x4 = 3.16228 − 0.0000023 = 3.16228
x3 = x4 = 3.162 x = 3.162 (3 D. P)

20
BISECTION METHOD
The bisection method (sometimes called the midpoint method for equations) is a method used to estimate
the solution of an equation.
We approach this problem by writing the equation in the form f(x) = 0 for some function f(x). This
reduces the problem to finding a root for the function f(x).
The Bisection Method also needs a closed interval [a,b] for which the function f(x) is positive at one
endpoint and negative at the other. In other words f(x) must satisfy the condition f(a)f(b) < 0. This means
that this algorithm can not be applied to find tangential roots.
Bisection Algorithm
The idea for the Bisection Algorithm is to cut the interval [a,b] you are given in half (bisect it) on each
iteration by computing the midpoint xmid. The midpoint will replace either a or b depending on if the sign
of f(xmid) agrees with f(a) or f(b).
Step 1: Compute xmid = (a+b)/2
Step 2: If sign(f(xmid)) = 0 then end algorithm
else If sign(f(xmid)) = sign(f(a)) then a = xmid
else b = xmid
Step 3: Return to step 1
• The Bisection Method is a successive approximation method that narrows down an interval that
contains a root of the function f(x)

• The Bisection Method is given an initial interval [a..b] that contains a root (We can use the
property sign of f(a) ≠ sign of f(b) to find such an initial interval)

• The Bisection Method will cut the interval into 2 halves and check which half interval contains a
root of the function

• The Bisection Method will keep cut the interval in halves until the resulting interval is extremely
small

The root is then approximately equal to any value in the final (very small) interval.

21
Figure 2: Bisection Graph

Figure 3: Bisection Graph

Figure 4: Bisection Graph

22
Example 1
Find the root of X3 – 2X - 3 = 0 by bisection method if the root lies between 0 and 2 [0, 2]. Take your
answer to 4 dp after three iterations
f(x) = X3 – 2X – 3
a = 0, b = 2
𝑎+𝑏 0+2
Xmid= 2
= 2
=1

f(a) = 03 – 2(0)– 3 = -3
f(b) = 23 – 2(2)– 3 = 1
f(xmid) = 13 – 2(1)– 3 = -4
Iteration a B xmid f(a) f(b) f(xmid)
1 0 2 1 -3 1 -4
2 1 2 1.5 -4 1 -2.262
3 1.5 2 1.75 -2.262 1 -1.140
4 1.75 2 1.875 -1.140 1 -0.158

X4= 1.875
X3 = 1.75
1.75+1.875
X= 2
= 1.8125 (4 dp)

Example 2
Find the root of X2– 3 = 0 by bisection method if the root lies between 0 and 4 [0, 4]
f(x) = X2– 3
a = 0, b = 4
𝑎+𝑏 0+4
Xmid= 2
= 2
=2

f(a) = 02– 3 = -3
f(b) = 42– 3 = 13

f(xmid) = 42– 3 = 1

Iteration a B xmid f(a) f(b) f(xmid)

1 0 4 2 -3 13 1
2 0 2 1 -3 1 -2

23
3 1 2 1.5 -2 1 -0.75
4 1.5 2 1.75 -0.75 1 0.0625
5 1.5 1.75 1.625 -0.75 0.0625 -0.3594
6 1.625 1.75 1.6875 -0.3594 0.0625 -0.1523

7 1.6875 1.75 1.71875 -0.1523 0.0625 -0.0459


8 1.71875 1.75 1.734375 -0.0459 0.0625 0.008056641

9 1.71875 1.734375 1.7265625 -0.0459 0.008056641 -0.018981933


10 1.7265625 1.734375 1.73046875 -0.018981933 0.008056641 -0.005477905
11 1.73046875 1.734375 1.732421875 -0.0054779050 0.008056641

1.7320404052 1.7320556640 1.732048035


734375 625

1.7320480346 1.7320556640 1.732051849 - 0.00001682319 0.000003607624


679688 625 0.000009607916 448 318
735

X = 1.732051849
X = 1.732052 [6 dp]
Example 3
Find the positive root of X3 – X = 1 by bisection method if the root lies between 1 and 2. Take your
answer to 4 dp after 3 iterations
f(x) = X3 – X – 1 = 1 [1, 2]
a = 1, b = 2
𝑎+𝑏 1+2
Xmid= 2
= 2
= 1.5

f(a) = 13 – 1 – 1 = -1
f(b) = 23 – 2 – 1 = 5
f(Xmid) = 1.53 – 1.5 – 1 = 0.875
Iteration a b xmid f(a) f(b) f(xmid)

1 1 2 1.5 -1 5 0.875
2 1 1.5 1.25 -1 0.875 -0.296875

24
3 1.25 1.5 1.375 -0.2969 0.875 0.224609375
4 1.25 1.375 1.3125 -0.2969 0.224609375 -0.051513671
X3 = 1.375
X4 = 1.3125
1.375 +1.3125
X= = 1.34375
2

X = 1.3438 [4 dp]

Example 4
Solve X3 – 9X + 1 = 0 by bisection method for the root between 2 and 4. Take your answer to 3dp. After
3 iterations
f(x) = X3 – 9X + 1 [2, 4]
a = 2, b = 4
𝑎+𝑏 2+4
f(Xmid) = 2
= 2
=3

f(a) = 23 – 9(2) + 1 = -9
f(b) = 43 – 9(4) + 1 = 29
f(Xmid) = 33 – 9(3) + 1 = 1

Iteration a b xmid f(a) f(b) f(xmid)

1 2 4 3 -9 29 1
2 2 3 2.5 -9 1 -5.875
3 2.5 3 2.75 -5.875 1 -2.953125
4 2.75 3 2.875 -2.953125 1 -1.111328125

X3= 2.75, X4= 2.875

2.75 +2.875
X= 2
= 2.8125 [4 dp]

Example 5
Find the positive of X – CosX = 0 by bisection method if the root lies between 0.5 and 1. Take your
answer to 4 dp after 3 iterations
f(x) = X – CosX [0.5, 1]

25
a = 0.5, b = 1
𝑎+𝑏 0.5+1
f(Xmid) = 2
= 2
= 0.75

Iteratio a B xmid f(a) f(b) f(xmid)


n
1 0.5 1 0.75 -0.377582561 0.459697694 -0.018311131
2 0.75 1 0.875 -0.018311131 0.459697694 0.234003141
3 0.75 0.875 0.8125 -0.018311131 0.234003141 0.124814437
4 0.75 0.8125 0.78125 -0.018311131 0.124814437 0.0071216116

X3= 0.8125, X4= 0.78125


0.8125 + 0.78125
X= = 0.796875
2

X = 0.7969[4 dp]

Example 6
Find the positive root of Xex= 1 by bisection method if the root lies between 0 and 1. Take your answer to
4 dp after 3 iterations.
f(x) = Xex– 1 [0, 1]
a = 0, b = 1
𝑎+𝑏 0+1
f(Xmid) = 2
= 2
= 0.5

f(a) = 0 x e0 – 1 = -1
f(b) = 1 x e1 – 1 = 1.718281828

f(Xmid) = 0.5 x e0.5 – 1 = -0.175639364

Iteratio A B xmid f(a) f(b) f(xmid)


n
1 0 1 0.5 -1 1.718281828 -0.175639346
2 0.5 1 0.75 -0.175639364 1.718281828 0.587750012
3 0.5 0.75 0.625 -0.175639364 0.587750012 -0.167653723
4 0.5 0.625 0.5625 -0.175639364 0.167653723 -0.012781755

26
X3= 0.625, X4= 0.5625
X3 +X4 0.625 + 0.5625
X= 2
= 2
=0.59375

X = 0.5938 [4 dp]

TRAPEZOIDAL RULE

Figure 5: Trapezoidal Rule

Figure 6: Trapezoidal Rule

 F x dx  2 y  2 y1  2 y 2  2 y 3    2 y n 1  y n 
b h
0
a

Example 1
Evaluate using trapezoidal rule

27

F x    2 sin xdx
0

Using the given table of values below


X 0 15° 30° 45° 60° 75° 90°

F(x) 0 0.2588 0.5000 0.7071 0.8660 0.9656 1.000

Solution n= 6


h  15  rad  0.2618
12

Area 
h
 y 0  2 y1  2 y 2  2 y3  2 y 4  2 y5  y 6 
2


0.2618
0  20.2588  20.5  20.7071  20.8660  20.9659  1
2
= 0.994254

28
SIMPSON’S RULE

Figure 7: Simpson’s Rule

 F x dx  3 y  4 y1  2 y 2  4 y 3  2 y 4    2 y n  2  4 y n 1  y n 
b h
0
a

Example 1
Using Simpson’s rule, evaluate

sin x
2.6
0.2 x
dx

Using the tabulation 0.20.42.6

Solution
h = 0.4 and

ba b  a 2 .6  0.2
h= n  6
n h 0 .4
Y0 Y1 Y2 Y3 Y4 Y5 Y6
X 0.2 0.6 1.0 1.4 1.8 2.2 2.6

F(x) 0.99335 0.94107 0.84147 0.70389 0.54103 0.36750 0.19827

From Simpson’s rule

area 
h
3
  
 y 0  y 6   2 y 2 y4  4 y1  y3  y5  

29

0.4
0.99335 0.19827  20.84147  0.54103 40.94107  0.70389  0.36750
3


0.4
1.19162  21.38250  42.01246
3
= 1.6009

Example 2
Using Simpsom’s Rule with strips to estimate
1 1
 1 x
0 2
dx Giving your answer to 4d.p.

Solution

A
h
3

y 0  4 y1  2 y 2  4 y3  y 4 
1 0
n  4, h   0.25
4
X 0 0.25 0.5 0.75 1
Y 1 0.94118 0.8 0.64 0.5

1 0.25
1  40.94118  20.8  40.64  0.5
1
 1 x
0 2
dx 
3
= 0.7854 4d.p

Example 3
3 1
Estimate 
1 x
dx using Simpson’s rule

With 4 strips, giving your answer to 4d.p.

A
h
 y 0  4 y1  2 y 2  4 y3  y 4 
3
n=4, a=1, b=3

30
b  a 3 1
h   0.5
n 4
X 1 1.5 2 2.5 3

Y 1 0.66667 0.5 0.4 0.33333

1 0.5
1  40.66667  20.5  40.4  0.33333
3
1 x
dx 
3
= 1.1000 (4d.p)
Example 4
Evaluate the following integral using Simpson’s rule with h=1.0, taking your answer to 2d.p
3
1= 3
x 4 dx

Solution
A = -3, b= 3, h=1.0

ba 33
n=  6
h 1 .0
Y0 Y1 Y2 Y3 Y4 Y5 Y6
X -3 -2 -1 0 1 2 3

F(x) 81 16 1 0 1 16 81

I
h
y0  4 y1  2 y 2  4 y3  2 y 4  4 y5  y6 
3

1.0
81  416  21  40  21  416  81
3
294
  98.00
3
Example 5
Evaluate the following integral using Simpson’s rule with h= 1.0, taking your answer to 4d.p
6 1
I  dx
0 1  x 
Solution
a=0, b=6, h=1.0

31
ba 60
n=  6
h 1.0
Y0 Y1 Y2 Y3 Y4 Y5 Y6

X 0 1 2 3 4 5 6
F(x) 1 0.5 0.3333 0.25 0.2 0.1667 0.1429

I
1..0
1  40.5  20.3333  40.25  20.2  40.1667  0.1429
3

 1.95884d. p 
5.8763

3
Example 5
1.2 1
Evaluate the integral using trapezoidal rule with h= 0.2, taking your answer to 4d.p I   1  x dx
0 2

Solution
a=0, b=1.2, h=0.2

b  a 1. 2  0
n=  6
h 0.2
Y0 Y1 Y2 Y3 Y4 Y5 Y6
X 0 0.2 0.4 0.6 0.8 1.00 1.2
F(x) 1 0.9615 0.8621 0.7353 0.6098 0.5000 0.4098

I
h
 y 0  2 y1  2 y 2  2 y3  2 y 4  2 y5  y 6 
2


0.2
1  20.9615  20.8621  20.7353  20.6098  20.5000  0.4098
2
= 0.8747 4d.p
Using Simpson’s rule

I
h
 y 0  4 y1  2 y 2  4 y3  2 y 4  4 y5  y 6 
3


0.2
1  40.9615  20.8621  40.7353  20.6098  40.5000  0.4098
3
 0.87614d. p 

32
FINITE DIFFERENCE
Gregory-Newton interpolation formula using forward finite differences.

Example 1
X 2 4 6 8 10
F(x) 14 88 274 620 1174

It is required to determine the value of F(x) at x=5.5


Solution

x0  4, x1  6, x p  5.5
h  x1  x0  6  2  2
x p  x0 5.5  4
p   0.75
h 2
FIRST COMPILE THE TABLE OF FORWARD DIFFERENCES
X F(x) F 2 F 3 F
2 14
74

x0  4 88 112

5.5 x p  186 48

x1  6 274 160

346 48
8 620 208
554
10 1174

The Gregory-Newton forward difference interpolation formula is

f p  1     f 0
p

33
 p 1 2
f p  f 0  pf 0  p
 p  1 p  2 3 f     
 f 0  p 0
 2!  3!


f p  1  p  p
 p  12  p  p  1 p  23      f
 6
 1 2 1 2  3 
0.75 0.25160 0.75 0.25 1.2548
f p  f 5.5  88  0.75186  
1 2 1 2  3
 88  139.5  15  1.875  214.375
Example 2
Determine the value of f(-1) from the set of function
X -4 -2 0 2 4 6 8
F(x) 541 55 1 -53 -155 31 1225

X F(x) F 2 F 3 F 4 F
-4 541
-486

x 0 -2 55 432

x p  1  -54 -432

x1 0 1 0 384

-54 -48
2 -53 -48 384
-102 336
4 -155 288 384

186 720
6 31 1008
1194
8 1225

34
x0  2, x1  0, x p  1
h  x1  x0  0  2  2
x p  x0 1 2 1
p  
h 2 2
p p  12 f 0 p  p  1 p  2 3 f 0 p  p  1 p  2  p  34 f 0
f p  f 0  pf 0   
1 2 1 2  3 1 2  3  4
1 1 1  1   3  1  1   3   5 
  0      48     384
2 2 2  2  2  2  2  2  2 
 55   54 
1
 
2 1 2 1 2  3 1 2  3  4
 55  27  0  3  15  10
f p  f  1  10

Example 3
Find the polynomial Fx which has the values F0= -6, F1 = -2, F2= 8, F3 =36, F4 =94, F5= 194, F6=348 and
calculate the value of F3.6 by using the difference table.
x F(x) F 2 F 3 F 4 F
0 -6
4
1 -2 6
10 12
2 8 18 0
28 12

x0  3 36 30 0

x p  3.6  58 12

x1 4 94 42 0

100 12

5 194 54
154
6 348

35
X0=3, x1 =4, h=x1-x0=4-3=1
Xp =3.6, p=𝑥𝑝−𝑥0

=3.6−3
1
=0.6

p p  1f 0 p p  1 p  23 f 0


f p  f 0  pf 0  
1 2 1 2  3
0.60.6  142 0.60.6  10.6  212
f p  36  0.658  
1 2 1 2  3
f p  36  34.8  5.04  0.672
 66.432
f (3.6)  66.432

LINEAR PROGRAMMING
Linear Programming/linear optimization
Optimisation problem is one requiring the determination of the optimal (maximum or minimum) value of
a given function, called the objective function, subject to a set of stated restrictions or constraints placed
on the variable concerned.
Linear programming is a method of solving an optimization problem when the objective function is a
linear function and the constraints are linear equations or Linear inequalities.
There are two methods for solving linear programming problems, there are:
(i) Graphical Method (ii) Simplex Method
(i)Graphical Method: This method is for solving two variables only. Example are given below

Example 1:
Maximize z = 2x1+ 3x2
Subject to: 3x1 + 6x2 ≤ 24
2x1 + x2 ≤ 10
x1, x2 ≥0

Solution
The coordinates for our plot are:
(i) 3x1 + 6x2 = 24
When x1 = 0, x2 = 4 which gives (0,4)
When x1 = 0, x2 = 8 which gives (8,0)
(ii) 2x1 + x2 = 10
If x1 = 0, x2 = 10, which gives (0, 10)

36
When x1 = 0, x2 = 5, which gives (5, 10)
Hence the coordinates are (0, 4) and (8,0) for the first line (3x1 + 6x2 = 24)
And (0,10) and (5,0) for the first line (3x1 + 6x2 = 24) and (0,10) and (5,0) for second line (2x1 +x2 = 10)
Profit Lines
The profit lines are obtained from the objective function
To maximize Z = 2x1 + 3x2 choose arbitrary Z. Let Z = 6
2x1 + 3x2 = 6
For x1 = 0, x2 = 2 coordinate (0, 2)
For x2 = 0, x1 = 3 coordinate (3, 0)
This gives line PQ
Now, we increase Z to say Z = 12, then
2x1 + 3x2 = 12
For x1 = 0, x2 = 4 coordinate (0, 4)
For x2 = 0, x1 = 6 coordinate (6, 0)
This gives Line AS. Since PQ and AS are parallel lines all such profit lines will be parallel and moving
upward by increasing Z as indicated in the graph. These profit lines will finally leave the feasible region
at point B which gives the optimum results with values of x1 = 4, x2 = 2
Hence maximum Z = 2x1 + 3x2
Z = 2(4) + 3(2) = 14

Example 2:
Maximize Z = x1 + 2x2
Subject to : x2 ≤ 3
x1 + x2 ≤ 5
x1 – 2x2 ≤ 2
x1, x2 ≥ 0
Solution
The coordinates of plot
(i) x2 = 3
(ii) x1 + x2 = 5

For x1 = 0, x2 = 5 which gives (0, 5)


For x2 = 0, x1 = 5 which gives (5, 0)

37
(iii) x1 – 2x2 = 2

For x1 = 0, x2 = -1 which gives (0,-1)


For x2 = 0, x1 = 2 which gives (2,0)
Profit lines
Z = x1 + 2x2
Let Z = 2
2 = x1 + 2x2
For x1 = 0, x2 = 1 coordinates (0, 1)
For x2 = 0, x1 = 2 coordinates (2, 0)
Now we increase Z to say Z = 4
4 = x1 + 2x2
For x1 = 0, x2 = 2 coordinates (0, 2)
For x2 = 0, x1 = 4 coordinates (4, 0)
Now increasing the Z to say 8
8 = x1 + 2x2
For x1 = 0, x2 = 4 coordinates (0, 4)
For x2 = 0, x1 = 8 coordinates (8, 0)
From equation of straight lines y = mx + c comparing it with the equation Z = x1 + 2x2
x2 = -x1/2 + Z/2, y = x2, m = -1/2 , c = z/2
From the graph: c= (Z/2)max =4
Zmax = 8

Example 3:
Maximize Z = 6𝑥1 + 9𝑥2
Subject to: 2𝑥1 + 2𝑥2 ≤ 24
𝑥1 + 5𝑥2 ≤ 44
6𝑥1 + 2𝑥2 ≤ 60
𝑥1 , 𝑥2 ≥ 0
Since the problem consists of only two variables 𝑥1 𝑎𝑛𝑑 𝑥2 , we may use a graphical method to obtain the
solution.
Solution

38
2𝑥1 + 2𝑥2 = 24
𝑥1 + 5𝑥2 = 44
6𝑥1 + 2𝑥2 = 60
The coordinates for the plot are obtained as follows:
(i) 2𝑥1 + 2𝑥2 = 24
For 𝑥1 = 0, 𝑥2 = 12 which gives (0, 12)
For 𝑥1 = 12, 𝑥2 = 0 which gives (12, 0)

(ii) 𝑥1 + 5𝑥2 = 44
For 𝑥1 = 0, 𝑥2 = 8.8 which gives (0, 8.8)
For 𝑥1 = 44, 𝑥2 = 0 which gives (44, 0)

(iii) 6𝑥1 + 2𝑥2 = 60


For 𝑥1 = 0, 𝑥2 = 30 which gives (0, 30)
For 𝑥1 = 10, 𝑥2 = 0 which gives (10, 0)
Hence, the coordinates are (0, 12) and (12, 0) for equation2𝑥1 + 2𝑥2 = 24, (0, 8.8) and (44, 0) for
equation 𝑥1 + 5𝑥2 = 44 and (0, 30) and (10, 0) for equation 6𝑥1 + 2𝑥2 = 60.
These coordinates now give the plot below.
Profit lines
To maximize Z = 6𝑥1 + 9𝑥2 → select an arbitrary Z which is a least common multiple of 6 and 9.
Let Z = 18
6𝑥1 + 9𝑥2 = 18
For 𝑥1 = 0, 𝑥2 = 2 which gives (0, 2)
For 𝑥1 = 3, 𝑥2 = 0 which gives (3, 0)
This gives line PQ
Since we are maximizing, we increase arbitrary Z, say Z = 36
6𝑥1 + 9𝑥2 = 36
For 𝑥1 = 0, 𝑥2 = 4 which gives (0, 4)
For 𝑥1 = 6, 𝑥2 = 0 which gives (6, 0)
This gives RS
Since PQ and RS are parallel lines, all such profit lines will be parallel and moving upward by increasing
Z as indicated in the graph. These profit lines will finally leave the feasible region at point B, which gives
the optimum result with values of
𝑥1 = 4 𝑎𝑛𝑑 𝑥2 = 8
Hence, maximum profit: Z = 6𝑥1 + 9𝑥2

39
= 6(4) + 9(8) = 96.
Example 4:
Maximize Z = 𝑥1 + 2𝑥2
Subject to: −3𝑥1 + 4𝑥2 ≤ 8
𝑥1 + 4𝑥2 ≤ 16
3𝑥1 + 2𝑥2 ≤ 18
𝑥1 , 𝑥2 ≥ 0
Coordinates of plot are:
(i) −3𝑥1 + 4𝑥2 = 8
For 𝑥1 = 0, 𝑥2 = 2 which gives (0, 2)
−8 −8
For 𝑥1 = , 𝑥2 = 0 which gives ( , 0)
3 3

(ii) 𝑥1 + 4𝑥2 = 16
For 𝑥1 = 0, 𝑥2 = 4 which gives (0, 4)
For 𝑥1 = 16, 𝑥2 = 0 which gives (16, 0)

(iii) 3𝑥1 + 2𝑥2 = 18


For 𝑥1 = 0, 𝑥2 = 9 which gives (0, 9)
For 𝑥1 = 6, 𝑥2 = 0 which gives (6, 0)
−8
Hence, the coordinates are (0, 2) and ( 3 , 0) for equation −3𝑥1 + 4𝑥2 = 8, (0, 4) and (16, 0) for
equation 𝑥1 + 4𝑥2 = 16 and (0, 9) and (6, 0) for equation 3𝑥1 + 2𝑥2 = 18.
These coordi*nates now give the plot below.
Profit lines
To maximize Z = 𝑥1 + 2𝑥2 → select an arbitrary Z which is a least common multiple of 1 and 2.
Let Z = 2
𝑥1 + 2𝑥2 = 2
For 𝑥1 = 0, 𝑥2 = 1 coordinates (0, 1)
For 𝑥1 = 2, 𝑥2 = 0 coordinates (2, 0)
This gives line PQ
Since we are maximizing, we increase arbitrary Z, say Z = 4
𝑥1 + 2𝑥2 = 4
For 𝑥1 = 0, 𝑥2 = 2 coordinates (0, 2)
For 𝑥1 = 4, 𝑥2 = 0 coordinates (4, 0)
Increasing arbitrary Z further

40
Let Z = 8
𝑥1 + 2𝑥2 = 8
For 𝑥1 = 0, 𝑥2 = 4 coordinates (0, 4)
For 𝑥1 = 8, 𝑥2 = 0 coordinates (8, 0)
This gives plot TW
Increasing the value of Z further
Let Z = 10
𝑥1 + 2𝑥2 = 10
For 𝑥1 = 0, 𝑥2 = 5 coordinates (0, 5)
For 𝑥1 = 10, 𝑥2 = 0 coordinates (10, 0)

Simplex method
Step I: Convert the inequality constraints to equality constraints. Equate the objective function to zero.
Step 2: Set up an initial tableau for the problem. Check if the tableau is feasible or not. If it is feasible it
means it has a finite optimal solution, and then you can proceed and solve the problem.
Step 3: Apply the simplex criterion I to identify the incoming variable (variable entry the basis) using the
most negative value in the zj - cj row.
Step 4: Also apply the simplex criterion II to identify the outgoing variable (variable leaving the basis) by
taking ratio using the smallest element.
Step 5: Identify the pivot element (i.e. intersection of the row element and column element. The reduce
the pivot element to unity (i.e. 1) by dividing the element by itself.
Step 6: Carry out the iteration process until the tableau is optimal (i.e. zj - cj ≥ 0) for a maximization
problem then stop.
New number = old number − the product of the corresponding entries in the main row and key column
Nc = C− (A x B)
Example 1

Max z  3x1  4 x 2  2 x3

s.t 2 x1  3x2  x3  50

41
3x1  2 x 2  2 x3  40

x1  5 x2  2 x3  60

x1 , x 2 , x3  0

Max z  3x1  4 x 2  2 x3 0

s.t 2 x1  3x 2  x3  x 4  50

3x1  2 x 2  2 x3  x5  40

x1  5 x2  2 x3  x6  60

x1 , x 2 , x3 , x 4 , x5 , x6  0

x1 x2 x3 x4 x5 x6

2 3 1  1  0  0 
3  2 2 0  0  0 
           
1   5  2 0 1 1

2 1  0  0 
 3  = 2 0  +3 1 +1 0 Linearly independent
 
       
1  0 0 1

Incoming vector

x1 x2 x3 x4 x5 x6 Resource vector

zj Cj -3 -4 -2 0 0 0 0

Basis

42
x4 2 3 1 1 0 0 50 50
 16
3

x5 3 -2 2 0 1 0 40

x6 1 2 0 0 1 60 60
5  12
5

50
Taking ratio  16
3

60
 12
5

x1 x2 x3 x4 x5 x6

 11 0 2 0 0 4 48
5 5
5

0 1 1 0 3 14
x4 7 5 5
5

x5 17
5 0 14
5 0 1 2
5 64

x2 1
5 1 2
5 0 0 1
5 12

0 0 5 11 0 1 70
7 7 7

1 0 1 5 0 3 10
x1 7 7 7

17 1 13 30
7 7
23
7

43
x5 0 0

0 1 3 1 0 2 10
x2 7 7 7

0 0 0 168
161
5
23
42
161
1760
23

1 0 0 14 1 8 260
x1 23 23 23 23

0 0 1 17 7 13 210
x3 23 23 23 23

0 1 0 4 3 1 140
x2 23 23 23 23

260 210 140


x1  x3  x 2 
23 23 23

x4  x5  x6  0

1760
z 
23

 

 

 
New value =  

New value =
2

 115  15    2  11  1  5   5
5 7 5 5 5 7 7
5

  11   5 
New value = 0   1   11
7
 5  7

44
 11  5
New value = 48     14   48  22  70
 5 7

Example 2

Max  3x1  2 x 2  4 x 3

S.t  4 x  2 x 2  2 x3  20

5 x1  3x 2  2 x 3  18

2 x1  3x 2  3x 3  21

x1  2 x 2  8

x , , x 2, x 3  0

Max  3x1  2 x 2  4 x3  0
S.t : 4 x1  2 x 2  2 x3  x 4  20

5 x1  3x 2  2 x 3  x 5  18

2 x1  3x 2  3x 3  x 6  21

x1  2 x 2  x 7  8

x1, x 2, x3, x 4, x5, x6, x7  0.

X1 X2 X3 X4 X5 X6 X7
j  Cj -3 -2 -4 0 0 0 0 0

Basis

X4 4 2 -2 1 0 0 0 20
X5 5 -3 2 0 1 0 0 18

X6 2 3 3 0 0 1 0 21
X7 1 2 0 0 0 0 1 8

45
X1 X2 X3 X4 X5 X6 X7
−𝟕 2 0 0 0 𝟒 0 28
𝟑 𝟑
Basis

X4 𝟏𝟔 4 0 1 0 𝟐 0 34
𝟑 𝟑

X5 𝟏𝟏 -5 0 0 1 −𝟐 0 4
𝟑 𝟑

X3 𝟐 1 1 0 0 𝟏 0 7
𝟑 𝟑

X7 1 2 0 0 0 0 1 8

X1 X2 X3 X4 X5 X6 X7
0 𝟏𝟕⁄ 0 0 𝟏⁄ 𝟒𝟐⁄ 0 𝟑𝟏𝟐⁄
𝟏𝟏 𝟏𝟏 𝟑𝟑 𝟏𝟏
Basis

X4 0 0 1 0 𝟑𝟏𝟎⁄
𝟏𝟏
X1 1 −𝟏𝟓⁄ 0 0 𝟑⁄ −𝟐⁄ 0 𝟏𝟐⁄
𝟏𝟏 𝟏𝟏 𝟏𝟏 𝟏𝟏
X3 0 1 0 0 𝟔𝟗⁄
𝟏𝟏
X7 0 0 0 1 𝟕𝟔⁄
𝟏𝟏

310 12 69 76
X4  , X1  , X 3  , X7 
11 11 11 11
X2  X5  X6  0

312

11
From the results,
X2 = 0, means items two should not be produced.

Example 3

46
Max Z = 2x1 + 6x2 + 4x3
S.t: 2x1 + 5x2 + 2x3 ≤ 38
4x1 + 2x2 + 3x3 ≤ 57
x1 + 3x2 + 5x3 ≤ 57
x1, x2, x3 ≥ 0

Introducing slack variables


2x1 + 5x2 + 2x3 + x4 = 38
4x1 + 2x2 + 3x3 + x5 = 57
x1 + 3x2 + 5x3 + x6 = 57
x1, x2, x3 , x4, x5, x6 ≥ 0

Max Z - 2x1 - 6x2 - 4x3 = 0

Simplex tableau

INITIAL TABLEAU
x1 x2 x3 x4 x5 x6 b
Zj - Cj

Basis -2 -6 -4 0 0 0 0

x4 2 5 2 1 0 0 38

x5 4 2 3 0 1 0 57

x6 1 3 5 0 0 1 57

Taking ratios

47
38
= 7.6
5
57
= 28.5
2
57
= 19
3

x1 x2 x3 x4 x5 x6 b
Zj - Cj

Basis 2/5 0 -8/5 6/5 0 228/5


0

x2 2/5 1 2/5 1/5 0 0 38/5

x5 16/5 0 11/5 -2/5 1 0 209/5

x6 -1/5 0 19/5 -3/5 0 1 171/5

Taking ratios:
38 5
× = 19
5 2
209 5
× = 19
5 11
171 5
× =9
5 19

x1 x2 x3 x4 x5 x6 b
Zj - Cj

Basis 16/19 0 0 18/19 0 18/19 60

x2 8/19 1 0 5/19 0 -2/19 4

48
x5 63/19 0 0 -1/19 1 -11/19 22

x3 -1/19 0 1 -3/19 0 5/19 9

Optimal solution
X2 * = 4
X5* = 22
x3 * = 9
x1* = x4* = x6*= 0
Zmax* = 60

49

You might also like