• 2 months ago
Transcript
00:00Hi, today I am going to explain this 9th one program that is multiplication of 2 by 2 matrix.
00:10So how multiplication of 2 by 2 matrix take place, how one matrix is multiplied with another
00:18one and then how the resulted value is going to store inside the third matrix that I am
00:25going to explain, this 9th one multiplication of 2 by 2 matrix.
00:33So first of all I am going to explain this program in a diagrammatical formation then
00:40I am going to implement the same program in C. So let us understand how multiplication
00:46will take place, what is the methodology, how the multiplication of 2 matrices take
00:53place and the resulted value stored inside the third one.
00:58So here is the diagrammatical approach to understand the multiplication of 2 matrices.
01:07This is the first array, first 2 dimensional array A which is having 2 rows and 2 columns,
01:16this is the second one by the name of B which is also having 2 rows and 2 columns.
01:23Now what is the procedure, what is the method, how multiplication take place, let us understand.
01:29The first row of first matrix that is of A matrix is going to multiplied with the first
01:41column of second matrix that is of B matrix.
01:48The first row is going to multiply with the first column of second matrix and the sum
02:02of it whatever the sum of it that will be going to store inside the third matrix that
02:10is in the C matrix in which location 0 row 0 column.
02:16Let us see when I multiply the first row of A matrix with the first column of B matrix
02:25what will happen, 20 is multiplied with 2 that is 20 into 240 then 10 is multiplied
02:35with 1 so 10 into 1 that is 10 and then submission will take place.
02:41If you see here I am indicating that is 40 plus 10 that will be what 50, so this resulted
02:48value is going to store inside the third matrix that is in the C matrix 0 row 0 column okay
02:57that is shifted here and the first row this first row of first matrix that is of A matrix
03:05is going to multiply with the second column of B matrix okay so 20 into 120 10 into 440
03:16so here 20 into 120 10 into 440 and the sum of it that is what 60 that 60 is going to
03:23store inside 0 row first column of the third matrix that is in the C matrix okay.
03:31Now the second row or the second row of A matrix is going to multiply it with the first
03:40column of B matrix okay so the second row first column and the second row second column
03:48so the first row of the first matrix is going to multiply with the first column of the second
03:56matrix okay so 30 into 2 that is what 60 so here I have done okay then 20 into 1 that
04:04is what 20 and the resulted value is going to store inside the first row 0 column of
04:13third matrix that is in the C matrix so the sum of it is going to store here.
04:19Then the second row second column the multiplication of the second row of the first matrix and
04:27the second column of the second matrix the multiplication of it will take place okay
04:33and the sum will take place and the resulted value is going to store inside the first row
04:38first column of the third matrix okay so that is what 30 into 1 30 20 into 4 okay and the
04:48multiplication took place and the resulted value that is 110 that is stored inside first
04:56row first column of third matrix that is of C matrix so this is the procedure and in this
05:03way the values are going to store and then it is going to display in a matrix form.
05:08Now why to do in this way why not directly to multiply the values why not to do in the
05:14same way as we do or as we have adopted when we have add the values not to directly multiply
05:24and get the result that is 20 into 2 40 and then 10 into 1 10 and then 30 into 1 30 then
05:3120 into 4 80 like this why don't we store it why is there is to multiply and then add
05:37and then to put the values inside it what is the reason behind it that I am going to
05:41explain here is an example for it this there there are two shop there is a shop number
05:49one and there is a shop number two in the shop number one if you see a 0 to 0 column
05:58and 0 first column the rate of the pen and pencils are given okay and in the shop number
06:03two and first to zero column and in the first row first column the rate of pen and pencils
06:09are given okay so this a matrix is having the rate of pen and pencil of both the shops
06:16shop number one and shop number two now in the second matrix B it's having the quantity
06:22okay so in 0 to 0 column on the Monday the quantity which the pen is having that is two
06:33okay and the pen the pencil quantity is that is what one and in Tuesday it is having what
06:39quantity one and of pencil the quantity is what four of pen the quantity is one and of
06:48pencil it's four so it's having the same quantity for both the shops for shop number one and
06:53the shop number two they used to give on the same quantity of pen and pencils on Monday
07:03and Tuesday okay so I have used simple numbers for the calculation so that we can easily
07:12do it and understand okay so on Monday the quantity of pen which the shops or the shops
07:20having that is pen the quantity of pen is what two and the pen and the quantity of pencil
07:26is what one on Tuesday they are they both the shops having what only one and the pencil
07:33is what that is what four okay so for the easy calculation I have I have taken not a
07:41big or a large numbers I have taken a small number for us for that the calculation can
07:47take easily and we can understand it okay now what we will achieve we will achieve the
07:56total amount of stock of both the shops on a Monday and Tuesday by multiplying the by
08:04multiplying the both the matrices that will be achieved so what what is that what what
08:09is the total amount of shop number one on Monday and what is the total amount of stock
08:16of shop number two on Monday that will be achieved okay and the same way how much the
08:23total amount of stock the shop number one is having on Tuesday and how much amount of
08:30total stock the shop number two is having on Tuesday that will be achieved by multiplying
08:35A and B matrices so let us see the shop number one is having the pan rate is what 20 and on
08:47Monday it's having the quantity what 2 so what 20 into 2 that is what 40 okay so we'll get the
08:56total amount of pan and then the shop number one is having the pencil of rate 10 but the
09:05quantity which it's having a pencil on Monday that is 1 so 10 into 1 that is what 10 okay
09:12so the total amount of total amount of stock of pen and pencil that is what 50 and that is the
09:21shop number one is having which is kept here okay on the jio through and jio column of C matrix so
09:28on Monday the total amount of stock which a shop number one is having that is that amount is what
09:3550 then this this row is again going to multiply it with the second column okay so on Tuesday the
09:46stock of shop number one for the pen is 1 and for the pencil is what 4 so let us calculate a
09:53total amount of stock so 20 into 1 that is what 20 and 10 into 4 that is what 40 okay so 20 is the
10:04amount of pen and 40 is the amount of pencil and when we sum it so this will be the total amount
10:11of stock on the Tuesday and that is kept here okay yeah on the jio through and first column the C
10:18matrix okay so we have got the total amount of stock on Monday of shop number one and the total
10:27amount of stock amount of stock on Tuesday of shop number one in the same way the same method
10:34will be applicable for the shop number two the second row of the first column first matrix is
10:43going to multiply with the first column of the second matrix and then the second row of the first
10:51matrix is going to multiply with the second column of the second matrix so let us do the second in
10:59this the same thing the shop number two is having the rate 30 of the pen and the 30 is going to
11:06multiply with one okay that is first of all with the two we have to calculate for the Monday so
11:1630 into 2 that will be what if you see 60 then the rate of the pencil that is what 20 that is
11:26going to multiply with the quantity that is 1 so 20 into 120 and then the sum will take place so
11:33the total amount of stock that is what 80 that is of the shop number 2 on Monday in the same way
11:39the rate of pen and pencil going to multiply it with the quantity or which is there on the Tuesday
11:47okay that is 30 into 1 that is of the pen and 20 into 4 that is what 80 okay so that is calculated
11:54and 110 is the amount that is the total amount of shop number shop number 2 on Tuesday so in
12:02this way we will get the total amount of stock which the shop number one is having on Monday
12:08and and on Tuesday in the same way we will be able to get the total amount of stock the shop
12:15number two is having on Monday and on Tuesday with this methodology so I hope that how the
12:24multiplication of matrices take place and what is the reason to use this methodology or to use this
12:32procedure to do the multiplication that first to multiply and to then add it or to do the sum why
12:39there is what is the reason behind it why we do this provide this example must be clear now I'm
12:45going to make the program in my next video of multiplication of two matrices okay thanks for today

Recommended