Module 1 Unit 1 Numerical Solution To Systems of Linear Equations 3

You might also like

You are on page 1of 49

NUMERICAL SOLUTION

TO LINEAR AND
NONLINEAR
ALGEBRAIC
EQUATIONS
UNIT 1: NUMERICAL SOLUTION TO
SYSTEMS OF LINEAR EQUATIONS
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

TOPICS:
Direct Methods: LU Factorization Methods
Iterative Methods: Jacobi’s Method and Gauss-Seidel Method

References

Chapra, S. C., & Canale, R. P. (2015). Numerical Methods for Engineers (7th ed.). New
York: McGraw-Hill Education.

Gerald, C., & Wheatley, P. (2004). Applied Numerical Analysis (7th ed.). Addison-
Wesley Publishing Co., Inc.

Kaw, A. K. (2007). LU Decomposition Method. Retrieved from Holistic Numerical


Methods: https://nm.mathforcollege.com/chapter-04-07-lu-decomposition-
method/

Kiusalaas, J. (2010). Numerical Methods in Engineering with Matlab (2nd ed.). New
York: Cambridge University Press.

Yang, W. Y., Cao, W., Chung, T.-S., & Morris, J. (2005). Applied Numerical Methods
Using MATLAB. New Jersey: John Wiley & Sons, Inc.

Unit Learning Outcomes

At the end of this learning unit, you should be able to:

 Solve systems of linear equations using LU factorization


methods
 Perform iterative methods of solving systems of linear equations

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

17
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

LU Factorization Methods

LU factorization is a direct method for solving systems of linear algebraic equations. The
term direct method refers to the procedure for computing a solution with a finite number
of steps, i.e., mathematically exact.

Compared with Gaussian Elimination, the primary appeal of LU decomposition is that the
time-consuming elimination step can be formulated so that in involves only operations
on the matrix of coefficients A. Thus, it is well suited for those situations where many right-
hand side vectors b must be evaluated for a single value of A. (Chapra & Canale, 2015)

The process of computing the Lower- and the Upper-triangular matrices for a given
square matrix A is known as LU decomposition or factorization. The combinations of L and
U for a prescribed A are endless, unless certain constraints are placed on L or U. These
constraints distinguish one type of decomposition from one another. Three commonly
used decomposition methods are: Doolittle, Crout and Cholesky. (Kiusalaas, 2010)

The idea behind LU factorization in solving systems of linear equations is this:

 If solving a set of linear equations Ax  b , we express the coefficients matrix A


as the product of a lower triangular matrix L and an upper triangular matrix U so
that the form Ax  b becomes LUx  b .
 If we let Ux be equal to another vector y , the equation becomes Ly  b from
which vector y can be solved by forward substitution.
 Then, Ux  y will yield x by the back substitution process.

Hence, to solve systems of linear equations by LU factorization technique, we follow these


steps:

1. Write the system into the form Ax  b .


2. Decompose A into L and U .
3. Solve for y from Ly  b .
4. Finally, solve for x from Ux  y .

LU Factorization by Doolittle’s Method

Doolittle’s decomposition method provides a method to factor A into L and U such that
L will have 1’s on the main diagonal. The following describes the algorithm for Doolittle’s
Method:
Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

18
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

A  LU
a11 a12 a13 ... a1n   1 0 0 ... 0 u11 u12 u13 ... u1n 
a a22 a23 ... a2n  l 1 0 ... 0  0 u 22 u 23 ... u 2n 
 21   21  
a31 a32 a33 ... a3n   l31 l32 1 ... 0  0 0 u33 ... u 3n 
    
 : : : ... :   : : : ... :  : : : ... : 
an 1 an 2 an 3 ... ann  ln 1 ln 2 ln 3 ... 1  0 0 0 0 u nn 

a 11 a 12 a 13 ... a 1n 
a a 22 a 23 ... a 2n 
 21 
a 31 a 32 a 33 ... a 3n 
 
 : : : ... : 
a n 1 an2 a n 3 ... a nn 
 u 11 u 12 u 13 ... u 1n 
l u l 21u 12  u 22 l 21u 13  u 23 ... l21u 1n  u 2n 
 21 11 
 l31u 11 l31u 12  l32u 22 l31u 13  l32u 23  u 33 ... l31u 1n  l32u 2n  u 3n 
 
 : : : ... : 
l n 1u 11 l n 1u 12  ln 2u 22 ln 1u 13  ln 2u 23  ln 3u 33 ... ln 1u 1n  l n 2u 2n  ln 3u 3n  ...  u nn 

The Doolittle’s decomposition approach generates the elements of L and U by sweeping


through the matrix by rows and columns. Obviously, the first elements that can be solved
are the elements of the 1st row of matrix U which are equal to the elements of the 1st row
of matrix A:

a 11 a 12 a 13 ... a 1n 
a a 22 a 23 ... a 2n 
 21 
a 31 a 32 a 33 ... a 3n 
 
 : : : ... : 
a n 1 an2 a n 3 ... a nn 
 u 11 u 12 u 13 ... u 1n 
l u l 21u 12  u 22 l 21u 13  u 23 ... l21u 1n  u 2n 
 21 11 
 l31u 11 l31u 12  l32u 22 l31u 13  l32u 23  u 33 ... l31u 1n  l32u 2n  u 3n 
 
 : : : ... : 
l n 1u 11 l n 1u 12  ln 2u 22 ln 1u 13  ln 2u 23  ln 3u 33 ... ln 1u 1n  l n 2u 2n  ln 3u 3n  ...  u nn 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

19
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Then using u 11 , we solve the elements of the 1st column of matrix L as follows:

a 21
l21 
u 11
a
l31  31
u 11

a
ln 1  n1
u 11

After which, we solve for the elements of the 2nd row of U, then the elements of the 2nd
column of L, and so on.

a 11 a 12 a 13 ... a 1n 
a a 22 a 23 ... a 2n 
 21 
a 31 a 32 a 33 ... a 3n 
 
 : : : ... : 
a n 1 an2 a n 3 ... a nn 
 u 11 u 12 u 13 ... u 1n 
