Solve a linear system using matrices | MIT 18.02SC Multivariable Calculus, Fall 2010

Uploaded by MIT on 03.01.2011


CHRISTINE BREINER: Welcome back to recitation.
In this video, what I want to work on is using what we know
about matrix multiplication and finding inverses of
matrices to solve a system of equations.
So we've set up the system already as if it's already in
matrix form.
And what I'd like us to do is, for this particular A-- this 3
by 3 matrix A--
find a vector x, so that Ax equals b.
Where b is equal to these two things.
So you're going to do two problems.
You're going to do when b equals 1, 2, negative 3.
And you're going to do when b is equal to 0, 0, 0.
So you want to find vector x so that Ax
equals this value here.
And what I'd like you to do is I'd like you to use the
strategy that you saw in the lecture, which is find A
inverse, and then take A inverse b.
So we really want to practice understanding how to find the
inverse of a matrix.
So why don't you work on this, pause the video, when you feel
comfortable, confident, that you have the right answer,
then bring the video back up, and you can compare
your work with mine.

OK, welcome back.
Well, hopefully you were able to make some headway and you
feel confident in your answers for 1 and 2.
I am going to find the inverse of the matrix A first, and
then solve the problem.
And because there's a lot of computation,
I may make a mistake.
So I'm going to have to check every once in awhile
that I'm doing OK.
so hopefully-- it's too bad you can't tell me if I've made
a mistake, but hopefully my studio audience
will help me out.
So the first thing I need to do is I need to find the
determinant of A. So I'm going to do that first, and then I'm
going to find the cofactor matrix and go from there.
So if I want to find the determinant of A. I guess I'll
just use the first row here, because it's pretty easy.
So the determinant of A is going to be 3 times the
determinant of this matrix--
this 2 by 2 matrix.
So it's going to be 3 times--
and then I get a 2 times negative 1, which is negative
2, and then minus 0-- so I get a 3 times negative 2.
And I was about to write plus, but I should write minus.
I take minus 1 times--
because this is my minus, I take negative of this thing
times the matrix that is these two components in the first
column and these two components
in the second column.
We take away the column and the row that the 1 is
contained in and we look at what remains-- the 2 by 2
matrix that remains.
And we find the determinant of that.
So we get negative 1 times negative 1,
which gives me a 1.
And then negative 1 times 0 gives me a 0.
So I just have the negative 1 from the row 1, column 2 spot,
and then the determinant of the matrix that
remains is 1, OK--
of the minor matrix that remains.
And then the last one I should put a plus, but notice that it
is a minus already, so I'm going to put just minus 1
times what remains.
What's this minor?
This one is this 2 by 2 matrix I'm looking at, right?
So I need to take the determinant of this 2 by 2
matrix and multiply it by that negative 1 to get the third
component here I have to add in.
Negative 1 times negative 1 is 1.
And then I subtract negative 1 times 2.
So this is where I have to be careful.
It's 1 minus negative 2.
So I'm going to get a 3.
1 here minus a negative 2-- so 1 plus 2--
I'm going to get a 3.
And so negative 6 minus 1 minus 3--
looks like I get a negative 10.
That's good, because I think that's what
I'm supposed to get.
Now what I want to do is I want to find the matrix of
minors for A. And then I'm going to find--
so I'm going to find the matrix of minors first, and
then I'm going to switch the signs appropriately so I get
the cofactors correct.
So some of them I already have. But, the whole matrix of
minors, I'm going to just go through and do it again to be
very careful.
So the first one I delete.
For the first row and column spot, I delete row 1 and
column 1, and I look at the determinant of that matrix.
That's 2 times negative 1 is negative 2 minus 0, so I get a
negative 2 there.
For the first row, second column I come back-- and I'm
now again looking, I'm deleting this column and row--
and so I'm looking at the determinant of this matrix.
So I get negative 1 times negative 1 is 1, minus
0, so I get a 1.
Again, I'm going to change all the signs later.
So I'm going to do that in the second step.
Now I'm in row 1, column 3.
So I'm going to delete row 1, column 3 and look at the
determinant of that matrix.
I get negative 1 times negative 1 is 1, minus the
negative 2, so there's my 3.
Those I already knew, but I didn't want to just plop them
in from here.
But notice that is what you get here.
Negative 2, 1, and 3.
That's exactly where they come from, right?
We got them by the same method.
OK, and so now I want to find the minors for the rest of it.
So let's look at, when I delete row 2, column 1, I'm
left with 1, negative 1 here.
Negative 1, negative 1 here.
So 1 times negative 1 is negative 1.
And then negative and negative is positive.
So it's negative 1 minus negative 1, so I
get negative 2.
That one was a lot of signs, so you might want to check.
Maybe I should check.
OK, maybe I should check.
I'm deleting this column and this row, so I get 1 times
negative 1.
That's a negative 1, right?
Negative 1 minus--
negative 1 times negative 1 is 1-- and so there's
negative 1 minus 1.
That looks good.
Negative 2.
Negative, negative, negative.
And then I'm looking at row 2, column 2.
So now I'm deleting this row and this column.
All right.
And so I have these sort of diagonals here.
That's what I'm interested in, right?
So I get 3 times negative 1.
That's negative 3.
And then minus 1, because I have negative 1 times negative
1 is positive 1.
So negative 3 minus 1.
So I should get negative 4.
And then I'm over here.
So I need to delete this column and this row.
So I get 3 times negative 1 is negative 3.
Minus the negative 1, that's plus 1.
So negative 3 plus 1 is negative 2.
And before I go on, I'm going to check those first 2 rows.
Because if I made a mistake now, it's only
going to get worse.
What did I have?
So far so good.
All right.
Next, final row.
OK, final row is, I'm going to delete this column and row
here, and I'm looking at this matrix.
1 times 0 is 0.
2 times negative 1 is negative 1, but I subtract that.
So it's 0 minus negative 2, so it's 2.
And then row 3, column 2.
So row 3, I delete row 3 and column 2.
3 times 0 is 0.
0 minus--
negative 1 times negative 1 is 1-- so 0 minus 1, that's
negative 1.
And then the last spot, I'm deleting this
row and this column.
So 3 times 2 is 6 minus negative 1.
I get 7.
All right, let's check that row.
2, negative 1, 7.
I have not done the cofactor matrix yet, because now I need
to change the appropriate signs.
OK, so if this is the matrix of minors, then if I want to
change it to the cofactor matrix, what do I have to do?
I'm going to scratch this out and write the cofactor matrix
so that we can just change the signs appropriately.
I'm going to do it all right here.
And how does it work?
Well, remember I'm going to go plus, minus, plus.
Minus, plus, minus.
Plus, minus, plus.
I have to do this grid that starts with plus and
alternates minus.
So this sign stays the same, this sign switches, this sign
stays the same.
That's the plus, minus, plus.
This one is going to be minus, plus, minus.
So the minus switches that.
Plus keeps that the same.
Minus switches that.
And then I was at minus, plus, minus.
So I'm going to have plus, minus, plus.
And so these two stay the same, and this one switches.
So a lot of things that were negative became positive.
And I had to change--
maybe I threw in one negative, maybe not.
But, so out all the signs I kept, this one stayed the
same, this one stayed the same, this one stayed the
same, these two stayed the same, and then these 4
switched, because it's the plus, minus, plus sort of grid
that I have to put on top of this.
OK, so that's the cofactor matrix.
We're getting closer.
OK, now we need the transpose of this, right?

