Like much mathematics, finding the inverse of a matrix is more difficult to describe than it is to actually do, so this will effectively be a worked example. Note that only square matrices can have an inverse, and that not all square matrices actually do have an inverse (specifically, if a matrix has a determinant of 0, it is said to be singular and has no inverse. This is because the inverse involves dividing by the determinant, and dividing by 0 causes all sorts of problems)
For a 2X2 matrix, many people simply use an identity for the inverse- if the matrix is
a b
c d
Then the inverse is 1/(ad-cb) * d -b
-c a
i.e., you switch a and d, and invert the signs on b and c. However, it is not obvious how to generalise this to larger matrices, even the next highest matrix , a 3X3.
Instead, a more systematic approach needs to be employed. Finding the inverse of a 3X3 matrix will be shown; and then it will be illustrated how this generates the same result as the above identity for a 2X2. With a bit more number crunching the inverse of a 4X4 can be found by essentially the same techniques.
To find the inverse we begin by constructing the matrix of minors. Take each element of the matrix and replace it with the determinant of what remains when both the row and column of that element are erased.
In the case of a 3X3 matrix this means finding the determinant of 9 different 2X2 matrices- use the fact that
det a b
c d = ad-bc
for now- this will be explained later. For a 4X4 you are faced with finding the determinant of 16 3X3 matrices- which is why i'm using a 3X3 example. As part of finding the inverse of a 3X3 involves finding the determinant, you will find everything you need to know for solving the 4X4 from the example of a 3X3.
To make things a bit clearer, let us consider an example.
2 -1 2
A= 1 -1 1
2 1 -3
There would be brackets but plain text is restrictive, hopefully you get the idea.
To construct the matrix of minors, we need the minors! For the top left entry in the matrix of minors, we will want the determinant of
-1 1
1 -3
as this is the matrix left when the top row and left column are erased from A. This is (-1)(-3) - (1)(1) = 3-1 =2.
Then to get the top row, middle entry we this time erase the top row, middle column, leaving
1 1
2 -3
which gives us a determinant of (1)(-3) - (1)(2) = -5.
In this way we build up a matrix of minors as follows:
2 -5 3
1 -10 4
1 0 -1
It is now necessary to create the matrix of cofactors. For this we apply the alternating law of signs:
+ - +
- + -
+ - +
In other words, the top left value remains unchanged, the sign on the top row, middle column entry is inverted, the top row, right column remains unchanged etc. Note that you are not trying to create an alternating pattern, just inverting the signs of every other entry.
Hence for our example we get
2 5 3
-1 -10 -4
1 0 -1
We now need the
transpose of this matrix: switching rows for columns to get
2 -1 1
5 -10 0
3 -4 -1
This is the matrix part of the inverse: all that remains is to find the determinant and divide by this to get the inverse of A.
There are two approaches here. If you are a mathematician, the best route is to multiply the matrix you have found by A. This should give a matrix which is a multiple of I, the identity matrix and so the determinant is 1 over this multiple. The advantage of this route is that it checks the matrix you have found is indeed correct- if you don't get something that looks like n lots of the identity matrix, you have gone wrong. Whilst I won't go into the details of matrix multiplication here, for our example we have:
2 -1 2 2 -1 1 5 0 0
1 -1 1 x 5 -10 0 = 0 5 0
2 1 -3 3 -4 -1 0 0 5
Hence we want to divide by 5 to get the Identity matrix, and thus the determinant of A, our original matrix, is 5. Note that although matrix multiplication is
non-commutative, the order in this particular case doesn't matter. For our example, this gives us an inverse of A ( A
-1) of:
1 2 -1 1
- x 5 -10 0
5 3 -4 -1
The alternative approach is if you don't want to have to do the
multiplication- for example, if you want to write a
computer program to find the inverse and thus can trust the calculations of the matrix of minors and cofactors- which you'll have to, as there is no actual check that A*A^-1 actually gives I by this method. It is also the way in which you'll want to find the determinant when building the matrix of minors for a 4X4 matrix, and it illustrates why the determinant of a 2X2 is ad- bc.
Basically, you multiply the values found in the top row elements of the matrix by the determinant of the corresponding minor- ie, by the corresponding value in the matrix of minors. You then take the first, subtract the second, and add the third. (note that for larger matrices you continue this process of addition and subtraction, ie subtract the fourth, add the fifth etc.) This process is applied to the top row only, not the whole matrix.
For our example, we get (2)(2) - (-1)(-5) + (2)(3) = 4 -5 + 6 = 5 as before.
Having shown this for the 3X3, hopefully you get the idea for the 4X4 and higher- construct a matrix of minors by finding the determinants of the minors, apply the alternating rule of signs to get the matrix of cofactors, take the transpose, then find the determinant by multiplying with the original (which also provides a check) or by using the top row elements (which doesn't but is quicker and easier).
All that remains to be shown is that the claimed value of the inverse and determinant of a 2X2 still hold true when this method is used rather than just recalling the identity.
By constructing our matrix of minors we get
d c
b a
As the determinant of a 1X1 matrix is the value of the only element, and by erasing the row and column containing an element in a 2X2 we are left with a minor that is just a 1X1 matrix.
Next, the matrix of cofactors is
d -c
-b a
Then the transpose is
d -b
-c a
Then, to find the determinant we use the second technique: (d)(a) - (-b)(-c) which is ad-bc as stated.
a b c
In general, the inverse matrix of a 3X3 matrix d e f
g h i
is
1 (ei-fh) (ch-bi) (bf-ce)
----------------------------- x (fg-di) (ai-cg) (cd-af)
a(ei-fh) - b(di-fg) + c(dh-eg) (dh-eg) (bg-ah) (ae-bd)
As the following writeups explain, this is far from the optimum way to find the inverse in practice. It is however, the way in which it is defined- working from this definition we can then introduce the concepts such as row operations that allow us to find the inverse of big matrices before the heat death of the universe. Whilst an appreciation of this approach is needed to start out with matrix mathematics in the first place (it's probably all you would see at A-level) and to understand subsequent work, chances are you'd never use it to invert anything bigger than 3*3!