l u l 21u 12  u 22 l 21u 13  u 23 ... l21u 1n  u 2n 
 21 11 
 l31u 11 l31u 12  l32u 22 l31u 13  l32u 23  u 33 ... l31u 1n  l32u 2n  u 3n 
 
 : : : ... : 
l n 1u 11 l n 1u 12  ln 2u 22 ln 1u 13  ln 2u 23  ln 3u 33 ... ln 1u 1n  l n 2u 2n  ln 3u 3n  ...  u nn 

The evaluations involved in Doolittle’s LU decomposition can be implemented by the


following concise series of formula.

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

20
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

u 1j  a1j for j  1, 2, 3,  , n
ai 1
li1  for i  2, 3,  , n
u 11

For i  2, 3,  , n
i 1
u ij  aij  l
k 1
ik u kj for j  i, i  1,  , n

i 1
aji  l jk u ki
lji  k 1
for j  i  1, i  2,  , n
u ii

EXAMPLE 1.1.1

1 4 1 
 
Use Doolittle’s decomposition method to find L and U of A  1 6  1 .
2  1 2 

Solution

U L

First Row First Column

u 11  a11  1 a 21 1
l21    1
u 12  a12  4 u 11 1
u 13  a13  1 a 2
l31  31   2
u 11 1

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

21
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Second Row Second Column

u 22  a 22  l21u 12 a32  l31u 12


l32 
 6  14  2 u 22
u 23  a 23  l21u 13  1  24

 1  11  2 2
 4.5

Third Row

u 33  a33  l31u 13  l32u 23


 2  21    4.5  2
 9

1 0 0 1 4 1 
   
 L  1 1 0 U  0 2  2
2  4.5 1 0 0  9

EXAMPLE 1.1.2

Find the roots of the following set of equations using Doolittle’s method.

x1  x2  x3  5
x 1  2x 2  2x 3  6
x 1  2x 2  3x 3  8

Solution

Step 1: Write the system into the form Ax  b .

1 1 1  x 1  5
    
1 2 2  x 2   6
1 2 3  x 3  8

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

22
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Step 2: Decompose A into L and U .

1 1 1
 
A  LU  1 2 2
1 2 3

U L

First Row First Column

u 11  a11  1 a 21 1
l21    1
u 12  a12  1 u 11 1
u 13  a13  1 a 1
l31  31   1
u 11 1

Second Row Second Column

u 22  a 22  l21u 12 a32  l31u 12


l32 
 2  11  1 u 22
u 23  a 23  l21u 13 2  11
  1
 2  11  1 1

Third Row

u 33  a33  l31u 13  l32u 23


 3  11  11
 1

1 0 0 1 1 1
   
 L  1 1 0 U  0 1 1
1 1 1 0 0 1

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

23
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Step 3: Solve for y from Ly  b .

1 0 0  y 1  5
    
1 1 0  y 2   6
1 1 1  y 3  8

 y1  5
   
 y1  y2   6
 y 1  y 2  y 3  8
y 1  5
   
 y 2   1
 y 3  2
5
 
y  1
2

Step 4: Finally, solve for x from Ux  y .

1 1 1  x 1  5
    
0 1 1  x 2   1
0 0 1  x 3  2
x 1  x 2  x 3  5
   
 x2  x3   1
 x3  2
x1   4 
   
 x 2     1
 x 3   2 
 4 
 
x    1
 2 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

24
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

EXAMPLE 1.1.3

Find the roots of the following set of equations using Doolittles’s Decomposition Method.

x1  x 2  x3  x4  1
2x 1 x 2  3x 3  x 4  2
x 1  x 2  2x 3  2x 4  3
x1  x 2  x3  x4  3

Solution

1  1 1  1  x 1  1
2  1 3 1   x  2
  2    
1 1 2 2   x 3  3
    
1 1 1 1   x 4  3

1  1 1  1
2  1 3 1 
A  LU   
1 1 2 2 
 
1 1 1 1 

U L

First Row First Column

u 11  a11  1 a 21 2
l21    2
u 12  a12  1 u 11 1
u 13  a13  1 a 1
l31  31   1
u 14  a14  1 u 11 1
a 1
l41  41   1
u 11 1

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

25
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

U L

Second Row Second Column

u 22  a 22  l21u 12 a32  l31u 12


l32 
 1  2  1  1 u 22
u 23  a 23  l21u 13 1  1  1
  2
 3  21  1 1
u 24  a 24  l21u 14 a  l41u 12
l42  42
u 22
 1  2  1  3
1  1  1
  2
1
Third Row Third Column

u 33  a33  l31u 13  l32u 23 a43  l41u 13  l42u 23


l43 
 2  11  21 u 33
 1 1  11  21
  2
u 34  a34  l31u 14  l32u 24  1
 2  1  1  23
 3

Fourth Row

u 44  a44  l41u 14  l42u 24  l43u 34


 1  1  1  23  2  3
 2

1 0 0 0 1  1 1  1
2 1 0 0 0 1 1 3 
 L    U   
1 2 1 0 0 0  1  3
   
1 2 2 1 0 0 0 2 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

26
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Ly  b
1 0 0 0  y 1  1
2 1 0 0  y 2  2
     
1 2 1 0  y 3  3
    
1 2 2 1  y 4  3
 y1  1
 2y 1  y 2  2
    
 y 1  2y 2  y 3  3
   
 y 1  2y 2  2y 3  y 4  3
y 1   1 
y   0 
 2   
y 3   2 
   
y 4    2
 1 
 0 
y   
 2 
 
  2

Ux  y
1  1 1  1  x 1   1 
0 1 1 
3 x2    0 
     
0 0  1  3  x 3   2 
    
0 0 0 2 x4    2
x 1  x 2  x 3  x 4   1 
 x  x  3x   0 
 2 3 4
   
  x 3  3x 4   2 
   
 2x 4    2

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

27
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

x 1  x 2  x 3  x 4   1 
 x  x  3x   0 
 2 3 4
   
  x 3  3x 4   2 
   
 2x 4    2
x 1   1 
x   2 
 2   
x 3   1 
   
x 4    1
 1 
 2 
x   
 1 
 
  1

EXAMPLE 1.1.4

Solve the following mesh current equations using Doolittle’s Method.

6I a  3I b  5
 3I a  12I b  5I c  5
 5I b  18I c  10

