Dot Product of Matrices
- زمان مطالعه 0 دقیقه
- سطح خیلی سخت
دانلود اپلیکیشن «زوم»
این درس را میتوانید به بهترین شکل و با امکانات عالی در اپلیکیشن «زوم» بخوانید
متن انگلیسی درس
Let’s generalize the dot product notion to matrices you can see this overly used matrix once again five
12 six minus three zero.
14 If I want to multiply it by three we would have a scalar times a matrix situation similar to what
we saw in the last lesson.
The shape of the matrix doesn’t change.
It just gets scaled.
We keep the shape and multiply each element by three.
The result is 15 36 18 minus 9 0 42.
But how do we multiply a matrix with another matrix using the same concept.
The dot product we can multiply two matrices.
There is a compatibility measure here too.
We can only multiply a matrix of dimensions and by N with a matrix of dimensions And by k basically
the second dimension of the first matrix has to match the first dimension of the second matrix.
So we can multiply a two by three Matrix with a three by 1 matrix.
Actually we can multiply it by a three by two three by three three by four and so on until three by
What’s important is that those threes are matching.
Similarly if I want to multiply a five by seven matrix compatible matrices for multiplication are 7
by 1 7 by 2 7 by 7 and so on.
OK fair what about the dimensions of the product itself.
When multiplying an Mbai by end matrix with an end by K matrix the output is an M by K matrix for instance
a two by three Matrix times a three by six matrix will give us a two by six matrix a three by four matrix
times a four by two Matrix.
Well give us a three by two Matrix a 100 by 300 matrix times 300 by three Matrix will result in a 100
by 3 matrix basically whichever dimension is repeating will disappear in the resulting matrix OK.
Now we know the compatibility measure.
How do we actually multiply matrices then.
Let’s start with two matrices to 8.
Mine is 4 and one minus seven.
These are two vectors or three by one matrices right.
In order to multiply them they need to have matching forms to find their dot product.
We transpose the first one and get a 1 by 3 times 3 by 1 form.
This is done because when we have a dot product we always multiply a row vector times a column vector.
Remember that the result of this multiplication is a one by one form or a scalar.
We reached this scalar by multiplying the corresponding elements and summing everything up.
We’ve already talked about that.
We just didn’t know the concept was the same.
Time to take the two major C’s and multiply them.
The first is the same one from the beginning of the example.
The second will be a three by 2 matrix 2 minus 1 8 0 3 0.
The first thing we need to do is check their compatibility two by three times three by two.
The forms are matching.
So we’re good to go.
The next step is to find the shape of the output matrix the matching dimension disappears.
So the resulting shape is two by two.
Finally we must do that multiplication itself.
Let me remind you two important things first major cities are nothing more than a collection of vectors.
And second when we have a dot product we always multiply a row vector times a column vector.
How does this apply to our case.
Well the first matrix is made up of two row vectors five 12 6 and minus 3 0 14.
The second matrix is made up of 2 column vectors 2 a 3 and minus 1 0 0.
In order to find the dot product of the two matrices we just need to find the dot product of the vectors
that are made of let’s find the dot product of five 12 6 and to a three it is five times two plus 12
times eight plus six times three which equals 124 easy 124 is also the first element of the output matrix.
Next we find the dot product of 5 12 6 with the second vector minus 1 0 0 it is five times minus 1 plus
12 times 0 plus 6 times 0.
The result is minus 5 which is the second element of the output matrix great.
Let’s get to the second row of the initial matrix.
There we have minus 3 0.
14 we repeat the same procedure.
The dot product of the vector minus 3 0 14 and to a three equals minus three times two plus 0 times
8 plus 14 times 3.
We get 36.
This is the first value on the second row of the output matrix.
Notice that the row vectors from the first Matrix determine the row and the output matrix in the same
way the column vectors from the second Matrix determine the column of the respective value.
Finally we find the last dot product we get three.
And the product matrix has been found great
in terms of code.
Things are very simple.
We use the method and the DOT and the two matrices and immediately get the result.
While this lesson is getting a bit long we should do another example just to solidify the knowledge.
I’ll take two big matrices this one and that one.
The first matrix is four by five.
The second matrix is five by two.
First things first are the major C’s compatible.
Yes they are second.
What will the shape of the output major XP of course war by two next.
Let’s divide the first matrix into row vectors and the second matrix in the column vectors.
There is a total of four row vectors and two column vectors in order to start multiplying.
We must find the dot product of the first row vector and the first column vector.
The result we get is minus 71.
Next we multiply the first row vector with a second column vector we get minus 48.
We continue with the known way until we fill the product matrix.
Linear algebra doesn’t seem that hard after all.
Do you feel comfortable.
Let’s do one more this matrix multiplied by that one of three by four matrix times a two by three Matrix.
What will the dimensions of the output matrix be.
Three by three.
Way way way way out.
It’s not three by three.
In fact it’s nothing to do Major.
These are not compatible.
It is very important to remember that more often than not you will not be able to multiply two matrices.
So please take good note of the shapes.
Thanks for watching.
مشارکت کنندگان در این صفحه
تا کنون فردی در بازسازی این صفحه مشارکت نداشته است.
🖊 شما نیز میتوانید برای مشارکت در ترجمهی این صفحه یا اصلاح متن انگلیسی، به این لینک مراجعه بفرمایید.