How many numerical multiplications for the product of three matrices?

9.3k Views Asked by At

For example you have the matrices $A, (5 \times 8), B, (8 \times 4), C (4 \times 10). $ The question wants you to find the number of multiplications if you were to multiply these matrices like $(A\times B)\times C$.

The answer is $5 \times 4 \times 8 + 5 \times 10 \times 4 = 160 + 200 = 360$ multiplications.

3

There are 3 best solutions below

1
On BEST ANSWER

Let's start this step-by-step. How many multiplications do you need if you were to multiply $M (1\times 8)$ by $N (8 \times 2)$?

$M$ has one row of $8$ numbers. When we multiply that by the first column, that's $8$ multiplications, which are then added up. (It's very similar to a dot product). Then, when we multiply the second column, that's another $8$ multiplications. That's a total of $16$ numerical multiplications.

What about if we use your $A, (5 \times 8), B, (8 \times 4)$ and multiply $A\times B$? For the first row, we do $4 \times 8 = 32$ multiplications. And we do that for all $5$ rows, so the total number of multiplications is $5\times 4 \times 8 = 160$.

How about $D (5 \times 4), C (4 \times 10)$ and multiply $D \times C$? The same reasoning leads us to $5\times 4 \times 10 = 200$ multiplications.

In fact, if we let $D = A\times B$, and we added the number of multiplications, we would get $(A \times B) \times C$ takes $360$ numerical multiplications to compute.

5
On

If you have an $5$ by $8$ matrix $A$ and you multiply it by an $8$ by $4$ matrix $B$ you will arrive at a $5$ by $4$ matrix and each entry in this matrix $AB$ will require you to multiply 8 times. Hence computing $AB$ requires $5\times 4\times 8$ multiplications.

Can you handle the rest?

Let's look at a smaller case. Say we are multiplying a $2\times3$ by $ 3\times 2 $. This should result in a $2 \times 2$ matrix. But how many times will I have multiplied?

$$\Big(\matrix{1 & 2 & 3 \\ 10& 20 & 30} \Big)\Bigg( \matrix{2 & 3 \\ 5 & 7 \\ 11 & 13} \Bigg) $$

$$= \Big( \matrix{1\times 2+2\times 5+3\times 11 & 1\times 3 +2\times 7+3\times 13 \\ 10\times 2+20\times 5+30\times 11 & 10\times 3 +20\times 7+30\times 13 \\} \Big) $$

$$= \Big( \matrix{45 & 56 \\ 450 & 560 \\} \Big) $$

So each entry (and there are $4$ because it's a $2 \times 2$ matrix) took $3$ multiplications (Where did the $3$ come from in the problem?). That means we had $12$ multiplications altogether. If you really think through why this number has to be 12 you can put together what has to happen in the larger case.

1
On

For a matrix mutiplication of order $(m\times n)$ and $(n\times p)$.

No of mutiplications involved are $= m\cdot n\cdot p$.

No Of additions involved are $= m\cdot n\cdot (p-1)$

so here for

first mutiplication: $5\cdot 8\cdot 4= 160$

Second mutiplication: $5\cdot 4\cdot 10 = 200$

Total $= 360$

Similarly Total addition would be $=300.$