Solution

 6  3 0  I a   5
    
  3 12  5 I b     5 
 0  5 18  I c    10

 6  3 0 
 
A  LU    3 12  5
 0  5 18 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

28
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

U L

First Row First Column

u 11  a11  6 a 21  3
l21    0.5
u 12  a12  3 u 11 6
u 13  a13  0 a 0
l31  31   0
u 11 6

Second Row Second Column

u 22  a 22  l21u 12 a32  l31u 12


l32 
 12    0.5  3  10.5 u 22
u 23  a 23  l21u 13  5  0  3 10
  
 5    0.50  5 10.5 21

Third Row

u 33  a33  l31u 13  l32u 23


 10 
 18  00      5
 21 
328

21

 1 0 0 6  3 0 
   
 L    0.5 1 0 U  0 10.5  5 
 0  10 21 1 0 0 328 
  21

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

29
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Ly  b
 1 0 0  y 1   5
    
  0.5 1 0  y 2     5 
 0  10 21 1  y 3    10

 
 y1   5
  0.5y  y     5 
 10 1 2
  
 y2  y3  
  10
 21 
y 1    5 
   
y   y 2     7.5
 y 3    95 
 7

UI  y
6  3 0  I a    5 
    
0 10.5  5  I b     7.5
0 0 328  I    95 
 21  c   7
 
 6I a  3I b    5 
10.5I  5I     7.5
 b c
  
328  95 
 Ic   7
 21 
I a    1375    1.397
 984
   
I  I b     185 164     1.128 Amp.
I c    285    0.869
 328 

LU Factorization by Crout’s Method

Crout’s decomposition method involves a U matrix with 1’s on the diagonal. The following
describes the algorithm for Crout’s Method:

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

30
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

A  LU
a11 a12 a13 ... a1n  l11 0 0 ... 0  1 u12 u13 ... u1n 
a a22 a23 ... a2n  l l 0 ... 0  0 1 u23 ... u2n 
 21   21 22
 
a31 a32 a33 ... a3n   l31 l32 l33 ... 0  0 0 1 ... u3n 
    
 : : : ... :  : : : ... :  : : : ... : 
an 1 an 2 an 3 ... ann  ln 1 ln 2 ln 3 ... lnn  0 0 0 0 1 

a11 a12 a13 ... a1n  l11 l11u12 l11u13 ... l1nu1n 
a a23 ... a2n  l  
a22 l u l l21 13  l22u 23
u ... l21u1n  l22u2n
 21   21 21 12 22

a31 a32 a33 ... a3n   l31 l31u12  l32 l31u13  l32u23  l33 ... l31u1n  l32u2n  l33u3n 
   
 : : : ... :  : : : ... : 
an 1 an 2 
an 3 ... ann  
ln 1 ln 1u12  ln 2 ln 1u13  ln 2u23  ln 3 ... ln 1u1n  ln 2u2n  ln 3u3n  ...  lnn 

The Crout’s decomposition approach solves the elements of L and U by sweeping


through the matrix by columns and rows as depicted in the figure below.

Figure 1.1. A schematic depicting the evaluations involved in Crout’s method

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

31
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

For a general n x n matrix, the elements of the L and U matrices can be found by:

li1  ai1 for i  1, 2, 3,..., n


a1j
u 1j  for j  2, 3, 4,  , n
l11

For j  2, 3, 4,  , n
j1
lij  aij  l
k 1
ik u kj for i  j, j  1,  , n
j1
a ji  l
k 1
jk u ki
u ji  for i  j  1, j  2,  , n
ljj

EXAMPLE 1.1.5

Solve Example 1.3 using Crout’s method.

x1  x 2  x3  x4  1
2x 1 x 2  3x 3  x 4  2
x 1  x 2  2x 3  2x 4  3
x1  x 2  x3  x4  3

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

32
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Solution

1  1 1  1  x 1  1
2  1 3 1   x  2
  2    
1 1 2 2   x 3  3
    
1 1 1 1   x 4  3

1  1 1  1
2  1 3 1 
A  LU   
1 1 2 2 
 
1 1 1 1 

L U

First Column First Row

l11  a11  1 a12  1


u 12    1
l21  a 21  2 l11 1
l31  a31  1 a 1
u 13  13   1
l41  a41  1 l11 1
a  1
u 14  14   1
l11 1

Second Column Second Row

l22  a 22  l21u 12 a 23  l21u 13 3  21


u 23  
 1  2  1  1 l22 1
l32  a32  l31u 12  1
 1  1  1  2 a 24  l21u 14 1  2  1
u 24  
l42  a42  l41u 12 l22 1
 1  1  1  2  3

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

33
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

L U

Third Column Third Row

l33  a33  l31u 13  l32u 23 a34  l31u 14  l32u 24


u 34 
 2  11  21 l33
 1 2  1  1  23

l43  a43  l41u 13  l42u 23  1
 1  11  21  3
 2

4th Column

l44  a44  l41u 14  l42u 24  l43u 34


 1  1  1  23    23
 2

1 0 0
0 1  1 1  1
2 1 0 0 0 1 1 3 
 L    U   
1 2  1 0 0 0 1 3 
   
1 2  2 2 0 0 0 1 

Ly  b
1 0 0  y 1 
0 1
2 1 0 0  y 2  2
     
1 2  1 0  y 3  3
    
1 2  2 2  y 4  3

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

34
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Ly  b
 y1  1
 2y 1  y 2  2
    
 y 1  2y 2  y 3  3
   
 y 1  2y 2  2y 3  2y 4  3
y 1   1 
y   0 
y   2
   
y 3    2
   
y 4    1

Ux  y
1  1 1  1  x 1   1 
0 1 1 3   x   0 
  2    
0 0 1 3   x 3    2
    
0 0 0 1   x 4    1
x 1  x 2  x 3  x 4   1 
 x  x  3x   0 
 2 3 4
   
 x 3  3x 4    2
   
 x4    1
x1   1 
x   2 
x   2
   
x 3   1 
   
x4    1

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

35
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

EXAMPLE 1.1.6

Use Crout’s method to find the solution to the given system of equations.

2x 1  x 2  2x 3  4x 4  6x 5  19
 3x 1  x 2  2x 3  2x 4  2x 5  6
