Multiply the matrices A1, A2, A3 of sizes 20 × 5, 5 × 50, 50 × 5? Ans is 1750 multiplications? how? What is the most efficient way to multiply the matrices A1, A2, A3 of sizes 20 × 5, 5 × 50, 
50 × 5?
Answer is : A1(A2 A3), 1750 multiplications.
how did they get the answer ? could someone show me please
 A: When you multiply the $5 \times 50$  matrix with the $50\times 5$ matrix your final matrix is a $5 \times 5 $ matrix.
From the definition of the matrix product you need $50$ multiplications for every value inside the matrix that is 
$$ 5\cdot 5  \cdot 50=1250$$
Than you multiply a $20 \times 5$ matrix with a $5 \times 5 $ matrix, the result is a $20\times 5 $ matrix and for every value you need $5$ multiplications so you need
$$5 \cdot 5 \cdot 20 = 500$$ 
multiplications for that one.
$$500+1250 =1750$$
When you calculate the other way you get at first a $20 \times 50$ matrix and you need 5 multiplications for every value so you have 
$$20 \cdot 50 \cdot 5=5000$$
The multiplication of the $20 \times 50$ matrix with the $50\times 5$ matrix gives you a $20 \times 5$ matrix, for every value you need 50 multiplications so you have 
$$20\cdot 5 \cdot 50=5000$$
So for both multiplications you need $5000$ multiplication so all together there are 
$$5000+5000=10000$$
which is in my opinion really a significant difference (it is more than factor $5$) to the other solution
A: When you multiply a $n \times m$ matrix by a $m \times l$ matrix, it takes $lmn$ multiplications.
There are only two possibilities here $((20 \times 5)(5 \times 50)) (50 \times 5)$ or $(20 \times 5)((5 \times 50) (50 \times 5))$. This gives $20 \times 5 \times 50 + 20 \times 50 \times 5 = 10000$, or $5 \times 50 \times 5 + 20 \times 5 \times 5 = 1750$.
