# Transpose of a matrixÂ product

## Video transcript

I've got a handful
of matrices here. I have the matrix A
that's an m by n matrix. You can see it has n
columns and m rows. And actually let me
throw in one entry there. It might be useful. This is the jth column. So the row is going to
look like this-- amj. That's that entry right there. And then I have matrix
B defined similarly, but instead of being an m by n
matrix, B is an n by m matrix. And so this entry right here. Let me just-- I realize
this might be useful. This is going to be my nth row. And it's going to
be my jth column. And then I also wrote
out their transposes. So if you look at the transpose
of B, B was an n by m matrix. Now the transpose is going
to be an m by n matrix. And each of its rows
become its columns. And the same thing I did for A.
It's transpose is right there, A was m by n. The transpose is n by m. And each of these rows
because each of these columns. Now fair enough. Let's define two new
matrices right now. Let's define the matrix
C. Let me do it over here. I think the real estate will
be valuable in this video. Let's define my
matrix C as being equal to the product of A and B. So what are going to
be the dimensions of C? Well, an m by n matrix times
an n by m matrix, these two have to be equal even for the
matrix product to be defined. And that's going to result
with an m by m matrix. Now let's define another matrix. Let's call it D. And
it's equal to B transpose times A transpose. And the dimensions are going
to be the same, because this is an m by n times an n by m. So these are the same. So which is a requirement for
this product to be defined. And so the dimensions of
B are going to be m by m. So let's explore a little bit
what the different entries of C are going to look like. So let me write my
matrix C right here. So it's just going to have a
bunch of entries-- c11, c12, all the way to c1m. You can imagine because
it's an m by n matrix, you're going to
have cmm over here. You know how this drill goes. But what I'm
curious about is how do we figure out what
the general cij is? How do we figure out what
a particular entry is? We know that C is the
product of A and B. So to get to a
particular entry in C-- and we've seen this
before-- so cij-- It's going to be--
you can view it as the dot product
of the ith row in A with the jth column
in B, just like that. And what's that
going to be equal to? It's going to be equal to ai1
times b1j plus ai2 times b2j. And you're just
going to keep going until you get to
the last term here, ain times the last
term here, bnj. Fair enough. Now what about our matrix D? What are its entries
going to look like? So D, similarly, it's
going to look like-- you're going to have d11, d12,
all the way to d1m. You're going to have dmm. I could keep putting
entries here. But I'm curious about just
that sum in general entry here. Let's say I want
to find d sub ji. That's what I want to find. So I want to find a general way
for any particular entry of d. The jth row and
ith column, which is a little bit different
than the convention we normally use
for these letters. But it's fine. The first one is D's row. The second one is D's--
is this entry's column. So how do we figure that out? So d sub j i. It's going to be equal to-- D is
the product of these two guys. So to get the jth row and
ith column entry here, we essentially take the
dot product of the jth row here, which is that right there,
with the ith column of A, which is that right there. So I'm going to take
the dot product of that. And you might already see
something interesting here. This thing right here is
equivalent to that thing right there. And this thing right here
is equivalent to that thing right there, because
we took the transposes. But let's actually
just write it out. So what is this dot product
going to be equal to? Well, it's going to be bij. Let me write it this way. It's going to bij times ai1. Or we could write
it as ai1 times b1j. And it's going to be
plus b2j times ai2, which is the same thing
as ai2 times b2j. And you're going to keep going
until you get b and j times ain. Or you could write
that as ain times bnj. Now notice something. These two things are equivalent. They're completely
equivalent statement. The d sub ji is
equivalent to c sub ij. Let me write that. Or I could write c sub ij
is equivalent to d sub ji. Or another way you could say
it is, all the entries that's at row i, column j in C is
now in row j, column i in D. And this is true
for all the entries. I stayed as general as possible. So what does this mean? This is the definition
of a transpose. So we now get that C
transpose is equal to D. Or you could say that C
is equal to D transpose. Now this is pretty
interesting, because how did we define these two? We said that our matrix C is
equal to the matrix product A and B. And we said that D is
equal to our matrix product B transpose times A transpose. I did those definitions
right there. Here are the definitions. And now we just found out that D
is equal to the transpose of C. So we could write that
C transpose, which is the same thing as A times
B transpose, is equal to D. So it is equal to D, which is
just B transpose A transpose. And this is a pretty
neat takeaway. If I take the product
of two matrices, and then transpose it, it's
equivalent to switching the order, or transposing
them, and then taking the product of the
reverse order-- B transpose, A transpose--
which is a pretty, pretty neat take away. And you could
actually extend this to an arbitrary
number of matrices that you're taking
the product of. I'm not proving it
here, but it's actually a very simple extension
from this right now. If you take the
matrices, let's say A-- let me do different
letters-- X, Y, Z, if you take their product
and then transpose it, it's equal to Z transpose,
Y transpose, X transpose. I haven't proven
this general case, and you could keep doing
it with four or five or n matrices multiplied by each
other, but it generally works. And you could
essentially prove it using what we proved
in this video right here, that you take the
product of two matrices, take their transpose,
it's equal to the product of their transposes
in reverse order.