2x 1  2x 2  x 3  x 4  x 5  10
 5x 1  x 2  x 3  2x 4  2x 5  6
2x 1  x 2  x 3  3x 4  4x 5  16

Solution

 2 1  2  6  x 1 
4   19
 3 1 2  2 2  x 2   6 
    
 2 2  1 1 1   x 3    10 
    
 5 1 1 2  2  x 4   6
 2 1 1  3 4   x 5   16 

 2 1  2  64
 3 1 2  2 2 
 
A  LU   2 2  1 1 1 
 
 5 1 1 2  2
 2 1 1  3 4 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

36
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

L U

First Column First Row

l11  a11  2 a12 1


u 12    0.5
l21  a 21  3 l11 2
l31  a31  2 a  2
u 13  13   1
l41  a41  5 l11 2
l51  a51  2 a 4
u 14  14   2
l11 2
a  6
u 15  15   3
l11 2

Second Column Second Row

l22  a 22  l21u 12 a 23  l21u 13 2    3  1


u 23  
 1    30.5  2.5 l22 2.5
l32  a32  l31u 12  0.4
 2  20.5  1 a 24  l21u 14  2    32
u 24  
l42  a42  l41u 12 l22 2.5
 1    50.5  3.5  1.6
l52  a52  l51u 12 a 25  l21u 15 2    3  3
u 25  
 1  20.5  0 l22 2.5
 2.8

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

37
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

L U

Third Column Third Row

l33  a33  l31u 13  l32u 23 a34  l31u 14  l32u 24


u 34 
 1  2  1  1  0.4 l33
 1.4 1  22  11.6

l43  a43  l41u 13  l42u 23 1.4
 1    5  1  3.5  0.4   23
7
 2.6 a35  l31u 15  l32u 25
u 35 
l53  a53  l51u 13  l52u 23 l33
 1  2  1  0  0.4 1  2  3  1  2.8

 3 1.4
 7

Fourth Column Fourth Row

l44  a44  l41u 14  l42u 24  l43u 34 a  l41u 15  l42u 25  l43u 35


u 45  45
 23  l44
 2    52  3.51.6    2.6  
 7   2    5  3  3.5  2.8
  15 7 - - 2.67

l54  a54  l51u 14  l52u 24  l53u 34  157


 23 
3  22  01.6  3    7715

 7 
 20
7

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

38
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Fifth Column

l55  a55  l51u 15  l52u 25  l53u 35  l54u 45


 4  2  3  0  2.8  37
 20  77 
-    
 7  15 
 11 3

 2 0 0 0 0  1 0.5  1 2  3 
  3 2.5 0 0 0  0 1  0.4 1.6  2.8 
   
 L   2 1 1.4 0 0  U  0 0 1  23 7 7 
 15   
  5 3.5  2.6  7 0  0 0 0 1  7715
 2 0 3 20 11  0 0 0 0 1 
 7 3

Ly  b
 2 0 0 0 0 y 1    19
  3 2.5 0 0 0     6 
  y 2   
 2 1 1.4 0 0   y 3    10 
 15    
  5 3.5  2.6  7 0 y 4   6
 2 0 3 20 11   y   16 
 7 3  5 
y 1    9.5
y    9 
 2  
 190
y   y 3   7
   68 
y 4   3
 y 5   5 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

39
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Ux  y
1 0.5  1 2  3 x1    9.5
0 1  0.4 1.6  
 2.8 x 2    9 
    
0 0 1  23 7 7   x 3    190 7 
    68 
0 0 0 1  7715  x 4   3
0 0 0 0  
1  x 5   
 5 
x 1  1
x  1
 2  
x   x 3   2
   
x 4  3
 x 5  5

LU Factorization by Cholesky’s Method

Unlike the Doolittle’s and Crout’s Method, Cholesky’s method does not have any
condition for the main diagonal entries. However, the coefficient matrix, A, must be a
symmetric, positive definite matrix.

A matrix is positive definite if:


a) It is symmetric and all its eigenvalues are positive.
b) It is symmetric and all its pivots are positive
c) It is symmetric and all upper left k x k determinants are positive

For a symmetric, positive definite matrix, A,

L  U T or U  LT
Hence,

A  LLT or A  U T U

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

40
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Explicitly, the algorithm for Cholesky’s Method can be described as follows:

For a general n x n matrix, the elements of the L can be found by:

l11  a11
ai 1
li1  for j  1 and i  2,3,  , n
l11

For j  2, 3,  , n
j1
ljj  ajj  l
k 1
2
jk

j1
aij  l ik ljk
lij  k 1
for i  j  1, j  2,  , n
ljj

Cholesky’s decomposition A  LLT has two limitations (Kiusalaas, 2010):

a) Since the matrix product LLT is always symmetric, Cholesky’s decomposition can
be applied only to symmetric matrices.

b) The decomposition process involves taking square roots of certain combinations


of the elements of A. It can be shown that square roots of negative numbers can
be avoided only if A is positive definite.

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

41
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

EXAMPLE 1.1.7

Find the roots of the following set of equations using Cholesky’s method.

4x 1  10x 2  8x 3  44
10x 1  26x 2  26x 3  128
8x 1  26x 2  61x 3  214

Solution

Before we apply Cholesky’s method, it is a good practice to examine the coefficient


matrix A whether it is symmetric and positive definite.

 4 10 8 
 
A  10 26 26
 8 26 61

By inspection, we could already say that A is symmetric. But, is it positive definite? From
(c), matrix A is positive definite if it is symmetric and all upper left k x k determinants are
positive.

1 1: 4  4
4 10
2 2:  426  1010  4
10 26
4 10 8
3  3 : 10 26 26  42661  10268  82610
8 26 61
- 42626  101061  8268
 36

As shown above, all determinants are positive, therefore, A is positive definite.

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

42
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

 4 10 8 
 
A  LLT  10 26 26
 8 26 61
l11  4  2
a 21 10
l21    5
l11 2
a 8
l31  31   4
l11 2
l22  a 22  l21 2  26  5 2  1
a32  l31l21 26  45
l32    6
l22 1
l33  a33  l31 2  l32 2  61  42  62  3

