Files
2025-02-Algorithm/reviews/R8d.md
2025-10-12 19:32:21 +09:00

44 lines
862 B
Markdown

# Review 8-4
* Hajin Ju, 2024062806
## Problem 1
What is the dimension of the matrix product $AB$ if $A$ is a $p\times q$ matrix and $B$ is a $q\times r$ matrix?
### Solution 1
$p\times r$
## Problem 2
Count the number of scalar multiplications to multiply $A$ and $B$ where $A$ is a $p\times q$ matrix and $B$ is a $q\times r$ matrix.
### Solution 2
$pqr$
## Problem 3
Count the number of scalar multiplications where the dimensions of $A_1$, $A_2$, and $A_3$ are $10\times 100$, $100\times 5$ and $5\times 50$, respectively.
1. $(A_1A_2)A_3$
2. $A_1(A_2A_3)$
### Solution 3
1. $5000 + 2500 = 7500$
2. $25000 + 50000 = 75000$
## Problem 4
Fully parenthesize the product $A_1A_2A_3A_4$. (There are five distinct ways.)
### Solution 4
1. $(A_1A_2)(A_3A_4)$
2. $(A_1(A_2A_3))A_4$
3. $A_1(A_2(A_3A_4))$
4. $A_1((A_2A_3)A_4)$
5. $((A_1A_2)A_3)A_4$