Matrix-Chain Multiplication

Definition

Given a chain of matrices, has dimension , fully parenthesize the product to minimize amount of scalar multiplications. Input is a sequence of dimensions .

Solution

Brute force takes exponential time.

Let denote the matrix results from evaluating , be the minimum number of scalar multiplications needed to compute , be the optimal split .

Compute shorter chains to longer chains: chain of length (trivial), , and all the way up to .