Answer / Đáp án: 4500
Step-by-step (EN): Compare both parenthesizations:
- $((M_1 M_2) M_3)$: $(M_1 M_2)$ takes $10 \times 30 \times 5 = 1{,}500$ ops and yields a $10 \times 5$ matrix; multiplying by $M_3$ ($5 \times 60$) takes $10 \times 5 \times 60 = 3{,}000$ ops. Total $= 1{,}500 + 3{,}000 = 4{,}500$.
- $(M_1 (M_2 M_3))$: $(M_2 M_3)$ takes $30 \times 5 \times 60 = 9{,}000$ ops and yields a $30 \times 60$ matrix; multiplying $M_1$ ($10 \times 30$) by it takes $10 \times 30 \times 60 = 18{,}000$ ops. Total $= 27{,}000$ ($6\times$ slower!).
Optimal cost $= 4{,}500$.
Giải chi tiết (VI): So sánh hai cách kết hợp dấu ngoặc:
- Cách 1: $((M_1 M_2) M_3)$ tốn $10 \times 30 \times 5 + 10 \times 5 \times 60 = 1.500 + 3.000 = 4.500$ phép nhân.
- Cách 2: $(M_1 (M_2 M_3))$ tốn $30 \times 5 \times 60 + 10 \times 30 \times 60 = 9.000 + 18.000 = 27.000$ phép nhân (chậm gấp $6$ lần!).
Vậy số phép nhân ít nhất là $4500$.
Computational Thinking / Tư duy Máy tính: Matrix Chain Multiplication DP (Quy hoạch động nhân chuỗi ma trận).