Although it seems that the Gauss elimination method gives an exact solution, the accuracy of this method is not very good in large systems. The main reason of inaccuracy in the gauss elimination method is round-off error because of huge mathematical operations of this technique. Furthermore, this method is very time consuming in large systems. Many of systems of linear algebraic equations which should be solved in engineering problems are large and there are lots of zeros in their coefficient matrix. To solve this kinds of problems, iterative methods often is used. Gauss-Seidel one of the iterative techniques, is very well-known because of its good performance in solving engineering problems. For a system of linear equation as follows:


a11x1 + a12x2 + … + a1nxn = c1

a21x1 + a22x2 + … + a2nxn = c2




an1x1 + an2x2 + … + annxn = cn


where xi are unknowns and aij are coefficients of unknowns and ci are equations’ constants. The Gauss-Seidel method needs a starting point as the first guess. The new guess is determined by using the main equation as follows:



Mathematically, it can be shown that if the coefficient matrix is diagonally dominant this method converges to exact solution.


The algorithm of the Gauss-Seidel method can be written as follows:


Step 1: Choose X = [x1,x2,…,xn] as a starting point

Step 2: Let X0 = X

Step 3: Let


Step 4: : If ||x-x0||<e  then let X is solution else go to step 2.

Step 5: End.


e: Acceptable approximated error.


System of Linear Equations                               
         (Source Code in C++)                                                 

o        Gauss Elimination Method                                                                          

o        Gauss-Seidel Method                                                                                     

o        Jacobi Method                                                            

o        LU Decomposition Method                                                                         

o        Relaxation Methods