hey folks my name is nathan johnston and welcome to lecture 10 of introductory linear algebra today we're going to learn about something called the transpose of a matrix okay and this is a new operation that's actually quite different from anything that we've seen before but fortunately it's actually very very straightforward okay so it's much simpler than matrix multiplication that we saw on the previous lecture okay so what the transpose of a matrix is is it's an operation that just interchanges the rows and columns of that matrix okay so if you've got some m by n matrix to start with then it's transpose is now an n by m matrix right it used to have m rows and n columns now it has n rows and m columns and all it is the way you get it is you just sort of interchange in row and column indices okay so whereas the i j entry used to be a i j now the i j entry is a j i okay so whatever entry used to be you know in the i j entry now it's in the j i entry okay and the way we denote the transpose is just a with a superscript t so if a is your original matrix then a with a superscript t that's the transpose of a matrix okay so let's just do a couple quick examples to make sure that we understand this definition okay to make sure we understand how to compute a transpose of a matrix okay and sort of the way to think about this is if you're given some matrix so 1 3 minus 2 4 in this case then the way to compute the transpose of it is while you're interchanging rows and columns and one way to think about that is you're reflecting the matrix across the main diagonal okay so i've sort of drawn on a green line here i'm just going to imagine reflecting the matrix across that green diagonal line and what i get when i do that is the transpose okay so anything on that green diagonal line the entries one and four they're just going to stay where they are they don't move but then the minus two and the three they have to swap spots okay i'm sort of reflecting their positions across that diagonal line so now the three is gonna be down there and you know the minus two moves up to the top right and that gives me the transpose matrix right okay i mean if you wanna go back and think about this a little bit more directly in terms of the definition okay the one one entry well now that's just the 1-1 entry it didn't move the 1-2 entry well now that's the 2-1 entry the 2-1 entry now that's the 1-2 entry you're just interchanging the row and column subscripts and the 2-2 entry is now the 2-2 entry so it didn't change right you just swap the i and the j the one and the two and those two off-diagonal cases and this works with non-square matrices just fine as well okay so if we start off with the two by four matrix this matrix b here okay then the transpose of it again just sort of imagine drawing on a diagonal line going through the diagonal entries the one one and the two two entries in this case and then just reflect the matrix across that line or another way of thinking about this even is just read the rows but place them in columns okay so the transpose it's going to be this it started off as a two by four matrix now it's a four by two matrix okay whereas the first row used to be one four zero seven now the first column is one four zero seven the second row used to be two minus three six five and now the second column is two minus three six five okay so the transpose just interchanges rows and columns it swaps them around okay and as always we've introduced a new mathematical operation let's look at what properties it has okay so theorem time what properties does the transpose of a matrix have okay and three of these properties are going to be very very not surprising so i'm just going to go over them super quickly the other property though is quite surprising so that's the one that we're actually gonna prove okay so the first property not surprising if you transpose a matrix and then transpose it again you just get back to where you started right so if you turn rows into columns and then turn them back into rows and you're just getting the original matrix back again right if you if you do oh i i j becomes j i then becomes i j well that's back where you start it okay so transposing twice has the same effect as doing nothing okay so a transpose transpose equals a not surprising a plus b transpose is just the sum of the individual transposes again not surprising because basically both of these operations are just happening entry-wise right a plus b that's entry-wise addition and then transpose well that just moves where those entries are around well you could equivalently just move the entries around move the entries around and then add up because everything's just happening entry-wise nothing surprising there in property b property d also not surprising okay if you do a matrix times the scalar and then transpose same thing as if you transpose and then multiply by a scalar because these are both entry-wise operations not surprising the surprising property here is property c okay if you do a product and then transpose well yeah you get the same thing as if you transpose individually and then product and then multiply but you have to be really really careful the order of the multiplication changes okay so this is not a typo right when i do a times b and then transpose what i get is b transpose times a transpose the transpose sort of swapped the order of multiplication okay this is not the same thing as a transpose b transpose all right so that's the property that we're going to prove we're going to prove property c here you can prove all of the other properties in a very analogous manner just work with the relevant definitions but let's prove this property c a b transpose equals b transpose a transpose all right so again just for the sake of sort of pinning down things a little bit more precisely i'm going to specify what dimensions everything are living in so the first matrix a i'm just going to specify that it's got m rows and n columns and then the second matrix b i'm going to specify that it has n rows and p columns okay and just remember this these ends here really do have to match that's why i made the match there otherwise the matrix multiplication doesn't make sense in the first place okay and then i is just going to index some row in the product a times b and j is going to index some column in the product a times b okay all right and then what we've got to do we want to show that two matrices are equal to each other and the way you do that is you show that every entry of the matrix on the left is equal to the corresponding entry of the matrix on the right so i want to show that the ij entry of the matrix on the left remember the matrix on the left was a b transpose i want to show that that equals the i j entry of b transpose times a transpose so let's compute this i j entry and simplify as much as we can okay so a b transpose the ij entry of that is the j i entry of just a times b right because that's what the transpose does it interchanges rows and columns so just swaps these row and column subscripts i j becomes j i okay and then the j i entry of a times b well now let's just use our definition of matrix multiplication okay so remember the way that this works is your outer subscripts are going to be whatever entry you want here i want the ji entry so those are my outer subscripts j on the left i on the right j on the left i on the right and then your inner subscripts are always going to match and you add up over all possible values of those inner subscripts okay so 1 1 and 2 2 all the way up to n n okay in other words dot product of j throw of a with i column of b all right and then not much more we can do there that's sort of as simplified as possible that's that's what that i j entry of a b transpose equals so now let's do the same thing with b transpose a transpose let's compute the i j entry of b transpose a transpose and our hope here is that this is going to be the same quantity all right so this time we've got to do the matrix multiplication first okay so let's use the definition of matrix multiplication we want the i j entry of this product so i take um you know the i1 entry of the matrix on the left and multiply by the 1j entry of the matrix on the right and then do the same thing for i2 and 2j and so on down the line again your outer subscripts are whatever the subscripts down there are i on the left j on the right i on the left j on the right and your inner subscripts are always going to match 1 1 2 2 all the way up to n n and you add up over all possible values of those inner subscripts all right so there i use the definition of matrix multiplication and now i've got a whole bunch of entries of transposed matrices well all the transpose does is swaps the subscripts so b transpo the i j entry of b transpose that's just sorry the i one entry of b transpose that's just the one i entry of b itself and then similarly uh the 1j entry of a transpose that's just the j1 entry of a itself okay so that's all i'm doing in this step i'm just removing all these transposes and the way that i do that is i have to swap all these subscripts so i2 becomes 2i 2j becomes j2 and so on that's how i get rid of the transpose all right great now i've simplified that as much as possible okay i've expressed this ij entry in terms of the entries of a and b themselves all right and now i just stare at these two quantities really really hard and i try to convince myself that they're the same well i've got an aj1 times b1i oh that's exactly what this term here is right aj1 times b1i the fact that they're in the opposite order doesn't matter these are real numbers and real number multiplication is commutative all right so this first term equals this first term similarly the second term equals this second term and so on down the line all of these terms just match up so they're the same okay these are the same quantity so we conclude that the matrices are the same as well because all of their entries are the same right so yeah a b transpose equals b transpose a transpose the transpose had just had the effect of you know transposing each of the matrices and swapping the order of multiplication all righty so let's just do a couple examples okay to make sure that we're comfortable with this idea and maybe it's helpful to see an actual numerical example showing that yeah a b transpose does equal b transpose h transpose but not a transpose b transpose so let's just make up a few random matrices there's an a there's a b and here's a c that's not square and let's do a couple matrix multiplications and transposes okay so to start off with a transpose is just well i mean the two and the three swap spots right b transpose the zero and the minus two are gonna swap spots the off diagonal entries just swap right and then c transpose well if c is a two by three matrix then c transpose is going to be a three by two matrix i mean these rows are just going to become its columns right all right so there's the transposes of those matrices and now let's multiply things together and see how it works with matrix multiplication okay so if you do a times b i'm going to go through this calculation more quickly than in the previous lecture because hopefully you're a little bit more comfortable with matrix multiplication now but remember what it is is it's rows of a dotted with columns of b okay so this top left entry minus 1 where did that come from it was this row 1 2 dotted with 3 minus two so it was three plus minus four which is minus one top right right entry is one two dotted with zero one bottom left entry is three four dotted with three minus two and bottom right entry was three four dotted with 0 1. okay so that's our product a b the product a transpose b transpose well you just do the same thing here okay if i want to compute a transpose b transpose then you just do rows dotted with columns row dot with column row dot with column and row dot with column to get these four entries down here okay and importantly notice that hey this matrix over here is not the transpose of this matrix over here right so doing the product and then the transpose it's not the same as doing the transposes individually and then the product unless you flip the order of multiplication if you do it the other way around if you compute b transpose times a transpose so now you're doing rows of b transpose dotted with columns of a transpose right so row dot with column row dotted with column and then row dotted with column and row dotted with column then you get these four entries and then look at this matrix and compare to this one on the left those are transposes of each other okay so if you do a product and then a transpose you do get the same thing as doing the transposes individually and then the product as long as you swap the order of multiplication as long as you turn the a b into b transpose a transpose all right so those are the transposes of each other so that illustrates that property c from the previous theorem okay as another way of seeing that to you know this sort of this matrix a transpose b transpose can't possibly be the right one to look at let's just think about sizes of matrix multiplication if i do a times c well i get some matrix the point is just that matrix exists that product is a two by three matrix okay but if i try to do uh okay and then if i do c transpose a transpose that also exists i happen to get a three by two matrix in that case okay but if i try to do it the other way if i try to compute a transpose c transpose so if i just try to multiply together the transposes individually well then what'll i get well i'll get a 2 by 2 times a 3 by 2 and oh shoot the inner dimensions don't match up so this matrix doesn't actually even exist okay so that sort of hints at why we have to swap the order of matrix multiplication because the transpose swaps the sizes of the matrix so if you leave the order of multiplication the same well all of a sudden the inner dimensions aren't the same anymore okay so maybe you can't multiply them okay it turns those inner dimensions the transposes turn the inner dimensions into the outer dimensions so you have to swap the order of multiplication as well to make everything work out alrighty so let's just ramp this idea up a little bit more we've talked about hey what do you do if you got a product of two matrices all transposed well what if you've got a product of three matrices all transposed well it turns out you don't need to do too much work uh to figure out what happens in this case we've already done the hard work okay in particular what you can do is you can just throw extra parentheses around everything if i just group a and b together and just think of a b as one matrix okay then what i get is i've got a b that's one matrix times c that's another matrix all transposed okay and i can use my rule about you know matrix times matrix transpose that says well i can just swap the order of this product here i can move that c out in front and bring the transpose on them individually right so here i just use part c of that theorem from up above its second matrix transposed times first matrix a b all transpose okay and now i can use that rule again here i've got a product of two matrices transposed so just swap the order of multiplication okay and when i unravel all of that what i get at the end of the day is abc all transposed equals c transpose b transpose a transpose okay so again the idea is the same you can apply the transpose to each of them individually as long as you completely flip the order of matrix multiplication whatever came last now comes first then the next one then the next one then the next one and so on and this works no matter how many matrices you have if you have a product of four matrices well yeah it's the product of the individual transposes as long as you completely flip the order okay and same as five same uh rule works with five and six and however many matrices you have okay as one final property of the transpose of a matrix let's see how it behaves when we apply it to vectors and in particular before we can take the transpose of it we're going to need to give a shape to those vectors so let's just assume from now on that if ever the shape of a vector is important we want to be a column vector right we could always arrange it in either order either as a row vector or as a column vector but just for the sake of having a convention we're always always always gonna arrange our vectors as column vectors from now on if shape matters okay so let's suppose that we've got two column vectors okay then what happens if we compute this matrix product v transpose w right this is a matrix product now this is a matrix multiplication that we can do now because you know column vectors really are matrices right if they're living in n-dimensional space then w is what it's got n rows in one column and v transpose well if v is a column vector with n rows in one column then v transpose is going to be have one row in n column so that's a product we can do right these are matrices okay in particular it's going to be 1 by n times n by 1 and when we do this matrix multiplication the inner dimensions match they're both n the outer dimensions are both one so we're going to get a one by one matrix when we do this product in other words we're gonna get a number okay so let's do that product right and the product that you get the number that you get is just this number right here which hopefully you recognize right this is the first entry of the two vectors multiplied together plus the product of the second entries plus the product of the last entries and all the ones in between of course that is exactly the dot product of those two vectors okay so the transpose and matrix multiplication taken together give us a way of sort of recovering the dot product it gives us sort of a link between this earlier vector operation that we saw and we're going to use this property a lot going throughout this course because it gives us sort of a way of simplifying a lot of ugly matrix products that we're going to see later on okay so for now just keep this property in the back of your mind if you ever see something like v transpose times w that's the exact same thing as w sorry as v dotted with w it's just another way of writing down the dot product as long as you're thinking of v and w both as column vectors alrighty so that'll do it for today that's enough about the transpose i'll see you next class when we start talking about powers of matrices