• retagged by
37,723 views
54 54 votes
Let $A_{1}, A_{2}, A_{3}$ and $A_{4}$ be four matrices of dimensions $10 \times 5, 5 \times 20, 20 \times 10$ and $10 \times 5$, respectively. The minimum number of scalar multiplications required to find the product $A_{1}A_{2}A_{3}A_{4}$ using the basic matrix multiplication method is _________.

8 Answers

Best answer
58 58 votes

The answer is $1500$.

Matrix Parenthesizing :  $A_1 ((A_2 A_3) A_4)$

Check my solution below, using dynamic programming $$\begin{array}{|l|l|}\hline A_{1} &A_{2} & A_{3} &A_{4}\\\hline 10 \times 5 & 5 \times 20 & 20 \times 10 & 10\times 5  \\\hline \end{array}$$

  • $A_{12} = 10 \times 5 \times 20 =1000$
  • $A_{23} = 5 \times 20 \times 10 =1000$
  • $A_{34} = 20 \times 10 \times 5 =1000$

$$A_{13}=min\left\{\begin{matrix} A_{12} + A_{33}+ 5 \times 20 \times 10 = 2000\\ A_{11} + A_{23} + 10 \times 5 \times 10 = 1500 \end{matrix}\right.$$

$$A_{24}=min\left\{\begin{matrix} A_{23} + A_{44}+ 5 \times 10 \times 5 = 1250\\ A_{22} + A_{34} + 5 \times 20 \times 5 = 1500 \end{matrix}\right.$$

$$A_{14}=min\left\{\begin{matrix} A_{11} + A_{24}+ 10 \times 5 \times 5 = 1500\\ A_{12} + A_{34} + 10 \times 20\times 5 \geqslant 2000\\ A_{13}+A_{44} + 10 \times 20\times 5 = 2000 \end{matrix}\right.$$

Answer is 1500.

• edited by
40 40 votes

my answer

13 13 votes

$A_{10\times 5}|A_{5\times 20}|A_{20\times 10}|A_{10\times 5}$

$P_{0}\times P_{1}|P_{1}\times P_{2}|P_{2}\times P_{3}|P_{3}\times P_{4}$

 

$(1,1)=0$ $(2,2)=0$ $(3,3)=0$ $(4,4)=0$
$(1,2)=1000$ $(2,3)=1000$ $(3,4)=1000$ $\times$
$(1,3)=1500$ $(2,4)=1250$ $\times$ $\times$
$(1,4)=1500$ $\times$ $\times$ $\times$

$A_{13}=min\left\{\begin{matrix} A_{12} + A_{33}+ 10 \times 20 \times 10(P_{0}\times P_{2}\times P_{3}) = 3000\\ A_{11} + A_{23} + 10 \times 5 \times 10(P_{0}\times P_{1}\times P_{3}) = 1500 \end{matrix}\right.$

$A_{24}=min\left\{\begin{matrix} A_{23} + A_{44}+ 5 \times 10 \times 5(P_{1}\times P_{3}\times P_{4}) = 1250\\ A_{22} + A_{34} + 5 \times 20 \times 5(P_{1}\times P_{2}\times P_{4}) = 1500 \end{matrix}\right.$

$A_{14}=min\left\{\begin{matrix} A_{11} + A_{24}+ 10 \times 5 \times 5(P_{0}\times P_{1}\times P_{4}) = 1500\\ A_{12} + A_{34} + 10 \times 20\times 5(P_{0}\times P_{2}\times P_{4}) = 3000\\ A_{13}+A_{44} + 10 \times 10\times 5(P_{0}\times P_{3}\times P_{4}) = 2000 \end{matrix}\right.$

8 8 votes
Minimum number of scalar multiplications required is 1500.

A1((A2A3)A4) is the order, where scalar multiplications are minimum here and is 1500
7 7 votes

$A[i,j] = \left\{\begin{matrix} 0;& i = j\\ & min_{i\leq k < j}(A[i,k] + A[k+1,j]+ p_{i-1}p_{k}p_{j});\:\: i < j\end{matrix}\right.$

• edited by
3 3 votes

For Matrix Chain Multiplication : - 

            A1 have P0 = 10 , P1 = 5

            A2 have P1 = 5 , P2 = 20

            A3 have P2 = 20 , P3 = 10

            A4 have P3 = 10 , P4 = 5

According to Rule : - 

                             A11 = A22 = A33 = A44 = 0

In 1st Bracket 1500 is minimum in 2nd bracket 1250 is min in 3rd Bracket 1500 minimum 

Now for bracket down to top we check how to we get minimum elements  

1500 is min which is by  A1(A2 to A 4)   for (A2 to A4 ) 1250 is minimum so (A2 A3)A4

Finally (A1 (( A2 A3) A4)) 

Reference : - https://home.cse.ust.hk/~dekai/271/notes/L12/L12.pdf

Answer:
Position:
Show:

Related questions

51 51 votes
6 answers 6 answers
25.2k
25.2k views
go_editor asked Sep 29, 2014
25,211 views
Four Matrices $M_1, M_2, M_3$ and $M_4$ of dimensions $ p \times q, \:\:q \times r, \:\:r \times s$ and $s \times t$ respectively can be multiplied in several ways with d...
4 4 votes
2 2 answers
3.1k
3.1k views
Misbah Ghaya asked Oct 1, 2016
3,125 views
Consider the problem of a chain <$A_{1} , A_{2} , A_{3},A_{4}$ of four matrices. Suppose that the dimensions of the matrices $A_{1} , A_{2} , A_{3}$ and $A_{4}$ are $30 \...
33 33 votes
4 answers 4 answers
11.4k
11.4k views
Akash Kanase asked Feb 12, 2016
11,361 views
The Floyd-Warshall algorithm for all-pair shortest paths computation is based onGreedy paradigm.Divide-and-conquer paradigm.Dynamic Programming paradigm.Neither Greedy no...
0 0 votes
2 answers 2 answers
1.3k
1.3k views
Bikram asked May 26, 2017
1,321 views
Matrix multiplication is associative and MCS ( matrix chain multiplication ) uses the following matrices:$\begin{array} \text{M1} & 10^* 100 \\ M2 & 100^* 5 \\ M3 & 5^* ...