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:04

Matrix vector products as linear transformations

Video transcript

I think you're pretty familiar with the idea of matrix vector product so what I want to do is that in this video is show you that taking a a product of a vector with the matrix is equivalent to a transformation it's actually a linear transformation so let me show you let's say we have some matrix a and let's say that its terms are or its columns are v1 their vector column vectors v2 all the way to VN so this guy has n columns let's see he has m rows so it's an M by n matrix and let's say I define some transformation let's say I define some transformation let's say my transformation goes from R n goes from RN to R M this is the domain I can take any vector in RN and it will map it to some vector in RM and I define my transformation so T of X where this is some vector in RN is equal to a my this this this is this a let me write it in this color right here and it should be bolded I kind of get careless sometimes with the bolding that big bold a times the vector X so the first thing you might say Sal gee this you know this this transformation looks very odd relative to how we've been defining transformations or functions so far so the first thing we have to just feel comfortable with is the idea that this is a transformation so what are we doing we're taking something from RN and then what is ax produce what is ax produce so we can we can ax if we write ax like this if this is X where its X 1 X 2 it's going to have n terms because it's an N it's in RN this can be re-written as X 1 times v1 plus x2 times v2 all the way to X n times VN so it's going to be a sum of a bunch of of these column vectors and each of these column vectors v1 v2 all the way to VN what set are they members of this is an M by n matrix so they're going to have M the the matrix has m rows or each of these column vectors will have M entries so all of these guys are members of RM so if I just take a linear combination of all of these guys I'm going to get another member of RM so this guy right here is going to be a member of RM another vector so clearly by multiplying my vector X times a I'm mapping I'm creating a mapping from our RN and let me pick another color - 2 RM and I'm saying it in very general terms maybe n is 3 maybe M is 5 who knows but I'm saying in very general terms and so if this is a particular instance a particular member of set RN so it's that vector our transformation or our function is going to map it to this guy right here and this guy will be a member of RM and we could call him a X or maybe if we said ax equal B we could call him the vector B whatever but this is our transformation mapping so this does fit our kind of definition or our terminology for a function or a transformation is a mapping from one set to another but it still might not be satisfying because you know everything we saw before looked kind of like this you know we if we had a transformation I would write it like you know the transformation of I would write you know X 1 and X 2 and xn is equal to and I'd write and I'd write I'd write a bunch of I'd write M terms here in commas and like we know that how does this relate to that and to do that I'll do a specific example so let's say that I had the matrix let's say that I have the matrix let me do a different letter let's say I have my matrix B and it is a fairly simple matrix let's say 2 minus 1 3 & 4 and I define some transformation so I define some transformation so I define some transformation T and it goes from R 2 to R 2 artoo and I define t.t of some vector x is equal to this matrix b times that vector X now what would that equal well the matrix is right there it's let me write it in purple 2 minus 1 3 and 4 times X X 1 X 2 and so what is this equal well this equals another vector it equals a vector in the co-domain r2 where the first term is 2 times X 1 I'm just doing the definition of matrix vector multiplication 2 times X 1 2 X 1 plus minus 1 times X 2 or minus X 2 that's that row times our vector and then the second row times that vector we get 3 times X 1 3 times X 1 plus 4 times X 2 plus 4 times X 2 so this is what we might be more familiar with and I can write I could rewrite this transformation I could rewrite this transformation as T of X 1 X 2 is equal to 2 X 1 minus X 2 comma let me scroll over a little bit comma 3 X 1 plus 4 X 2 so hopefully you're satisfied now that a matrix multiplication it isn't some new exotic form of transfer transformation that they really are just another way that this this statement right here is just another way of writing this exact transformation right here now the next question you might ask and I already told you the answer to this at the beginning of the video is is multiplication by a matrix always going to be a linear transformation and what are the two constraints for being a linear transformation we know that the transformation of two vectors a plus B the sum of two vectors should be equal to the sum of their transformations transformation of a plus the transformation of B and then the other requirement is that the transformation of a scaled version of a vector should be equal to a scaled version of the transformation these are our two requirements for being a linear transformation so let's see if matrix multiplication applies there and I've touched on this in the past and I've even told you that you know you should prove it and we already kind of I've already assumed you know but I'll prove it to you here because I'm tired of telling you that you know you should prove it I should do it at least once so let's see matrix multiplication if I multiply a matrix a times some vector X we know that let's say let me write it this way we know that this is equivalent to I set our matrix we could just write it let's say this is an M by n matrix we can write any matrix as just a series of column vectors so this guy could have n column vectors so let's say it's v1 v2 all the way to VN column vectors and each of these guys are going to have M components times x1 x2 all the way down to xn and we've seen this multiple multiple times before this by the definition of matrix vector multiplication is equal to x1 times v1 that times that this scalar times that vector plus x2 times v2 all the way to plus xn times VN this was by definition of a matrix vector multiplication and of course this is going to and I did this at the top of the video this is going to have right here this this vector is going to be a member of our M it's going to have M components so what happens if I take if I take some if I take some matrix a some M by n matrix a and I multiply it times I multiply it times the sum of two vectors a plus B where so I could rewrite this as this thing right here so my matrix a times the sum of a plus B the first term will just be a1 plus b1 second term is a2 plus b2 all the way down to a n plus BN this is the same thing as this I'm not saying a of a plus B I'm saying a times let me put it maybe I should put a dot right there I'm multiplying the matrix not Adam maybe I want to be careful my notation this is the matrix vector multiplication it's not some type of new matrix dot product but this is the same thing as this multiplication right here and based on what I just told you up here which we've seen multiple multiple times this is the same thing as a1 plus v1 times the first column in a which is that vector right there this a is the same as this a so times v1 plus a2 plus b2 times v2 all the way to plus a n plus BN times VN all I did Ichigo the each X I term here is just being replaced by an AI plus bi terms so if you so each X 1 here is replaced by an a1 plus b1 here so this is this is equivalent to this and then from the fact that we know that well vector vector multiple vector vector products times scalars exhibit the distributive property we can say that this is equal to this is equal to a1 times v1 let me actually write all of the a1 terms well let me write this a 1 times v1 plus b1 times v1 plus a2 times v2 plus b2 times v2 all the way to plus a n times VN plus BN times VN and then if we just reassociate this if we just group all of the A's together all of the a terms together we get a 1 plus a sorry a 1 plus let me write it this way a 1 plus x v1 plus a2 times v2 plus all the way a n times VN I just grabbed all the a terms we get that plus all the B terms all the B terms I'll do in this color all the B terms are like that so plus b1 times v1 plus b2 times v2 all the way to plus BN times VN that's that guy right there is equivalent to this statement up here I just regrouped everything which is of course equivalent to that statement over there but what's this equal to this is equal to this is equal to my vector these columns are remember the column for the matrix capital a so this is equal to the matrix capital a times a1 a2 all the way down to a n which was our vector a and what's this equal to this is equal to plus these V ones these are the columns for a so it's equal to the matrix a times my vector B b1 b2 all the way down to BN this is my vector B so we just saw that we just showed you that if I if I add my two vectors a and B and then multiply it by the matrix it's completely equivalent to multiplying each of the vectors times the matrix first and then adding them up so we've satisfied and this is for any mate an M by n matrix so we've now satisfied this first condition right there and then what about the second condition and this one's even more straightforward to understand C times a1 so let me write it this way fire water right well let me just the vector a times I'm sorry the matrix capital A time's the vector lowercase a let me do it this way because I want times the vector C lowercase a so I'm multiplying my vector times the scalar first is equal to I can write my big matrix a i've already labeled its columns its v1 v2 all the way to VN that's my matrix a and then what does C a look like see a you just multiply that scalar times each of the terms of a so it's ca1 ca2 all the way down to C a n and what is this equal we know this we've seen this this show multiple times before right there so it just equals this equals I'll write a little bit lower it equals C a 1 times this column vector times V 1 plus C a 2 times v2 times the sky all the way to plus CA n times VN times VN times the vector V N and if you just factor this C out once again scalar multiplication times vectors exhibits the distributive property I believe I've done a video on that but it's very easy to prove so this will be equal to C times I'll just stay in one color right now a 1 V 1 plus a 2 V 2 plus all the way to a n VN and what is this thing equal to well that's just our matrix a that's just our matrix a times our vector or our matrix upper case a I maybe I'm overloading the letter A and then my matrix upper case a times my vector lowercase a times my lowercase a right where the lowercase a is just you know this thing right here a 1 a 2 and so forth this thing up here was the same thing as that so I just showed you that what if I take my matrix and multiply it times some vector that was multiplied by a scalar first that's equivalent to first multiplying the matrix times the vector and then multiplying by the scalar so we we've shown you that matrix times vector products or matrix vector products satisfy this condition of linear transformations and this condition so the big takeaway right here is matrix multiplication and this is a important takeaway matrix matrix multiplication or matrix products with vectors vectors is always a linear transformation linear transformation and this is a bit of a side note in the next video I'm going to show you that any linear transformation this is incredibly powerful can be represented by a matrix product or by by any transformation on any vector can be equivalently I guess written as a product of that vector with a matrix has huge repercussions and you know just as a sidenote kind of tying this back to your everyday life you probably you know you have your your xbox or your Sony Playstation and you know you have these 3d graphic programs where you're running around and shooting at things and the way that the the software renders those programs where you can see things from every different angle you know you have a cube and then if you if you kind of move this way a little bit the cube will look more like this and it gets rotated and you move up and down these are all transformations of matrices and we'll do this in more detail that and or these are all transformations of vectors or the positions of vectors and I'll do that in a lot more detail and all of that is really just matrix multiplications so all of these things that you're doing in your fancy 3d games on your Xbox your PlayStation they're all just matrix multiplications I'm going to prove that to you the next video and so when you have these graphics cards or these graphics engines all they are and this is kind of a you know where we're jumping away from the theoretical but all these you know graphics processors are are hard-wired matrix multipliers if I have just a generalized some type of CPU I have to in software write how to multiply matrices but if I'm right making an Xbox or something and 99% of what I'm doing is just rotating these these abstract objects and displaying them in transformed ways I should have a dedicated piece of hardware a chip that all it does it's hardwired into it is multiplying matrices and that's what those graphics processors or graphics engines really are