6 recurrences - tum · 2020-02-22 · methods for solving recurrences 1.guessing+induction guess...
TRANSCRIPT
![Page 1: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/1.jpg)
6 Recurrences
Algorithm 2 mergesort(listL)1: n← size(L)2: if n ≤ 1 return L3: L1 ← L[1 · · · bn2 c]4: L2 ← L[bn2 c + 1 · · ·n]5: mergesort(L1)6: mergesort(L2)7: L←merge(L1, L2)8: return L
This algorithm requires
T(n) = T(⌈n
2
⌉)+ T
(⌊n2
⌋)+O(n) ≤ 2T
(⌈n2
⌉)+O(n)
comparisons when n > 1 and 0 comparisons when n ≤ 1.
![Page 2: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/2.jpg)
6 Recurrences
Algorithm 2 mergesort(listL)1: n← size(L)2: if n ≤ 1 return L3: L1 ← L[1 · · · bn2 c]4: L2 ← L[bn2 c + 1 · · ·n]5: mergesort(L1)6: mergesort(L2)7: L←merge(L1, L2)8: return L
This algorithm requires
T(n) = T(⌈n
2
⌉)+ T
(⌊n2
⌋)+O(n) ≤ 2T
(⌈n2
⌉)+O(n)
comparisons when n > 1 and 0 comparisons when n ≤ 1.
![Page 3: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/3.jpg)
Recurrences
How do we bring the expression for the number of comparisons
(≈ running time) into a closed form?
For this we need to solve the recurrence.
![Page 4: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/4.jpg)
Recurrences
How do we bring the expression for the number of comparisons
(≈ running time) into a closed form?
For this we need to solve the recurrence.
![Page 5: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/5.jpg)
Methods for Solving Recurrences
1. Guessing+Induction
Guess the right solution and prove that it is correct via
induction. It needs experience to make the right guess.
2. Master Theorem
For a lot of recurrences that appear in the analysis of
algorithms this theorem can be used to obtain tight
asymptotic bounds. It does not provide exact solutions.
3. Characteristic Polynomial
Linear homogenous recurrences can be solved via this
method.
![Page 6: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/6.jpg)
Methods for Solving Recurrences
4. Generating Functions
A more general technique that allows to solve certain types
of linear inhomogenous relations and also sometimes
non-linear recurrence relations.
5. Transformation of the Recurrence
Sometimes one can transform the given recurrence relations
so that it e.g. becomes linear and can therefore be solved
with one of the other techniques.
![Page 7: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/7.jpg)
6.1 Guessing+Induction
First we need to get rid of the O-notation in our recurrence:
T(n) ≤
2T(⌈n
2
⌉)+ cn n ≥ 2
0 otherwise
Informal way:
Assume that instead we have
T(n) ≤
2T(n
2
)+ cn n ≥ 2
0 otherwise
One way of solving such a recurrence is to guess a solution, and
check that it is correct by plugging it in.
![Page 8: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/8.jpg)
6.1 Guessing+Induction
First we need to get rid of the O-notation in our recurrence:
T(n) ≤
2T(⌈n
2
⌉)+ cn n ≥ 2
0 otherwise
Informal way:
Assume that instead we have
T(n) ≤
2T(n
2
)+ cn n ≥ 2
0 otherwise
One way of solving such a recurrence is to guess a solution, and
check that it is correct by plugging it in.
![Page 9: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/9.jpg)
6.1 Guessing+Induction
First we need to get rid of the O-notation in our recurrence:
T(n) ≤
2T(⌈n
2
⌉)+ cn n ≥ 2
0 otherwise
Informal way:
Assume that instead we have
T(n) ≤
2T(n
2
)+ cn n ≥ 2
0 otherwise
One way of solving such a recurrence is to guess a solution, and
check that it is correct by plugging it in.
![Page 10: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/10.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d.
Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 11: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/11.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d. Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 12: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/12.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d. Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 13: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/13.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d. Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn
= dn logn+ (c − d)n≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 14: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/14.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d. Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n
≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 15: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/15.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d. Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 16: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/16.jpg)
6.1 Guessing+Induction
Suppose we guess T(n) ≤ dn logn for a constant d. Then
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
if we choose d ≥ c.
Formally, this is not correct if n is not a power of 2. Also even in
this case one would need to do an induction proof.
![Page 17: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/17.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.
Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 18: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/18.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 19: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/19.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 20: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/20.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16):
true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 21: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/21.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 22: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/22.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 23: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/23.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 24: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/24.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 25: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/25.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 26: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/26.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn
= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 27: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/27.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n
≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 28: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/28.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 29: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/29.jpg)
6.1 Guessing+Induction T(n) ≤
2T(n
2
)+ cn n ≥ 16
b otw.Guess: T(n) ≤ dn logn.
Proof. (by induction)
ñ base case (2 ≤ n < 16): true if we choose d ≥ b.
ñ induction step n/2→ n:
Let n = 2k ≥ 16. Suppose statem. is true for n′ = n/2. We
prove it for n:
T(n) ≤ 2T(n
2
)+ cn
≤ 2(dn2
logn2
)+ cn
= dn(logn− 1)+ cn= dn logn+ (c − d)n≤ dn logn
Hence, statement is true if we choose d ≥ c.
![Page 30: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/30.jpg)
6.1 Guessing+Induction
How do we get a result for all values of n?
We consider the following recurrence instead of the original one:
T(n) ≤
2T(⌈n
2
⌉)+ cn n ≥ 16
b otherwise
Note that we can do this as for constant-sized inputs the running
time is always some constant (b in the above case).
![Page 31: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/31.jpg)
6.1 Guessing+Induction
How do we get a result for all values of n?
We consider the following recurrence instead of the original one:
T(n) ≤
2T(⌈n
2
⌉)+ cn n ≥ 16
b otherwise
Note that we can do this as for constant-sized inputs the running
time is always some constant (b in the above case).
![Page 32: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/32.jpg)
6.1 Guessing+Induction
How do we get a result for all values of n?
We consider the following recurrence instead of the original one:
T(n) ≤
2T(⌈n
2
⌉)+ cn n ≥ 16
b otherwise
Note that we can do this as for constant-sized inputs the running
time is always some constant (b in the above case).
![Page 33: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/33.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n)
≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 34: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/34.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 35: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/35.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 36: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/36.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 37: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/37.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn
≤ dn log( 9
16n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 38: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/38.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn
≤ dn log( 9
16n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 39: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/39.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 40: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/40.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 41: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/41.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn
≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 42: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/42.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn
≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 43: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/43.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn
≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 44: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/44.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn
≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 45: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/45.jpg)
6.1 Guessing+Induction
We also make a guess of T(n) ≤ dn logn and get
T(n) ≤ 2T(⌈n
2
⌉)+ cn
≤ 2(d⌈n
2
⌉log
⌈n2
⌉)+ cn
≤ 2(d(n/2+ 1) log(n/2+ 1)
)+ cn≤ dn log
( 916n)+ 2d logn+ cn
= dn logn+ (log 9− 4)dn+ 2d logn+ cn≤ dn logn+ (log 9− 3.5)dn+ cn≤ dn logn− 0.33dn+ cn≤ dn logn
for a suitable choice of d.
⌈n2
⌉≤ n
2 + 1
n2 + 1 ≤ 9
16n
log 916n = logn+ (log 9− 4)
logn ≤ n4
![Page 46: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/46.jpg)
6.2 Master Theorem
Lemma 1
Let a ≥ 1, b ≥ 1 and ε > 0 denote constants. Consider the
recurrence
T(n) = aT(nb
)+ f(n) .
Case 1.
If f(n) = O(nlogb(a)−ε) then T(n) = Θ(nlogb a).
Case 2.
If f(n) = Θ(nlogb(a) logkn) then T(n) = Θ(nlogb a logk+1n),k ≥ 0.
Case 3.
If f(n) = Ω(nlogb(a)+ε) and for sufficiently large naf(nb ) ≤ cf(n) for some constant c < 1 then T(n) = Θ(f (n)).
![Page 47: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/47.jpg)
6.2 Master Theorem
We prove the Master Theorem for the case that n is of the form
b`, and we assume that the non-recursive case occurs for
problem size 1 and incurs cost 1.
![Page 48: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/48.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a a a a a a a a a
![Page 49: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/49.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a a a a a a a a a
![Page 50: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/50.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
a a a a a a a a a
![Page 51: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/51.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 52: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/52.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
xn
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 53: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/53.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 54: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/54.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 55: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/55.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
a2f( nb2 )
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 56: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/56.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
a2f( nb2 )
alogb n
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 57: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/57.jpg)
The Recursion Tree
The running time of a recursive algorithm can be visualized by a
recursion tree:
x f(n)
af(nb )
a2f( nb2 )
alogb n
nlogb a
=
n
nb
nb
nb
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
nb2
11111111 1 1 1 1 1 1 1
a
aaa
a a a a a a a a a
![Page 58: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/58.jpg)
6.2 Master Theorem
This gives
T(n) = nlogb a +logb n−1∑i=0
aif(nbi
).
![Page 59: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/59.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
![Page 60: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/60.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
![Page 61: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/61.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
![Page 62: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/62.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
![Page 63: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/63.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 64: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/64.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 65: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/65.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 66: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/66.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 67: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/67.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 68: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/68.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 69: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/69.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
![Page 70: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/70.jpg)
Case 1. Now suppose that f(n) ≤ cnlogb a−ε.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a−ε
= cnlogb a−εlogb n−1∑i=0
(bε)i
= cnlogb a−ε(bε logb n − 1)/(bε − 1)
= cnlogb a−ε(nε − 1)/(bε − 1)
= cbε − 1
nlogb a(nε − 1)/(nε)
Hence,
T(n) ≤(
cbε − 1
+ 1)nlogb(a)
∑ki=0 qi = qk+1−1
q−1
b−i(logb a−ε) = bεi(blogb a)−i = bεia−i
⇒ T(n) = O(nlogb a).
![Page 71: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/71.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 72: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/72.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 73: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/73.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 74: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/74.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 75: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/75.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 76: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/76.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 77: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/77.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n)
![Page 78: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/78.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = O(nlogb a logb n) ⇒ T(n) = O(nlogb a logn).
![Page 79: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/79.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 80: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/80.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 81: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/81.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 82: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/82.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 83: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/83.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 84: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/84.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 85: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/85.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n)
![Page 86: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/86.jpg)
Case 2. Now suppose that f(n)≥ cnlogb a.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≥ clogb n−1∑i=0
ai(nbi
)logb a
= cnlogb alogb n−1∑i=0
1
= cnlogb a logb n
Hence,
T(n) = Ω(nlogb a logb n) ⇒ T(n) = Ω(nlogb a logn).
![Page 87: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/87.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
![Page 88: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/88.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a
=logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
![Page 89: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/89.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
![Page 90: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/90.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
∑i=1
ik ≈ 1k`k+1
![Page 91: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/91.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
![Page 92: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/92.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
![Page 93: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/93.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
![Page 94: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/94.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
![Page 95: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/95.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
![Page 96: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/96.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
![Page 97: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/97.jpg)
Case 2. Now suppose that f(n) ≤ cnlogb a(logb(n))k.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤ clogb n−1∑i=0
ai(nbi
)logb a·(
logb
(nbi
))k
= cnlogb a`−1∑i=0
(logb
(b`
bi
))k
= cnlogb a`−1∑i=0
(` − i)k
= cnlogb a∑i=1
ik
≈ cknlogb a`k+1
n = b` ⇒ ` = logb n
∑i=1
ik ≈ 1k`k+1
⇒ T(n) = O(nlogb a logk+1n).
![Page 98: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/98.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
![Page 99: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/99.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
![Page 100: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/100.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
![Page 101: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/101.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
![Page 102: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/102.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
![Page 103: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/103.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
![Page 104: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/104.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
![Page 105: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/105.jpg)
Case 3. Now suppose that f(n) ≥ dnlogb a+ε, and that for
sufficiently large n: af(n/b) ≤ cf(n), for c < 1.
From this we get aif(n/bi) ≤ cif(n), where we assume that
n/bi−1 ≥ n0 is still sufficiently large.
T(n)−nlogb a =logb n−1∑i=0
aif(nbi
)
≤logb n−1∑i=0
cif(n)+O(nlogb a)
≤ 11− c f(n)+O(n
logb a)
Hence,
T(n) ≤ O(f (n))
q < 1 :∑ni=0 qi = 1−qn+1
1−q ≤ 11−q
⇒ T(n) = Θ(f (n)).
![Page 106: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/106.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 107: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/107.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 108: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/108.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 109: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/109.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 110: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/110.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0
001001101
1
11011001
This gives that two n-bit integers can be added in time O(n).
![Page 111: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/111.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0
001001101
1
11011001
This gives that two n-bit integers can be added in time O(n).
![Page 112: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/112.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00
01001101
11
1011001
This gives that two n-bit integers can be added in time O(n).
![Page 113: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/113.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00
01001101
11
1011001
This gives that two n-bit integers can be added in time O(n).
![Page 114: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/114.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000
1001101
111
011001
This gives that two n-bit integers can be added in time O(n).
![Page 115: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/115.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000
1001101
111
011001
This gives that two n-bit integers can be added in time O(n).
![Page 116: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/116.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001
001101
1110
11001
This gives that two n-bit integers can be added in time O(n).
![Page 117: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/117.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001
001101
1110
11001
This gives that two n-bit integers can be added in time O(n).
![Page 118: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/118.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010
01101
11101
1001
This gives that two n-bit integers can be added in time O(n).
![Page 119: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/119.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010
01101
11101
1001
This gives that two n-bit integers can be added in time O(n).
![Page 120: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/120.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100
1101
111011
001
This gives that two n-bit integers can be added in time O(n).
![Page 121: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/121.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100
1101
111011
001
This gives that two n-bit integers can be added in time O(n).
![Page 122: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/122.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001
101
1110110
01
This gives that two n-bit integers can be added in time O(n).
![Page 123: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/123.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001
101
1110110
01
This gives that two n-bit integers can be added in time O(n).
![Page 124: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/124.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010011
01
11101100
1
This gives that two n-bit integers can be added in time O(n).
![Page 125: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/125.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
00010011
01
11101100
1
This gives that two n-bit integers can be added in time O(n).
![Page 126: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/126.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100110
1
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 127: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/127.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
000100110
1
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 128: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/128.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 129: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/129.jpg)
Example: Multiplying Two Integers
Suppose we want to multiply two n-bit Integers, but our registers
can only perform operations on integers of constant size.
For this we first need to be able to add two integers A and B:
101011011 A
110010001 B
0001001101
111011001
This gives that two n-bit integers can be added in time O(n).
![Page 130: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/130.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 131: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/131.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 132: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/132.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 133: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/133.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 134: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/134.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 135: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/135.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
0
10001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 136: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/136.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 137: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/137.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 138: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/138.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
00
00000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 139: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/139.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 140: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/140.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 141: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/141.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
000
10001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 142: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/142.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 143: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/143.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 144: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/144.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 145: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/145.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 146: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/146.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).
ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 147: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/147.jpg)
Example: Multiplying Two Integers
Suppose that we want to multiply an n-bit integer A and an m-bit
integer B (m ≤ n).
1101×10001
10001
010001
0000000
00010001
11011101
Time requirement:
ñ Computing intermediate results: O(nm).ñ Adding m numbers of length ≤ 2n: O((m+n)m) = O(nm).
![Page 148: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/148.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB × . . .. . . . . . . . .. . . . . . a0an−1b0bn−1 an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 149: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/149.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB ×
. . .. . . . . . . . .. . . . . . a0an−1b0bn−1 an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 150: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/150.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
× . . .. . .
. . . . . .. . . . . .
a0an−1b0bn−1
an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 151: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/151.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . .
. . . . . .. . . . . . a0an−1b0bn−1 an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 152: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/152.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . . . . . . . .. . . . . . a0an−1b0bn−1 an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 153: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/153.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . . . . . . . .. . . . . . a0an−1b0bn−1 an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 154: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/154.jpg)
Example: Multiplying Two Integers
A recursive approach:
Suppose that integers A and B are of length n = 2k, for some k.
AB
×
. . .. . . . . . . . .. . . . . . a0an−1b0bn−1 an2−1an
2bn
2−1bn2
B0B1 A0A1
Then it holds that
A = A1 · 2n2 +A0 and B = B1 · 2
n2 + B0
Hence,
A · B = A1B1 · 2n + (A1B0 +A0B1) · 2n2 +A0B0
![Page 155: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/155.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 156: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/156.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 157: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/157.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 158: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/158.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 159: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/159.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 160: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/160.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 161: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/161.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 162: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/162.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 163: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/163.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 164: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/164.jpg)
Example: Multiplying Two Integers
Algorithm 3 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z1 ←mult(A1, B0)+mult(A0, B1)7: Z0 ←mult(A0, B0)8: return Z2 · 2n + Z1 · 2
n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )2T(n2 )+O(n)T(n2 )O(n)
We get the following recurrence:
T(n) = 4T(n
2
)+O(n) .
![Page 165: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/165.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
=⇒ Not better then the “school method”.
![Page 166: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/166.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
=⇒ Not better then the “school method”.
![Page 167: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/167.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
=⇒ Not better then the “school method”.
![Page 168: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/168.jpg)
Example: Multiplying Two Integers
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
In our case a = 4, b = 2, and f(n) = Θ(n). Hence, we are in
Case 1, since n = O(n2−ε) = O(nlogb a−ε).
We get a running time of O(n2) for our algorithm.
=⇒ Not better then the “school method”.
![Page 169: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/169.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
![Page 170: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/170.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
![Page 171: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/171.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
![Page 172: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/172.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
![Page 173: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/173.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,
Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
![Page 174: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/174.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
![Page 175: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/175.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)
![Page 176: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/176.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)
![Page 177: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/177.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)
![Page 178: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/178.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)
![Page 179: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/179.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )
![Page 180: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/180.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )T(n2 )
![Page 181: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/181.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )T(n2 )T(n2 )+O(n)
![Page 182: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/182.jpg)
Example: Multiplying Two Integers
We can use the following identity to compute Z1:
Z1 = A1B0 +A0B1
= (A0 +A1) · (B0 + B1)−A1B1 −A0B0
= Z2︷ ︸︸ ︷A1B1
= Z0︷ ︸︸ ︷A0B0
Hence,Algorithm 4 mult(A, B)1: if |A| = |B| = 1 then
2: return a0 · b0
3: split A into A0 and A1
4: split B into B0 and B1
5: Z2 ←mult(A1, B1)6: Z0 ←mult(A0, B0)7: Z1 ←mult(A0+A1, B0+B1)−Z2−Z0
8: return Z2 · 2n + Z1 · 2n2 + Z0
O(1)O(1)O(n)O(n)T(n2 )T(n2 )T(n2 )+O(n)O(n)
![Page 183: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/183.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
![Page 184: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/184.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
![Page 185: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/185.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
![Page 186: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/186.jpg)
Example: Multiplying Two Integers
We get the following recurrence:
T(n) = 3T(n
2
)+O(n) .
Master Theorem: Recurrence: T[n] = aT(nb )+ f(n).ñ Case 1: f(n) = O(nlogb a−ε) T(n) = Θ(nlogb a)ñ Case 2: f(n) = Θ(nlogb a logkn) T(n) = Θ(nlogb a logk+1n)ñ Case 3: f(n) = Ω(nlogb a+ε) T(n) = Θ(f (n))
Again we are in Case 1. We get a running time of
Θ(nlog2 3) ≈ Θ(n1.59).
A huge improvement over the “school method”.
![Page 187: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/187.jpg)
6.3 The Characteristic Polynomial
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
This is the general form of a linear recurrence relation of order kwith constant coefficients (c0, ck ≠ 0).
ñ T(n) only depends on the k preceding values. This means
the recurrence relation is of order k.
ñ The recurrence is linear as there are no products of T[n]’s.
ñ If f(n) = 0 then the recurrence relation becomes a linear,
homogenous recurrence relation of order k.
Note that we ignore boundary conditions for the moment.
![Page 188: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/188.jpg)
6.3 The Characteristic Polynomial
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
This is the general form of a linear recurrence relation of order kwith constant coefficients (c0, ck ≠ 0).
ñ T(n) only depends on the k preceding values. This means
the recurrence relation is of order k.
ñ The recurrence is linear as there are no products of T[n]’s.
ñ If f(n) = 0 then the recurrence relation becomes a linear,
homogenous recurrence relation of order k.
Note that we ignore boundary conditions for the moment.
![Page 189: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/189.jpg)
6.3 The Characteristic Polynomial
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
This is the general form of a linear recurrence relation of order kwith constant coefficients (c0, ck ≠ 0).
ñ T(n) only depends on the k preceding values. This means
the recurrence relation is of order k.
ñ The recurrence is linear as there are no products of T[n]’s.
ñ If f(n) = 0 then the recurrence relation becomes a linear,
homogenous recurrence relation of order k.
Note that we ignore boundary conditions for the moment.
![Page 190: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/190.jpg)
6.3 The Characteristic Polynomial
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
This is the general form of a linear recurrence relation of order kwith constant coefficients (c0, ck ≠ 0).
ñ T(n) only depends on the k preceding values. This means
the recurrence relation is of order k.
ñ The recurrence is linear as there are no products of T[n]’s.
ñ If f(n) = 0 then the recurrence relation becomes a linear,
homogenous recurrence relation of order k.
Note that we ignore boundary conditions for the moment.
![Page 191: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/191.jpg)
6.3 The Characteristic Polynomial
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
This is the general form of a linear recurrence relation of order kwith constant coefficients (c0, ck ≠ 0).
ñ T(n) only depends on the k preceding values. This means
the recurrence relation is of order k.
ñ The recurrence is linear as there are no products of T[n]’s.
ñ If f(n) = 0 then the recurrence relation becomes a linear,
homogenous recurrence relation of order k.
Note that we ignore boundary conditions for the moment.
![Page 192: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/192.jpg)
6.3 The Characteristic Polynomial
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
This is the general form of a linear recurrence relation of order kwith constant coefficients (c0, ck ≠ 0).
ñ T(n) only depends on the k preceding values. This means
the recurrence relation is of order k.
ñ The recurrence is linear as there are no products of T[n]’s.
ñ If f(n) = 0 then the recurrence relation becomes a linear,
homogenous recurrence relation of order k.
Note that we ignore boundary conditions for the moment.
![Page 193: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/193.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 194: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/194.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].
ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 195: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/195.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 196: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/196.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 197: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/197.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 198: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/198.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 199: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/199.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 200: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/200.jpg)
6.3 The Characteristic Polynomial
Observations:
ñ The solution T[1], T[2], T[3], . . . is completely determined
by a set of boundary conditions that specify values for
T[1], . . . , T [k].ñ In fact, any k consecutive values completely determine the
solution.
ñ k non-concecutive values might not be an appropriate set of
boundary conditions (depends on the problem).
Approach:
ñ First determine all solutions that satisfy recurrence relation.
ñ Then pick the right one by analyzing boundary conditions.
ñ First consider the homogenous case.
![Page 201: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/201.jpg)
The Homogenous Case
The solution space
S =T = T[1], T[2], T[3], . . . ∣∣ T fulfills recurrence relation
is a vector space.
This means that if T1,T2 ∈ S, then also
αT1 + βT2 ∈ S, for arbitrary constants α,β.
How do we find a non-trivial solution?
We guess that the solution is of the form λn, λ ≠ 0, and see what
happens. In order for this guess to fulfill the recurrence we need
c0λn + c1λn−1 + c2 · λn−2 + · · · + ck · λn−k = 0
for all n ≥ k.
![Page 202: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/202.jpg)
The Homogenous Case
The solution space
S =T = T[1], T[2], T[3], . . . ∣∣ T fulfills recurrence relation
is a vector space. This means that if T1,T2 ∈ S, then also
αT1 + βT2 ∈ S, for arbitrary constants α,β.
How do we find a non-trivial solution?
We guess that the solution is of the form λn, λ ≠ 0, and see what
happens. In order for this guess to fulfill the recurrence we need
c0λn + c1λn−1 + c2 · λn−2 + · · · + ck · λn−k = 0
for all n ≥ k.
![Page 203: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/203.jpg)
The Homogenous Case
The solution space
S =T = T[1], T[2], T[3], . . . ∣∣ T fulfills recurrence relation
is a vector space. This means that if T1,T2 ∈ S, then also
αT1 + βT2 ∈ S, for arbitrary constants α,β.
How do we find a non-trivial solution?
We guess that the solution is of the form λn, λ ≠ 0, and see what
happens. In order for this guess to fulfill the recurrence we need
c0λn + c1λn−1 + c2 · λn−2 + · · · + ck · λn−k = 0
for all n ≥ k.
![Page 204: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/204.jpg)
The Homogenous Case
The solution space
S =T = T[1], T[2], T[3], . . . ∣∣ T fulfills recurrence relation
is a vector space. This means that if T1,T2 ∈ S, then also
αT1 + βT2 ∈ S, for arbitrary constants α,β.
How do we find a non-trivial solution?
We guess that the solution is of the form λn, λ ≠ 0, and see what
happens.
In order for this guess to fulfill the recurrence we need
c0λn + c1λn−1 + c2 · λn−2 + · · · + ck · λn−k = 0
for all n ≥ k.
![Page 205: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/205.jpg)
The Homogenous Case
The solution space
S =T = T[1], T[2], T[3], . . . ∣∣ T fulfills recurrence relation
is a vector space. This means that if T1,T2 ∈ S, then also
αT1 + βT2 ∈ S, for arbitrary constants α,β.
How do we find a non-trivial solution?
We guess that the solution is of the form λn, λ ≠ 0, and see what
happens. In order for this guess to fulfill the recurrence we need
c0λn + c1λn−1 + c2 · λn−2 + · · · + ck · λn−k = 0
for all n ≥ k.
![Page 206: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/206.jpg)
The Homogenous Case
Dividing by λn−k gives that all these constraints are identical to
c0λk + c1λk−1 + c2 · λk−2 + · · · + ck = 0
This means that if λi is a root (Nullstelle) of P[λ] then T[n] = λniis a solution to the recurrence relation.
Let λ1, . . . , λk be the k (complex) roots of P[λ]. Then, because of
the vector space property
α1λn1 +α2λn2 + · · · +αkλnk
is a solution for arbitrary values αi.
![Page 207: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/207.jpg)
The Homogenous Case
Dividing by λn−k gives that all these constraints are identical to
c0λk + c1λk−1 + c2 · λk−2 + · · · + ck = 0c0λk + c1λk−1 + c2 · λk−2 + · · · + ck︸ ︷︷ ︸characteristic polynomial P[λ]
This means that if λi is a root (Nullstelle) of P[λ] then T[n] = λniis a solution to the recurrence relation.
Let λ1, . . . , λk be the k (complex) roots of P[λ]. Then, because of
the vector space property
α1λn1 +α2λn2 + · · · +αkλnk
is a solution for arbitrary values αi.
![Page 208: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/208.jpg)
The Homogenous Case
Dividing by λn−k gives that all these constraints are identical to
c0λk + c1λk−1 + c2 · λk−2 + · · · + ck = 0c0λk + c1λk−1 + c2 · λk−2 + · · · + ck︸ ︷︷ ︸characteristic polynomial P[λ]
This means that if λi is a root (Nullstelle) of P[λ] then T[n] = λniis a solution to the recurrence relation.
Let λ1, . . . , λk be the k (complex) roots of P[λ]. Then, because of
the vector space property
α1λn1 +α2λn2 + · · · +αkλnk
is a solution for arbitrary values αi.
![Page 209: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/209.jpg)
The Homogenous Case
Dividing by λn−k gives that all these constraints are identical to
c0λk + c1λk−1 + c2 · λk−2 + · · · + ck = 0c0λk + c1λk−1 + c2 · λk−2 + · · · + ck︸ ︷︷ ︸characteristic polynomial P[λ]
This means that if λi is a root (Nullstelle) of P[λ] then T[n] = λniis a solution to the recurrence relation.
Let λ1, . . . , λk be the k (complex) roots of P[λ]. Then, because of
the vector space property
α1λn1 +α2λn2 + · · · +αkλnk
is a solution for arbitrary values αi.
![Page 210: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/210.jpg)
The Homogenous Case
Lemma 2
Assume that the characteristic polynomial has k distinct roots
λ1, . . . , λk. Then all solutions to the recurrence relation are of the
form
α1λn1 +α2λn2 + · · · +αkλnk .
Proof.
There is one solution for every possible choice of boundary
conditions for T[1], . . . , T [k].
We show that the above set of solutions contains one solution for
every choice of boundary conditions.
![Page 211: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/211.jpg)
The Homogenous Case
Lemma 2
Assume that the characteristic polynomial has k distinct roots
λ1, . . . , λk. Then all solutions to the recurrence relation are of the
form
α1λn1 +α2λn2 + · · · +αkλnk .
Proof.
There is one solution for every possible choice of boundary
conditions for T[1], . . . , T [k].
We show that the above set of solutions contains one solution for
every choice of boundary conditions.
![Page 212: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/212.jpg)
The Homogenous Case
Lemma 2
Assume that the characteristic polynomial has k distinct roots
λ1, . . . , λk. Then all solutions to the recurrence relation are of the
form
α1λn1 +α2λn2 + · · · +αkλnk .
Proof.
There is one solution for every possible choice of boundary
conditions for T[1], . . . , T [k].
We show that the above set of solutions contains one solution for
every choice of boundary conditions.
![Page 213: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/213.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:
α1 · λ1 + α2 · λ2 + · · · + αk · λk = T[1]α1 · λ2
1 + α2 · λ22 + · · · + αk · λ2
k = T[2]...
α1 · λk1 + α2 · λk2 + · · · + αk · λkk = T[k]
![Page 214: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/214.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:
α1 · λ1 + α2 · λ2 + · · · + αk · λk = T[1]
α1 · λ21 + α2 · λ2
2 + · · · + αk · λ2k = T[2]
...
α1 · λk1 + α2 · λk2 + · · · + αk · λkk = T[k]
![Page 215: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/215.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:
α1 · λ1 + α2 · λ2 + · · · + αk · λk = T[1]α1 · λ2
1 + α2 · λ22 + · · · + αk · λ2
k = T[2]
...
α1 · λk1 + α2 · λk2 + · · · + αk · λkk = T[k]
![Page 216: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/216.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:
α1 · λ1 + α2 · λ2 + · · · + αk · λk = T[1]α1 · λ2
1 + α2 · λ22 + · · · + αk · λ2
k = T[2]...
α1 · λk1 + α2 · λk2 + · · · + αk · λkk = T[k]
![Page 217: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/217.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:
α1 · λ1 + α2 · λ2 + · · · + αk · λk = T[1]α1 · λ2
1 + α2 · λ22 + · · · + αk · λ2
k = T[2]...
α1 · λk1 + α2 · λk2 + · · · + αk · λkk = T[k]
![Page 218: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/218.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:λ1 λ2 · · · λkλ2
1 λ22 · · · λ2
k...
λk1 λk2 · · · λkk
α1
α2...
αk
=T[1]T[2]
...
T[k]
We show that the column vectors are linearly independent. Then
the above equation has a solution.
![Page 219: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/219.jpg)
The Homogenous Case
Proof (cont.).
Suppose I am given boundary conditions T[i] and I want to see
whether I can choose the α′is such that these conditions are met:λ1 λ2 · · · λkλ2
1 λ22 · · · λ2
k...
λk1 λk2 · · · λkk
α1
α2...
αk
=T[1]T[2]
...
T[k]
We show that the column vectors are linearly independent. Then
the above equation has a solution.
![Page 220: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/220.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
λ1 λ2 · · · λk−1 λkλ2
1 λ22 · · · λ2
k−1 λ2k
......
......
λk1 λk2 · · · λkk−1 λkk
∣∣∣∣∣∣∣∣∣∣∣=
k∏i=1
λi ·
∣∣∣∣∣∣∣∣∣∣∣
1 1 · · · 1 1λ1 λ2 · · · λk−1 λk...
......
...λk−1
1 λk−12 · · · λk−1
k−1 λk−1k
∣∣∣∣∣∣∣∣∣∣∣
=k∏i=1
λi ·
∣∣∣∣∣∣∣∣∣∣∣
1 λ1 · · · λk−21 λk−1
1
1 λ2 · · · λk−22 λk−1
2...
......
...1 λk · · · λk−2
k λk−1k
∣∣∣∣∣∣∣∣∣∣∣
![Page 221: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/221.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
λ1 λ2 · · · λk−1 λkλ2
1 λ22 · · · λ2
k−1 λ2k
......
......
λk1 λk2 · · · λkk−1 λkk
∣∣∣∣∣∣∣∣∣∣∣=
k∏i=1
λi ·
∣∣∣∣∣∣∣∣∣∣∣
1 1 · · · 1 1λ1 λ2 · · · λk−1 λk...
......
...λk−1
1 λk−12 · · · λk−1
k−1 λk−1k
∣∣∣∣∣∣∣∣∣∣∣
=k∏i=1
λi ·
∣∣∣∣∣∣∣∣∣∣∣
1 λ1 · · · λk−21 λk−1
1
1 λ2 · · · λk−22 λk−1
2...
......
...1 λk · · · λk−2
k λk−1k
∣∣∣∣∣∣∣∣∣∣∣
![Page 222: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/222.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
λ1 λ2 · · · λk−1 λkλ2
1 λ22 · · · λ2
k−1 λ2k
......
......
λk1 λk2 · · · λkk−1 λkk
∣∣∣∣∣∣∣∣∣∣∣=
k∏i=1
λi ·
∣∣∣∣∣∣∣∣∣∣∣
1 1 · · · 1 1λ1 λ2 · · · λk−1 λk...
......
...λk−1
1 λk−12 · · · λk−1
k−1 λk−1k
∣∣∣∣∣∣∣∣∣∣∣
=k∏i=1
λi ·
∣∣∣∣∣∣∣∣∣∣∣
1 λ1 · · · λk−21 λk−1
1
1 λ2 · · · λk−22 λk−1
2...
......
...1 λk · · · λk−2
k λk−1k
∣∣∣∣∣∣∣∣∣∣∣
![Page 223: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/223.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
1 λ1 · · · λk−21 λk−1
1
1 λ2 · · · λk−22 λk−1
2...
......
...1 λk · · · λk−2
k λk−1k
∣∣∣∣∣∣∣∣∣∣∣=
∣∣∣∣∣∣∣∣∣∣∣
1 λ1−λ1 ·1 · · · λk−21 −λ1 ·λk−3
1 λk−11 −λ1 ·λk−2
1
1 λ2−λ1 ·1 · · · λk−22 −λ1 ·λk−3
2 λk−12 −λ1 ·λk−2
2...
......
...1 λk−λ1 ·1 · · · λk−2
k −λ1 ·λk−3k λk−1
k −λ1 ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣
![Page 224: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/224.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
1 λ1 · · · λk−21 λk−1
1
1 λ2 · · · λk−22 λk−1
2...
......
...1 λk · · · λk−2
k λk−1k
∣∣∣∣∣∣∣∣∣∣∣=
∣∣∣∣∣∣∣∣∣∣∣
1 λ1−λ1 ·1 · · · λk−21 −λ1 ·λk−3
1 λk−11 −λ1 ·λk−2
1
1 λ2−λ1 ·1 · · · λk−22 −λ1 ·λk−3
2 λk−12 −λ1 ·λk−2
2...
......
...1 λk−λ1 ·1 · · · λk−2
k −λ1 ·λk−3k λk−1
k −λ1 ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣
![Page 225: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/225.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
1 λ1−λ1 ·1 · · · λk−21 −λ1 ·λk−3
1 λk−11 −λ1 ·λk−2
1
1 λ2−λ1 ·1 · · · λk−22 −λ1 ·λk−3
2 λk−12 −λ1 ·λk−2
2...
......
...1 λk−λ1 ·1 · · · λk−2
k −λ1 ·λk−3k λk−1
k −λ1 ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣=
∣∣∣∣∣∣∣∣∣∣∣
1 0 · · · 0 0
1 (λ2 − λ1) ·1 · · · (λ2 − λ1) ·λk−32 (λ2 − λ1) ·λk−2
2...
......
...1 (λk − λ1) ·1 · · · (λk − λ1) ·λk−3
k (λk − λ1) ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣
![Page 226: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/226.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
1 λ1−λ1 ·1 · · · λk−21 −λ1 ·λk−3
1 λk−11 −λ1 ·λk−2
1
1 λ2−λ1 ·1 · · · λk−22 −λ1 ·λk−3
2 λk−12 −λ1 ·λk−2
2...
......
...1 λk−λ1 ·1 · · · λk−2
k −λ1 ·λk−3k λk−1
k −λ1 ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣=
∣∣∣∣∣∣∣∣∣∣∣
1 0 · · · 0 0
1 (λ2 − λ1) ·1 · · · (λ2 − λ1) ·λk−32 (λ2 − λ1) ·λk−2
2...
......
...1 (λk − λ1) ·1 · · · (λk − λ1) ·λk−3
k (λk − λ1) ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣
![Page 227: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/227.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
1 0 · · · 0 0
1 (λ2 − λ1) ·1 · · · (λ2 − λ1) ·λk−32 (λ2 − λ1) ·λk−2
2...
......
...1 (λk − λ1) ·1 · · · (λk − λ1) ·λk−3
k (λk − λ1) ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣=
k∏i=2
(λi − λ1) ·
∣∣∣∣∣∣∣∣∣1 λ2 · · · λk−3
2 λk−22
......
......
1 λk · · · λk−3k λk−2
k
∣∣∣∣∣∣∣∣∣
![Page 228: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/228.jpg)
Computing the Determinant
∣∣∣∣∣∣∣∣∣∣∣
1 0 · · · 0 0
1 (λ2 − λ1) ·1 · · · (λ2 − λ1) ·λk−32 (λ2 − λ1) ·λk−2
2...
......
...1 (λk − λ1) ·1 · · · (λk − λ1) ·λk−3
k (λk − λ1) ·λk−2k
∣∣∣∣∣∣∣∣∣∣∣=
k∏i=2
(λi − λ1) ·
∣∣∣∣∣∣∣∣∣1 λ2 · · · λk−3
2 λk−22
......
......
1 λk · · · λk−3k λk−2
k
∣∣∣∣∣∣∣∣∣
![Page 229: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/229.jpg)
Computing the Determinant
Repeating the above steps gives:∣∣∣∣∣∣∣∣∣∣∣
λ1 λ2 · · · λk−1 λkλ2
1 λ22 · · · λ2
k−1 λ2k
......
......
λk1 λk2 · · · λkk−1 λkk
∣∣∣∣∣∣∣∣∣∣∣=
k∏i=1
λi ·∏i>`
(λi − λ`)
Hence, if all λi’s are different, then the determinant is non-zero.
![Page 230: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/230.jpg)
The Homogeneous Case
What happens if the roots are not all distinct?
Suppose we have a root λi with multiplicity (Vielfachheit) at least
2. Then not only is λni a solution to the recurrence but also nλni .
To see this consider the polynomial
P[λ] · λn−k = c0λn + c1λn−1 + c2λn−2 + · · · + ckλn−k
Since λi is a root we can write this as Q[λ] · (λ−λi)2. Calculating
the derivative gives a polynomial that still has root λi.
![Page 231: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/231.jpg)
The Homogeneous Case
What happens if the roots are not all distinct?
Suppose we have a root λi with multiplicity (Vielfachheit) at least
2. Then not only is λni a solution to the recurrence but also nλni .
To see this consider the polynomial
P[λ] · λn−k = c0λn + c1λn−1 + c2λn−2 + · · · + ckλn−k
Since λi is a root we can write this as Q[λ] · (λ−λi)2. Calculating
the derivative gives a polynomial that still has root λi.
![Page 232: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/232.jpg)
The Homogeneous Case
What happens if the roots are not all distinct?
Suppose we have a root λi with multiplicity (Vielfachheit) at least
2. Then not only is λni a solution to the recurrence but also nλni .
To see this consider the polynomial
P[λ] · λn−k = c0λn + c1λn−1 + c2λn−2 + · · · + ckλn−k
Since λi is a root we can write this as Q[λ] · (λ−λi)2. Calculating
the derivative gives a polynomial that still has root λi.
![Page 233: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/233.jpg)
The Homogeneous Case
What happens if the roots are not all distinct?
Suppose we have a root λi with multiplicity (Vielfachheit) at least
2. Then not only is λni a solution to the recurrence but also nλni .
To see this consider the polynomial
P[λ] · λn−k = c0λn + c1λn−1 + c2λn−2 + · · · + ckλn−k
Since λi is a root we can write this as Q[λ] · (λ−λi)2. Calculating
the derivative gives a polynomial that still has root λi.
![Page 234: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/234.jpg)
This means
c0nλn−1i + c1(n− 1)λn−2
i + · · · + ck(n− k)λn−k−1i = 0
Hence,
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0︸ ︷︷ ︸
T[n]︸ ︷︷ ︸
T[n−1]︸ ︷︷ ︸
T[n−k]
![Page 235: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/235.jpg)
This means
c0nλn−1i + c1(n− 1)λn−2
i + · · · + ck(n− k)λn−k−1i = 0
Hence,
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0
︸ ︷︷ ︸T[n]
︸ ︷︷ ︸T[n−1]
︸ ︷︷ ︸T[n−k]
![Page 236: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/236.jpg)
This means
c0nλn−1i + c1(n− 1)λn−2
i + · · · + ck(n− k)λn−k−1i = 0
Hence,
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0︸ ︷︷ ︸
T[n]︸ ︷︷ ︸
T[n−1]︸ ︷︷ ︸
T[n−k]
![Page 237: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/237.jpg)
The Homogeneous Case
Suppose λi has multiplicity j.
We know that
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0
(after taking the derivative; multiplying with λ; plugging in λi)
Doing this again gives
c0n2λni + c1(n− 1)2λn−1i + · · · + ck(n− k)2λn−ki = 0
We can continue j − 1 times.
Hence, n`λni is a solution for ` ∈ 0, . . . , j − 1.
![Page 238: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/238.jpg)
The Homogeneous Case
Suppose λi has multiplicity j. We know that
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0
(after taking the derivative; multiplying with λ; plugging in λi)
Doing this again gives
c0n2λni + c1(n− 1)2λn−1i + · · · + ck(n− k)2λn−ki = 0
We can continue j − 1 times.
Hence, n`λni is a solution for ` ∈ 0, . . . , j − 1.
![Page 239: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/239.jpg)
The Homogeneous Case
Suppose λi has multiplicity j. We know that
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0
(after taking the derivative; multiplying with λ; plugging in λi)
Doing this again gives
c0n2λni + c1(n− 1)2λn−1i + · · · + ck(n− k)2λn−ki = 0
We can continue j − 1 times.
Hence, n`λni is a solution for ` ∈ 0, . . . , j − 1.
![Page 240: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/240.jpg)
The Homogeneous Case
Suppose λi has multiplicity j. We know that
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0
(after taking the derivative; multiplying with λ; plugging in λi)
Doing this again gives
c0n2λni + c1(n− 1)2λn−1i + · · · + ck(n− k)2λn−ki = 0
We can continue j − 1 times.
Hence, n`λni is a solution for ` ∈ 0, . . . , j − 1.
![Page 241: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/241.jpg)
The Homogeneous Case
Suppose λi has multiplicity j. We know that
c0nλni + c1(n− 1)λn−1i + · · · + ck(n− k)λn−ki = 0
(after taking the derivative; multiplying with λ; plugging in λi)
Doing this again gives
c0n2λni + c1(n− 1)2λn−1i + · · · + ck(n− k)2λn−ki = 0
We can continue j − 1 times.
Hence, n`λni is a solution for ` ∈ 0, . . . , j − 1.
![Page 242: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/242.jpg)
The Homogeneous Case
Lemma 3
Let P[λ] denote the characteristic polynomial to the recurrence
c0T[n]+ c1T[n− 1]+ · · · + ckT[n− k] = 0
Let λi, i = 1, . . . ,m be the (complex) roots of P[λ] with
multiplicities `i. Then the general solution to the recurrence is
given by
T[n] =m∑i=1
`i−1∑j=0
αij · (njλni ) .
The full proof is omitted. We have only shown that any choice of
αij’s is a solution to the recurrence.
![Page 243: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/243.jpg)
Example: Fibonacci Sequence
T[0] = 0
T[1] = 1
T[n] = T[n− 1]+ T[n− 2] for n ≥ 2
The characteristic polynomial is
λ2 − λ− 1
Finding the roots, gives
λ1/2 = 12±√
14+ 1 = 1
2
(1±
√5)
![Page 244: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/244.jpg)
Example: Fibonacci Sequence
T[0] = 0
T[1] = 1
T[n] = T[n− 1]+ T[n− 2] for n ≥ 2
The characteristic polynomial is
λ2 − λ− 1
Finding the roots, gives
λ1/2 = 12±√
14+ 1 = 1
2
(1±
√5)
![Page 245: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/245.jpg)
Example: Fibonacci Sequence
T[0] = 0
T[1] = 1
T[n] = T[n− 1]+ T[n− 2] for n ≥ 2
The characteristic polynomial is
λ2 − λ− 1
Finding the roots, gives
λ1/2 = 12±√
14+ 1 = 1
2
(1±
√5)
![Page 246: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/246.jpg)
Example: Fibonacci Sequence
Hence, the solution is of the form
α(
1+√52
)n+ β
(1−√5
2
)n
T[0] = 0 gives α+ β = 0.
T[1] = 1 gives
α(
1+√52
)+ β
(1−√5
2
)= 1
=⇒ α− β = 2√5
![Page 247: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/247.jpg)
Example: Fibonacci Sequence
Hence, the solution is of the form
α(
1+√52
)n+ β
(1−√5
2
)n
T[0] = 0 gives α+ β = 0.
T[1] = 1 gives
α(
1+√52
)+ β
(1−√5
2
)= 1
=⇒ α− β = 2√5
![Page 248: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/248.jpg)
Example: Fibonacci Sequence
Hence, the solution is of the form
α(
1+√52
)n+ β
(1−√5
2
)n
T[0] = 0 gives α+ β = 0.
T[1] = 1 gives
α(
1+√52
)+ β
(1−√5
2
)= 1
=⇒ α− β = 2√5
![Page 249: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/249.jpg)
Example: Fibonacci Sequence
Hence, the solution is of the form
α(
1+√52
)n+ β
(1−√5
2
)n
T[0] = 0 gives α+ β = 0.
T[1] = 1 gives
α(
1+√52
)+ β
(1−√5
2
)= 1 =⇒ α− β = 2√
5
![Page 250: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/250.jpg)
Example: Fibonacci Sequence
Hence, the solution is
1√5
[(1+√5
2
)n−(
1−√52
)n]
![Page 251: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/251.jpg)
The Inhomogeneous Case
Consider the recurrence relation:
c0T(n)+ c1T(n− 1)+ c2T(n− 2)+ · · · + ckT(n− k) = f(n)
with f(n) ≠ 0.
While we have a fairly general technique for solving homogeneous,
linear recurrence relations the inhomogeneous case is different.
![Page 252: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/252.jpg)
The Inhomogeneous Case
The general solution of the recurrence relation is
T(n) = Th(n)+ Tp(n) ,
where Th is any solution to the homogeneous equation, and Tp is
one particular solution to the inhomogeneous equation.
There is no general method to find a particular solution.
![Page 253: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/253.jpg)
The Inhomogeneous Case
The general solution of the recurrence relation is
T(n) = Th(n)+ Tp(n) ,
where Th is any solution to the homogeneous equation, and Tp is
one particular solution to the inhomogeneous equation.
There is no general method to find a particular solution.
![Page 254: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/254.jpg)
The Inhomogeneous Case
Example:
T[n] = T[n− 1]+ 1 T[0] = 1
Then,
T[n− 1] = T[n− 2]+ 1 (n ≥ 2)
Subtracting the first from the second equation gives,
T[n]− T[n− 1] = T[n− 1]− T[n− 2] (n ≥ 2)
or
T[n] = 2T[n− 1]− T[n− 2] (n ≥ 2)
I get a completely determined recurrence if I add T[0] = 1 and
T[1] = 2.
![Page 255: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/255.jpg)
The Inhomogeneous Case
Example:
T[n] = T[n− 1]+ 1 T[0] = 1
Then,
T[n− 1] = T[n− 2]+ 1 (n ≥ 2)
Subtracting the first from the second equation gives,
T[n]− T[n− 1] = T[n− 1]− T[n− 2] (n ≥ 2)
or
T[n] = 2T[n− 1]− T[n− 2] (n ≥ 2)
I get a completely determined recurrence if I add T[0] = 1 and
T[1] = 2.
![Page 256: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/256.jpg)
The Inhomogeneous Case
Example:
T[n] = T[n− 1]+ 1 T[0] = 1
Then,
T[n− 1] = T[n− 2]+ 1 (n ≥ 2)
Subtracting the first from the second equation gives,
T[n]− T[n− 1] = T[n− 1]− T[n− 2] (n ≥ 2)
or
T[n] = 2T[n− 1]− T[n− 2] (n ≥ 2)
I get a completely determined recurrence if I add T[0] = 1 and
T[1] = 2.
![Page 257: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/257.jpg)
The Inhomogeneous Case
Example:
T[n] = T[n− 1]+ 1 T[0] = 1
Then,
T[n− 1] = T[n− 2]+ 1 (n ≥ 2)
Subtracting the first from the second equation gives,
T[n]− T[n− 1] = T[n− 1]− T[n− 2] (n ≥ 2)
or
T[n] = 2T[n− 1]− T[n− 2] (n ≥ 2)
I get a completely determined recurrence if I add T[0] = 1 and
T[1] = 2.
![Page 258: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/258.jpg)
The Inhomogeneous Case
Example:
T[n] = T[n− 1]+ 1 T[0] = 1
Then,
T[n− 1] = T[n− 2]+ 1 (n ≥ 2)
Subtracting the first from the second equation gives,
T[n]− T[n− 1] = T[n− 1]− T[n− 2] (n ≥ 2)
or
T[n] = 2T[n− 1]− T[n− 2] (n ≥ 2)
I get a completely determined recurrence if I add T[0] = 1 and
T[1] = 2.
![Page 259: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/259.jpg)
The Inhomogeneous Case
Example: Characteristic polynomial:
λ2 − 2λ+ 1 = 0
λ2 − 2λ+ 1︸ ︷︷ ︸(λ−1)2
Then the solution is of the form
T[n] = α1n + βn1n = α+ βn
T[0] = 1 gives α = 1.
T[1] = 2 gives 1+ β = 2 =⇒ β = 1.
![Page 260: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/260.jpg)
The Inhomogeneous Case
Example: Characteristic polynomial:
λ2 − 2λ+ 1 = 0λ2 − 2λ+ 1︸ ︷︷ ︸(λ−1)2
Then the solution is of the form
T[n] = α1n + βn1n = α+ βn
T[0] = 1 gives α = 1.
T[1] = 2 gives 1+ β = 2 =⇒ β = 1.
![Page 261: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/261.jpg)
The Inhomogeneous Case
Example: Characteristic polynomial:
λ2 − 2λ+ 1 = 0λ2 − 2λ+ 1︸ ︷︷ ︸(λ−1)2
Then the solution is of the form
T[n] = α1n + βn1n = α+ βn
T[0] = 1 gives α = 1.
T[1] = 2 gives 1+ β = 2 =⇒ β = 1.
![Page 262: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/262.jpg)
The Inhomogeneous Case
Example: Characteristic polynomial:
λ2 − 2λ+ 1 = 0λ2 − 2λ+ 1︸ ︷︷ ︸(λ−1)2
Then the solution is of the form
T[n] = α1n + βn1n = α+ βn
T[0] = 1 gives α = 1.
T[1] = 2 gives 1+ β = 2 =⇒ β = 1.
![Page 263: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/263.jpg)
The Inhomogeneous Case
Example: Characteristic polynomial:
λ2 − 2λ+ 1 = 0λ2 − 2λ+ 1︸ ︷︷ ︸(λ−1)2
Then the solution is of the form
T[n] = α1n + βn1n = α+ βn
T[0] = 1 gives α = 1.
T[1] = 2 gives 1+ β = 2 =⇒ β = 1.
![Page 264: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/264.jpg)
The Inhomogeneous CaseIf f(n) is a polynomial of degree r this method can be applied
r + 1 times to obtain a homogeneous equation:
T[n] = T[n− 1]+n2
Shift:
T[n− 1] = T[n− 2]+ (n− 1)2
= T[n− 2]+n2 − 2n+ 1
Difference:
T[n]− T[n− 1] = T[n− 1]− T[n− 2]+ 2n− 1
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
![Page 265: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/265.jpg)
The Inhomogeneous CaseIf f(n) is a polynomial of degree r this method can be applied
r + 1 times to obtain a homogeneous equation:
T[n] = T[n− 1]+n2
Shift:
T[n− 1] = T[n− 2]+ (n− 1)2
= T[n− 2]+n2 − 2n+ 1
Difference:
T[n]− T[n− 1] = T[n− 1]− T[n− 2]+ 2n− 1
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
![Page 266: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/266.jpg)
The Inhomogeneous CaseIf f(n) is a polynomial of degree r this method can be applied
r + 1 times to obtain a homogeneous equation:
T[n] = T[n− 1]+n2
Shift:
T[n− 1] = T[n− 2]+ (n− 1)2
= T[n− 2]+n2 − 2n+ 1
Difference:
T[n]− T[n− 1] = T[n− 1]− T[n− 2]+ 2n− 1
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
![Page 267: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/267.jpg)
The Inhomogeneous CaseIf f(n) is a polynomial of degree r this method can be applied
r + 1 times to obtain a homogeneous equation:
T[n] = T[n− 1]+n2
Shift:
T[n− 1] = T[n− 2]+ (n− 1)2 = T[n− 2]+n2 − 2n+ 1
Difference:
T[n]− T[n− 1] = T[n− 1]− T[n− 2]+ 2n− 1
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
![Page 268: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/268.jpg)
The Inhomogeneous CaseIf f(n) is a polynomial of degree r this method can be applied
r + 1 times to obtain a homogeneous equation:
T[n] = T[n− 1]+n2
Shift:
T[n− 1] = T[n− 2]+ (n− 1)2 = T[n− 2]+n2 − 2n+ 1
Difference:
T[n]− T[n− 1] = T[n− 1]− T[n− 2]+ 2n− 1
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
![Page 269: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/269.jpg)
The Inhomogeneous CaseIf f(n) is a polynomial of degree r this method can be applied
r + 1 times to obtain a homogeneous equation:
T[n] = T[n− 1]+n2
Shift:
T[n− 1] = T[n− 2]+ (n− 1)2 = T[n− 2]+n2 − 2n+ 1
Difference:
T[n]− T[n− 1] = T[n− 1]− T[n− 2]+ 2n− 1
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
![Page 270: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/270.jpg)
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
Shift:
T[n− 1] = 2T[n− 2]− T[n− 3]+ 2(n− 1)− 1
= 2T[n− 2]− T[n− 3]+ 2n− 3
Difference:
T[n]− T[n− 1] =2T[n− 1]− T[n− 2]+ 2n− 1
− 2T[n− 2]+ T[n− 3]− 2n+ 3
T[n] = 3T[n− 1]− 3T[n− 2]+ T[n− 3]+ 2
and so on...
![Page 271: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/271.jpg)
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
Shift:
T[n− 1] = 2T[n− 2]− T[n− 3]+ 2(n− 1)− 1
= 2T[n− 2]− T[n− 3]+ 2n− 3
Difference:
T[n]− T[n− 1] =2T[n− 1]− T[n− 2]+ 2n− 1
− 2T[n− 2]+ T[n− 3]− 2n+ 3
T[n] = 3T[n− 1]− 3T[n− 2]+ T[n− 3]+ 2
and so on...
![Page 272: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/272.jpg)
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
Shift:
T[n− 1] = 2T[n− 2]− T[n− 3]+ 2(n− 1)− 1
= 2T[n− 2]− T[n− 3]+ 2n− 3
Difference:
T[n]− T[n− 1] =2T[n− 1]− T[n− 2]+ 2n− 1
− 2T[n− 2]+ T[n− 3]− 2n+ 3
T[n] = 3T[n− 1]− 3T[n− 2]+ T[n− 3]+ 2
and so on...
![Page 273: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/273.jpg)
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
Shift:
T[n− 1] = 2T[n− 2]− T[n− 3]+ 2(n− 1)− 1
= 2T[n− 2]− T[n− 3]+ 2n− 3
Difference:
T[n]− T[n− 1] =2T[n− 1]− T[n− 2]+ 2n− 1
− 2T[n− 2]+ T[n− 3]− 2n+ 3
T[n] = 3T[n− 1]− 3T[n− 2]+ T[n− 3]+ 2
and so on...
![Page 274: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/274.jpg)
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
Shift:
T[n− 1] = 2T[n− 2]− T[n− 3]+ 2(n− 1)− 1
= 2T[n− 2]− T[n− 3]+ 2n− 3
Difference:
T[n]− T[n− 1] =2T[n− 1]− T[n− 2]+ 2n− 1
− 2T[n− 2]+ T[n− 3]− 2n+ 3
T[n] = 3T[n− 1]− 3T[n− 2]+ T[n− 3]+ 2
and so on...
![Page 275: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/275.jpg)
T[n] = 2T[n− 1]− T[n− 2]+ 2n− 1
Shift:
T[n− 1] = 2T[n− 2]− T[n− 3]+ 2(n− 1)− 1
= 2T[n− 2]− T[n− 3]+ 2n− 3
Difference:
T[n]− T[n− 1] =2T[n− 1]− T[n− 2]+ 2n− 1
− 2T[n− 2]+ T[n− 3]− 2n+ 3
T[n] = 3T[n− 1]− 3T[n− 2]+ T[n− 3]+ 2
and so on...
![Page 276: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/276.jpg)
6.4 Generating Functions
Definition 4 (Generating Function)
Let (an)n≥0 be a sequence. The corresponding
ñ generating function (Erzeugendenfunktion) is
F(z) :=∑n≥0
anzn ;
ñ exponential generating function (exponentielle
Erzeugendenfunktion) is
F(z) :=∑n≥0
ann!zn .
![Page 277: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/277.jpg)
6.4 Generating Functions
Definition 4 (Generating Function)
Let (an)n≥0 be a sequence. The corresponding
ñ generating function (Erzeugendenfunktion) is
F(z) :=∑n≥0
anzn ;
ñ exponential generating function (exponentielle
Erzeugendenfunktion) is
F(z) :=∑n≥0
ann!zn .
![Page 278: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/278.jpg)
6.4 Generating Functions
Example 5
1. The generating function of the sequence (1,0,0, . . .) is
F(z) = 1 .
2. The generating function of the sequence (1,1,1, . . .) is
F(z) = 11− z .
![Page 279: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/279.jpg)
6.4 Generating Functions
Example 5
1. The generating function of the sequence (1,0,0, . . .) is
F(z) = 1 .
2. The generating function of the sequence (1,1,1, . . .) is
F(z) = 11− z .
![Page 280: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/280.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 281: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/281.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 282: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/282.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 283: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/283.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 284: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/284.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 285: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/285.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 286: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/286.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 287: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/287.jpg)
6.4 Generating Functions
There are two different views:
A generating function is a formal power series (formale
Potenzreihe).
Then the generating function is an algebraic object.
Let f =∑n≥0 anzn and g =∑n≥0 bnzn.
ñ Equality: f and g are equal if an = bn for all n.
ñ Addition: f + g :=∑n≥0(an + bn)zn.
ñ Multiplication: f · g :=∑n≥0 cnzn with cn =∑np=0 apbn−p.
There are no convergence issues here.
![Page 288: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/288.jpg)
6.4 Generating Functions
The arithmetic view:
We view a power series as a function f : C→ C.
Then, it is important to think about convergence/convergence
radius etc.
![Page 289: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/289.jpg)
6.4 Generating Functions
The arithmetic view:
We view a power series as a function f : C→ C.
Then, it is important to think about convergence/convergence
radius etc.
![Page 290: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/290.jpg)
6.4 Generating Functions
The arithmetic view:
We view a power series as a function f : C→ C.
Then, it is important to think about convergence/convergence
radius etc.
![Page 291: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/291.jpg)
6.4 Generating Functions
What does∑n≥0 zn = 1
1−z mean in the algebraic view?
It means that the power series 1− z and the power series∑n≥0 zn are invers, i.e.,
(1− z
)·( ∞∑n≥0
zn)= 1 .
This is well-defined.
![Page 292: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/292.jpg)
6.4 Generating Functions
What does∑n≥0 zn = 1
1−z mean in the algebraic view?
It means that the power series 1− z and the power series∑n≥0 zn are invers, i.e.,
(1− z
)·( ∞∑n≥0
zn)= 1 .
This is well-defined.
![Page 293: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/293.jpg)
6.4 Generating Functions
What does∑n≥0 zn = 1
1−z mean in the algebraic view?
It means that the power series 1− z and the power series∑n≥0 zn are invers, i.e.,
(1− z
)·( ∞∑n≥0
zn)= 1 .
This is well-defined.
![Page 294: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/294.jpg)
6.4 Generating Functions
Suppose we are given the generating function
∑n≥0
zn = 11− z .
We can compute the derivative:
∑n≥1
nzn−1 = 1(1− z)2
∑n≥1
nzn−1
︸ ︷︷ ︸∑n≥0(n+1)zn
Hence, the generating function of the sequence an = n+ 1
is 1/(1− z)2.
![Page 295: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/295.jpg)
6.4 Generating Functions
Suppose we are given the generating function
∑n≥0
zn = 11− z .
We can compute the derivative:
∑n≥1
nzn−1 = 1(1− z)2
∑n≥1
nzn−1
︸ ︷︷ ︸∑n≥0(n+1)zn
Hence, the generating function of the sequence an = n+ 1
is 1/(1− z)2.
![Page 296: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/296.jpg)
6.4 Generating Functions
Suppose we are given the generating function
∑n≥0
zn = 11− z .
We can compute the derivative:
∑n≥1
nzn−1 = 1(1− z)2
∑n≥1
nzn−1
︸ ︷︷ ︸∑n≥0(n+1)zn
Hence, the generating function of the sequence an = n+ 1
is 1/(1− z)2.
![Page 297: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/297.jpg)
6.4 Generating Functions
Suppose we are given the generating function
∑n≥0
zn = 11− z .
We can compute the derivative:
∑n≥1
nzn−1 = 1(1− z)2
∑n≥1
nzn−1
︸ ︷︷ ︸∑n≥0(n+1)zn
Hence, the generating function of the sequence an = n+ 1
is 1/(1− z)2.
![Page 298: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/298.jpg)
6.4 Generating Functions
We can repeat this
∑n≥0
(n+ 1)zn = 1(1− z)2 .
Derivative: ∑n≥1
n(n+ 1)zn−1 = 2(1− z)3
∑n≥1
n(n+ 1)zn−1
︸ ︷︷ ︸∑n≥0(n+1)(n+2)zn
Hence, the generating function of the sequence
an = (n+ 1)(n+ 2) is 2(1−z)3 .
![Page 299: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/299.jpg)
6.4 Generating Functions
We can repeat this
∑n≥0
(n+ 1)zn = 1(1− z)2 .
Derivative: ∑n≥1
n(n+ 1)zn−1 = 2(1− z)3
∑n≥1
n(n+ 1)zn−1
︸ ︷︷ ︸∑n≥0(n+1)(n+2)zn
Hence, the generating function of the sequence
an = (n+ 1)(n+ 2) is 2(1−z)3 .
![Page 300: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/300.jpg)
6.4 Generating Functions
We can repeat this
∑n≥0
(n+ 1)zn = 1(1− z)2 .
Derivative: ∑n≥1
n(n+ 1)zn−1 = 2(1− z)3
∑n≥1
n(n+ 1)zn−1
︸ ︷︷ ︸∑n≥0(n+1)(n+2)zn
Hence, the generating function of the sequence
an = (n+ 1)(n+ 2) is 2(1−z)3 .
![Page 301: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/301.jpg)
6.4 Generating Functions
We can repeat this
∑n≥0
(n+ 1)zn = 1(1− z)2 .
Derivative: ∑n≥1
n(n+ 1)zn−1 = 2(1− z)3
∑n≥1
n(n+ 1)zn−1
︸ ︷︷ ︸∑n≥0(n+1)(n+2)zn
Hence, the generating function of the sequence
an = (n+ 1)(n+ 2) is 2(1−z)3 .
![Page 302: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/302.jpg)
6.4 Generating Functions
We can repeat this
∑n≥0
(n+ 1)zn = 1(1− z)2 .
Derivative: ∑n≥1
n(n+ 1)zn−1 = 2(1− z)3
∑n≥1
n(n+ 1)zn−1
︸ ︷︷ ︸∑n≥0(n+1)(n+2)zn
Hence, the generating function of the sequence
an = (n+ 1)(n+ 2) is 2(1−z)3 .
![Page 303: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/303.jpg)
6.4 Generating Functions
Computing the k-th derivative of∑zn.
∑n≥k
n(n− 1) · . . . · (n− k+ 1)zn−k
=∑n≥0
(n+ k) · . . . · (n+ 1)zn
= k!(1− z)k+1 .
Hence: ∑n≥0
(n+ kk
)zn = 1
(1− z)k+1 .
The generating function of the sequence an =(n+kk
)is 1(1−z)k+1 .
![Page 304: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/304.jpg)
6.4 Generating Functions
Computing the k-th derivative of∑zn.∑
n≥kn(n− 1) · . . . · (n− k+ 1)zn−k
=∑n≥0
(n+ k) · . . . · (n+ 1)zn
= k!(1− z)k+1 .
Hence: ∑n≥0
(n+ kk
)zn = 1
(1− z)k+1 .
The generating function of the sequence an =(n+kk
)is 1(1−z)k+1 .
![Page 305: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/305.jpg)
6.4 Generating Functions
Computing the k-th derivative of∑zn.∑
n≥kn(n− 1) · . . . · (n− k+ 1)zn−k =
∑n≥0
(n+ k) · . . . · (n+ 1)zn
= k!(1− z)k+1 .
Hence: ∑n≥0
(n+ kk
)zn = 1
(1− z)k+1 .
The generating function of the sequence an =(n+kk
)is 1(1−z)k+1 .
![Page 306: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/306.jpg)
6.4 Generating Functions
Computing the k-th derivative of∑zn.∑
n≥kn(n− 1) · . . . · (n− k+ 1)zn−k =
∑n≥0
(n+ k) · . . . · (n+ 1)zn
= k!(1− z)k+1 .
Hence: ∑n≥0
(n+ kk
)zn = 1
(1− z)k+1 .
The generating function of the sequence an =(n+kk
)is 1(1−z)k+1 .
![Page 307: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/307.jpg)
6.4 Generating Functions
Computing the k-th derivative of∑zn.∑
n≥kn(n− 1) · . . . · (n− k+ 1)zn−k =
∑n≥0
(n+ k) · . . . · (n+ 1)zn
= k!(1− z)k+1 .
Hence: ∑n≥0
(n+ kk
)zn = 1
(1− z)k+1 .
The generating function of the sequence an =(n+kk
)is 1(1−z)k+1 .
![Page 308: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/308.jpg)
6.4 Generating Functions
Computing the k-th derivative of∑zn.∑
n≥kn(n− 1) · . . . · (n− k+ 1)zn−k =
∑n≥0
(n+ k) · . . . · (n+ 1)zn
= k!(1− z)k+1 .
Hence: ∑n≥0
(n+ kk
)zn = 1
(1− z)k+1 .
The generating function of the sequence an =(n+kk
)is 1(1−z)k+1 .
![Page 309: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/309.jpg)
6.4 Generating Functions
∑n≥0
nzn =∑n≥0
(n+ 1)zn −∑n≥0
zn
= 1(1− z)2 −
11− z
= z(1− z)2
The generating function of the sequence an = n is z(1−z)2 .
![Page 310: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/310.jpg)
6.4 Generating Functions
∑n≥0
nzn =∑n≥0
(n+ 1)zn −∑n≥0
zn
= 1(1− z)2 −
11− z
= z(1− z)2
The generating function of the sequence an = n is z(1−z)2 .
![Page 311: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/311.jpg)
6.4 Generating Functions
∑n≥0
nzn =∑n≥0
(n+ 1)zn −∑n≥0
zn
= 1(1− z)2 −
11− z
= z(1− z)2
The generating function of the sequence an = n is z(1−z)2 .
![Page 312: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/312.jpg)
6.4 Generating Functions
∑n≥0
nzn =∑n≥0
(n+ 1)zn −∑n≥0
zn
= 1(1− z)2 −
11− z
= z(1− z)2
The generating function of the sequence an = n is z(1−z)2 .
![Page 313: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/313.jpg)
6.4 Generating Functions
We know ∑n≥0
yn = 11−y
Hence,
∑n≥0
anzn = 11− az
The generating function of the sequence fn = an is 11−az .
![Page 314: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/314.jpg)
6.4 Generating Functions
We know ∑n≥0
yn = 11−y
Hence,
∑n≥0
anzn = 11− az
The generating function of the sequence fn = an is 11−az .
![Page 315: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/315.jpg)
6.4 Generating Functions
We know ∑n≥0
yn = 11−y
Hence,
∑n≥0
anzn = 11− az
The generating function of the sequence fn = an is 11−az .
![Page 316: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/316.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z)
=∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 317: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/317.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z) =∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 318: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/318.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z) =∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 319: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/319.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z) =∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 320: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/320.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z) =∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 321: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/321.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z) =∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 322: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/322.jpg)
Example: an = an−1 + 1, a0 = 1
Suppose we have the recurrence an = an−1 + 1 for n ≥ 1 and
a0 = 1.
A(z) =∑n≥0
anzn
= a0 +∑n≥1
(an−1 + 1)zn
= 1+ z∑n≥1
an−1zn−1 +∑n≥1
zn
= z∑n≥0
anzn +∑n≥0
zn
= zA(z)+∑n≥0
zn
= zA(z)+ 11− z
![Page 323: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/323.jpg)
Example: an = an−1 + 1, a0 = 1
Solving for A(z) gives
∑n≥0
anzn =
A(z) = 1(1− z)2
=∑n≥0
(n+ 1)zn
Hence, an = n+ 1.
![Page 324: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/324.jpg)
Example: an = an−1 + 1, a0 = 1
Solving for A(z) gives
∑n≥0
anzn =
A(z) = 1(1− z)2
=∑n≥0
(n+ 1)zn
Hence, an = n+ 1.
![Page 325: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/325.jpg)
Example: an = an−1 + 1, a0 = 1
Solving for A(z) gives
∑n≥0
anzn = A(z) = 1(1− z)2
=∑n≥0
(n+ 1)zn
Hence, an = n+ 1.
![Page 326: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/326.jpg)
Example: an = an−1 + 1, a0 = 1
Solving for A(z) gives
∑n≥0
anzn = A(z) = 1(1− z)2 =
∑n≥0
(n+ 1)zn
Hence, an = n+ 1.
![Page 327: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/327.jpg)
Example: an = an−1 + 1, a0 = 1
Solving for A(z) gives
∑n≥0
anzn = A(z) = 1(1− z)2 =
∑n≥0
(n+ 1)zn
Hence, an = n+ 1.
![Page 328: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/328.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2(
n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)31n! ez
![Page 329: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/329.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− z
n+ 11
(1− z)2(n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)31n! ez
![Page 330: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/330.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2
(n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)31n! ez
![Page 331: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/331.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2(
n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)31n! ez
![Page 332: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/332.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2(
n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)31n! ez
![Page 333: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/333.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2(
n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− az
n2 z(1+ z)(1− z)3
1n! ez
![Page 334: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/334.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2(
n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)3
1n! ez
![Page 335: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/335.jpg)
Some Generating Functions
n-th sequence element generating function
11
1− zn+ 1
1(1− z)2(
n+kk
) 1(1− z)k+1
nz
(1− z)2
an1
1− azn2 z(1+ z)
(1− z)31n! ez
![Page 336: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/336.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 337: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/337.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 338: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/338.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G
∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 339: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/339.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 340: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/340.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 341: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/341.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 342: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/342.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 343: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/343.jpg)
Some Generating Functions
n-th sequence element generating function
cfn cF
fn + gn F +G∑ni=0 fign−i F ·G
fn−k (n ≥ k); 0 otw. zkF
∑ni=0 fi
F(z)1− z
nfn zdF(z)
dz
cnfn F(cz)
![Page 344: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/344.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:
ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 345: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/345.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:
ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 346: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/346.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:
ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 347: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/347.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:
ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 348: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/348.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:
ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 349: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/349.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:ñ partial fraction decomposition (Partialbruchzerlegung)
ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 350: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/350.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 351: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/351.jpg)
Solving Recursions with Generating Functions
1. Set A(z) =∑n≥0 anzn.
2. Transform the right hand side so that boundary condition
and recurrence relation can be plugged in.
3. Do further transformations so that the infinite sums on the
right hand side can be replaced by A(z).
4. Solving for A(z) gives an equation of the form A(z) = f(z),where hopefully f(z) is a simple function.
5. Write f(z) as a formal power series.Techniques:ñ partial fraction decomposition (Partialbruchzerlegung)ñ lookup in tables
6. The coefficients of the resulting power series are the an.
![Page 352: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/352.jpg)
Example: an = 2an−1, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
2. Transform right hand side so that recurrence can be plugged
in:
A(z) = a0 +∑n≥1
anzn
2. Plug in:
A(z) = 1+∑n≥1
(2an−1)zn
![Page 353: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/353.jpg)
Example: an = 2an−1, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
2. Transform right hand side so that recurrence can be plugged
in:
A(z) = a0 +∑n≥1
anzn
2. Plug in:
A(z) = 1+∑n≥1
(2an−1)zn
![Page 354: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/354.jpg)
Example: an = 2an−1, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
2. Transform right hand side so that recurrence can be plugged
in:
A(z) = a0 +∑n≥1
anzn
2. Plug in:
A(z) = 1+∑n≥1
(2an−1)zn
![Page 355: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/355.jpg)
Example: an = 2an−1, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
2. Transform right hand side so that recurrence can be plugged
in:
A(z) = a0 +∑n≥1
anzn
2. Plug in:
A(z) = 1+∑n≥1
(2an−1)zn
![Page 356: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/356.jpg)
Example: an = 2an−1, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
2. Transform right hand side so that recurrence can be plugged
in:
A(z) = a0 +∑n≥1
anzn
2. Plug in:
A(z) = 1+∑n≥1
(2an−1)zn
![Page 357: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/357.jpg)
Example: an = 2an−1, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
2. Transform right hand side so that recurrence can be plugged
in:
A(z) = a0 +∑n≥1
anzn
2. Plug in:
A(z) = 1+∑n≥1
(2an−1)zn
![Page 358: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/358.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 359: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/359.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 360: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/360.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 361: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/361.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 362: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/362.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 363: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/363.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 364: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/364.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 365: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/365.jpg)
Example: an = 2an−1, a0 = 1
3. Transform right hand side so that infinite sums can be
replaced by A(z) or by simple function.
A(z) = 1+∑n≥1
(2an−1)zn
= 1+ 2z∑n≥1
an−1zn−1
= 1+ 2z∑n≥0
anzn
= 1+ 2z ·A(z)
4. Solve for A(z).
A(z) = 11− 2z
![Page 366: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/366.jpg)
Example: an = 2an−1, a0 = 1
5. Rewrite f(z) as a power series:
∑n≥0
anzn =
A(z) = 11− 2z
=∑n≥0
2nzn
![Page 367: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/367.jpg)
Example: an = 2an−1, a0 = 1
5. Rewrite f(z) as a power series:
∑n≥0
anzn = A(z) = 11− 2z
=∑n≥0
2nzn
![Page 368: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/368.jpg)
Example: an = 2an−1, a0 = 1
5. Rewrite f(z) as a power series:
∑n≥0
anzn = A(z) = 11− 2z
=∑n≥0
2nzn
![Page 369: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/369.jpg)
Example: an = 3an−1 + n, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
![Page 370: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/370.jpg)
Example: an = 3an−1 + n, a0 = 1
1. Set up generating function:
A(z) =∑n≥0
anzn
![Page 371: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/371.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 372: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/372.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 373: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/373.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 374: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/374.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 375: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/375.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 376: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/376.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 377: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/377.jpg)
Example: an = 3an−1 + n, a0 = 1
2./3. Transform right hand side:
A(z) =∑n≥0
anzn
= a0 +∑n≥1
anzn
= 1+∑n≥1
(3an−1 +n)zn
= 1+ 3z∑n≥1
an−1zn−1 +∑n≥1
nzn
= 1+ 3z∑n≥0
anzn +∑n≥0
nzn
= 1+ 3zA(z)+ z(1− z)2
![Page 378: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/378.jpg)
Example: an = 3an−1 + n, a0 = 1
4. Solve for A(z):
A(z) = 1+ 3zA(z)+ z(1− z)2
gives
A(z) = (1− z)2 + z(1− 3z)(1− z)2
= z2 − z + 1(1− 3z)(1− z)2
![Page 379: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/379.jpg)
Example: an = 3an−1 + n, a0 = 1
4. Solve for A(z):
A(z) = 1+ 3zA(z)+ z(1− z)2
gives
A(z) = (1− z)2 + z(1− 3z)(1− z)2
= z2 − z + 1(1− 3z)(1− z)2
![Page 380: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/380.jpg)
Example: an = 3an−1 + n, a0 = 1
4. Solve for A(z):
A(z) = 1+ 3zA(z)+ z(1− z)2
gives
A(z) = (1− z)2 + z(1− 3z)(1− z)2
= z2 − z + 1(1− 3z)(1− z)2
![Page 381: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/381.jpg)
Example: an = 3an−1 + n, a0 = 1
4. Solve for A(z):
A(z) = 1+ 3zA(z)+ z(1− z)2
gives
A(z) = (1− z)2 + z(1− 3z)(1− z)2 =
z2 − z + 1(1− 3z)(1− z)2
![Page 382: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/382.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
We use partial fraction decomposition:
z2 − z + 1(1− 3z)(1− z)2
!= A1− 3z
+ B1− z +
C(1− z)2
This gives
z2 − z + 1 = A(1− z)2 + B(1− 3z)(1− z)+ C(1− 3z)
= A(1− 2z + z2)+ B(1− 4z + 3z2)+ C(1− 3z)
= (A+ 3B)z2 + (−2A− 4B − 3C)z + (A+ B + C)
![Page 383: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/383.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
We use partial fraction decomposition:
z2 − z + 1(1− 3z)(1− z)2
!= A1− 3z
+ B1− z +
C(1− z)2
This gives
z2 − z + 1 = A(1− z)2 + B(1− 3z)(1− z)+ C(1− 3z)
= A(1− 2z + z2)+ B(1− 4z + 3z2)+ C(1− 3z)
= (A+ 3B)z2 + (−2A− 4B − 3C)z + (A+ B + C)
![Page 384: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/384.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
We use partial fraction decomposition:
z2 − z + 1(1− 3z)(1− z)2
!= A1− 3z
+ B1− z +
C(1− z)2
This gives
z2 − z + 1 = A(1− z)2 + B(1− 3z)(1− z)+ C(1− 3z)
= A(1− 2z + z2)+ B(1− 4z + 3z2)+ C(1− 3z)
= (A+ 3B)z2 + (−2A− 4B − 3C)z + (A+ B + C)
![Page 385: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/385.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
We use partial fraction decomposition:
z2 − z + 1(1− 3z)(1− z)2
!= A1− 3z
+ B1− z +
C(1− z)2
This gives
z2 − z + 1 = A(1− z)2 + B(1− 3z)(1− z)+ C(1− 3z)
= A(1− 2z + z2)+ B(1− 4z + 3z2)+ C(1− 3z)
= (A+ 3B)z2 + (−2A− 4B − 3C)z + (A+ B + C)
![Page 386: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/386.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
We use partial fraction decomposition:
z2 − z + 1(1− 3z)(1− z)2
!= A1− 3z
+ B1− z +
C(1− z)2
This gives
z2 − z + 1 = A(1− z)2 + B(1− 3z)(1− z)+ C(1− 3z)
= A(1− 2z + z2)+ B(1− 4z + 3z2)+ C(1− 3z)
= (A+ 3B)z2 + (−2A− 4B − 3C)z + (A+ B + C)
![Page 387: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/387.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
We use partial fraction decomposition:
z2 − z + 1(1− 3z)(1− z)2
!= A1− 3z
+ B1− z +
C(1− z)2
This gives
z2 − z + 1 = A(1− z)2 + B(1− 3z)(1− z)+ C(1− 3z)
= A(1− 2z + z2)+ B(1− 4z + 3z2)+ C(1− 3z)
= (A+ 3B)z2 + (−2A− 4B − 3C)z + (A+ B + C)
![Page 388: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/388.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
This leads to the following conditions:
A+ B + C = 1
2A+ 4B + 3C = 1
A+ 3B = 1
which gives
A = 74B = −1
4C = −1
2
![Page 389: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/389.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
This leads to the following conditions:
A+ B + C = 1
2A+ 4B + 3C = 1
A+ 3B = 1
which gives
A = 74B = −1
4C = −1
2
![Page 390: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/390.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
A(z)
= 74· 1
1− 3z− 1
4· 1
1− z −12· 1(1− z)2
= 74·∑n≥0
3nzn − 14·∑n≥0
zn − 12·∑n≥0
(n+ 1)zn
=∑n≥0
(74· 3n − 1
4− 1
2(n+ 1)
)zn
=∑n≥0
(74· 3n − 1
2n− 3
4
)zn
6. This means an = 743n − 1
2n− 34 .
![Page 391: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/391.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
A(z) = 74· 1
1− 3z− 1
4· 1
1− z −12· 1(1− z)2
= 74·∑n≥0
3nzn − 14·∑n≥0
zn − 12·∑n≥0
(n+ 1)zn
=∑n≥0
(74· 3n − 1
4− 1
2(n+ 1)
)zn
=∑n≥0
(74· 3n − 1
2n− 3
4
)zn
6. This means an = 743n − 1
2n− 34 .
![Page 392: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/392.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
A(z) = 74· 1
1− 3z− 1
4· 1
1− z −12· 1(1− z)2
= 74·∑n≥0
3nzn − 14·∑n≥0
zn − 12·∑n≥0
(n+ 1)zn
=∑n≥0
(74· 3n − 1
4− 1
2(n+ 1)
)zn
=∑n≥0
(74· 3n − 1
2n− 3
4
)zn
6. This means an = 743n − 1
2n− 34 .
![Page 393: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/393.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
A(z) = 74· 1
1− 3z− 1
4· 1
1− z −12· 1(1− z)2
= 74·∑n≥0
3nzn − 14·∑n≥0
zn − 12·∑n≥0
(n+ 1)zn
=∑n≥0
(74· 3n − 1
4− 1
2(n+ 1)
)zn
=∑n≥0
(74· 3n − 1
2n− 3
4
)zn
6. This means an = 743n − 1
2n− 34 .
![Page 394: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/394.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
A(z) = 74· 1
1− 3z− 1
4· 1
1− z −12· 1(1− z)2
= 74·∑n≥0
3nzn − 14·∑n≥0
zn − 12·∑n≥0
(n+ 1)zn
=∑n≥0
(74· 3n − 1
4− 1
2(n+ 1)
)zn
=∑n≥0
(74· 3n − 1
2n− 3
4
)zn
6. This means an = 743n − 1
2n− 34 .
![Page 395: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/395.jpg)
Example: an = 3an−1 + n, a0 = 1
5. Write f(z) as a formal power series:
A(z) = 74· 1
1− 3z− 1
4· 1
1− z −12· 1(1− z)2
= 74·∑n≥0
3nzn − 14·∑n≥0
zn − 12·∑n≥0
(n+ 1)zn
=∑n≥0
(74· 3n − 1
4− 1
2(n+ 1)
)zn
=∑n≥0
(74· 3n − 1
2n− 3
4
)zn
6. This means an = 743n − 1
2n− 34 .
![Page 396: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/396.jpg)
6.5 Transformation of the Recurrence
Example 6f0 = 1
f1 = 2
fn = fn−1 · fn−2 for n ≥ 2 .
Define
gn := logfn .
Then
gn = gn−1 + gn−2 for n ≥ 2
g1 = log 2 = 1(for log = log2), g0 = 0
gn = Fn (n-th Fibonacci number)
fn = 2Fn
![Page 397: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/397.jpg)
6.5 Transformation of the Recurrence
Example 6f0 = 1
f1 = 2
fn = fn−1 · fn−2 for n ≥ 2 .
Define
gn := logfn .
Then
gn = gn−1 + gn−2 for n ≥ 2
g1 = log 2 = 1(for log = log2), g0 = 0
gn = Fn (n-th Fibonacci number)
fn = 2Fn
![Page 398: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/398.jpg)
6.5 Transformation of the Recurrence
Example 6f0 = 1
f1 = 2
fn = fn−1 · fn−2 for n ≥ 2 .
Define
gn := logfn .
Then
gn = gn−1 + gn−2 for n ≥ 2
g1 = log 2 = 1(for log = log2), g0 = 0
gn = Fn (n-th Fibonacci number)
fn = 2Fn
![Page 399: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/399.jpg)
6.5 Transformation of the Recurrence
Example 6f0 = 1
f1 = 2
fn = fn−1 · fn−2 for n ≥ 2 .
Define
gn := logfn .
Then
gn = gn−1 + gn−2 for n ≥ 2
g1 = log 2 = 1(for log = log2), g0 = 0
gn = Fn (n-th Fibonacci number)
fn = 2Fn
![Page 400: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/400.jpg)
6.5 Transformation of the Recurrence
Example 6f0 = 1
f1 = 2
fn = fn−1 · fn−2 for n ≥ 2 .
Define
gn := logfn .
Then
gn = gn−1 + gn−2 for n ≥ 2
g1 = log 2 = 1(for log = log2), g0 = 0
gn = Fn (n-th Fibonacci number)
fn = 2Fn
![Page 401: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/401.jpg)
6.5 Transformation of the Recurrence
Example 6f0 = 1
f1 = 2
fn = fn−1 · fn−2 for n ≥ 2 .
Define
gn := logfn .
Then
gn = gn−1 + gn−2 for n ≥ 2
g1 = log 2 = 1(for log = log2), g0 = 0
gn = Fn (n-th Fibonacci number)
fn = 2Fn
![Page 402: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/402.jpg)
6.5 Transformation of the Recurrence
Example 7
f1 = 1
fn = 3fn2+n; for n = 2k, k ≥ 1 ;
Define
gk := f2k .
Then:
g0 = 1
gk = 3gk−1 + 2k, k ≥ 1
![Page 403: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/403.jpg)
6.5 Transformation of the Recurrence
Example 7
f1 = 1
fn = 3fn2+n; for n = 2k, k ≥ 1 ;
Define
gk := f2k .
Then:
g0 = 1
gk = 3gk−1 + 2k, k ≥ 1
![Page 404: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/404.jpg)
6.5 Transformation of the Recurrence
Example 7
f1 = 1
fn = 3fn2+n; for n = 2k, k ≥ 1 ;
Define
gk := f2k .
Then:
g0 = 1
gk = 3gk−1 + 2k, k ≥ 1
![Page 405: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/405.jpg)
6.5 Transformation of the Recurrence
Example 7
f1 = 1
fn = 3fn2+n; for n = 2k, k ≥ 1 ;
Define
gk := f2k .
Then:
g0 = 1
gk = 3gk−1 + 2k, k ≥ 1
![Page 406: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/406.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 407: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/407.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 408: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/408.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 409: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/409.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 410: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/410.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 411: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/411.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 412: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/412.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 413: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/413.jpg)
6 Recurrences
We get
gk = 3[gk−1
]+ 2k
= 3[3gk−2 + 2k−1
]+ 2k
= 32 [gk−2]+ 32k−1 + 2k
= 32[3gk−3 + 2k−2
]+ 32k−1 + 2k
= 33gk−3 + 322k−2 + 32k−1 + 2k
= 2k ·k∑i=0
(32
)i
= 2k · (32)k+1 − 11/2
= 3k+1 − 2k+1
![Page 414: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/414.jpg)
6 Recurrences
Let n = 2k:
gk = 3k+1 − 2k+1, hence
fn = 3 · 3k − 2 · 2k
= 3(2log 3)k − 2 · 2k
= 3(2k)log 3 − 2 · 2k
= 3nlog 3 − 2n .
![Page 415: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/415.jpg)
6 Recurrences
Let n = 2k:
gk = 3k+1 − 2k+1, hence
fn = 3 · 3k − 2 · 2k
= 3(2log 3)k − 2 · 2k
= 3(2k)log 3 − 2 · 2k
= 3nlog 3 − 2n .
![Page 416: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/416.jpg)
6 Recurrences
Let n = 2k:
gk = 3k+1 − 2k+1, hence
fn = 3 · 3k − 2 · 2k
= 3(2log 3)k − 2 · 2k
= 3(2k)log 3 − 2 · 2k
= 3nlog 3 − 2n .
![Page 417: 6 Recurrences - TUM · 2020-02-22 · Methods for Solving Recurrences 1.Guessing+Induction Guess the right solution and prove that it is correct via induction. It needs experience](https://reader033.vdocuments.site/reader033/viewer/2022042710/5f5b5157881fc8234a1a68cb/html5/thumbnails/417.jpg)
6 Recurrences
Let n = 2k:
gk = 3k+1 − 2k+1, hence
fn = 3 · 3k − 2 · 2k
= 3(2log 3)k − 2 · 2k
= 3(2k)log 3 − 2 · 2k
= 3nlog 3 − 2n .