Matrix multiplication:
A is pxq and B is qxr C is rxs then no of mul's required for AB=p*q*r and order of AB is pxr.
(AB) is pxr and C is rxs no of mul's required for (AB)C=pxs.
Total no of multiplications needed=#mul's(AB)+#((AB)C)=p*q*r+p*r*s
ABC is done in two ways I)(AB)C and II) A(BC)
Case I) (AB)C
No of multiplications for AB=10*100*5=5000 and order of AB is 10x5
(AB)C no of multiplications=10*5*50=2500.
Total no of multiplications=5000+2500=${\color{Red} 7500}$
Case II) A(BC)
No of multiplications for BC=100*5*50=25000 and order of BC is 100x5
A(BC) no of multiplications=10*100*5=5000
Total no of multiplications=25000+5000=30000
Consider less no of multiplications i.e) 7500