▁A ▁is ▁a ▁ 1 0 ▁× ▁ 3 0 ▁matrix , ▁B ▁is ▁a ▁ 3 0 ▁× ▁ 5 ▁matrix , ▁and ▁C ▁is ▁a ▁ 5 ▁× ▁ 6 0 ▁matrix , ▁then ▁ ▁computing ▁( AB ) C ▁needs ▁( 1 0 × 3 0 × 5 ) ▁+ ▁( 1 0 × 5 × 6 0 ) ▁ ▁= ▁ 1 5 0 0 ▁+ ▁ 3 0 0 0 ▁= ▁ 4 5 0 0 ▁operations , ▁while ▁computing ▁A ( BC ) ▁needs ▁( 3 0 × 5 × 6 0 ) ▁+ ▁( 1 0 × 3 0 × 6 0 ) ▁= ▁ 9 0 0 0 ▁+ ▁ 1 8 0 0 0 ▁= ▁ 2 7 0 0 0 ▁operations . ▁ ▁Clear ly ▁the ▁first ▁method ▁is ▁more ▁efficient . ▁With ▁this ▁information , ▁the ▁problem ▁statement ▁can ▁be ▁ref ined ▁as ▁" how ▁to ▁determine ▁the ▁optimal ▁parenthes ization ▁of ▁a ▁product ▁of ▁n ▁matrices ?" ▁Check ing ▁each ▁possible ▁parenthes ization ▁( br ute ▁force ) ▁would ▁require ▁a ▁run - time ▁that ▁is ▁exponential ▁in ▁the ▁number ▁of ▁matrices , ▁which ▁is ▁very ▁slow ▁and ▁imp ract ical ▁for ▁large ▁n . ▁A ▁quick er ▁solution ▁to ▁this ▁problem ▁can ▁be ▁achieved ▁by ▁breaking ▁up ▁the ▁problem ▁into ▁a ▁set ▁of ▁related ▁sub problem s . ▁By ▁solving ▁sub problem s ▁once ▁and ▁re using ▁the ▁solutions , ▁the ▁required ▁run - time ▁can ▁be ▁dr ast ically