Gauss Jordan Method Pseudocode

Earlier in Gauss Jordan Method Algorithm, we discussed about an algorithm for solving systems of linear equation having n unknowns. In this tutorial we are going to develop pseudocode for this method so that it will be easy while implementing using programming language.

Pseudocode for Gauss Jordan Method

1. Start

2. Input the Augmented Coefficients Matrix (A):
	
	For i = 1 to n
		
		For j = 1 to n+1
			
			Read Ai,j
		
		Next j
	
	Next i

3. Apply Gauss Jordan Elimination on Matrix A:
	
	For i = 1 to n
		
		If Ai,i = 0
			
			Print "Mathematical Error!"
			Stop
		
		End If
		
		For j = 1 to n
			
			If i ≠ j 
				
				Ratio = Aj,i/Ai,i
				
				For k = 1 to n+1
				
					Aj,k = Aj,k - Ratio * Ai,k
			
				Next k
				
			End If
			
		Next j
	Next i

4. Obtaining Solution:
	
	For i = 1 to n 
		Xi = Ai,n+1/Ai,i
	Next i

5. Display Solution:
	
	For i = 1 to n
		
		Print Xi
	
	Next i

6. Stop


---------------
Note: All array indexes are assumed to start from 1.

Recommended Readings

  1. Gauss Jordan Method Algorithm
  2. Gauss Jordan Method Pseudocode
  3. Gauss Jordan Method Using C
  4. Gauss Jordan Method Using C++