To calculate the Inverse of a Matrix using Gauss Jordon Method

To calculate the Inverse of a Matrix using Gauss Jordon Method

Program to calculate the Inverse of a Matrix using Gauss Jordon Method, a simple yet complete algorithm follows below.
Gauss Jordon Method can be employed to solve a system of linear equations having solutions. Unlink in Gauss Elimination method (in which triangular matrix is formed), in Gauss Jordon Method all off diagonal elements are eliminated producing a diagonal matrix. Finally, inverse of the matrix formed by system of equations is computed.
[A:I]?[I:A-1] where
[A]= matrix to be solved for
[A-1]= required inverse matrix
[I]= identity matrix
/** To compute the inverse of matric [A] using Gauss Jordon Method
Simple but complete algorithm
1. start
2. n ie size of sq matrix
3.matrix reading
i= 1 to n
j= 1 to n
read a[i][j] 2.identity matrix
i= 1 to n
j= 1 to n
{
if(i==j)
b[i][j]=1
else
b[i][j]=0
}
3.elimination
k= 1 to n
{
i= 1 to n
{
if(i==k) goto LABEL;
pivot= a[i][k]/a[k][k] j= 1 to n
{
a[i][j]= a[i][j]-pivot*a[k][j] b[i][j]= b[i][j]-pivot*b[k][j] }
LABEL
}
}
4.identity matrix
i= 1 to n
j= 1 to n
b[i][j]= b[i][j]/a[i][i] 5.display inverse matrix
i= 1 to n
j= 1 to n
cout “b[“< <
*************************************/
#include
#include
#include
void main()
{
int n;
clrscr();
cout< }
}
getch();
}
To calculate the Inverse of a Matrix using Gauss Jordon Method in C++ Programming Language for Numerical Methods for Engineering Students

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top