Computing determinants | Linear Algebra MATH1141 | N J Wildberger
3.01K subscribers
SUBSCRIBED
We give some additional techniques for computing determinants of square matrices. Most of these are related to row reduction.
00:00
hello everyone I'm Norman Wahlburgers in
00:04
this lecture we're going to be looking
00:05
at how to compute determinants and we
00:08
rely a lot on row reduction and knowing
00:12
how each step of a row reduction effects
00:15
of course by determinants
00:17
but may be a good place to start is to
00:20
just have a look at the 3 by 3 case okay
00:23
it's a special case but it's actually
00:24
quite important in applications so let
00:27
me remind you that if you have a general
00:29
3 by 3 matrix like this with entries a
00:32
IJ then the determinant is a sum of six
00:36
different terms each of these terms
00:38
corresponds to a product of entries one
00:40
in each row and when each column and
00:42
there are plus and minus signs depending
00:44
on the sign of the corresponding
00:45
permutation now sometimes it's a little
00:48
bit you know challenging to remember
00:49
that so I just want to first start by
00:51
outlining it I kind of a quick and easy
00:54
way of remembering this in the 3x3 case
00:57
the idea is do just a copy the matrix
01:00
down here in blue on the left and then
01:04
another copy on the right and then it
01:06
turns out that the various six terms
01:09
correspond to sort of taking diagonals
01:11
in this set up so for example if we take
01:15
say this diagonal a 1 a 2 2 a 3 3 that
01:21
corresponds to this term if we take a 1
01:23
2 times 8 to 3 and then keep going down
01:25
here to a 3 1 that corresponds to this
01:28
term and then if we go a 3 1 a 2 1 a 3 2
01:31
that corresponds to this term so we're
01:34
getting all the positive terms with
01:38
these diagonals going down to the right
01:40
now if we kept on going you know to a 1
01:43
1 a 2 2 8 3 3 well then we just be back
01:46
to where we started so there'd be
01:47
nothing new so there's really only three
01:48
independent diagonals of this bigger
01:51
Augmented matrix in in this direction
01:55
now what about the other direction well
01:57
if we want to go in the other direction
01:58
we could start here say a 1 1 a 2 3 a 3
02:03
2 well that's exactly this term that
02:06
appears with a minus sign
02:08
Green and then over 1 a 1 2 a 2 1 a 3 3
02:14
a 1 2 a 2 1 a 3 that's that one there
02:17
and then over 1 again a 1 3 a 2 2 a 3
02:22
one over there corresponds to that job
02:24
so here are the 3 ones that occur with
02:27
with minus signs so that's one way of
02:31
remembering how to compute a 3 by 3
02:35
another important kind of thing to know
02:40
is that our basic formula our defining
02:43
formula for the determined actually has
02:46
some variance so recall that originally
02:49
the this determinant up here the
02:51
determinant was defined as a11 times
02:56
capital a11 representing that 2 2 by 2
02:59
sub matrix the minor and then minus a 1
03:06
2 A 1 2 and then plus a 1 3 a 1 3 so
03:11
we're going across the first row here
03:15
and multiply each one of these entries
03:17
along that first row by a corresponding
03:19
minor of another 2 by 2 determinant
03:22
obtained by removing the row and column
03:24
with alternating plus minus and plus for
03:32
the coefficients now it turns out
03:36
there's a corresponding formula in fact
03:39
for any row and any column so this
03:42
generalizes to a formula involving
03:52
expansion around any row the war in fact
04:04
column and to figure out what the signs
04:09
are you just have to remember this
04:10
checkerboard pattern just like a
04:13
checkerboard has white and black squares
04:15
so we alternate plus and minus signs
04:20
along this
04:22
determinate and this is a three by three
04:24
story but in fact it works for a general
04:27
end by an okay so works for the end by
04:31
end case just as well but let me
04:33
illustrate it here so the same
04:36
determinant that we were calculating
04:38
before okay we started off with the
04:41
matrix a let's call this this is matrix
04:43
a so this determinant a we had one
04:47
formula for it here
04:48
here's another formula which is very
04:50
similar okay so suppose we decided
04:52
instead to go along this row so we could
04:55
write it as a the first element in that
04:58
row is a 2-1 and then the corresponding
05:01
matrix which is a minor a 2-1 and then
05:06
the next entry along that role with the
05:08
a2 to we don't have to multiply that by
05:10
a to 2 and then plus a 2 3 times a 2 3
05:18
so for example the first term here would
05:22
correspond to taking the entry here and
05:25
multiply it by the determinant of the
05:28
matrix you get by taking the rows and
05:31
columns not involving that things so
05:33
that little 2 by 2 matrix there in red
05:37
that's the a 2 1 that's appearing here
05:40
okay so you could go across that second
05:42
row get a very similar formula to the
05:46
one that we originally started with but
05:48
it's more flexible and if we wanted to
05:52
go down a column we could do the same
05:54
kind of thing so let's say we go down
05:55
this this last column here so that would
05:59
be then the first entry would be a 1 3
06:03
that's that entry right there
06:05
and we have to multiply it by its
06:07
corresponding minor a 1 3 and there's a
06:10
plus sign because there's a plus sign on
06:12
that checkerboard in that position and
06:14
then below it the a 2 3 entry gets a
06:18
minus sign and the Associated minor a 2
06:21
3 and then that's that one there and
06:25
then finally a 3 3 times its associated
06:34
so let me give you an application of
06:36
this formula which is sometimes nice to
06:39
remember so an application is to the
06:42
cross product of vectors go back to our
06:46
vectors section remember that we had the
06:52
cross product of two vectors so maybe we
06:54
have the vector 1 3 2 and we want to
06:59
take the cross product of -2 1 4 you
07:04
want to know what that is so there was a
07:07
formula there but it turns out the
07:09
formula can also be remembered with a
07:13
determinant point of view so to do that
07:16
let me introduce the standard basis
07:20
vectors say I is the vector 1 0 0 J is
07:26
the vector 0 1 0 and K is the vector 0 0
07:30
1 this is often used in engineering
07:32
courses ok just the three basis vectors
07:36
then we can define this cross product
07:39
though this thing here is equal to it's
07:42
a kind of a funny formula it's a
07:44
determinant i j k we put down the first
07:48
column and then the first vector 1 3 2
07:52
down that next column and the next
07:54
vector minus 2 1 4 down the third column
08:01
now what do we mean by this well it's
08:04
just like we're expanding this ok
08:06
there's I J's and kaizen vault and the I
08:09
J's and KS are just to be interpreted as
08:11
these particular vectors so let me just
08:13
show you how this works and the key is
08:15
to expand this out using the first
08:18
column ok
08:21
so I remind you that the signs here are
08:23
plus minus and plus so if I expand this
08:27
out I would get I times the
08:30
corresponding determined I'm just gonna
08:32
write that determine about 3 1 2 4 okay
08:35
and then minus J times the corresponding
08:39
determinant that you get by limiting
08:41
that row and column there'll be a 1 a
08:43
minus
08:44
to a 2 and a 4 and then plus K times the
08:50
determinant 1 minus 2/3 water okay and
08:55
what are these things well the first one
08:57
is 12 minus 2 so that's 10 I and the
09:00
next one is minus 4 minus minus 4 that's
09:04
8 it's all together H or minus 8 J and
09:08
then the last one 1 minus minus 6 s plus
09:12
7 plus 7 K now that's a linear
09:17
combination of the basis vectors and
09:19
that's then a vector 10 minus 8 7 that's
09:26
just another way of doing the cross
09:29
product and we could check that the dot
09:32
product between that cross product and
09:35
any of the two original vectors is 0 so
09:37
we take the dot product with this one we
09:39
got 10 minus 24 plus 14 which is 0 so
09:43
those things are perpendicular if we
09:46
take the dot product with this one we
09:48
get minus 20 minus 8 plus 28 which is
09:51
also 0 so we've done that correctly okay
09:54
that's the cross product ok great now
09:59
let's talk about computing determinants
10:03
more generally so the most efficient way
10:05
of computing most efficient way of
10:12
computing determinants in general is to
10:17
use row reduction use row reduction and
10:25
the key point is there that each of the
10:27
three basic row operations corresponds
10:32
to a very specific effect on
10:33
determinants if we interchange two rows
10:36
or swap two rows the determinant is
10:38
changed by minus 1 if we add a multiple
10:42
of one row to another they determinant
10:44
is not changed and if we multiply a row
10:47
by a scalar say lambda then the
10:49
determinant is correspondingly
10:51
multiplied by lambda so the idea is that
10:54
we row reduce until we get into a row
10:56
salon form and then the determinant is
11:00
very easy to read we just look at the
11:02
product of the diagonal elements but we
11:04
have to adjust that final determinant by
11:08
considering you know how many swaps
11:10
we've done and how many multiplications
11:13
of rows we we have done so we have to
11:15
compensate for those operations in the
11:19
row reduction let's have a look at an
11:22
example okay so let's have a look at
11:27
this example here is a four by four
11:30
matrix and we want to find its
11:32
determinant okay so let's let's row
11:36
reduce this thing and and see what we
11:38
get so first step
11:41
well we maybe we should start with the
11:43
actual matrix so we want to know what
11:45
this is okay so we're gonna row reduce
11:48
okay so I copy at 1 4 1 - 3 - 10 0 1 0 0
11:55
- 2 0 0 - 2 1 and we're going to perform
11:59
row operations our first operation is
12:03
we're going to take that top one and
12:04
we're going to subtract twice it from
12:09
the second row so the new Row 2 is the
12:14
old Row 2 - 2 Row 1 okay and that's 1 4
12:17
1 - 3 and then that's so 2 minus 2 is 0
12:22
10 minus 8 is 2 0 minus 2 is 0 minus 2
12:27
is minus 2 1 minus plus 1 minus 2 times
12:34
minus 3 is I guess plus 7 ok and then we
12:37
have 0 0 2 2 and this 0 0 - 2 1 still
12:42
stays where it is ok now we're going to
12:45
do another thing this one here is fine
12:48
it already has zeros below it so we'll
12:50
move to this one and blow take Row 4
12:54
will be Row 4 plus Row 3 ok so that
12:58
becomes 1 4 1 - 3 0 2 - 2 7 0 0 2 2 we
13:08
just
13:08
and the throw so we get zero and three
13:13
so now it's in row echelon form and we
13:16
see the leading entries are all down the
13:19
diagonal okay so the determinant here is
13:26
equal to the product of the diagonal
13:29
entries what's the determinant is equal
13:31
to 1 times 2 times 2 times 3 which is 12
13:35
so now the steps that we performed were
13:38
all of the kind adding a multiple of one
13:41
row to another and crucially that
13:43
operation does not change the
13:45
determinant so the determinant of this
13:48
thing was also equal to 12 and the
13:50
determinant of this thing was also equal
13:53
to 12 that's what we originally want to
13:55
calculate so this thing is in fact 12
13:59
now I just want to point out that this
14:04
is a kind of a interesting little
14:06
situation where the matrix actually can
14:09
can't be subdivided here there's a block
14:11
of zeros in the bottom and and here this
14:15
two-by-two matrix it has determinant
14:18
equal to 2 minus 2 minus minus 4 so
14:26
that's a 6 and this one here this has
14:30
determinant this little 2 by 2's
14:32
determinant
14:33
10 minus 4 times 2 is 8 so that's 2 ok
14:38
determinant is equal to 2 determinants
14:43
equal 2 and happily the product of these
14:46
determinants is equal to 12 so there's
14:49
actually more magic in the world of
14:51
determines so we've only really just
14:53
touched on things there are classically
14:56
beautiful formulas going back to the
14:58
18th and 19th century mathematicians who
15:00
investigated this topic great lengths so
15:04
there's formulas from lagron Janco she
15:08
and and very various other people ok but
15:12
anyway so that's an easy example of how
15:15
we row reduce as we get to row echelon
15:17
matrix and then we take the product of
15:22
the diagonal entries and adjusted
15:24
correspondingly for any swaps that we
15:28
may have done in any multiplications of
15:29
roles let's do another example alright
15:35
so here's another example that's kind of
15:37
interesting it's an important
15:39
theoretical result that also we've met
15:43
in the context of fitting a curve to
15:46
some points so it's a vandermonde
15:48
determinant and I'll do the general 3x3
15:53
case so it's a matrix which has a very
15:55
special form that all the entries along
15:58
every row are just subsequent powers of
16:02
a single number so let's say the first
16:04
row is one a and a squared and the next
16:07
row is 1 B and B squared and the third
16:11
row is 1 C and C squared so now we have
16:14
a matrix with not with number entries
16:18
but with variable entries and that's
16:20
interesting to often very interesting
16:23
especially in this case so we want to
16:25
know what the determinant of this thing
16:27
is ok so let's do row reduction but you
16:32
know in this sort of general algebraic
16:34
context so we'll start by Row 2 is equal
16:39
to Rho 2 minus Rho 1 and also Row 3 is
16:42
Row 3 minus Row 1 so we're using this
16:46
one here to get rid of the ones below it
16:48
we get 1 a a squared 0 B minus a here
16:54
and B squared minus a squared here and u
16:58
0 C minus a and C squared minus a
17:02
squared ok so how we can simplify this
17:07
let's do the phone let's take Row 2 and
17:10
we're going to divide it by B minus a
17:14
and our 3 Row 3 is 1 over C minus a
17:19
times Row 3 because we see there's a
17:21
common factors in the second row of B
17:24
minus a ok so when we do that well we
17:29
get just 1 here and B plus a and when we
17:34
do it to the
17:35
/ C minus a we get one here and C plus a
17:41
now let's take this entry here and use
17:45
it to get rid of this entry here so the
17:48
row three will be Row three minus Row
17:50
two for a total of one a a squared 0 1 B
17:55
plus a and 0 we get 1 minus 1 is 0 and C
17:59
plus a minus B plus a is C minus B ok so
18:06
now we're in a row echelon form we see
18:10
that the entries are along the diagonal
18:12
here and we can read off the determinant
18:14
very quickly
18:15
so here the determinant is equal to 1
18:19
times 1 times C minus B so it's C minus
18:25
B so what about what about here so to go
18:30
from here to here we added a multiple of
18:33
one row to another that doesn't change
18:34
the determinant so this determinant is
18:36
also equal to C minus B but what did we
18:40
do
18:41
when we went from here to here what we
18:43
did is we divided by B minus a one of
18:47
the rows and we divided by C minus a so
18:49
we have to compensate for that ok that
18:52
means the determinant here is going to
18:54
be C minus B that we already have times
18:57
B minus a times C minus a and the first
19:05
step that we took was adding a multiple
19:08
of one row to another we know that
19:10
doesn't change the determinant so this
19:12
last thing here that we get there is
19:14
also the determinant of this thing and
19:16
so we can conclude that the determinant
19:18
is therefore the determinant of such a
19:22
matrix a let's give it a name so that's
19:24
a it's equal to C minus B times B minus
19:35
a times C minus a it's a product of the
19:43
differences between the three entries a
19:47
B and C
19:49
so in particular if a B and C are
19:51
distinct so if a B and C are distinct
20:01
that they're none no two of them are
20:03
equal then determinant of a does not
20:08
equal zero and so a is invertible and it
20:16
might be a fun little exercise for you
20:18
to calculate what the inverse is in this
20:21
case okay so these are some of the kind
20:28
of important things maybe I will just
20:30
mention a few more things sort of to
20:33
finish off things
20:34
so I remind you of the main theorem that
20:37
we had I told you about last time which
20:41
I didn't really prove at all it actually
20:43
involves a little bit of work but
20:47
actually okay basically the proof of
20:53
this multiplicative property of the
20:55
determinant involves examining again the
20:58
consequences of multiplying by
21:01
elementary row matrices we could do that
21:04
but it's maybe another you know ten
21:07
minutes I will not gonna actually prove
21:09
that but it is an important result and
21:12
it has some consequences which are also
21:15
useful when you're calculating things
21:20
okay so another consequence is following
21:23
proposition that if a is an N by n
21:27
invertible matrix then the determinant
21:37
of a inverse equals one over the
21:43
determinant of a that's a very nice
21:48
thing the inverse matrix has the inverse
21:52
determinant and the proof is pretty
21:56
simple it's simply a consequence of the
21:58
fact that since a times a inverse
22:02
was the identity matrix we know that the
22:06
determinant of a a inverse which is the
22:11
determinant of the identity matrix which
22:13
is 1 equals the determinant of a times
22:18
the determinant of a inverse and that's
22:22
basically what we're saying we're saying
22:23
the turn of a times the determinant of a
22:25
inverse is equal to 1 ok so that's
22:31
probably a good place to to finish so
22:33
we've outlined some some kind of key
22:37
techniques for computing determinants
22:39
there's a lot more to be said about
22:41
determinants it's a very classical rich
22:44
subject that was extensively studied in
22:46
the nineteenth centuries and earlier too
22:48
in fact it actually came before sort of
22:51
modern linear algebra but it's still a
22:53
theoretical importance but these days
22:55
you know our computers are very good at
22:58
calculating determines and usually
23:00
determinants are calculated by computers
23:02
that's just the reality