2 0 0 2 5 4
   
 L  5 1 0 U  L T
 0 1 6
4 6 3 0 0 3

Ly  b
2 0 0  y 1   44 
    
5 1 0  y 2   128
4 6 3  y 3  214
y 1  22
   
y   y 2   18
 y 3   6 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

43
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Ux  y
2 5 4  x 1  22
    
0 1 6  x 2   18
0 0 3  x 3   6 
x 1   8
   
x  x 2    6 
 x 3   2 

EXAMPLE 1.1.8

Solve the following system of equations by Cholesky’s factorization.

3x 1  2x 2  18x 3  10x 4  45
3x 1  10x 2  2x 3  2x 4  17
9x 1  3x 2  3x 3  3x 4  24
3x 1  2x 2  10x 3  10x 4  29

Solution

3  2 18 10   x 1  45
3 10  2  2  x  17
  2    
9 3 3 3  x 3  24
    
3  2 10 10   x 4  29

Notice that the coefficient matrix is not symmetric. However, if we can re-arrange the
equations to come up with a symmetric matrix, then Cholesky’s method can be used to
find the solution. For instance, we can interchange equations (1) and (3). By rewriting the
system of equations, we should get:

9x 1  3x 2  3x 3  3x 4  24
3x 1  10x 2  2x 3  2x 4  17
3x 1  2x 2  18x 3  10x 4  45
3x 1  2x 2  10x 3  10x 4  29

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

44
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

9 3 3 3  x1  24
3 10  2  2  x  17
  2    
3  2 18 10   x 3  45
    
3  2 10 10   x 4  29

After re-arranging the equations, the resulting coefficient matrix is now symmetric. We
can skip the test for the positive definiteness of the matrix. If one of the diagonal entries
(i.e., ljj) is not a real number, it is an indication that the coefficient matrix is not positive
definite.

9 3 3 3 
3 10  2  2
A  LLT   
3  2 18 10 
 
3  2 10 10 
l11  a11  3
a 21
l21   1
l11
a
l31  31  1
l11
a
l41  41  1
l11
l22  a 22  l21 2  3
a32  l31l21
l32   1
l22
a  l41l21
l42  42  1
l22
l33  a33  l31 2  l32 2  4
a43  l41l31  l42l32
l43   2
l33
l44  a44  l41 2  l42 2  l43 2  2

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

45
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

3 0 0 0 3 1 1 
1
1 3 0 0 0 3  1  1
 L    U  LT   
1  1 4 0 0 0 4 2 
   
1  1 2 2 0 0 0 2 

Ly  b
3 0 0 0  y 1  24
1 3  
0 0 y2  17
     
1  1 4 0  y 3  45
    
1  1 2 2  y 4  29
y 1  8
y  3
y      
2

y 3  10
   
y 4  2

Ux  y
3 1 1 x1 
1 8
0 
3  1  1 x2  3
     
0 0 4 2  x 3  10
    
0 0 0 2 x4  2
x1  1
x  2
x      
2

x 3  2
   
x4  1

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

46
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

EXAMPLE 1.1.9

Solve the following mesh current equations using Cholesky’s Method.

6I a  3I b  5
 3I a  12I b  5I c  5
 5I b  18I c  10

Solution

 6  3 0  I a   5
    
  3 12  5 I b     5 
 0  5 18  I c    10

 6  3 0 
 
A  LL    3 12  5
T

 0  5 18 
l11  a11  6
a 21  3 6
l21    
l11 6 2
a
l31  31  0
l11
42
l22  a 22  l21 2 
2
a32  l31l21 5 42
l32   
l22 21
l33  a33  l31 2  l32 2  3.95209408

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

47
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

   6  6 0
6 0 0  2 
 
 L   6 2 42 0  U  0 42  5 42 
 2   2 21 
 0  5 42 21 3.95209408 0 0 3.95209408
 

Ly  b
 6 0 0  y   5
  1 
 6 42 0   y 2     5 
 2 2 
 0  5 42 21 3.95209408  y 3    10

y 1    2.041241452
   
y   y 2     2.314550249
 y 3    3.433984186

UI  y
 6  6  0
 2  I a    2.041241452
0    
42  5 42 21  I b     2.314550249
 2 
0 0 3.95209408 I c    3.433984186
 
I a    1.397
   
I  I b     1.128 Amp.
I c    0.869

Iterative Methods

In certain cases, such as when a system of equations is large or the coefficient matrix is
sparse (has many zeros), iterative methods are more advantageous and are preferred
over the direct methods. They may be more economical in memory requirements of a
computer. For hand computation, they have the distinct advantage that they are self-
correcting if an error is made. They may sometimes be used to reduce round-off error in

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

48
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations
the solutions computed by direct methods. They can also be applied to sets of nonlinear
equations.

Iterative methods start with an initial guess of the solution x and then repeatedly improve
solution until the change in x becomes negligible. Since the required number of iterations
can be very large, the iterative methods are, in general, slower than their direct
counterparts. Another serious drawback of iterative methods is that they do not always
converge to the solution. In fact, it can be shown that convergence is guaranteed only
if the coefficient matrix is diagonally dominant. (Kiusalaas, 2010)

According to Gerald & Wheatley (2004), a system is said to be diagonally dominant when
the system of equations can be ordered so that each diagonal entry of the coefficient
matrix is larger in magnitude than the sum of the magnitudes of the other coefficients in
that row. Formally, an n x n matrix A is diagonally dominant if and only if for each
i  1, 2,  , n ,
n
aii  
j1
aij
ji

This is a sufficient condition for convergence. Although this may seem like a very restrictive
condition, it turns out that there are many applied problems that have this property
(electrical circuits, steady-state and transient heat transfer, etc.). The two iterative
methods for solving Ax  b are the Jacobi method and the Gauss-Seidel method.

Jacobi Method

The Jacobi method is also called “the method of simultaneous displacements” because
each of the equations is simultaneously changed by using the most recent set of x-values.
We assume that the system Ax  b has been re-arranged so that the matrix A is
diagonally dominant. The iterative method depends on the re-arrangement of the
equations in this manner:

n
bi  a
j1
ij xj
ji
xi  for i  1,2,3,  , n
aii

