Main content

## Linear algebra

### Course: Linear algebra > Unit 2

Lesson 7: Transpose of a matrix- Transpose of a matrix
- Determinant of transpose
- Transpose of a matrix product
- Transposes of sums and inverses
- Transpose of a vector
- Rowspace and left nullspace
- Visualizations of left nullspace and rowspace
- rank(a) = rank(transpose of a)
- Showing that A-transpose x A is invertible

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Transpose of a matrix product

Taking the transpose of the product of two matrices. Created by Sal Khan.

## Want to join the conversation?

- Forgive my ignorance, but what is the practical application of transposing a matrix product? When will we actually use this type of math? Thanks, T.S.(6 votes)
- From the top of my head I can think of two applications of the transpose:

1) Within maths, but potentially useful due to extensions: We know we can take the transpose of a determinant without changing it. So by performing a transpose we might be able to transform a determinant into a more familiar form, making it easier to solve for any applications which require a determinant.

2) In quantum physics, we use matrices and other linear algebra objects and their compositions quite regularly. We also take their transpose fairly frequently (specifically, we take the Hermitian conjugate, which combines transpose and complex conjugate). So that is a notable application.(6 votes)

- At6:07Sal says that Cij is equivalent to Dji, but both elements were apparently selected at random so there is no guarantee that the i in C is the same value as the i in D. Wouldn't one have to specify a connection between Cij and Dji when selecting Dji in order to assert that they are equal? How would such a restriction be stated mathmatically?(2 votes)
- Maybe Sal should have been clearer. While the i,j in Cij are arbitrary, the i,j in Dji are
*not*. Instead, they are automatically*fixed*by the i, j in Cij. For example, if we chose (at random) i,j to be 2,3, then element C23 would be selected (at random), BUT the corresponding element in D would be*fixed*to be D32. No random selection allowed here.

The idea is this: Every element in C has*one*associated element in D equal to its value. Its (row, col) location turns out to be a swap of the (row_, col_) location of the element in C. Thus, if the element in C was Cij (row_ = i, col_ = j), then the "partner" element in D is Dji (row = j, col = i).(8 votes)

- At7:37, Sal concludes that the transpose of the product of two matrices is simply the matrices themselves transposed and then multiplied in reverse order. Would this technique work for products of more than two matrices? For example, if we have (ABC)^T, would that equal (C^T) (B^T) (A^T)?(2 votes)
- Great question,

Let us use the fact that matrix multiplication is associative, that is (AB)C=A(BC). Then we can write (ABC)^T=((AB)C)^T. AB is just a matrix so we can use the rule we developed for the transpose of the product to two matrices to get ((AB)C)^T=(C^T)(AB)^T=(C^T)(B^T)(A^T).

That is the beauty of having properties like associative. It might be hard to believe at times but math really does try to make things easy when it can.(9 votes)

- There is a serious problem. If matrix A is a m x n matrix, B is a n x k matrix , the product will be mxk. If I take the transpose of the matrix, it will be the transpose of B times the transpose of A, which is not possible, a n x k matrix can not mutiply a m x n matrix! What's wrong?(1 vote)
- If you take the transpose of B, you will get a k x n matrix, and if you take the transpose of A, you will get an n x m matrix. A k x n matrix can be multiplied by an n x m matrix.(4 votes)

- Ok, is it necessary for A to be m*n and B to be n*m. Can't B be n*k? Will this still work?(2 votes)
- Well yes, it won't work. Because if your matrix
**A**is an n x m matrix, and**B**is an m x k matrix, the product of**AB**will be defined, but the product of**A^T**and**B^T**will not be defined. So this works only for matrices of the**same type**.(1 vote)

- At2:50he says "we've seen this before." I watched all five videos in the matrix multiplication section and I don't remember anything about finding a specific entry in a matrix product. What video was it in?(1 vote)
- at8:07what happens when there are 3 matrices? can we apply the same on them as well?(2 votes)
- Is this refering to algebra?(2 votes)
- At2:18, Sal defined a matrix D as the transpose of B times the transpose of A. I am having a hard time understanding why he couldn't have done the transpose of A times the transpose of B. Is it because you would get a n x n matrix instead of

m x m?(1 vote)- Go back to https://www.khanacademy.org/math/linear-algebra/matrix-transformations/composition-of-transformations/v/linear-algebra-matrix-product-examples and work forward from there, asking any questions you want answered.

Maybe some of the videos on matrices in:

algebra: https://www.khanacademy.org/math/algebra-home/alg-matrices

precalc: https://www.khanacademy.org/math/precalculus/precalc-matrices

would also be helpful, to get a better grasp of how matrices work.(1 vote)

- I'm confused. C and D are supposed to be mxm matrices, but Sal is numbering the last row/col in each matrix as mxn. Shouldn't it be mxm?(1 vote)
- I think that is an oversight. For an mxm matrix, the bottom right element would have an index of mm as you say.(1 vote)

## 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.