3x3 matrix inversion

hi everyone.my teacher want me a simple program which calculate addition,multiplication,transpose and inversion of 3x3 matrix.
i overcame addition,multiplication and transpose but i get stuck in inversion part. i want your help in this matter..

here is my program's code:

#include<iostream>
using namespace std;
int main()
{
int a[3][3] , b[3][3] , c[3][3], d[3][3];

int i , j , k;
cout<<"enter the 3x3 N matrix \n"<<endl;
for( i = 0 ; i < 3 ; i++)
for( j = 0 ; j < 3 ; j++)
cin>>a[i][j];

for( i = 0 ; i < 3 ; i++)
for( j = 0 ; j < 3 ; j++)
{
b[i][j] = 0;
c[i][j] = 0;
for( k = 0 ;k < 3 ; k++)
b[i][j] += a[i][k]*a[k][j];
c[i][j] += a[i][j]+a[i][j];
d[j][i] = a[i][j];

}


cout<<"\n 1- N+N= \n";
for( i = 0 ; i < 3 ; i++)
{
for( j = 0 ; j < 3 ; j++)
cout<<c[i][j]<<" ";
cout<<endl;
}

cout<<"\n 2- N*N= \n";
for( i = 0 ; i < 3 ; i++)
{
for( j = 0 ; j < 3 ; j++)
cout<<b[i][j]<<" ";
cout<<endl;
}

cout<<"\n 3- N^T= \n";
for( i = 0 ; i < 3 ; i++)
{
for( j = 0 ; j < 3 ; j++)
cout<<d[i][j]<<" ";
cout<<endl;
}

cout<<"\n 4- N^-1= \n";

//???????



return main();
}


i will be grateful if you help me.thanks in advance:)


Topic archived. No new replies allowed.