We start with some initial approximation to the value of variables (each component
might be taken equal to zero if no better initial estimates are at hand). New estimates
are generated using the following formula:

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

49
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

n
bi  a
j1
ij x j  k  1
ji
x i k   for i  1,2,3,  , n
aii

Where:
x k  = new estimate for the variable
k  1 = previous estimate for the variable
x

Then, the new values are used to generate a second approximation, and the process is
repeated until successive values of each of the variables are sufficiently alike or a
preferred accuracy is satisfied.

EXAMPLE 1.1.10

Apply Jacobi iterative method to find the solution to the given set of equations.

6x 1  2x 2  x 3  11
x 1  2x 2  5x 3  1
 2x 1  7x 2  2x 3  5

Solution

Before we begin our iterative scheme, we can first test if the coefficient matrix of the
system is diagonally dominant.
i  1: 6   2  1
6  3 ok
i  2: 2  1   5
2  6 failed
i  3 : 2   2  7
2  9 failed

As shown above, the given system in its given arrangement is not diagonally dominant.
However, we can reorder the equations so that the coefficient matrix becomes
diagonally dominant. The new arrangement is:

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

50
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

6x 1  2x 2  x 3  11
 2x 1  7x 2  2x 3  5
x 1  2x 2  5x 3  1

We write the following equations for generating new estimates for the unknown variables.

k  11  2x 2k  1  x 3k  1
x1 
6
k  1
5  2x 1  2x 3k  1
x 2k  
7
k  1
 1  x1  2x 2k  1
x 3k  
 5

k  0 : x 1 0  x 20  x 30  0

k  1:
11  2x 20  x 30
x 11   1.83333
6
5  2x 10  2x 30
x 21   0.71429
7
 1  x 10  2x 20
x 31   0.2
 5

k  2:
 2 11  2x 21  x 31
x1   2.0381
6
5  2x 11  2x 31
x 2 2   1.18094
7
 1  x 11  2x 21
x 3 2   0.852376
 5

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

51
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

k x1 x2 x3
0 0 0 0
1 1.83333 0.71429 0.2
2 2.0381 1.18094 0.852376
3 2.08492 1.05306 1.08
4 2.00435 1.00141 1.03821
5 1.9941 0.99033 1.00143
6 1.99654 0.99791 0.99495
7 2.00015 1.00045 0.99847
8 2.00041 1.00048 1.00021
9 2.00013 1.00006 1.00027
10 1.99998 0.99996 1.00005
11 1.99998 0.99998 0.99998
12 2 1 0.99999
13 2 1 1

The solution converges after 13 iterations. The final solution is

x1  2
   
x   x 2   1
 x 3  1

EXAMPLE 1.1.11

Solve the following equations with Jacobi method.

 12  2 3 1 x1  0
  2 15 6 
3 x2  0
     
 1 6 20  4  x 3  20
    
 0  3 2 9 x4  0

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

52
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Solution

k  2x 2 k  1  3x 3k  1  x 4k  1
x1 
12
k  1
2x 1  6x 3k  1  3x 4k  1
x 2k  
15
k  1
20  x 1  6x 2k  1  4x 4k  1
x 3k  
20
k  1 k  1
3x 2  2x 3
x 4k  
9

k x1 x2 x3 x4
0 0 0 0 0
1 0 0 1 0
2 -0.25 -0.4 1 -0.22222
3 -0.29815 -0.38889 1.08806 -0.35556
4 -0.3072 -0.40387 1.06046 -0.37142
5 -0.30148 -0.39086 1.06224 -0.37028
6 -0.29985 -0.39104 1.05828 -0.36634
7 -0.29922 -0.39002 1.05904 -0.36552
8 -0.2993 -0.39041 1.05886 -0.36535
9 -0.29934 -0.39038 1.05902 -0.36544
10 -0.29937 -0.39043 1.05899 -0.36546
11 -0.29936 -0.39042 1.05901 -0.36547
12 -0.29937 -0.39042 1.059 -0.36548
13 -0.29936 -0.39042 1.059 -0.36547
14 -0.29936 -0.39042 1.059 -0.36547
15 -0.29936 -0.39042 1.059 -0.36547
16 -0.29936 -0.39042 1.059 -0.36547

After 16 iterations, the final solution converges to

 0.29936
 0.39042
x   
 1.059 
 
 0.36547

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

53
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

EXAMPLE 1.1.12

Apply Jacobi iterative method to find the solution to the following mesh-current
equations of a certain electrical network.

 15  j15I a  10  j10I b  120


10  j10I a  50  j50I b  25  j25I c  0
25  j25I b  45  j45I c  80  j60

Solution

k   120  10  j10I b k  1


Ia 
 15  j15
k   10  j10I a k  1  25  j25I c k  1
Ib 
 50  j50
k  80  j60  25  j25I b k  1
Ic 
 45  j45

k Ia Ib Ic
0 1 1 1
1 4.6667-j4 0.7 -1+j0.2222
2 4.4667-j4 0.4333-j0.6889 -1.1667+j0.2222
3 4.2889-j4.4593 0.31-j0.6889 -1.3148-j0.1605
4 4.2067-j4.4593 0.2004-j0.9721 -1.3833-j0.1605
5 4.1336-j4.6481 0.1497-j0.9721 -1.4442-j0.3178
6 4.0998-j4.6481 0.1046-j1.0885 -1.4724-j0.3178
7 4.0697-j4.7257 0.0838-j1.0885 -1.4974-j0.3825
8 4.0559-j4.7257 0.0652-j1.1364 -1.509-j0.3825
9 4.0435-j4.7576 0.0567-j1.1364 -1.5193-j0.4091
10 4.0378-j4.7576 0.0491-j1.1561 -1.5241-j0.4091
11 4.0327-j4.7707 0.0455-j1.1561 -1.5283-j0.4201
12 4.0303-j4.7707 0.0424-j1.1642 -1.5303-j0.4201
13 4.0283-j4.7761 0.0409-j1.1642 -1.532-j0.4246
14 4.0273-j4.7761 0.0397-j1.1675 -1.5328-j0.4246
15 4.0265-j4.7783 0.0391-j1.1675 -1.5335-j0.4264
16 4.0261-j4.7783 0.0386-j1.1689 -1.5338-j0.4264
17 4.0257-j4.7793 0.0383-j1.1689 -1.5341-j0.4272

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

