Let , where Ai has dimensions P[i-1] x P[i]. P is an array of dimensions.
For now, the subproblems will be finding the minimum number of scalar multiplications m[i,j] for computing Ai .. j(1 i j n).
Define m[i,j].
Note that a recursive algorithm based on this definition would still require exponential time.