Matrix chain multiplication is a problem that can be solved using the Dynamic Programming approach, it requires the right brackets with matrices to multiply the given matrices with a minimum number of multiplications. Example
M1 = 12 x 20 M2 = 20 x 15 M3 = 15 x 30
There are two ways to solve this problem, depending on where you start to multiply your matrices.
1). ((M1 x M2) x M3) 2). (M1 x (M2 x M3))
At first only 3600 + 5400 = 9000 multiplications are required.
The second solution requires 9,000 + 7,200 = 16,200 multiplications.
Here we choose the first second, because it needs less than the number of multiplications.
Your program should be able to tell the user how to copy matrices to minimize multiplications ( Optimization Problem )
source share