<P> This image illustrates possible triangulations of a regular hexagon . These correspond to the different ways that parentheses can be placed to order the multiplications for a product of 5 matrices . </P> <P> For the example below, there are four sides: A, B, C and the final result ABC . A is a 10 × 30 matrix, B is a 30 × 5 matrix, C is a 5 × 60 matrix, and the final result is a 10 × 60 matrix . The regular polygon for this example is a 4 - gon, i.e. a square: </P> <P> The matrix product AB is a 10x5 matrix and BC is a 30x60 matrix . The two possible triangulations in this example are: </P> <Ul> <Li> <P> Polygon representation of (AB) C </P> </Li> <Li> <P> Polygon representation of A (BC) </P> </Li> </Ul>

Total running time of matrix chain multiplication of n matrices