Professional Documents
Culture Documents
Homework1 EdgarCeh PDF
Homework1 EdgarCeh PDF
Homework 1
0.1
(a)
𝑛 100 100
𝑓(𝑛) − 1− 1−0 1
lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 𝑛𝑛 𝑛
200 = lim𝑛→∞ 𝑛
200 = 1−0
= 1
= 1 , then f=O(g)
− 1−
𝑛 𝑛 𝑛
𝑛 200 200
𝑔(𝑛) − 1− 1−0 1
lim𝑛→∞ 𝑓(𝑛) = lim𝑛→∞ 𝑛 𝑛
𝑛 100 = lim𝑛→∞ 𝑛
100 = 1−0
= 1
= 1 , then g=O(f), or f= Ω(g)
− 1−
𝑛 𝑛 𝑛
Therefore, f = Θ(g)
(d)
Therefore, f = Θ(g)
(e)
1
𝑓(𝑛) 𝑙𝑜𝑔2𝑛 𝑛 1
lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 𝑙𝑜𝑔3𝑛 = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = lim𝑛→∞ 𝑛1 = lim = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = = 1 , then
𝑛 𝑛→∞ 𝑛 1
f=O(g)
1
𝑔(𝑛) 𝑙𝑜𝑔3𝑛 𝑛 1
lim𝑛→∞ 𝑓(𝑛) = lim𝑛→∞ 𝑙𝑜𝑔3𝑛 = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = lim𝑛→∞ 𝑛1 = lim = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = = 1 , then
𝑛 𝑛→∞ 𝑛 1
g=O(f), or f= Ω(g)
Therefore, f = Θ(g)
(f)
1
𝑓(𝑛) 10𝑙𝑜𝑔𝑛 𝑙𝑜𝑔𝑛 𝑙𝑜𝑔𝑛 𝑙𝑜𝑔𝑛
lim𝑛→∞ = lim𝑛→∞ = 10 ∙ lim𝑛→∞ = 10 ∙ lim𝑛→∞ = 5 ∙ lim𝑛→∞ =5∙1=
𝑔(𝑛) log(𝑛2 ) log(𝑛2 ) 2 log(𝑛) log 𝑛
5 , then f=O(g)
Therefore, f = Θ(g)
(o)
𝑓(𝑛) 𝑛! 1∙2∙3∙⋯∙𝑛 ∞
lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 2𝑛 = lim𝑛→∞ 2∙2∙2∙⋯∙2 = 1
= ∞ , then f ≠ O(g)
𝑔(𝑛) 2𝑛 2∙2∙2∙⋯∙2 1
lim𝑛→∞ = lim𝑛→∞ = lim𝑛→∞ = = 0 , then g = O(f) , or f= Ω(g)
𝑓(𝑛) 𝑛! 1∙2∙3∙⋯∙𝑛 ∞
0.2
𝑐 𝑛+1 −1
This is a geometric series, and its closed formula for c≠1 is
𝑐−1
(a)
𝑐𝑛+1 −1 0−1
𝑔(𝑛) −1 1
lim𝑛→∞ 𝑓(𝑛) = lim𝑛→∞ 𝑐−1
1
= 𝑐−1
1
= 𝑐−1
= 1−𝑐
, then g = O(f) , or f= Ω(g) for c<1
Therefore, f = Θ(g)
(b)
𝑛 1 1
𝑔(𝑛) 𝑛+1 + 1+ 1+0 1
lim𝑛→∞ = lim𝑛→∞ = lim𝑛→∞ 𝑛 𝑛
𝑛 = lim𝑛→∞ 𝑛
= = = 1, then cg=O(f) or f= Ω(g)
𝑓(𝑛) 𝑛 1 1 1
𝑛
Therefore, f = Θ(g)
(c)
1
𝑓(𝑛) 𝑐𝑛 1 1 1 lim (1) 1 1 1 𝑐−1
lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 𝑐𝑛+1 −1
= 1 ∙ lim𝑛→∞ 𝑐
1 = 1 ∙𝑐∙ 𝑛→∞
1 = 1 ∙𝑐∙1= 𝑐
, then c>1
𝑐−1 1− 𝑛 𝑐−1 lim (1− 𝑛+1 ) 𝑐−1
𝑐−1 𝑐 −1 𝑛→∞ 𝑐
2
𝑐𝑛+1 −1
𝑔(𝑛) 1 𝑐 𝑛+1 −1 1 1 1 1
lim𝑛→∞ 𝑓(𝑛) = lim𝑛→∞ 𝑐−1 𝑐𝑛
= ∙ lim
𝑐−1 𝑛→∞ 𝑐 𝑛
= ∙ lim 𝑐
𝑐−1 𝑛→∞
− 𝑐𝑛 = 𝑐−1
∙ lim𝑛→∞ 𝑐 − lim𝑛→∞ 𝑐 𝑛 =
1 𝑐
𝑐−1
∙ (𝑐 − 0) = 𝑐−1 , then c>1 to not be undetermined. g=O(f) or f= Ω(g)
Therefore, f = Θ(g)
0.3
(a)
Basis case:
Inductive Hypothesis: Let k be a positive integer where k>=6, then Fk = Fk-1 + Fk-2 >= 20.5k. We want to
show that Fk+1 >= 20.5k+1
Inductive step:
0.4
(a)
𝑎11 𝑎12 𝑏11 𝑏12 𝑎 ∙ 𝑏 + 𝑎12 ∙ 𝑏21 𝑎11 ∙ 𝑏12 + 𝑎12 ∙ 𝑏22
(𝑎 𝑎22 ) ∙ (𝑏21 ) = ( 11 11 )
21 𝑏22 𝑎21 ∙ 𝑏11 + 𝑎22 ∙ 𝑏21 𝑎21 ∙ 𝑏12 + 𝑎22 ∙ 𝑏22
(b)
Using as an example X8, n=8 then log8 = 3, then there must be 3 matrix multiplications.
3
2 2 2
𝐹 𝐹8 0 1 8 0 1 4 0 1 2
( 7 )=( ) = (( ) ) = ((( ) ) ) =
𝐹8 𝐹9 1 1 1 1 1 1
𝟐 𝟐 2 2
𝟎 𝟏 𝟎 𝟏 1 1 2 𝟏 𝟏 𝟏 𝟏 2 3 2 𝟐 𝟑 𝟐 𝟑
((( )∙( )) ) = (( ) ) = (( )∙( )) = ( ) =( )∙( )=
𝟏 𝟏 𝟏 𝟏 1 2 𝟏 𝟐 𝟏 𝟐 3 5 𝟑 𝟓 𝟑 𝟓
13 21
( )
21 34
There are 3 matrix multiplications, so we can generalize that log(n) is suffice for computing Xn