WEBVTT mathematics/algebra-2/eaton
00:00:00.000 --> 00:00:02.400
Welcome to Educator.com.
00:00:02.400 --> 00:00:05.600
In today's lesson, we will be covering matrix multiplication.
00:00:05.600 --> 00:00:11.700
In a previous lesson, we discussed scalar multiplication, which is multiplying a constant by a matrix.
00:00:11.700 --> 00:00:17.700
This time, we will be talking about multiplying one matrix by another.
00:00:17.700 --> 00:00:23.800
Before you proceed with matrix multiplication, you need to verify that the dimension requirement has been met.
00:00:23.800 --> 00:00:31.300
So, suppose that matrix A is m by n, and matrix B has dimensions of p by q.
00:00:31.300 --> 00:00:36.200
The product of these two matrices can be obtained only if n = p.
00:00:36.200 --> 00:00:45.100
Now, what is that saying? What that is saying is that the number of columns of the first matrix must equal the number of rows of the second matrix.
00:00:45.100 --> 00:00:52.300
So, in order to find AB, to find that product, to be allowed to do that kind of multiplication,
00:00:52.300 --> 00:01:38.800
the number of columns of the first matrix must equal the number of rows of the second matrix.
00:01:38.800 --> 00:01:48.800
OK, once you find that product, the resulting product matrix, AB, will have dimensions of m times q.
00:01:48.800 --> 00:01:54.700
So, the product matrix dimensions will have the number of rows of the first matrix and the same number of columns as the second matrix.
00:01:54.700 --> 00:01:58.600
To make this more concrete, let's look at an example.
00:01:58.600 --> 00:02:17.500
If matrix A equals 2, -1, 4, 0, and matrix B equals 3, 4, 2, 1, 0, -3, 0, -2; my first question is, "Can I multiply them--can I find AB?"
00:02:17.500 --> 00:02:24.800
Well, this has one row and four columns; it is a 1x4 matrix.
00:02:24.800 --> 00:02:32.500
This has four rows and two columns; it is a 4x2 matrix; so this gives me 1x4 and 4x2.
00:02:32.500 --> 00:02:42.000
So, all I have to do is see, "OK, does this second number equal this first number?" and yes, the second number does equal the first number.
00:02:42.000 --> 00:02:44.300
Therefore, I can multiply those.
00:02:44.300 --> 00:02:47.700
Now, what are going to be the dimensions of the product matrix?
00:02:47.700 --> 00:02:55.300
Well, the dimensions of the product matrix...this is a 1x4, multiplied by a 4x2 matrix; and AB is going to have
00:02:55.300 --> 00:03:04.100
the same number of rows as this first matrix (which is 1), and the same number of columns as the second matrix (which is 2).
00:03:04.100 --> 00:03:07.800
So, the product matrix is going to be a 1x2 matrix.
00:03:07.800 --> 00:03:13.300
So, the important thing is: before you multiply, make sure that you verify that the dimension requirement is met--
00:03:13.300 --> 00:03:19.900
that the second number of the first matrix is equal to the first number of the second matrix.
00:03:19.900 --> 00:03:37.600
And to predict the dimensions of the product matrix, you take this first number and this second number; and that will give you the product matrix dimensions, 1x2.
00:03:37.600 --> 00:03:44.500
OK, multiplying by matrices is not exactly what you would expect.
00:03:44.500 --> 00:03:51.200
It is not like addition and subtraction of matrices, where (in addition and subtraction) we just took the first matrix
00:03:51.200 --> 00:03:58.000
and added the corresponding element of that to the corresponding element of the second matrix (and the same in subtraction).
00:03:58.000 --> 00:04:02.900
You might think, "OK, I am just going to multiply the corresponding elements by each other."
00:04:02.900 --> 00:04:07.300
But it is actually more complicated than that; and you need to take it step-by-step.
00:04:07.300 --> 00:04:23.700
So, the best way to understand this is to go through an example: so let's look at a pair of matrices and multiply them out.
00:04:23.700 --> 00:04:37.500
OK, this is my first matrix; I am going to call it A; and then, I want to multiply it by another matrix, which I am going to call B.
00:04:37.500 --> 00:04:44.000
So, before I multiply, I have to make sure that they meet the dimension requirements.
00:04:44.000 --> 00:04:52.100
And A has two rows, and it has four columns; B has four rows and two columns.
00:04:52.100 --> 00:04:59.600
So, I am allowed to multiply these, because this second number equals the first number.
00:04:59.600 --> 00:05:11.600
My product matrix, AB, is going to have two rows and two columns; it is going to be a square matrix with dimensions 2x2.
00:05:11.600 --> 00:05:17.100
Now, as you read up here, it says that the element in row I and column J of the product...
00:05:17.100 --> 00:05:23.300
so the element in a certain row and column of the product of the matrices A and B...
00:05:23.300 --> 00:05:29.600
is obtained by forming the sum of the products of the corresponding elements in row I
00:05:29.600 --> 00:05:35.100
(in a certain row of matrix A) and the corresponding column, J, of matrix B.
00:05:35.100 --> 00:05:45.600
What does this mean? Well, instead of just saying row I and column 1, let's start with row 1, column 1.
00:05:45.600 --> 00:05:50.400
I want to find the element that goes right here, in row 1, column 1.
00:05:50.400 --> 00:06:01.300
And the way I am going to do that is: I am going to go over here to row 1, and I am going to go here in column 1;
00:06:01.300 --> 00:06:09.300
and I am going to multiply 3 by 4 and find that product, and then I am going to add that to the next product, 2 by 0.
00:06:09.300 --> 00:06:14.700
Then, I am going to add that to the next product, 0 by 1, to 0 by 3, and so on.
00:06:14.700 --> 00:06:20.300
So, row 1, column 1; then I am going to go to the corresponding row in A and the corresponding column in B.
00:06:20.300 --> 00:06:39.500
And working this out, this gives me 3 times 4, plus 2 times 0, plus 0 times 3, plus 1 times -2.
00:06:39.500 --> 00:06:50.000
Working that out, that is going to give me 12 + 0 + 0 - 2; 12 - 2 is 10.
00:06:50.000 --> 00:06:53.900
Therefore, my row 1, column 1 element is 10.
00:06:53.900 --> 00:07:09.000
OK, next let's work on row 1, column 2; that means I am going to go to row 1 here in A, and column 2 here, in B, and do the same operations.
00:07:09.000 --> 00:07:26.200
So, row 1, column 2: that is 3 times -1, plus 2 times 2, plus 0 times 1, plus 1 times 0.
00:07:26.200 --> 00:07:41.500
OK, working that out, this gives me -3 + 4 + 0 + 0; that is 4 and -3, so that is 1.
00:07:41.500 --> 00:07:47.700
Therefore, my row 1, column 2 element for the product is 1.
00:07:47.700 --> 00:07:52.500
All right, now I need to work with this second row; and I am going to think about what position this is right here.
00:07:52.500 --> 00:08:06.900
This is row 2, column 1; that means I am going to go to row 2 here and column 1 in B and do the same thing.
00:08:06.900 --> 00:08:26.800
OK, row 2, column 1: -1 times 4, plus 0 times 0, plus 4 times 3 (so the third element here and the third element here),
00:08:26.800 --> 00:08:31.900
plus the fourth element here and the fourth element there.
00:08:31.900 --> 00:08:46.300
All right, figuring this out, this is going to give me -4 + 0 + 12 + -2, or - 2; look at it either way.
00:08:46.300 --> 00:09:06.300
This is going to give me -4 and 12, which is 8, minus 2...actually, let's make this clearer...plus 12, minus 2...it is going to give me...
00:09:06.300 --> 00:09:22.300
let's see...that is -4, 0, 4 and 3, 2 and -2; OK, so this is going to give me 12 - 6, or 6.
00:09:22.300 --> 00:09:37.300
Now, the next row and column position: I have row 2, column 2.
00:09:37.300 --> 00:10:01.000
Here is row 2; here is column 2; it is going to give me -1 times -1, plus 0 times 2, plus 4 times 1, plus 2 times 0.
00:10:01.000 --> 00:10:18.400
OK, so that is going to come out to...-1 times -1 is 1, plus 0, plus 4, plus 0; 4 + 1 is 5, so I am going to get 5 right here.
00:10:18.400 --> 00:10:26.300
So again, if I just looked here, and I said, "OK, that is row 1, column 2," then I would get that
00:10:26.300 --> 00:10:38.100
by going to row 1 here and column 2 here and multiplying each of those, and then finding the sum of their products.
00:10:38.100 --> 00:10:46.600
So, even with a bigger matrix, you can always find a particular position by using this method.
00:10:46.600 --> 00:10:52.900
OK, there are some properties that govern matrix multiplication that you need to be familiar with.
00:10:52.900 --> 00:11:00.300
If A, B, and C are matrices for which products are defined, and k is any scalar, then these properties hold.
00:11:00.300 --> 00:11:07.500
The first property you will recognize as the associative property for multiplication.
00:11:07.500 --> 00:11:19.100
And what it says is that I can either multiply A times B, find that product, and then multiply by C;
00:11:19.100 --> 00:11:27.500
or I can multiply B times C, find that product, and then multiply A; and I will get the same result.
00:11:27.500 --> 00:11:35.100
OK, next I see the same thing here (it is the associative property), except this time, it also involves multiplying a scalar.
00:11:35.100 --> 00:11:38.600
So, here I have matrix multiplication, and then I also have a scalar.
00:11:38.600 --> 00:11:43.700
And I can either multiply the two matrices and then multiply the scalar times that product;
00:11:43.700 --> 00:11:51.800
or I can multiply the scalar times the first matrix, then multiply that product by the second matrix;
00:11:51.800 --> 00:11:56.500
or the scalar and the second matrix, and the product by the first matrix.
00:11:56.500 --> 00:12:06.500
So, it doesn't matter which order I do the multiplication in, in this situation; these two first, then the other two.
00:12:06.500 --> 00:12:12.200
Next, you are going to recognize the distributive property.
00:12:12.200 --> 00:12:19.600
And the distributive property, as usual, says that, if I have these two matrices, B + C,
00:12:19.600 --> 00:12:23.300
and I am multiplying A by them, another approach that would give the equal result
00:12:23.300 --> 00:12:30.900
is to first multiply A and B, and then add that product to the product of A and C--the distributive property.
00:12:30.900 --> 00:12:43.400
And again, the distributive property would work if I placed these as follows, added A and B, and then multiplied C.
00:12:43.400 --> 00:12:48.500
The same thing: I could say the product of A and C, plus the product of B and C.
00:12:48.500 --> 00:12:55.300
What is very important to realize is that the order that you multiply matrices in matters a lot.
00:12:55.300 --> 00:13:03.500
So, if I say, "Oh, I am going to do AB; does this equal BA?" no, it does not always equal that.
00:13:03.500 --> 00:13:08.200
Sometimes it does; but very often it does not--these are two different things.
00:13:08.200 --> 00:13:16.700
Therefore, matrix multiplication is not commutative; it does not follow the commutative property,
00:13:16.700 --> 00:13:31.700
and so you can't simply say, "A times B is the same as B times A"; you can't just change the order of those two.
00:13:31.700 --> 00:13:41.200
The first example: suppose A is 3x4; B is a matrix that is 4x3; C is 3x3; and D is 4x4.
00:13:41.200 --> 00:13:44.400
What are possible defined products of the four matrices?
00:13:44.400 --> 00:13:53.800
Recall that, for a product to be defined, the second number of the first matrix has to equal the first number of the other matrix.
00:13:53.800 --> 00:14:00.000
So, let's first look at AA; is that defined?
00:14:00.000 --> 00:14:12.000
Well, if I have 3x4, and I am trying to multiply it by 3x4; these two are not equal, so this is not defined.
00:14:12.000 --> 00:14:23.300
OK, and let's make a list here of the ones that are defined, because that is what they are asking me for--where the product is defined.
00:14:23.300 --> 00:14:31.400
If I take A times B, well, the second number of A is equal to the first number of B; so that is defined.
00:14:31.400 --> 00:14:41.700
Now, let's do it in the opposite order, BA: if I have 4x3 and 3x4, that is also defined.
00:14:41.700 --> 00:14:48.500
OK, now AC: 3x4 and 3x3--that is not defined.
00:14:48.500 --> 00:15:03.600
Now, if I put C first--if I say CA--it is 3x3 and 3x4, and these two are equal, so CA would have a defined product.
00:15:03.600 --> 00:15:10.600
OK, now 3x4 and 4x4; that is AD; that is defined, because of the 4 and the 4.
00:15:10.600 --> 00:15:23.500
However, if I put D first--if I say I am going to do DA--that is going to give me the D first, which is 4x4, and then A, 3x4; that is not defined.
00:15:23.500 --> 00:15:34.600
OK, moving on to B: B times B (BB) is 4x3 and 4x3; that is not defined.
00:15:34.600 --> 00:15:40.500
BC is 4x3 and 3x3; these two are equal, so BC is defined.
00:15:40.500 --> 00:15:53.300
CB is 3x3 and 4x3--not defined; OK, BD--4x3 and 4x4--not defined.
00:15:53.300 --> 00:16:04.700
But if I put the D first, then I would get 4x4 and 4x3; that is defined, so DB is defined.
00:16:04.700 --> 00:16:14.900
OK, now I am up to C; 3x3 and 3x3--CC--that is a square matrix, so that is defined; the multiplication is defined for that.
00:16:14.900 --> 00:16:28.000
OK, now, CD--3x3 and 4x4--is not defined; then I try the D first--it is not going to matter: 4x4 and 3x3 is still not defined.
00:16:28.000 --> 00:16:39.800
OK, let's go to D: I can multiply DD, because I have 4x4 and 4x4, and that means that, of course,
00:16:39.800 --> 00:16:45.300
since this is a square matrix, this second number and the first number there are going to be equal.
00:16:45.300 --> 00:16:50.600
So, these are my defined products; I have 3, 6, 8 defined products.
00:16:50.600 --> 00:16:56.200
So, these are all the ones where the second number of the first matrix--
00:16:56.200 --> 00:17:01.400
the number of columns--was equal to the first number of the second matrix--the number of rows.
00:17:01.400 --> 00:17:08.900
And I can perform multiplication of these sets of matrices.
00:17:08.900 --> 00:17:18.200
OK, now doing some matrix multiplication: before I proceed, I am going to make sure that the product is defined--that I can do it.
00:17:18.200 --> 00:17:32.200
So, I have a 2x2 matrix here, and I have a 2x2 matrix here; therefore, multiplication is allowed.
00:17:32.200 --> 00:17:45.700
I am rewriting this down here, since this second number is equal to this first number (so multiplication is allowed).
00:17:45.700 --> 00:17:55.900
Using the method we discussed: my product matrix is going to be 2x2 also--the first number here and the second number there.
00:17:55.900 --> 00:18:06.000
I am expecting a 2x2 matrix; so let's first look for this position--row 1, column 1.
00:18:06.000 --> 00:18:10.900
I am going to go to row 1 here and column 1 here and work with those two.
00:18:10.900 --> 00:18:19.000
I am going to say 3 times 0 (that product), and I am going to add it to the product of 2 times 4.
00:18:19.000 --> 00:18:30.800
That is going to give me 0 + 8, which is 8; so the element in row 1, column 1 is 8.
00:18:30.800 --> 00:18:44.000
Now, row 1, column 2--I am going to go to row 1 here--row 1 of this first matrix--and column 2 of the second matrix.
00:18:44.000 --> 00:19:00.600
And that is going to give me...row 1 is 3, times 6; so row 1, column 2 is 2 and -1, so plus 2 times -1.
00:19:00.600 --> 00:19:10.100
It is going to give me 18 - 2, which equals 16.
00:19:10.100 --> 00:19:30.000
OK, now the next position is row 2, column 1; working with that, that is going to give me a -1 times 0, plus 4 times 4,
00:19:30.000 --> 00:19:37.100
which is going to equal 0 plus 16, which is 16.
00:19:37.100 --> 00:19:45.600
Next, I want to find...this is row 2, but it is column 2 this time.
00:19:45.600 --> 00:20:08.400
So, I go to row 2 here and column 2 here: -1 times 6, plus 4 times -1--that is going to give me -6 - 4, or -10.
00:20:08.400 --> 00:20:15.200
As expected, my product matrix is also 2x2; and again, if I picked any element in here--
00:20:15.200 --> 00:20:23.200
let's say I picked this 16--I could simply say, "OK, that is row 2, column 1."
00:20:23.200 --> 00:20:30.400
And I would get that by multiplying and finding the products of row 2 of the first matrix
00:20:30.400 --> 00:20:36.300
and column 1 of the second matrix, and adding those up--finding the sum of those.
00:20:36.300 --> 00:20:44.200
This is the result of the multiplication of these two matrices.
00:20:44.200 --> 00:20:54.700
Example 3: I have 1, 2 rows and 3 columns, so I have a 2x3 matrix and a 3x2 matrix.
00:20:54.700 --> 00:20:58.200
These two are equal, so I am allowed to multiply them.
00:20:58.200 --> 00:21:07.000
The product of these two is going to have this number of rows (2) and this number of columns.
00:21:07.000 --> 00:21:15.300
So, I am going to get a matrix that is going to be 2x2 for my product here.
00:21:15.300 --> 00:21:33.200
OK, I am setting up the product matrix right here, and first looking for row1 , column 1; so I am going to use row 1 here, column 1 here.
00:21:33.200 --> 00:21:54.000
2 times 0 is the product; then I am going to add that to the next product, which is -1 times 3, and the third product, which is 0 times -2,
00:21:54.000 --> 00:22:11.000
which equals...2 times 0 gives me 0, minus 3, plus 0; so it is -3--row 1, column 1, right here, is -3.
00:22:11.000 --> 00:22:35.600
Row 1 right here, but column 2: I am going to take 2 times 1; OK, in row 1, column 2, the next set of elements is -1 and 6,
00:22:35.600 --> 00:22:48.200
so plus -1 times 6; then I still have row 1, column 2; I have 0 times -1; figure that out--
00:22:48.200 --> 00:23:00.100
that is 2 - 6 + 0, so it is just 2 - 6, and that gives me -4, so row 1, column 2 is -4.
00:23:00.100 --> 00:23:12.500
OK, moving on to the second row: the first thing I need to find is row 2, column 1--row 2 here, column 1 here.
00:23:12.500 --> 00:23:31.700
0 times 0, plus 3 times 3, plus -2 times -2; OK, that is going to give me 0 + 9, and then -2 times -2 is positive 4, so plus 4.
00:23:31.700 --> 00:23:37.000
9 + 4 is 13, so row 2, column 1, gives me 13.
00:23:37.000 --> 00:23:45.200
OK, next I need to find row 2, column 2.
00:23:45.200 --> 00:24:08.600
Row 2, column 2: 0 times 1, plus 3 times 6, plus -2 times -1 is going to give me 0 + 18... -2 and -1 is positive 2, so that is 20.
00:24:08.600 --> 00:24:13.900
OK, and as expected, I got a 2x2 matrix, and I could find any position by just honing in and saying,
00:24:13.900 --> 00:24:22.000
"OK, that is row 1, column 2, so I am going to multiply row 1 elements and column 2 elements and add those products."
00:24:22.000 --> 00:24:26.900
Now, at first, I know this seems like a lot of work; but you should go step-by-step, find the row, find the column,
00:24:26.900 --> 00:24:32.700
write out what you need to write out; and then, later on, as you get faster, you can just do a lot of it in your head.
00:24:32.700 --> 00:24:39.600
But right now, since there are a lot of steps, go to each row and each column, and figure out what those are.
00:24:39.600 --> 00:24:54.500
OK, Example 4 asks us to do some multiplication and some addition, so I need to find the sum of the products AB + AC.
00:24:54.500 --> 00:24:59.200
But remembering the distributive property, I can actually do this more easily.
00:24:59.200 --> 00:25:16.000
Recall that, according to the distributive property for matrix multiplication, AB + AC = A(B + C).
00:25:16.000 --> 00:25:22.100
I would rather do it this way, because matrix multiplication is difficult; addition is much easier.
00:25:22.100 --> 00:25:31.800
This way, instead of multiplying twice and adding once, I would rather just add these together, and then only have to multiply one time.
00:25:31.800 --> 00:25:36.000
So, I am going to approach this by using the distributive property.
00:25:36.000 --> 00:25:42.700
So, what I am going to do is find A times (B + C), and it is going to be equivalent to this.
00:25:42.700 --> 00:26:06.800
Let's start out by finding B + C: B is 0, 3, 1, 4; that is B; and I am going to add that to C, which is right here: 1, 2, 0, -3.
00:26:06.800 --> 00:26:12.400
Now, recall from matrix addition: all you have to do is add the corresponding elements,
00:26:12.400 --> 00:26:15.400
and you are going to get a matrix of the same dimensions as the original.
00:26:15.400 --> 00:26:18.400
And these are both 2x2 matrices, so I can add them.
00:26:18.400 --> 00:26:30.600
0 + 1 is going to give me 1; 3 + 2 is going to give me 5; 1 + 0--I am going to get 1; 4 - 3 is 1.
00:26:30.600 --> 00:26:42.400
Now, this gives me B + C; the next thing I need to do is multiply A times B + C.
00:26:42.400 --> 00:26:50.900
So, let's go back up here and look at what A is: A is...2 and -1 are the elements, and 3, 2; that is A.
00:26:50.900 --> 00:27:04.100
I am going to go ahead and add that to what I discovered that B + C is: 1, 5, 1...oh, excuse me, multiply--we are now multiplying that.
00:27:04.100 --> 00:27:15.000
All right, recall from matrix multiplication that I have to make sure I am even allowed to multiply these.
00:27:15.000 --> 00:27:24.300
And this is a 2x2 matrix, and this is a 2x2 matrix; so this second number is equal to the first number here, so I can multiply them.
00:27:24.300 --> 00:27:33.400
All right, row 1, column 1--this position on my product matrix--is going to give me row 1 here and column 1 here.
00:27:33.400 --> 00:27:44.300
That is 2 times 1, plus 3 times 1; that is just 2 + 3, so that is 5.
00:27:44.300 --> 00:27:58.600
OK, now, row 1, column 2: row 1 here, and column 2 here: 2 times 5, plus 3 times 1.
00:27:58.600 --> 00:28:05.000
2 times 5 is 10, plus 3--that is going to give me 13 for this position.
00:28:05.000 --> 00:28:27.000
OK, the next row, row 2, column 1: -1 times 1, plus 2 times 1; that is going to give me -1 plus 2, which equals 1.
00:28:27.000 --> 00:28:30.500
So, for row 2, column 1, I get 1.
00:28:30.500 --> 00:28:45.600
Now, row 2, column 2, right here, is -1 times 5, plus 2 times 1.
00:28:45.600 --> 00:28:52.600
-1 times 5 is -5, plus 2 gives me -3.
00:28:52.600 --> 00:28:59.500
So, this gives me A times (B + C), which is equivalent to what they asked me to find, AB + AC.
00:28:59.500 --> 00:29:05.400
So, the key step here was recognizing that you could use the distributive property there, because that made a lot less work.
00:29:05.400 --> 00:29:10.000
I only had to do one set of matrix multiplication, instead of 2.
00:29:10.000 --> 00:29:17.300
So, I first used the distributive property; and then I had to add B and C.
00:29:17.300 --> 00:29:21.500
So, I added B and C, and got this sum matrix, B + C.
00:29:21.500 --> 00:29:30.300
And then, I multiplied it by A; so here is (B + C) times A, using my typical method to get this result.
00:29:30.300 --> 00:29:36.000
That concludes this lesson of Educator.com on matrix multiplication, and I will see you next time!