Cheapest way to chain three products

You must compute the product ABCABC where AA is 2×32\times3, BB is 3×43\times4, and CC is 4×24\times2, using the standard algorithm (an m×nm\times n times n×pn\times p product costs m⋅n⋅pm\cdot n\cdot p scalar multiplications). Matrix multiplication is associative, so you may bracket it as (AB)C(AB)C or A(BC)A(BC). What is the minimum total number of scalar multiplications?

Show hints (2)+
  1. Cost out both bracketings (AB)C(AB)C and A(BC)A(BC) separately.
  2. Each stage costs m⋅n⋅pm\cdot n\cdot p; add the two stages, then take the smaller total.

Answer

Reveal answer →

36

Create a free account to see the full worked solution and track your progress.

Interview format: Numerical Reasoning Tests, Trading Aptitude Tests

Related questions