Gauss Elimination, Gauss-Jordan Elimination and Gauss Seidel Iteration Method: Performance Comparison Using Mat Lab
Gauss Elimination, Gauss-Jordan Elimination and Gauss Seidel Iteration Method: Performance Comparison Using Mat Lab
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
*Dr. Udai Bhan Trivedi , **Mr. Santosh Kumar Sharma, ***Mr. Vishok Kumar Singh
*PSIT college of Higher Education, Kanpur
** PSIT college of Higher Education, Kanpur
***IMS Unison University, Dehradun
ABSTRACT:
This Paper compares the Execution time taken by various methods for solving linear systems i.e. Gauss Elimination,
Gauss Jordan Elimination Methods and Gauss Seidel iterative Methods. The paper uses MAT LAB R2012a software to
solve the problems of linear equations with these methods.
The Various Linear Equations with two, three, four, five and six variable has been solved with these methods using
computer program developed in MAT LAB language. Total Time taken by these algorithms involved have calculated and
compared. This paper also explicitly reveals that in some situations the Gauss Seidel Iteration Method is not convergent.
KEYWORDS: Gauss Elimination, Gauss Jordan Elimination, Gauss Seidel Iteration Method, MAT LAB
Programming, Linear system.
aii aij For all ‘i’ and aii aij for at least one ‘i’
j 1
j 1 j i
j i
Dr.P.V.Ubale, G.S.Sci,Arts,Comm. College , Khamgaon on his article “Comparison of solution of 3x3 system
of linear equation in terms of Cost” concludes that Gauss Jordan method is very expensive as compared to the
Gauss elimination method in order to find out solution from system of linear Equations. [7].
753 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
R. B. Srivastava and Vinod Kumar examined the comparison of numerical efficiencies of Gaussian
Elimination and Gauss -Jordan Elimination methods for the solutions of linear simultaneous equations. In his
research work they solved twenty simultaneous equations with the help of computer program which was
developed in C++ Programming Language. They find that the efficiency of Gaussian elimination method
depends on the number of calculation involved in the solution of linear simultaneous equation. As the number
of calculations increases; the efficiency of Gaussian elimination method decreases and vice-versa [4].
754 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
755 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
matrix. At all steps of Gauss elimination method the elimination is done not only for the lower diagonal
entries but also the upper diagonal entries.
Consider the system of linear equation
a11x1 + a12x2 + … + a1nxn = a1,n+1
a21x1 + a22x2 + … + a2nxn = a2,n+1
a31x1 + a32x2 + … + a3nxn = a3,n+1
………………
an1x1 + an3x2 + … + annxn = an,n+1
Where aij and ai,j+1 are known constant and xi’s are unknowns. The system is equivalent to AX = b. Where
A is augmented matrix and X is column vector of unknown variable and b is Column Vector of Constant
known as Constant vector
The general procedure for Gauss Jordan elimination can be summarized in the following steps:
The algorithms consists of following three major steps
1. Read the Augment matrix A
2. Reduce the augmented matrix [A/b] to the transform A into diagonal form (pivoting).
3. Divide right-hand side’s elements as well as diagonal elements by the diagonal elements in the row, which
will make each diagonal element equal to one
If a 0 is located on the diagonal, switch the rows until a non-zero is in that place. If you are unable to do so,
stop; the system has either infinite or no solution.
The MAT LAB Function gauss_jordan (x) code of above procedure is listed below, This function accept input
(i) concatenation of augmented matrix(A) and Constant Vector (b) and return solution to the linear system AX
= b as vector [y]
756 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
find the new value of x2. Similarly, the new x1 and x2 will be used in third equation to find the value of x3 and
so on.
after every iteration, the algorithm calculates the absolute relative error for each of xi as
|e|=| (xi(new)-xi(old))/ xi(new) | * 100
When the absolute relative approximate error for each xi is less than the pre-specified tolerance, the iterations
are stopped [8]
Consider the system of linear equation
a11x1 + a12x2 + … + a1nxn = a1,n+1
a21x1 + a22x2 + … + a2nxn = a2,n+1
a31x1 + a32x2 + … + a3nxn = a3,n+1
………………
an1x1 + an3x2 + … + annxn = an,n+1
Rewriting each equation
From Equation (1)
c2 a21 x1 a23 x3 a2 n xn
x2
a22
cn 1 an 1,1 x1 an 1, 2 x2 an 1,n 2 xn 2 an 1,n xn
xn 1
an 1,n 1
cn an1 x1 an 2 x2 an ,n 1 xn 1
xn
ann
General Form of each equation
n
c1 a1 j x j
j 1
j 1
x1
a11
n
c2 a 2 j x j
j 1
j2
x2
a22
................................
n
cn 1
j 1
a n 1, j xj
j n 1
xn 1
an 1,n 1
757 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
n
c n a nj x j
j 1
jn
xn
a nn
The algorithm start with an initial guess x1=x2=......xn=0 the initial guess can also be stored in another variable
y1=y2=.......yn=0 when these values are substituted in equation (1) that will produce the a new value for x1 and
when the new values of x1, together with old values of x2,x3,....xn are substituted in equation(2) we get the new
value of x2. And in same manner the algorithm calculate the new value of x1, x2 ...xn. The old values are
available in y1, y2 ...yn. If the old values and new values are become identical the process will stop, otherwise
transfer the new values to the variable y1,y2,....yn and continuing the same procedure to get fresh better value
of x1, x2,....xn. The procedure will stop when old values and new values are almost same
The MAT LAB Function gauss_jordan itergauss( A,b,n ) code of above procedure is listed below, This
function accept input (i) augmented matrix(A) (ii) Constant Vector (b) (iii) number of iteration(n) and solution
to the linear system AX = b as vector [x]
function [ x ] = itergauss( A,b,n )
%%check if gauss-seidel method is applicable
[si,sj]=size(A);
if si~=sj
disp('error matrix is not square');
return
end
if prod(diag(A))==0
disp('gauss-seidel iterative method is not applicable');
return
end
E=tril(A,-1);
F=triu(A,1);
D=A-E-F
Bj=-inv(D)*(E+F);
rho=max(abs(eig(Bj))); %spectral radius
if rho>=1
disp('gauss-seidel method do not converge');
return
end
y=zeros(si,n);
tic
for i=[1:1:n]
y(:,i+1)=inv(D+E)*(b-F*y(:,i));
end
x=y(:,n);
execution_time=toc
end
758 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
START
Gauss Elimination or
Gauss Jordan or Gauss
Seidel Iteration
Apply GAUSS_ELIM(A, b) method of Apply gauss_jordan (x) method of Apply itergauss( A,b,n ) method of
Gauss Elimination Gauss Jordan Gauss Seidel
Show result and execution time Show result and execution time Show result and execution time
END
759 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
760 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
Average
Because the standard deviation of all the above observation in the table is very low for respective methods we
can conclude that the average can be represent the entire class.
761 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
Figure 3: Line Graph Among time taken by different Algorithm in MAT LAB
IV. CONCLUSION
After analysing the above table, conclusion can be drawn that generally Gauss Elimination Method is faster
than the Gauss Jordan Elimination method and Gauss Seidel Iterative Method. The efficiency of Gaussian
elimination method depends on the number of calculation involved in the solution of linear simultaneous
equation. As the number of calculations increases; the efficiency of Gaussian elimination method decreases
and vice-versa due to more time has been taken by algorithm in backward substitution.
The time taken by these algorithms implemented in MAT LAB software is far less than if same would be
implemented by using C++, Java or any high programming language, due to support of Vector
Processing(parallel processing) while dealing with Matrix, by MAT LAB.
The Gauss Seidel Iterative Method is the slowest among all algorithms and suffers with problem of
convergence (in our five and six variable case). Gauss Seidel Algorithm which is iterative algorithm can find
the solution for linear system where the augmented matrix [A] has diagonally dominant coefficient [6].
762 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh
International Journal of Engineering Technology Science and Research
IJETSR
www.ijetsr.com
ISSN 2394 – 3386
Volume 4, Issue 10
October 2017
V. REFERENCES
[1]. Luke Smith, Joan Powell. An Alternative Method to Gauss-Jordan Elimination: Minimizing Fraction Arithmetic, the
Mathematics Educator, 2011.
[2]. K. Rajalakshmi. Parallel Algorithm for Solving Large System of Simultaneous Linear Equations, IJCSNS
International Journal of Computer Science and Network Security.
[3]. Adenegan, Kehinde Emmanuel1, Aluko. Tope Moses:Gauss and Gauss-Jordan elimination methods for solving
system of linear equations: comparisons and applications, Journal of Science and Science Education, Ondo.
[4]. R.B Srivastava, Vinod Kumar. Comparison of Numerical Efficiencies of Gaussian Elimination and Gauss-Jordan
Elimination methods for the Solutions of linear Simultaneous Equations, Department of Mathematics M.L.K.P.G.
College Balrampur. U.P., India.
[5]. T.J. Dekker, W. Hoffmann. Rehabilitation of the Gauss- Jordan algorithm, Department of Computer Systems,
University of Amsterdam, Kruisl
[6] Fadugba Sunday Emmanuel. Some Iterative Methods for Solving Systems of Linear Equations. Department of
Mathematical Sciences, Ekiti State University, Ado Ekiti, Nigeria
[7] Dr.P.V.Ubale. “Comparison of solution of 3x3 system of linear equation in terms of Cost” G.S.Sci,Arts,Comm.
College , Khamgaon
[8] C.xavier. Fortran 77 and Numerical Methods. Derpartment of Computer Science, Madurai Kamraj University.
[9] Jeff Christensen. A Brief History of Linear Algebra. Final Project Math 2270 Grant Gustafson, University of Utah
[10] Tucker, Alan. (1993). “The Growing Importance of Linear Algebra in Undergraduate Mathematics” . The College
Mathematics Journal, 1, 3-9
763 Dr. Udai Bhan Trivedi , Mr. Santosh Kumar Sharma,Mr. Vishok Kumar Singh