Matrix multiplication is really
useful since you can pack
a lot of computation into just
one matrix multiplication operation.
But you should be careful of how you use them.
In this video I want to
tell you about a few properties of matrix multiplication.
When working with just raw
numbers or when working with
scalars, multiplication is commutative.
And what I mean by that is
if you take three times
five, that is equal
to five times three and
the ordering of this multiplication doesn't matter.
And this is called the commutative
property of multiplication of real numbers.
It turns out this property that
you can, you know, reverse
the order in which you
multiply things, this is not true for matrix multiplication.So
concretely, if A and
B are matrices, then in
general, A times B is
not equal to B times
A. So just be careful of that.
It's not okay to arbitrarily reverse
the order in which you are multiplying matrices.
So, we say that matrix multiplication
is not commutative, it's a fancy
way of saying it.
As a concrete example, here
are two matrices, matrix 1100
times 0020, and if you multiply
these two matrices, you get this result on the right.
Now, let's swap around the order of these two matrices.
So, I'm going to take these
two matrices and just reverse them.
It turns out if you multiply
these two matrices, you get
the second answer on the
right and, you know, real
clearly, these two matrices are
not equal to each other.
So, in fact, in
general, if you have
a matrix operation like
A times B. If A
is an m by n matrix
and B is an by
M matrix, just as an example.
Then, it turns out
that the matrix A times
B right, is going
to be an m by
m matrix, where as
the matrix b x a
is going to be an n
by n matrix so the
dimensions don't even match, right,
so A times B and
B times A may not even be the same dimension.
In the example on the left,
I have all two by two matrices,
so the dimensions were the same,
but in general reversing the
order of the matrices
can even change the dimension
of the outcome so
matrix multiplication is not commutative.
Here's the next I want to talk about.
So, when talking about real
numbers, or scalars, let's
see, I have 3 times 5 times 2.
I can either multiply 5
times 2 first, and
I can compute this as 3 times 10.
Or, I can multiply
three times five for us and
I can compute this as, you
know fifteen times two and
both of these give you the same answer, right?
Each, both of these is equal
to thirty so Whether I
multiply five times
two first or whether I
multiply three times five
first because well, three
times five times two
is equal to three times
five times two.
And this is called the
associative property of role number multiplication.
It turns out that matrix multiplication is associative.
So concretely, let's say
I have a product of three
matrices, A times B times
C. Then I can
compute this either as A
times, B times C
or I can compute this as
A times B, times C
and these will actually give me the same answer.
I'm not going to prove this, but
you can just take my word for it, I guess.
So just be clear what I mean by
these two cases, let's look
at first one first case.
What I mean by that is
if you actually want to compute
A times B times C, what
you can do is you can
first compute B times C.
So that D equals B time
C, then compute A times
D. And so this is really
computing a times B
times C. Or, for
this second case, You can
compute this as, you can
set E equals A
times B. Then compute E
times C. And this
is then the same as a
times B times C
and it turns out that both
of these options will give
you, is guaranteed to give you the same answer.
And so we say that matrix
multiplication does enjoy the associative property.
Okay?
And don't worry about the terminology
associative and commutative that's
why there's not really going to use
this terminology later in these
class, so don't worry about memorizing those terms.
Finally, I want to
tell you about the identity
matrix, which is special matrix.
So let's again make the
analogy to what we know
of raw numbers, so when dealing
with raw numbers or scalar
numbers, the number one,
is you can think
of it as the identity of multiplication,
and what I mean by that
is for any number
Z, the number 1
times z is equal
to z times one, and
that's just equal to
the number z, right, for any raw number.
Z. So 1 is
the identity operation and so it satisfies this equation.
So it turns out that
in the space of matrices as
an identity matrix as well.
And it's unusually denoted i,
or sometimes we write it
as i of n by
n we want to make explicit the dimensions.
So I subscript n by n
is the n by n identity matrix.
And so there's a different identity
matrix for each dimension n and are a few examples.
Here's the two by two identity
matrix, here's the three
by three identity matrix, here's the four by four identity matrix.
So the identity matrix, has the
property that it has
ones along the diagonals,
right, and so on and
is zero everywhere else, and
so, by the way the
one by one identity matrix is just a number one.
This is one by one matrix
just and it's not a very
interesting identity matrix and informally
when I or others are being
sloppy, very often, we will
write the identity matrix using fine notation.
I draw, you know, let's
go back to it and just write 1111,
dot, dot, dot, 1
and then we'll, maybe, somewhat
sloppily write a bunch of zeros there.
And these zeros, this
big zero, this big zero
that's meant to denote that this
matrix is zero everywhere except for
the diagonals, so this is just
how I might sloppily write
this identity matrix
She says property that for
any matrix A, A times
identity i times A
A. So that's a lot
like this equation that we have up here.
One times z equals z times
one, equals z itself so
I times A equals A
times I equals A. Just
make sure we have the dimensions right, so
if A is a n
by n matrix, then this
identity matrix that's an
m by n identity matrix.
And if A is m by
n then this identity
matrix, right, for matrix
multiplication make sense that has a
m by n matrix because
this m has a match
up that m And
in either case the outcome
of this process is you
get back to Matrix A, which
is m by n.
So whenever we write
the identity matrix I, you
know, very often the dimension rightwill
be implicit from the context.
So these two I's they' re
actually different dimension matrices, one
may be N by N, the other
is M by M But when
we want to make the dimension
of the matrix explicit, then sometimes
we'll write to this I subscript
N by N, kind of like we have up here.
But very often the dimension will be implicit.
Finally, just want to point
out that earlier I
said that A times B
is not in general equal
to B times A, right?
That for most matrices A and B, this is not true.
But when B is the identity matrix, this does hold true.
That A times the identity
matrix does indeed equal to
identity times A, it's
just that this is not true
for other matrices, B in general.
So that's it for the
properties of matrix multiplication.
And the special matrices, like the
identity matrix I want to
tell you about, in the next
and final video now linear algebra review.
I am going to quickly tell you
about a couple of special
matrix operations, and after
that you know everything you need
to know about linear algebra for this course