We saw that a 2-by-2 matrix
has an inverse if and only if
. This condition generalises to bigger matrices as follows. To each
-by-
matrix
, we will define a number
(the determinant of
) such that
has an inverse if and only if
.
Definition:
Let
be an
-by-
matrix. The number
is defined as follows.
Pick an entry from each row in such a way that no two of your choices are in the same column. (If
were 2-by-2 then you could either pick
and
or
and
).
Multiply your chosen entries together (if
were 2-by-2 this would give us
or
).
Do the same for every other choice you could have made, and add up the results with signs (I'll explain the signs later). (If
were 2-by-2, we would get
).
Before we explain the signs, let's see how many choices there would be if
, so
If you pick
from the top row, you can't pick anything in the first column for your other choices, so the only possibilities are
or
from the second and third rows. In this way, the possible choices give:
so there are six possibilities.
More generally:
Lemma:
Let
be an
-by-
matrix. The number of ways of choosing something from each row so that no two are in the same column is
.
For each choice, write down the column numbers in the order you chose them. For example:
corresponds to choosing entry 1 from row 1, entry 2 from row 2 and entry 3 from row 3, so you'd write down
;
corresponds to choosing entry 1 from row 1, entry 3 from row 2 and entry 2 from row 3, so you'd write down
.
This gives a permutation of
. Every permutation arises and a choice is determined by the permutation you wrote down, so the number of choices is the same as the number of permutations, which is
.
Signs
Having made a choice as above and written down the corresponding permutation of
, the sign you assign to this choice is:
if your permutation is even (i.e. can be written as an even number of transpositions);
if your permutation is odd (i.e. can be written as an odd number of transpositions).
Suppose you picked
, corresponding to the permutation
. To get from
back to
, I don't have to do anything (i.e. 0 transpositions) and 0 is an even number so this is an even permutation, and
contributes with a plus sign to the determinant.
Suppose you picked
corresponding to the permutation
. To get from
back to
you need to transpose
and
, so that's one transposition, and the permutation is odd. Therefore
contributes with a minus sign.
Here are the permutations and signs for the other choices when
:
Product
Permutation
Sign
so
If
then our two choices are
(permutation
, even so plus sign) and
(permutation
, odd so minus sign), giving
Index notation
We have a nice formula in index notation:
Here:
the sum is over all permutations
of
means the sign (
if
is even,
if
is odd).
to understand the product, note that
is the choice from the first row (which is why the first index is 1) and it lives in column
(remember
is the permutation which tells us which column our choices live in). Similarly,
is the choice from the second row, etc.
Examples
Let
. There's only one valid choice which doesn't involve any zeros, namely
. This corresponds to the permutation
. To get back to
we'd have to transpose
and
, which is an odd number of transpositions, so it has a minus sign. Therefore
.
Remark:
To get back from
to
, we could also have flipped
and
(getting to
) then
and
(getting to
) then
and
(getting to
). This would have been three transpositions, which is still an odd number. The reason the definition of odd vs even permutations makes sense is that any permutation can be written as either an odd number of transpositions or an even number, but never as both. We won't prove that here.
Let
. Again, there's only one valid choice which has no zeros, and this choice corresponds to the permutation
, so the only contribution to the determinant is
. Therefore
.
This applies to any diagonal matrix, i.e. a matrix whose off-diagonal entries are all zero: the determinant is the product of diagonal entries (with no extra signs).
Consider an upper triangular matrix (where all entries strictly below the diagonal are zero) like
From the last row you have to pick the last entry. Therefore from the penultimate row you have to pick the penultimate entry, and so on, and you end up being forced to pick only the diagonal entries. So you get the product of diagonal entries with no extra sign (in this example,
).
Since the elementary matrix
is upper triangular (if
, or lower triangular if
), and has all its diagonal entries equal to
, we see that
.
Since the elementary matrix
is a diagonal matrix with all diagonal entries
except one which is
, we get
.