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:9:52

Video transcript

let's say we have three matrices a B and C and let's say that B and C are both M by n matrices and that a is a let's call it a K by M matrix and what I want to do is figure out whether matrix products exhibit the distributive property so let's test out a times B plus C a times B plus C and of course these are all matrices so B just to make things clear be the matrix B could be represented as just a bunch of column vectors v1 v2 all the way to BN and the matrix C can also be represented as just a bunch of column vector so could with the matrix a but I don't have to draw that just yet so the matrix C could just be represented as a bunch of column vectors C 1 C 2 all the way to C and maybe I should've drawn this taller these are column vectors so they actually have some verticality to them I think you've seen that multiple times so what is a times B plus C well let's let's figure out what B plus C is this is equal to a times B plus C when you add B plus C the definition of matrix addition is you just add the corresponding columns which essentially boils down to adding the corresponding entries so that is going to be equal to the first column is going to be equal to b1 plus c1 the second column is going to be b2 plus c2 and you're going to go all the way to the nth column is going to be BN plus CN now by our definition of matrix matrix products this is this product right here is going to be equal to its going to be equal to the matrix where we take the matrix a and multiply it by each of the column vectors of this matrix here of B plus C which as you can imagine these are both M by n in fact they both have to have the same dimensions for this addition to be well-defined so this is going to be an M by n matrix are you told you that a is a K by and we know this is well-defined because a has the same number of columns as B plus C has a row so this is well-defined and this is going to be equal to let me switch colors again it's going to be equal to a times the column vector b1 plus c1 the second column is going to be a times the column vector B 2 plus c2 running out of space it's going to be all the way to a times the column vector B n plus C n this is our definition of matrix matrix products you just take the first matrix and you multiply it times each of the column vectors of the second Matrix and we can we can say that because we've already defined matrix vector products so what is this thing on the right equal to I'll keep switching colors this is equal to we know that matrix vector products exhibit the distributive property I don't even remember when I did that video but we've assumed it for a while it's a very trivial thing to prove so this each of these columns are going to be equal to let me write it this way this guy right here can be rewritten the first column is going to be a time's the column vector b1 plus a time's the column vector c1 this term right there is the same thing as that term right there the next one is going to be a b2 plus matrix a time's the vector c2 and then the nth column is going to be the matrix so we have keep going and then the nth column is going to be the matrix a time's the column vector B n plus matrix a time's the column vector C C and just like just like that now we can write this matrix as the sum of two different matrices so what is this going to be equal to this is equal to this is equal to let me see I'll rest write it right here this is equal to a B 1 as the first column a B 2 is the second column all the way to a B n as a third column so that's these terms right there and then if I were to add to that the matrix a times vector c1 a time's the column vector c2 these are just the different columns of this matrix and we just then have the matrix a time's the column vector C n these represent these terms so clearly if I add these two matrices I just add the corresponding column vectors and I'll get this matrix up here but what is this equal to this this right here by definition this is the matrix a times the matrix B right the definition of matrix products is you take the first matrix and multiply times the column vectors of the second Matrix and by the same argument I guess you could say this is equivalent to a times C and all of this remember we just got a bunch of equal signs is equal to a times B plus C so now we can say definitively that as long as the products are well-defined and the sums are well-defined so they all have to have the correct dimensions that a times B plus C is equal to a B plus a C so it matrix products do exhibit the distributive property at least in this direction and I say that because remember matrix products are not commutative so we don't know necessarily that B plus C times a is equivalent to that in fact most of the times these two things are not equivalent so we don't know quite yet that if we reversed this whether it's still going to exhibit the distributive property so let's try to do that let's do that I'll do a little bit quicker because I think you know the general argument here so let's take B plus C times a and I'll just write a is its column vectors a1 a2 all the way to a has m columns if I remember correct right a has m columns so all the way to a M and by the definition of matrix products this is going to be equal to this is going to be equal to the matrix B plus C is just a matrix right we can represent it as a sum of two matrix but this is just a matrix so it's B plus C times each of the column vectors of a so it's going to be equal to B plus C times a 1 B plus C times a 2 all the way to B plus C times a n and I once again I've many videos ago that I think we showed that the mate that matrix vector products are distributive that they are distributive so we can just distribute this vector along these two matrices and if I haven't proven it yet it's actually a very straightforward proof to do so we could say that this is equal to this is equal to B a 1 plus C a 2 that's the first column the second column is B times a 2 plus C times a 2 all the way to B times a n plus C times a n plus C times a n and then what is this equal to well I think we can skip well I'll write it out this is equivalent to B times a this is a one oh this is an A one right here B times a 1 and then B times a 2 all the way to be a n plus the vector C times a1 C times a 2 all the way to C times a n right this guy represents these terms right there this guy represents the first terms in each of these column vectors and this by the definition of matrix products is just equivalent to be a and then this is just equivalent to ca so now we've seen that the distributive property works both ways with matrix matrix vector products that b plus c times a is equal to b a plus C a and that a times B plus C a times B plus C is equal to a B plus a C now the one thing that you have to be careful of is that these two things are not equivalent or you just figured out that this guy is equal to B a plus C a so the distribution works in both ways but when you're dealing with matrices it's very important to keep order to keep your order so that this is going to be you know you have the a second here so it's be a plus C a you can't say that this is equal to a B plus AC you can't just switch these up because we've shown multiple times or we've talked about it multiple times that matrix products are not commutative you can't just switch the order of the products but we've at least shown in this video that the distributive property works both ways