Analyze Question
This is a simple example to understand matrix chain order in DP.
As we know, all the DP problem can be solve by three basic criteria
find the optimized sub problem
In matrix multiplication , the cost of multiplication of matrix is different between the different multi sequence.for e.g. we have 3 matrix
A: 10X100
B: 100x5
C: 5x50
then if we follow diff multiplication sequence
for ((A1A2)A3) : A1A2=$10\times 100 \times 5 = 5000 $ A3=$10\times5\times50 = 2500$ tot: 7500
for(A1(A2A3)): A2A3=$100 \times 5 \times 50 = 25000$ A1 = $10\times100\times50=50000$ tot:75000
and thus its 10 times bigger for the last approach than the first approach
and in DP we suppose if we already know the best solution for the matrix multiplication, for e.g. (A1A2A3A4)(A5A6A7) , if we separate them into subarrays ((A1A2A3)A4) (A5(A6A7)) the subarray it self should also be the optimized multiplication.