If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:17:32

Linear transformations as matrix vector products

Video transcript

let's say I have an n-by-n matrix that looks like this so let me just see if I can do it in general terms in the first row and first column and that entry has a 1 and then everything else the rest of the n minus 1 rows in that first column we're all going to be 0 so it's going to be zeros all the way down to the nth term and then the second column we have a 0 in the first component but then in a 1 in the second component and then it goes zeros all the way down and you keep doing this in the third row in the third order let me say third column although it would have apply to the third row as well that the one shows up in the third component and then it's zeros all the way down and this essentially you have the ones filling up the diagonal of this matrix right here so if you go all the way to the nth column or the nth column vector you have a bunch of zeros until you get you have n minus 1 zeros and then the very last component the nth component there will be a 1 so you have essentially a matrix with 1 down ones down the diagonal this matrix has a bunch of neat properties and we'll explore it more in the future but I'm just exposing you to this because it has one very neat property relative to linear transformations but I'm going to call this the identity matrix and I'll call this I sub n and I call that sub n because it's an N by n identity matrix if I you know I sub 2 would be equal to a 2 by 2 identity matrix would be it would look like that and I sub 3 would look like this 1 0 0 0 1 0 0 0 1 I think you get the point now the neat thing about this identity matrix becomes evident when you multiply it times any vector so we could we have a default we can multiply this guy times the N component vector or a member of RN so let's do that so if we multiply this matrix times let's call this vector X this is X 1 X 2 all the way down to X n what is this going to be equal to if I do so this is vector X right here so if I multiply matrix I my identity matrix I sub N and I multiply it times my vector X where X is a member of RN has n components what am I going to get well I'm going to get 1 times X 1 plus 0 times X 2 plus 0 times X 3 plus 0 times X 4 all of that so it's essentially going to have you can kind of view it as this row dotted with the vector so you're the only nonzero term is going to be the one times the X 1 so it's going to be X 1 sorry let me do it like this so you're going to get another vector in RN you're going to get another vector in RN like that and so the first term is that row essentially being dotted with that column and so you just get X 1 and then the next the next entry is going to be this row or you could view it as the transpose of this row dotted with that column so 0 times X 1 plus 1 times X 2 plus 0 times everything else so the only nonzero term is the one times X 2 so you get an X 2 there and then you keep doing that and what you're going to get you're going to get an X 3 because the only nonzero term here is the third one and you're going to go all the way down until you get an xn but what is this thing equal to this is just equal to X so the neat thing about this identity matrix that we've created is that when you multiply it times any vector you get the vector again the identity matrix times any vector in RN it's only defined for vectors in RN is equal to that vector again and actually the columns the columns of the identity matrix have a special I guess the set of columns has a set a special name they are called so you know if we call this first column e1 and this second column e2 and the third column and the third column let me see e 2 and the third column e 3 and we go all the way to e n these vectors these column vectors here the set of these so 2 e 1 e 2 all the way to e n this is called the standard basis standard basis 4rn so why is it call that well it's the word basis is there so two things must be true these things must span our end and they must be linearly independent it's pretty obvious from inspecting they're linearly independent if this guy has a 1 here and no one else has a 1 there there's no way you can construct that one with some combination of the rest of the guys and you can make that same argument for each of the ones in each of the components so it's clearly linearly independent and then to see that you can span that you can construct any vector with a linear combination of these guys you really just have to you just really have to you know whatever vector you want to construct if you want to construct x1 let me put it this way if you want to construct this vector if you want to let me write it this way let me pick a different one let's say you want to construct the vector a1 a2 a3 all the way down to a n so this is some member of RN you want to construct this vector well the linear combination that would get you this is literally a1 times e1 plus a2 times e2 plus all the way to a n times en right you just this this scalar times this first column vector will essentially just get you what will this look like this will look like a 1 and then you'd have a bunch of zeros you'd have n minus 1 zeros plus 0 and you'd have an a2 and then you'd have a bunch of zeros and then you keep doing that and then you would have zeros a bunch of zeros then you would have an a n and obviously by our definition of vector addition you add all of these things up you get this guy right here and it's kind of obvious because this right here is the same thing as our identity matrix times a 1 I just wanted to expose you to that idea now let's apply what we already know about linear transformations to what we've just learned about this identity matrix I just told you that I can represent any vector like this I can let me write it rewrite it maybe terms of X I can write any vector X I can write any vector X as a linear combination of these of the standard basis which is really just the Kahlo of the identity matrix oh I can write that as x1 times a1 plus x2 times e2 all the way to xn times en and remember each of these column vectors right here I'd like for a 1 is just 1 in the first come in the first entry and then all the rest are 0 is e 2 is a 1 in the second entry and everything else is 0 en is or a 5 is a 1 in the fifth entry and everything else is 0 and this I just showed you and this is a bit obvious from this right here now we know that by definition a linear transformation so if I do so a linear transformation of X a linear transformation of well let me put it this way a linear transformation of X of our vector X is the same thing as taking the linear transformation of this whole thing we do another color is equal to the linear transformation of let me say actually instead of using the T let me use T instead of using L let me use T I used L by accident because I was thinking linear but if I were to take the linear transformation of X because that's the notation we're used to that's the same thing as taking a linear transformation of this thing these they're equivalent so X 1 times e 1 plus X 2 times e 2 all the way to plus X n times en it's equivalent statements now from the definition of linear transformations we know that this is the same thing that the transformation of the sum is equal to the sum of the transformation so this is equal to this is equal to the transformation of X 1 e 1 plus the transformation of X 2 e 2 where this is just any linear transformation let me make that very clear this is any linear transformation any linear transformation this is the this by definition linear transformations have to satisfy these properties so the transformation times X 2 e 2 all the way to this transformation times this last entry the scalar xn times my standard basis vector e and and we know from the other property of linear transformations that the transformation of a vector multiplied by the scalar is the same thing is the same thing as the scalar multiplied by the transformation multiplied by the transformation of the vector that's just from our definition of linear transformations plus x2 times the transformation of e 2 plus all the way that to X let me write all the way to xn times the transformation of en now what is this I could rewrite this so everything I've done so far so the transformation of X is equal to that which I've just using our properties of linear transformations all linear transformations this has to be true for them I get to this and this is equivalent this is equal to if we view each of these as a column vector each of those as a column vector this is equal to what this is equal to the matrix where this is the first column te1 and then the second column is T e2 and then we go all the way to T e n times our times let me put it this way times x1 x2 all the way to xn we've seen this multiple multiple times now what's really really really neat about this is I just started with an arbitrary transformation and I just show that an arbitrary transformation arbitrary linear transformation of X can be re-written as a product of a matrix where I'm taking that same linear transformation of each of our standard basis vectors and I can construct that matrix and multiplying that matrix times my X vector is the same thing as this transformation so this essentially showing you that all transformations all let me be careful all linear transformations can be represented by a it can be a matrix vector product not only did I show you that you can do it but it's actually a fairly straightforward thing to do this is actually a pretty simple op to do let me let me show you an example and this is what I mean I think this is super neat let's say that I just I'm just going to make up some transformation let's say I have a transformation and it's a mapping between let's make it extra interesting between r2 and r3 and let's say my transformation say let's say that T of X 1 X 2 is equal to let's say the first entry is x1 plus 3x2 the second entry is 5 x2 minus x1 and let's say the third entry is for x1 plus x2 this is a mapping I could have written it like this I could write T of any vector in r2 x1 x2 is equal to maybe this is just redundant but I think you get the idea I like this notation better x1 plus 3x2 5 x2 minus x1 and then 4 X 1 plus X 2 this statement and this statement I just wrote are equivalent and I like to visualize this a little bit more now I just told you that I can represent this transformation as a matrix vector product how do I do it well what I do is I take the transformation of this guy so what am i my domain right here is r2 and I produce a vector that's it going to be an RN so what I do is let's say so I'm concerned with multiplying things times things times vectors in r2 so what we're going to do is we're going to start with the identity matrix identity - because that's my domain and it just looks like this 1 0 0 1 I'm just going to start with that and all I do is I apply my transformation to each of the columns each of my standard bases these are the standard basis for r2 right and you might be you know wonder what you know I showed you that their basis how do I know that there's 10th why do they why do they call the standard basis and I haven't covered this in a lot of detail right yet but you could take the dot product of any of these guys with the dot product with any of the other guys and you'll see that they're all orthogonal to each other the dot part any one of these columns with the other is always zero so that's a nice clue and they all have length of one so that's a nice reason why they're called the standard basis but anyway back to our our our attempt to represent this transformation as a matrix vector product so we say look our domain is in r2 so let's start with I two or ar-ar-ar we call it our two by two identity matrix and let's apply the transformation to each of the its column vectors where each of its column vectors are a vector in the standard basis for r2 so our stand so T of so I could so I'm going to write it like this T of first the first column is T of this column and then the second column is going to be T of 0 1 and I know I'm getting Messier with my handwriting but what is T of what is T of the vector 1 0 well we just go here and we construct another vector so we get 1 plus 3 times 0 is 1 then we get 5 times 0 minus 1 so that's minus 1 right x2 is 0 in this case and then we get 4 times 1 plus 0 so that's just 4 so that's T of 1 0 and then what is T of let me T of 0 1 T of 0 1 is equal to so we have 0 plus 3 times 1 is 3 then we have 0 minus 1 is minus 1 let me make sure I did this one right what was this this was 5 times 0 minus 1 and then now if 5 times 0 minus x1 which is 1 now this case it's 5 times I'll have to be careful let me this is 5 times x2 x2 is 1 so 5 times 1 minus 0 so it's 5 and then I have 4 times 0 plus x2 plus 1 and I just showed you if I replace if I replace each of these standard basis vectors with the transformation of them what do I get I get this vector right here so I already figured out what they are i get if i replace if I take this guy and evaluate it it's the vector 1 minus 1 4 and then this guy is a vector 3 5 + 1 + I so what we just did and this is I don't know I for some reason I find this to be pretty amazing we can renounce formation here as the product of any vector so if we define this to be equal to a so we could really we could write we could write it this way we can now write our transformation our transformation of x1 x2 can now be re-written as the product of this vector I'll write it in green the vector 1 3 - 1 5 4 1 times our input vector x1 x2 which is super cool because now we just have to do a matrix multiplication instead of this and if we have some processor that does this super fast we can then use that and what's really I don't know I think this is it's especially elegant because what happens here is we applied the transformations to each of the columns of a 2 by 2 matrix and we got a 3 by 2 matrix we got a 3 by 2 matrix and we know what happens when you multiply 3 by 2 matrix times a vector that's in r2 or you can almost view this as a 2 by 1 matrix you're going to get you're going to get a vector that is in r3 right because you're going to have these guys times that guy is going to be the first term these ties and these guys going to be the second term these guys times those guys are going to be the third term so if I by kind of creating this 3 by 2 matrix we have actually created a mapping from r2 to r3 anyway I for some reason I find this to be especially neat hopefully at least you find this somewhat instructive