Friday, October 17, 2014

Gauss-Jordan Elimination Method

Gauss-Jordan Elimination Method
Gauss Jordan Elimination Method is used for solving system of linear equation and also used to find the inverse of an invertible square matrix. For finding the solution of the given set of linear equation a sequence of operations performed on the augmented matrix obtained from the set of linear equations until the coefficient part of the augmented matrix becomes identity matrix. To modify the augmented matrix we can swap the two rows or multiplying a row by a non-zero number or adding a multiple of one row to another row.

Consider the set of linear equations of 3 variable

The augmented matrix for the given set of equation is 


  Using the below operation to the augmented matrix
R1 = R1 /a1
R2 = R2a2*R1
R3 = R3a3*R1
The augmented matrix will become
Now apply these operations
R2 = R2 /D
R1 = R1B*R2
R3 = R3F*R2
The augmented matrix will become


Finally, apply these operations
R3 = R3/R
R1 = R1N*R3
R2 = R2P*R3
The augmented matrix will become

 
Thus, the values of  x, y and z can be obtained as
x = T
y = U
z = V

Note: If we apply all the above operations to an identity matrix it will produce the inverse of the coefficient matrix

Matlab Program for 3 Variables simultaneous equations using Gauss-Jordan Elimination Method

a=input('Enter the Augmented Matrix  >  ')
i=eye(3);
a(1,:)=a(1,:)/a(1);
i(1,:)=i(1,:)/a(1);
i(3,:)=i(3,:)-a(3)/a(1)*i(1,:);
a(3,:)=a(3,:)-a(3)/a(1)*a(1,:);
i(3,:)=i(2,:)-a(2)/a(1)*i(1,:);
a(2,:)=a(2,:)-a(2)/a(1)*a(1,:);
i(2,:)=i(2,:)/a(5);
a(2,:)=a(2,:)/a(5);
i(1,:)=i(1,:)-a(4)*i(2,:);
a(1,:)=a(1,:)-a(4)*a(2,:);
i(3,:)=i(3,:)-a(6)*i(2,:);
a(3,:)=a(3,:)-a(6)*a(2,:);
i(3,:)=i(3,:)/a(9);
a(3,:)=a(3,:)/a(9);
i(1,:)=i(1,:)-a(7)*i(3,:);
a(1,:)=a(1,:)-a(7)*a(3,:);
i(2,:)=i(2,:)-a(8)*i(3,:);
a(2,:)=a(2,:)-a(8)*a(3,:);
i  % it will produce inverse of the coefficient matrix
x=a(10)
y=a(11)
z=a(12)

No comments:

Post a Comment