Skip to content

Commit f97f683

Browse files
newptcaiwalkccc
authored andcommitted
Update 4.2.md
Give a more detailed explanation of 4.2-5.
1 parent bb8fb71 commit f97f683

File tree

1 file changed

+64
-7
lines changed

1 file changed

+64
-7
lines changed

docs/Chap04/4.2.md

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,74 @@ By master theorem, we can find the largest $k$ to satisfy $\log_3 k < \lg 7$ is
123123
124124
> V. Pan has discovered a way of multiplying $68 \times 68$ matrices using $132464$ multiplications, a way of multiplying $70 \times 70$ matrices using $143640$ multiplications, and a way of multiplying $72 \times 72$ matrices using $155424$ multiplications. Which method yields the best asymptotic running time when used in a divide-and-conquer matrix-multiplication algorithm? How does it compare to Strassen's algorithm?
125125
126-
Using what we know from the last exercise, we need to pick the smallest of the following
126+
**Analyzing Pan's Methods**
127+
128+
Pan has introduced three methods for divide-and-conquer matrix multiplication, each with different parameters. We will analyze the recurrence relations, compute the exponents using the Master Theorem, and compare the resulting asymptotic running times to Strassen’s algorithm.
129+
130+
**Method 1:**
131+
132+
- **Recurrence Relation:**
127133
128134
$$
129-
\begin{aligned}
130-
\log_{68} 132464 & \approx 2.795128 \\\\
131-
\log_{70} 143640 & \approx 2.795122 \\\\
132-
\log_{72} 155424 & \approx 2.795147.
133-
\end{aligned}
135+
T(n) = 132{,}464 \cdot T\left(\frac{n}{68}\right)
136+
$$
137+
138+
- **Parameters:** $a = 132{,}464$, $b = 68$
139+
- **Applying Master Theorem:**
140+
141+
$$
142+
\log_b a = \frac{\log 132{,}464}{\log 68} \approx 2.7951284873613815
143+
$$
144+
145+
- **Asymptotic Running Time:** $O(n^{2.7951284873613815})$
146+
147+
**Method 2:**
148+
149+
- **Recurrence Relation:**
150+
151+
$$
152+
T(n) = 143{,}640 \cdot T\left(\frac{n}{70}\right)
153+
$$
154+
155+
- **Parameters:** $a = 143{,}640$, $b = 70$
156+
- **Applying Master Theorem:**
157+
134158
$$
159+
\log_b a = \frac{\log 143{,}640}{\log 70} \approx 2.795122689748337
160+
$$
161+
162+
- **Asymptotic Running Time:** $O(n^{2.795122689748337})$
163+
164+
**Method 3:**
165+
166+
- **Recurrence Relation:**
167+
168+
$$
169+
T(n) = 155{,}424 \cdot T\left(\frac{n}{72}\right)
170+
$$
171+
172+
- **Parameters:** $a = 155{,}424$, $b = 72$
173+
- **Applying Master Theorem:**
174+
175+
$$
176+
\log_b a = \frac{\log 155{,}424}{\log 72} \approx 2.795147391093449
177+
$$
178+
179+
- **Asymptotic Running Time:** $O(n^{2.795147391093449})$
180+
181+
**Comparison to Strassen's Algorithm**
182+
183+
Strassen’s algorithm has an asymptotic running time of $O(n^{2.807})$, derived from $\log_2 7 \approx 2.807$.
184+
185+
**Which Method is Best?**
186+
187+
Now, let's compare the exponents:
188+
189+
- **Method 1:** $\log_b a = 2.7951284873613815$
190+
- **Method 2:** $\log_b a = 2.795122689748337$
191+
- **Method 3:** $\log_b a = 2.795147391093449$
135192
136-
The fastest one asymptotically is $70 \times 70$ using $143640$.
193+
Since **smaller exponents lead to more efficient algorithms**, **Method 2** is the best because it has the smallest exponent, $2.795122689748337$.
137194
138195
## 4.2-6
139196

0 commit comments

Comments
 (0)