-
-
Well, after the last video,
hopefully, we're a little
-
familiar with how you
add matrices.
-
So now let's learn how
to multiply matrices.
-
And keep in mind, these are
human-created definitions for
-
matrix multiplication.
-
We could have come up with
completely different ways to
-
multiply it.
-
But I encourage you to learn
this way because it'll help
-
you in math class.
-
And we will see later that
there's actually a lot of
-
applications that come out
of this type of matrix
-
multiplication.
-
So let me think of
two matrices.
-
I will do two 2 by 2 matrices,
and let's multiply them.
-
Let's say-- let me pick some
random numbers: 2,
-
minus 3, 7, and 5.
-
And I'm going to multiply that
matrix, or that table of
-
numbers, times 10, minus 8--
let me pick a good number
-
here-- 12, and then minus 2.
-
So now there might be a strong
temptation-- and you know in
-
some ways it's not even an
illegitimate temptation-- to
-
do the same thing with
multiplication that we did
-
with addition, to just multiply
the corresponding
-
terms. So you might be tempted
to say, well, the first term
-
right here, the 1, 1 term, or
in the first row and first
-
column, is going to
be 2 times 10.
-
And this term is going
to be minus 3 times
-
minus 8 and so forth.
-
And that's how we added matrices
so maybe it's a
-
natural extension to multiply
matrices the same way.
-
And that is legitimate.
-
One could define it that way,
but that's not the way it is
-
in the real world.
-
And the way in the real world,
-
unfortunately, is more complex.
-
But if you look at a
bunch of examples I
-
think you'll get it.
-
And you'll learn that
it's actually fairly
-
straightforward.
-
So how do we do it?
-
So this first term that's in
the first row and its first
-
column, is equal to essentially
this first row's
-
vector-- no, this first
row vector--
-
times this column vector.
-
Now what do I mean
by that, right?
-
So it's getting it's row
information from the first
-
matrix's row, and it's getting
it's column information from
-
the second matrix's column.
-
So how do I do that?
-
If you're familiar with dot
product, it's essentially the
-
dot product of these
two matrices.
-
Or without saying it that fancy,
it's just this: it's 2
-
times 10, so 2-- I'm going to
write small-- times 10, plus
-
minus 3 times 12.
-
I'm going to run out of space.
-
And so what's this second
term over here?
-
Well, we're still on the first
row of the product vector but
-
now we're on the
second column.
-
We get our column information
from here.
-
So let's pick a good color--
this is a slightly different
-
shade of purple.
-
So now this is going to be--
I'll do that in another
-
color-- 2 times minus 8-- let me
just write out the number--
-
2 times minus 8 is minus 16,
plus minus 3 times minus 2--
-
what's minus 3 times minus 2?
-
That is plus 6, right?
-
So that's in row 1 column 2.
-
It's minus 16 plus 6.
-
And then let's come down here.
-
So now we're in the
second row.
-
So now we're going to use--
we're getting our row
-
information from the first
matrix-- I know this is
-
confusing and I feel bad for you
right now, but we're going
-
to a bunch of examples and
I think it'll make sense.
-
So this term-- the bottom left
term-- is going to be this row
-
times this column.
-
So it's going to be 7 times
10, so 70, plus 7 times 10
-
plus 5 times 12, plus 60.
-
And then the bottom right term
is going to be 7 times minus
-
8, which is minus 56 plus
5 times minus 2.
-
So that's minus 10.
-
So the final product is going to
be 2 times 10 is 20, minus
-
36, so that's minus 16
plus 6, that's 10.
-
90-- was that what I said?
-
No, it was-- 70, plus
60, that's 130.
-
And then minus 56 minus
10, so minus 66.
-
So there you have it.
-
We just multiplied this matrix
times this matrix.
-
Let me do another example.
-
And I think I'll actually
squeeze it on this side so
-
that we can write this side out
a little bit more neatly.
-
So let's take the matrix and
now 1, 2, 3, 4, times the
-
matrix 5, 6, 7, 8.
-
Now we have much more space to
work with so this should come
-
out neater.
-
OK, but I'm going to do the
same thing, so to get this
-
term right here-- the top left
term-- we're going to take--
-
or the one that has row 1 column
1-- we're going to take
-
the row 1 information from
here, and the column 1
-
information from here.
-
So you can view it as
this row vector
-
times this column vector.
-
So it results, 1 times
5 plus 2 times 7.
-
-
Right?
-
There you go.
-
And so this term, it'll be this
row vector times this
-
column vector-- let me do that
in a different color-- will be
-
1 times 6 plus 2 times 8.
-
Let me write that down.
-
So it's 1 times 6
plus 2 times 8.
-
-
Now we go down to
the second row.
-
And we get our row information
from the first vector-- let me
-
circle it with this color--
and it is 3 times 5
-
plus 4 times 7.
-
-
And then we are in the bottom
right, so we're in the bottom
-
row and second column.
-
So we get our row information
from here and our column
-
information from here.
-
So it's 3 times 6
plus 4 times 8.
-
-
And if we simplify,
this is 5 plus--
-
Well actually, let me just
remind you where all the
-
numbers came from.
-
So we have that green
color, right?
-
This 1 and this 2, that's
this 1 and this 2,
-
this 1 and this 2.
-
Right?
-
And notice, these were in the
first row and they're in the
-
first row here.
-
And this 5 and this 7?
-
Well, that's this 5 and this
7, and this 5 and this 7.
-
So, interesting.
-
This was in column 1 of the
second matrix and this is in
-
column 1 in the product
matrix.
-
And similarly, the
6 and the 8.
-
That's this 6, this 8, and then
it's used here, this 6
-
and this 8.
-
And then finally this 3 and the
4 in the brown, so that's
-
this 3, this 4, and
this 3 and this 4.
-
And we could of course
simplify all of it.
-
This was 1 times 5 plus 2 times
7, so that's 5 plus 14,
-
so this is 19.
-
This is 1 times 6 plus 2
times 8, so it's 6 plus
-
16, so that's 22.
-
This is 3 times 5
plus 4 times 7.
-
So 15 plus 28, 38, 43-- if my
math is correct-- and then we
-
have 3 times 6 plus 4 times 8.
-
So that's 18 plus
32, that's 50.
-
So now let me ask you-- just so
you know that the product
-
matrix-- just write
it neatly-- is
-
19, 22, 43, and 50.
-
So now let me ask
you a question.
-
When we did matrix addition we
learned that if I had two
-
matrices-- it didn't matter what
order we added them in.
-
So if we said, A plus B-- and
these are matrices; that's why
-
I'm making them all bold-- we
said this is the same thing as
-
B plus A, based on how
we define matrix
-
addition, B plus A.
-
So now let me ask
you a question.
-
Is multiplying two matrices,
is AB-- that's just means
-
we're multiplying A and B-- is
that the same thing as BA?
-
-
Does it matter?
-
Does the order of the matrix
multiplication matter?
-
And so, I'll tell you right
now, it actually matters a
-
tremendous amount.
-
And actually there are certain
matrices that you can add in
-
one direction that you can't
add in the other-- oh, that
-
you can multiply in one way but
you can't multiply in the
-
other order.
-
And well, I'll show you that
in an example-- but just to
-
show that this isn't even equal
for most matrices, I
-
encourage you to multiply these
two matrices in the
-
other order.
-
Actually let me do that.
-
Let me do that really
fast just to prove
-
the point to you.
-
So let me delete all
this top part.
-
-
Let me delete all of it, and
actually I can delete to this.
-
So hopefully, you know that when
I multiply this matrix
-
times this matrix, I got this.
-
So let me switch the order--
and I'll do it fairly fast
-
just so as to not bore you-- so
let me switch the order of
-
the matrix multiplication.
-
This is good as this is another
example-- so I'm going
-
to multiply this matrix: 5, 6,
7, 8, times this matrix-- and
-
I just switched the order; and
we're testing to see whether
-
order matters-- 1, 2, 3, 4.
-
Let's do it-- and I won't do all
the colors and everything,
-
I'll just do it systematically.
-
I think you just have to see a
lot of examples here-- So this
-
first term gets its row
information from the first
-
matrix, column information
from the second matrix.
-
So it's 5 times 1 plus 6 times
3, so it's 5 times 1--
-
Let me just write,
actually edit.
-
I'm going to skip a step here--
OK so it's 5 times 1
-
plus 6 times 3, plus 18.
-
What's the second term here?
-
It's going to be 5 times
2 plus 6 times 4.
-
So 5 times 2 is 10, plus
6 times 4 is 24.
-
Right, now we just took
this row times this
-
column right here.
-
OK now we're down here for the
set-- so then we're doing this
-
row, this element right here at
the bottom left is going to
-
use this row, and this column.
-
So it's 7 times 1
plus 8 times 3.
-
8 times 3 is 24.
-
And then finally, to get this
element we're essentially
-
multiplying this row times this
column, so it's 7 times 2
-
is 14, plus 8 times
4, plus 32.
-
So this is equal to 5
plus 18 is 23, 34.
-
What's 7 plus 24?
-
That's 31, 46.
-
So notice, if we called
this matrix A and this
-
is matrix B, right?
-
In the last example, we showed
that A times B is equal to 19,
-
22, 43, 50.
-
And we just showed that, well,
if you reverse the order, B
-
times A is actually this
completely different matrix.
-
So the order in which
you multiply
-
matrices completely matters.
-
So I'm actually running
out of time.
-
In the next video I going talk
a little bit more about the
-
types of matrix-- well, one, we
know that order matters--
-
and in the next video I'll
show that what type of
-
matrices can be multiplied
by each other.
-
When we added or subtracted
matrices, we just said, well
-
they have to have the same
dimensions because you're
-
adding or subtracting
corresponding terms. But
-
you'll see with multiplication
it's a little bit different.
-
And we'll do that in
the next video.
-
See you soon.
-