So if I look at the transpose, actually, know what I'm going
to do-- because I'm also just going to have to take the
transpose and then multiply it by 1 over the determinant--
I'm going to do that all at once.
Because we can do that all at once, and then we don't have
to worry about it.
So A inverse I know is going to be negative 1/10, because
the determinant was minus 10.
So it's 1 over the determinant times the
transpose of this matrix.
So the transpose of this matrix-- remember what I'm
going to do is essentially you fix the diagonal and you're
going to flip.
That's really what, in the square matrix, that's how you
can think about it.
But every column is going to become a row.
So I'm going to write this as my first row.
This first column is going to become my first row.
So it's going to be negative 2, 2, 2 as my first row.
And then the next column is going to be negative 1,
negative 4, 1.
I mean next row.
I will take a column and change it to a row.
The next row is going to be negative 1, negative 4, 1.
And then the last one.
I take this column and I change it to a row.
It's going to be 3, 2, 7.

And because again, I want to make sure-- this
one is really messy--
I want to make sure I have something similar for that, or
exactly that.
I think I'm still doing all right.
Now, let's get to solving the problem.
Because so far, we just were finding the inverse matrix.
So I'm going to leave it in this form, instead of dividing
by 10 in every spot, because that will be annoying.
So let's think about how do I want to solve the system.
That I had, I had Ax equals b.
And actually, I mean, my strategy is to find the
inverse matrix.
I didn't talk to you about why we know the inverse matrix
actually exists.
But ultimately, you haven't even seen this yet in the
lecture videos, really.
Except that you know that the determinant of A being
non-zero gives you an inverse matrix.
That's all you know, I think, at this point.
That you have the determinant of A. It's non-zero, so you
can find an inverse matrix.
Makes sense based on the formulation you have, because
if the determinant is 0, then this quantity 1 over the
determinant of A, you've run into quite a bit of trouble.
So that's just as a little sidebar, we know the inverse
matrix exists for A.
So what we do--
this is again the strategy--
you multiply A inverse A times x on the left side.
Is equal to-- sorry-- that should be the lowercase b.
Should be a vector there.
It is equal to A inverse b on the right hand side.
And you notice, it's very important, in the matrix
multiplication video we saw that it's very important the
order in which you multiply matrices.
And since I'm putting A inverse on the far left of
this side of the equality, I have to put it on the far left
of the right hand side of the equality.
And in fact, you would run into trouble if you tried to
switch the order of these.
We wouldn't be able to multiply them.
All right?
So A inverse A, we know is just the identity matrix.
So you get the identity matrix times x is equal
to A inverse b.
So you can find x by finding A inverse times b.
And so now we have A inverse.
Let's see if we can solve the problem.
One point I want to make is that now
that you have A inverse--
I've tried to ask you to solve the problem for
two different b's--
you don't have to go and find A inverse again, right?
You're done finding A inverse.
You just now have to do the multiplication.
So now for number 1, we had b was equal to--
I'm going to write it here, so I don't have to
keep looking over--
1, 2, negative 3.
So A inverse b is going to be equal to-- well I should get
another vector, so I should just have
three components here.
And I'm probably going to have to write out what I get,
because it might be long.
But let's see-- actually, you know what I'm going to do to
make it easier?
Because there's a lot of junk going on here.
So what I'm going to do to make it easier is put the
negative 1/10 in front to start.
Because that negative 1/10 is going to come along with every
term, so I'm just going to put the negative 1/10 in front and
deal with it at the end.
So now I'm just going to multiply b-- which is this 1,
2, negative 3--
by this big matrix here without the
negative 1/10 in front.
So let's look at that.
We're just going to have first row times the column, and
that's going to give me the first position.
So negative 2 times 1 is negative 2.
I'm going to write them all down.
Plus 2 times 2 is 4.
Plus 2 times negative 3 is negative 6.
So that's the first position.
We'll simplify in a moment.
So the next one, I get negative 1 times 1.
That's negative 1.
Then I get negative 4 times 2.
That's negative 8.
So minus 8.
And then I get 1 times negative 3, so minus 3.
So we've got two of the rows done.
We just have to simplify them in a moment.
And now we just do this third component.
So it's the third row of A inverse without that scalar in
front, times the only column of b to
give me the last position.
So 3 times 1 is 3, plus 2 times 2 is 4, so I get 3 plus
4, and then 7 times negative 3 is minus 21.
So what do I get when I write it all out?
I get negative 1/10.
And then--
so negative 8 plus 4-- that looks like a minus 4.
8, 9, 10, 11, 12.
That looks like a negative 12.
It's a lot of adding for me.
I make a lot of adding mistakes, so
we should be careful.
This looks like negative 14.
So this is a matrix that, it's just a vector, right?
All the negative signs will drop out.
I'll get some fractions.
But if it is the correct answer-- which I'm really
hoping it is, because I just did this whole problem and I
hope it's the correct answer-- if it's the correct answer,
then what should it do?
When I take the original A that I had and I multiply it
by this, I should get b.
I should get 1, 2, negative 3.
So you can check your work very easily
to see if it works.
You can take A times this, and see if you get b.
And then you'll know if this is the x we were looking for.
And then let's look at number two.
I just said that b equals 0, 0, 0.
And the point I want to make there is that since this has
an inverse, A inverse, since A has an inverse, A inverse b is
going to be--
in this case--
A inverse times 0, 0, 0, which is going to give you 0, 0, 0.
So the only solution we have in this case--
because A inverse, if I look and I try and multiply every
row by this column, right, I'm going to get 0 in the first
spot, 0 in the second spot, and 0 in the third spot--
so the solution I get--
the x I'm looking for, so that Ax equals 0, 0, 0--
is 0, 0, 0.
And what I just want to mention to you, is that that
is true because A is invertible.
If A were not invertible, you could get other solutions.
Other things might work.
And that's also true, actually, in this case as
well, but it's a little harder to see that it could be
potentially a weird thing.
To solve Ax equals 0, 0, 0, it's sort of like, naturally
we see 0, 0, 0 as a solution.
Right away you can see that, and that's one that we get.
The point I want to make is because A is invertible,
that's the only solution.
And if A were not invertible, you could get other
solutions to that.
So that's something that we haven't seen yet-- we haven't
dealt with yet--
but that is something that can happen.
So I just want to point out that there could be an oddity
if A were not invertible.
But since A is invertible, we get just one solution for both
of these things.
So I'm going to go back and just remind you of a few
things of how we found the inverse matrix,
and then I will stop.
So we were given a matrix A. And to go through the steps of
finding the inverse matrix, what did we do?
The first thing we did was we found the determinant.
Then we found the matrix of minors.
And then I just took that matrix of minors, put the plus
minus grid on top of it so that I got
the cofactor matrix.
And then once I had the cofactor matrix, you just have
to transpose it.
So I came over here.
I transposed that, and I put 1 over the
determinant of A in front.
So the scalar is 1 over the determinant of A times the
transpose of the cofactor matrix.
And that's what gives me A inverse.
So there are a fair number of steps, but you can do them
very systematically, and then you have the inverse matrix
that you're looking for.
And then you can solve for x when you're looking for Ax
equals b, and you know b and you know A. And you do this
same process we just outlined here again, and
that gives it to you.
OK, I think I'll stop there.