GAUSS-SEIDEL METHOD OF SOLVING SIMULTANEOUS LINEAR EQUATIONS

AN INTERACTIVE EBOOK

 

Title

An interactive e-book for illustrating the Gauss-Seidal Method of Solving Simultaneous Linear Equations

Creator

Autar K Kaw

Subject and Keywords

LU Decomposition, Simultaneous Linear Equations, Mathcad, Maple, Mathematica, Matlab, Simulations.

Description

This is an interactive E-book for illustrating Gauss-Seidal Method of Solving Simultaneous Linear Equations.  It includes links to simulations in Mathcad, Maple, Mathematica, and Matlab for the algorithm, multiple-choice quizzes, problem set, and a PowerPoint presentation.

Publisher

Holistic Numerical Methods Institute,

College of Engineering,

University of South Florida, Tampa, FL 33620-5350.

Contributors

Autar Kaw

Format

Text/HTML

Last Revised

 Monday, December 17, 2007

Identifier

http://numericalmethods.eng.usf.edu/ebooks/gaussseidel_04sle_ebook.pdf

Language

English

Rights

http://numericalmethods.eng.usf.edu/rights.htm

 

Table of Contents

 

Why do we need another method to solve a set of simultaneous linear equations?

      Example 1

 

The above system of equations does not seem to converge?  Why?

      Example 2

      Example 3

 

PowerPoint Presentation on Gauss Seidal Method

 
Simulations

      Method [MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB]

      Convergence [MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB]

      Test your knowledge of Gauss-Seidal Method [HTML] [PDF] [DOC]

 

Why do we need another method to solve a set of simultaneous linear equations?

In certain cases, such as when a system of equations  is large, iterative methods of solving equations such as Gauss-Seidal method are more advantageous.  Elimination methods   such as Gaussian elimination are prone to round off errors for a large set of equations.  Iterative methods, such as Gauss-Seidal method, allow the user the control of the round-off error.  Also if the physics of the problem are well known for faster convergence, initial guesses needed in iterative methods can be made more judiciously.

You convinced me, so what is the algorithm for Gauss-Seidel method?  Given a general set of n equations and n unknowns, we have

          

      .                 .

      .                 .

      .                 .

If the diagonal elements are non-zero, each equation is rewritten for the corresponding unknown, that is, the first equation is rewritten with  on the left hand side and the second equation is rewritten with on the left hand side and so on as follows

     

 

 

 

These equations can be rewritten in the summation form as

            .

            .

.

 

Hence for any row i,

Now to find xi’s, one assumes an initial guess for the xi’s and then use the rewritten equations to calculate the new guesses.  Remember, one always uses the most recent guesses to calculate xi.  At the end of each iteration, one calculates the absolute relative approximate error for each xi as

           

where is the recently obtained value of xi, and is the previous value of xi.

When the absolute relative approximate error for each xi is less than the pre-specified tolerance, the iterations are stopped.

PowerPoint Presentation on Gauss Seidal Method

 
Simulations on Gauss-Seidal Method

      Method [MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB]

      Convergence [MAPLE] [MATHCAD] [MATHEMATICA] [MATLAB]

Back to TOC

Example 1

The upward velocity of a rocket is given at three different times in the following table

Time, t

Velocity, v

s

m/s

5

106.8

8

177.2

12

279.2

           

The velocity data is approximated by a polynomial as

The coefficients a1, a2, a3 for the above expression were found in Chapter 5 to be given by

 

 

Find the values of a1, a2, a3 using Gauss-Seidal Method.  Assume an initial guess of the solution as .

Solution

Rewriting the equations gives

           

           

           

Iteration #1:

Given the initial guess of the solution vector as

           

we get

           

                 = 3.6720

           

                 =

           

                  =

The absolute relative approximate error for each xi then is

           

                    = 72.76%

           

                    = 125.47%

           

                    = 103.22%

At the end of the first iteration, the guess of the solution vector is

            and the maximum absolute relative approximate error is 125.47%.

 

Iteration #2:

The estimate of the solution vector at the end of iteration #1 is

           

Now we get

           

                  = 12.056

           

                  =

           

                 =

The absolute relative approximate error for each  then is

           

                     = 69.542%

           

                    = 85.695%

           

                    = 80.54%.

At the end of second iteration the estimate of the solution is

           

and the maximum absolute relative approximate error is 85.695%.

Conducting more iterations gives the following values for the solution vector and the corresponding absolute relative approximate errors.

Iteration

a1

a2

a3

1

2

3

4

5

6

3.672

12.056

47.182

193.33

800.53

3322.6

72.767

67.542

74.448

75.595

75.850

75.907

-7.8510

-54.882

-255.51

-1093.4

-4577.2

-19049

125.47

85.695

78.521

76.632

76.112

75.971

-155.36

-798.34

-3448.9

-14440

-60072

-249580

103.22

80.540

76.852

76.116

75.962

75.931

 As seen in the above table, the solution is not converging to the true solution of

a1 = 0.29048

a2 = 19.690

a3 = 1.0858

Back to TOC

The above system of equations does not seem to converge?  Why?

Well, a pitfall of most iterative methods is that they may or may not converge.  However, certain classes of systems of simultaneous equations do always converge to a solution using Gauss-Seidel method.  This class of system of equations is where the coefficient matrix [A] in [A][X] = [C] is diagonally dominant, that is

                for all i

and  for at least one i.

If a system of equations has a coefficient matrix that is not diagonally dominant, it may or may not converge.  Fortunately, many physical systems that result in simultaneous linear equations have diagonally dominant coefficient matrix, which then assures convergence for iterative methods such as Gauss-Seidel method of solving simultaneous linear equations.

Back to TOC

Example 2

Given the system of equations.

                           

                       

                       

find the solution using Gauss-Seidal method.  Given

                        as the initial guess.

Solution

The coefficient matrix

           

is diagonally dominant as

           

           

           

and the inequality is strictly greater than for at least one row.  Hence, the solution should converge using Gauss-Seidel method.

Rewriting the equations, we get

           

           

           

Assuming an initial guess of

           

 

Iteration #1:

           

                 = 0.50000

           

                 = 4.9000

           

                 = 3.0923

The absolute relative approximate error at the end of first iteration is

           

                    = 67.662%

           

                     = 100.000%

           

                    = 67.662%

The maximum absolute relative approximate error is 100.000%

 

Iteration #2:

           

                 = 0.14679

           

                 = 3.7153

           

                 = 3.8118

At the end of second iteration, the absolute relative approximate error is

           

                    =  240.62%

           

                     = 31.887%

           

                    = 18.876%.

The maximum absolute relative approximate error is 240.62%.  This is greater than the value of 67.612% we obtained in the first iteration.  Is the solution diverging?  No, as you conduct more iterations, the solution converges as follows.

Iteration

a1

a2

a3

1

2

3

4

5

6

0.50000

0.14679

0.74275

0.94675

0.99177

0.99919

67.662

240.62

80.23

21.547

4.5394

0.74260

4.900

3.7153

3.1644

3.0281

3.0034

3.0001

100.00

31.887

17.409

4.5012

0.82240

0.11000

3.0923

3.8118

3.9708

3.9971

4.0001

4.0001

67.662

18.876

4.0042

0.65798

0.07499

0.00000

This is close to the exact solution vector of

           

Back to TOC

Example 3

            Given the system of equations

                       

                       

                                  

Find the solution using Gauss-Seidel method.  Use  as the initial guess.

Solution

Rewriting the equations, we get

           

           

           

Assuming an initial guess of

           

 

the next six iterative values are given in the table below

Iteration

a1

a2