This is an attempt to describe in words,
i.e., without using standard matrix notation showing the rows and columns, one
way of getting the inverse of a square matrix.
(You’ll have to just imagine the rows and columns.)
Let’s say you have a square matrix
A. Elements in that array will be
referred to with ij subscripts, e.g., “Aij”, where i specifies a row in A and j
specifies a column. (They’re integers
from 1 to N, where N is the order of your matrix.) The inverse of A is the transpose of the matrix of cofactors
divided by the determinant of A—call it “det(A).” (I’ll assume for now that you
know how to get the determinant.)
Here’s how you get the matrix of
cofactors. You first have to find the
minor of each element Aij. The minor of
Aij is the matrix formed from matrix A by neglecting the row and column
containing Aij. (If A is an N x N
matrix, any minor is an N-1 x N-1 matrix.) For each of those minor matrices,
you calculate its determinant. That
determinant goes into what we’ll call the matrix M at position ij. (Matrix M is an N x N matrix. The minor determinants, Mij, can be thought
of as replacing the respective elements Aij.)
The cofactor of Aij (call it “Cij”) is
simply Mij * (-1)^(i + j). The matrix
of cofactors is just all of those cofactors arranged in the matrix C in the
respective ij positions. So, take the
transpose of cofactor matrix C, divide each element in the resulting matrix by
det(A), and you have the inverse of A.
That’s the standard textbook analytical
method of finding the inverse of a matrix.
There are also numerical techniques, such as gaussian elimination, based
on the concept of how simultaneous linear equations are solved. I bet if you do a google search, you’ll find
information on them (or even already written routines that you can abscond with
:) ).
Here’s the textbook analytical technique
for finding det(A). You find the
cofactors of A11, A12, A13, …, A1N, as described above. (You can use any row of elements you
want. I usually find the first row as
convenient as any.) det(A) is then A11 * C11 + A12 * C12 + A13 * C13 + … + A1N
* C1N.