1. ## Matrix Inverse Problem

Hello,
I made the program to inverse a 3*3 matrix and here's the code to do that

Code:
```#include <iostream.h>

{

for(i=0;i<r;i++)
{
}

for(l=0;l<r;l++)
{
for(m=0;m<c;m++)
{
t=0;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if(i!=l && j!=m)
{
temp[t]=matrix[i][j];
t++;
}
}
}
}
}
}

int main(void)
{
clrscr();
float inverse[3][3],det=0;
matrix=new int *[3];
for(i=0;i<3;i++)
{
matrix[i]=new int [3];
}
cout<<"\n\nEnter 9 Elements :\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>matrix[i][j];
}
}

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout.width(4);
}
cout<<endl;
}
cout<<"\n\nValues Of Matrix :\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
if(i+j==1 || i+j==3)
{
matrix[i][j]*=-1;
}
cout.width(4);
cout<<matrix[i][j];
}
cout<<endl;
}
for(j=0;j<3;j++)
{
}
if(det!=0)
{
cout<<"\n\nThe Determinant Is :"<<det;

cout<<"\n\nThe Inverse Of Matrix Is :\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout.width(8);
cout.precision(3);
cout<<inverse[i][j];
}
cout<<endl;

}
}
else
cout<<"\n\nInverse Of Matix Not Possible";
return 0;
}```

Now what i want to know is that is the logic of the program correct??
This is just a 3 *3 matrix. Can a N*N matrix be inverted??If yes then kindly tell me what changes do i need to make in the above program to make it work for a N*N matrix?
i am not sure whether a N*N matrix be inverted or not??!

anybody please tell me how to find adjoint of a N*N matrix or of 4*4 matrix so that i can get a rough idea and try to implement that program in C++.

2. Find a linear algebra textbook. Square matrices can be inverted if and only if their determinant is nonzero.

3. i have already stated that condition in the program .You may check it out

4. What I'm saying is that is the condition for any N*N matrix to be invertible. Of course, computing a determinant gets harder.