GATE | Sudo GATE 2020 Mock I (27 December 2019) | Question 55
Assume that multiplying a matrix M1 of dimension a×b with another matrix M2 of dimension bxc requires abc scalar multiplications. Computing the product of n matrices M1M1M3 … Mn can be done by parenthesizing in different ways. Define MiMi+1 as an explicitly computed pair for a given parenthesization if they are directly multiplied. For example, in the matrix multiplication chain M1M2M3M4M5M6 using parenthesization (M1(M2M3))(M4(M5M6)), M2M3 and M5M6 are only explicitly computed pairs.
Consider a matrix multiplication chain A1A2A3A4, where matrices A1, A2, A3 and A4 are of dimensions 5×40,40×6,6×20 and 20×5 respectively. In the parenthesization of A1A2A3A4 that minimizes the total number of scalar multiplications, the explicitly computed pairs is/are
(A) A1A2 and A3A4
(B) A2A3 only
(C) A3A4 only
(D) A1A2 and A2A3
Explanation: Given matrix A5X40, A40×6, A6×20, A20×5
According to matrix chain multiplication:
Therefore, selected pairs are:
[A3, A4] = 600 [A1, A2] = 1200
So, option (A) is correct.
Quiz of this Question
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.