54
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations
18 4.0255-j4.7793 0.0381-j1.1695 -1.5343-j0.4272
19 4.0254-j4.7797 0.038-j1.1695 -1.5344-j0.4275
20 4.0253-j4.7797 0.0379-j1.1697 -1.5344-j0.4275
21 4.0253-j4.7798 0.0379-j1.1697 -1.5345-j0.4276

The process is terminated after 21 iterations since the changes in the values of the
unknown currents between the last two iterations are negligible. Therefore, the final
solution is
 4.0253  j4.7798 
 
I   0.0379  j1.1697  Amp.
  1.5345  j0.4276

Gauss-Seidel Method

In the algorithm for Jacobi iteration, the new value for an unknown variable is not used
at once to compute the new value of another unknown variable until all new values
have been found even though in nearly all cases the new value is better than the old.
This makes the rate of convergence of Jacobi method very slow.

The Gauss-Seidel method is a variant of the Jacobi method that usually improves the rate
of convergence by implementing the strategy of always using the latest available value
of a particular variable. In this method, the first step is to rearrange the set of equations
by solving each equation for one of the variables in terms of the others, exactly as it is
done in the Jacobi method. One then proceeds to improve each x-value in turn, using
always the most recent approximations to the values of other variables. The algorithm for
Gauss-Seidel is as follows:

0 
Beginning with an initial approximation to the solution vector, x , compute each
 
component of x k by

For i  1, 2,  , n
i-1 n
bi   a ij x j k   a ij x j k  1
x i k  
j1 ji1
for k  1, 2, 
a ii

The iteration process will be terminated when successive values of each of the variables
are sufficiently alike or a preferred accuracy is satisfied.

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

55
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Convergence in the Gauss-Seidel method can be further accelerated using the


overrelaxation technique (Gerald & Wheatley, 2004) . The iteration equations when using
this technique take this form, where w is the overrelaxation factor:

For i  1, 2,  , n
w  i-1 n

x i  k   x i  k  1 
a ii
 bi 
  a ij x j k   a ij x j k  1  for k  1, 2, 
 j1 ji 

To avoid divergence, the optimal overrelaxation factor lies between 1 and 2.

EXAMPLE 1.1.13

Apply Gauss-Seidel iterative method to find the solution to the given set of equations.
Compare the number of iterations with that of the Jacobi method.

6x 1  2x 2  x 3  11
 2x 1  7x 2  2x 3  5
x 1  2x 2  5x 3  1

Solution

k  11  2x 2 k  1  x 3 k  1
x1 
6
k 
5  2x 1  2x 3 k  1
x 2 k  
7
k 
 1  x1  2x 2 k 
x 3 k  
 5

k  0:
x 1 0   x 2 0   x 3 0   0

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

56
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

k  1:
1 11  2x 2 0  x 3 0
x1   1.83333
6
5  2x 1 1  2x 3 0
x 2 1   1.2381
7
 1  x 1 1  2x 2 1
x 3 1   1.06190
 5

k  2:
11  2x 2 1  x 3 1
x 1  2   2.06905
6
5  2x 1  2  2x 3 1
x 2  2   1.00204
7
 1  x 1  2  2x 2  2
x 3  2   1.01463
 5

k  3 :
11  2x 2  2  x 3  2
x 1 3    1.99824
6
5  2x 1 3   2x 3  2
x 2 3    0.99532
7
 1  x 1 3   2x 2 3 
x 3 3    0.99778
 5

k x1 x2 x3
0 0 0 0
1 1.83333 1.23809 1.0619
2 2.06905 1.00204 1.01463
3 1.99824 0.99532 0.99778
4 1.99881 1.00029 0.99988
5 2.00012 1.00007 1.00005
6 2.00002 0.99999 1
7 2 1 1
8 2 1 1

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

57
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

With the same initial values, the Gauss-Seidel method gives the solution after 8 iterations
compared with 13 iterations by the Jacobi method.

EXAMPLE 1.1.14

Solve the following equations with Gauss-Seidel method.

 12  2 3 1 x1  0
  2 15 6 
3 x2  0
     
 1 6 20  4  x 3  20
    
 0  3 2 9 x4  0

Solution

k  2x 2 k  1  3x 3k  1  x 4k  1
x1 
12
k  k  1
2x 1  6x 3  3x 4k  1
x 2k  
15
k 
20  x 1  6x 2k   4x 4k  1
x 3k  
20
k  k 
3x 2  2x 3
x 4k  
9

k x1 x2 x3 x4
0 0 0 0 0
1 0 0 1 -0.22222
2 -0.23148 -0.38642 1.08306 -0.36949
3 -0.30438 -0.39991 1.06129 -0.36915
4 -0.30121 -0.39085 1.05849 -0.3655
5 -0.29931 -0.3902 1.05893 -0.36538
6 -0.29932 -0.39041 1.05901 -0.36547
7 -0.29937 -0.39043 1.059 -0.36548
8 -0.29937 -0.39042 1.059 -0.36547
9 -0.29936 -0.39042 1.059 -0.36547
10 -0.29936 -0.39042 1.059 -0.36547

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

58
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

After 10 iterations, the Gauss-Seidel iteration converges to this final solution (Jacobi
method had 16 iterations.):

 0.29936
 0.39042
x   
 1.059 
 
 0.36547

EXAMPLE 1.1.15

Apply Gauss-Seidel iterative method to find the solution to the following mesh-current
equations of a certain electrical network.

 15  j15I a  10  j10I b  120


10  j10I a  50  j50I b  25  j25I c  0
25  j25I b  45  j45I c  80  j60

Solution

k   120  10  j10I b k  1


Ia 
 15  j15
k   10  j10I a k   25  j25I c k  1
Ib 
 50  j50
k  80  j60  25  j25I b k 
Ic 
 45  j45

