Skip to content
Related Articles
Open in App
Not now

Related Articles

ISRO | ISRO CS 2020 | Question 23

Improve Article
Save Article
  • Last Updated : 04 Sep, 2020
Improve Article
Save Article

Consider product of three matrices M1, M2 and M3 having w rows and x columns, x rows and y columns, and y rows and z columns. Under what condition will it take less time to compute the product as (M1M2)M3 than to compute M1(M2M3) ?

(A) Always take the same time
(B) (1/x + 1/z) < (1/w + 1/y)
(C) x > y
(D) (w + x) > (y + z)

Answer: (B)

Explanation: Cost of (M1M2)M3 :

= wxy + wyz       ------ (i) 

Cost of M1(M2M3) :

= xyz + wxz       ------ (ii)  

If (M1M2)M3 will take less time than M1(M2M3), then

wxy + wyz < xyz + wxz 

Dividing both sides by wxyz,

= (1/x + 1/z) < (1/w + 1/y) 

So, option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!