k Ia Ib Ic
0 1 1 1
1 4.6667-j4 1.4333-j0.8 -0.7593-j0.2222
2 4.9555-j4.5333 0.6115-j1.0178 -1.2158-j0.3432
3 4.4077-j4.6785 0.2736-j1.1073 -1.4036-j0.3929
4 4.1824-j4.7382 0.1347-j1.1441 -1.4807-j0.4134
5 4.0898-j4.7627 0.0776-j1.1592 -1.5124-j0.4218
6 4.0517-j4.7728 0.0541-j1.1655 -1.5255-j0.4253
7 4.0361-j4.777 0.0445-j1.1681 -1.5308-j0.4267

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

59
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations
8 4.0297-j4.7787 0.0405-j1.1691 -1.5331-j0.4273
9 4.027-j4.7794 0.0389-j1.1695 -1.5339-j0.4275
10 4.0259-j4.7797 0.0382-j1.1697 -1.5343-j0.4276
11 4.0255-j4.7798 0.038-j1.1698 -1.5344-j0.4277
12 4.0253-j4.7799 0.0379-j1.1698 -1.5345-j0.4277
13 4.0253-j4.7799 0.0378-j1.1698 -1.5346-j0.4277
14 4.0252-j4.7799 0.0377-j1.1698 -1.5346-j0.4277
15 4.0251-j4.7799 0.0377-j1.1698 -1.5346-j0.4277
16 4.0251-j4.7799 0.0377-j1.1698 -1.5346-j0.4277

After 16 iterations, the final solution is:

 4.0251  j4.7799 
 
I   0.0377  j1.1698  Amp.
  1.5346  j0.4277

EXAMPLE 1.1.16

Find the roots of the system of linear equations using Gauss-Seidel Method, accurate to
four decimal digits. Start with x1 = x2 = x3 = x4 = x5 = 1.0.

4x 1  x 2  x 3  x 5  3.6
5x 2  2x 3  x 4  x 5  2.4
x 1  x 2  6x 3  x 4  x 5  9.4
 x 1  x 2  4x 4  x 5  10.2
x 1  x 2  x 3  x 4  5x 5  10.6

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

60
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

Solution

 3.6  x 2k  1  x 3k  1  x 5k  1


x 1k  
4
 k  1
 2.4  2x 3  x 4k  1  x 5k  1
x 2k  
5
k 
 9.4  x 1  x 2k   x 4k  1  x 5k  1
x 3k  
 6
k  k 
10.2  x 1  x 2  x 5k  1
x 4k  
4
k 
10.6  x 1  x 2k   x 3k   x 4k 
x 5k  
5

k x1 x2 x3 x4 x5
0 1 1 1 1 1
1 -1.65 -1.28 1.41167 1.5675 2.1102
2 -1.4605 -1.7802 1.6395 1.21228 2.1978
3 -1.4143 -1.8178 1.59633 1.19253 2.2086
4 -1.3968 -1.7988 1.60092 1.19895 2.1991
5 -1.4003 -1.8 1.59963 1.20015 2.2001
6 -1.3999 -1.7999 1.60008 1.20003 2.1999
7 -1.4 -1.8 1.59999 1.20003 2.2
8 -1.4 -1.8 1.60001 1.2 2.2
9 -1.4 -1.8 1.6 1.2 2.2
10 -1.4 -1.8 1.6 1.2 2.2

  1.4
  1.8
 
The final solution is x   1.6  .
 
 1.2 
 2.2 

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

61
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

EXERCISES 1.1

Practice your skills by working on the exercises below.

I. Find the solution to the following systems of equations using Doolittle’s method.

x 1  4x 2  3x 3  11
a. 2x 1  9x 2  8x 3  27
3x 1  16x 2  18x 3  55

1 7 6 5 x 1   35 
2 15 16 13  x   88 
b.    2
   
3 25 35 29  x 3  185
    
5 41 61 58  x 4  342

 2 21  19 17  15   x 1    39 
 6  61 70  62 54   x   157 
  2   
c.  10 91  184 155  133  x 3     467
    
 18 167  288 185  172  x 4    696
  30  281 468  267 222   x 5   934 

II. Solve the systems of equations using Crout’s factorization.

2 2 4 6  x1   18 
 2 6 8 14   x   42 
a.    2
   
 6 16 38 54   x 3  162
    
16 32 80 160  x 4  432

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

62
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

2 4 6 2  x 1  4
1  
4 5 1 x2  4
b.      
0 1 3 2  x 3  3
    
1 5 8 5  x 4  9

  3  9  12  21  x 1    60
  3  8  4  12  x    41
c.   2    
 2  5 2 13   x 3   1
    
 1 4 15 48   x 4   74 

III. Apply Cholesky’s factorization to the following systems of equations.

1 1 3 1   x 1   14 
1 5 13 3   x   86 
a.    2
   
3 13 98 16  x 3  598
    
1 3 16 4   x 4   88 

  81  18  27  36  x 1   405 
 18 29 21 28   x 2    210
b.      
  27  21  27  30  x 3   246 
    
 36 28 30 52   x 4    430

3 17  19  22  x 1    19
9 3 3 6   x2   15 
c.       
6  22 77 81   x 3   87 
    
3  19 107 77   x 4   80 

IV. Solve the following systems of equations, starting with the initial estimates of
x i 0  0 for i  1, 2,  , n , using (i) Jacobi method and (ii) Gauss-Seidel
method. Iterate until four-figure accuracy after the decimal point is achieved.

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

63
MODULE 1
Numerical Solution to Linear and Nonlinear Algebraic
Equations

 4  1 0 0  x1  15
 1 4  1 0   x  10
a.   2    
 0  1 4  1  x 3  10
    
 0 0  1 3  x4  10

5x 1  x 2  3x 3  10.9
b.  3x 1  6x 2  2x 3  8
x 1  3x 2  5x 3  4

4 1 2 0  x 1 
0  7.95 
0 5 0 
0 2 x2    8.35 
    
c. 1 1 8 0 1  x 3   13.15
    
0 0  1 4 1  x 4   5.1 
1 0 1  5 8  x 5   6.45 

QUIZ

Work on Graded Quiz No. 1.

Property of and for the exclusive use of SLU. Reproduction, storing in a retrieval system, distributing, uploading or posting online, or transmitting in any form or by any
means, electronic, mechanical, photocopying, recording, or otherwise of any part of this document, without the prior written permission of SLU, is strictly prohibited.

64

You might also like