You are on page 1of 4

08/30/2017

Homework 1

Edgar Ceh Varela

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)

𝑓(𝑛) 𝑛𝑙𝑜𝑔𝑛 1 𝑛𝑙𝑜𝑔𝑛 1 𝑙𝑜𝑔𝑛


lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 10𝑛𝑙𝑜𝑔10𝑛 = lim
10 𝑛→∞ 𝑛𝑙𝑜𝑔10𝑛
= 10
lim𝑛→∞ 𝑙𝑜𝑔10𝑛 = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] =
1
1 1 𝑛 1
10
lim𝑛→∞ 𝑛1 = lim
10 𝑛→∞ 𝑛
= [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = 10 ∙ 1 = 0.1 , then f=O(g)
𝑛

𝑔(𝑛) 10𝑛𝑙𝑜𝑔10𝑛 𝑛𝑙𝑜𝑔10𝑛 𝑙𝑜𝑔10𝑛


lim𝑛→∞ 𝑓(𝑛) = lim𝑛→∞ 𝑛𝑙𝑜𝑔𝑛
= 10 ∙ lim = 10 ∙ lim𝑛→∞ = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = 10 ∙
𝑛→∞ 𝑛𝑙𝑜𝑔𝑛 𝑙𝑜𝑔𝑛
1
𝑙𝑜𝑔10𝑛+1 𝑛
lim𝑛→∞ = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = 10 ∙ lim𝑛→∞ 𝑛1 = 10 ∙ lim = [𝐿′ 𝐻𝑜𝑝𝑖𝑡𝑎𝑙] = 10 ∙ 1 = 10 , then
𝑙𝑜𝑔𝑛+1 𝑛 𝑛→∞ 𝑛
g=O(f), or f= Ω(g)

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)

𝑔(𝑛) log(𝑛2 ) 1 log(𝑛2 ) 1 2 log(𝑛) 2 𝑙𝑜𝑔𝑛 1


lim𝑛→∞ = lim𝑛→∞ = ∙ lim𝑛→∞ = ∙ lim𝑛→∞ = ∙ lim𝑛→∞ = ∙1=
𝑓(𝑛) 10log 𝑛 10 log 𝑛 10 log 𝑛 10 log 𝑛 5
1
= 0.2 , then g=f(g), or f= Ω(g)
5

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 𝑐−1 1−𝑐


lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 𝑐𝑛+1 −1
= 0−1 = −1
= 1
= 1 − 𝑐 , then f = O(g) for c<1
𝑐−1 𝑐−1

𝑐𝑛+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)

g(n) where c=1, can be represented as g(n) = 1+1+1…+1 = n+1


𝑛
𝑓(𝑛) 𝑛 1 1 1
lim𝑛→∞ 𝑔(𝑛) = lim𝑛→∞ 𝑛+1 = lim𝑛→∞ 𝑛
𝑛 1 = lim𝑛→∞ 1 = 1+0
= 1 = 1, then f=O(g)
+ 1+
𝑛 𝑛 𝑛

𝑛 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 𝑛→∞ 𝑐

to not be undetermined. f=O(g)

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)

F0 = 0, F1=1, F2 =1, F3=2, F4 = 3, F5=5

Basis case:

For n=6, Fn = F6 = Fn-1 + Fn-2 = F5 + F4 = 5 + 3 = 8 >= 8 = 23 = 20.5(6) = 20.5(n)

For n=7, Fn = F7 = Fn-1 + Fn-2 = F6 + F5 = 8 + 5 = 13 >= 11.3 = 23.5 = 20.5(7) = 20.5(n)

For n=8, Fn = F8 = Fn-1 + Fn-2 = F7 + F6 = 13 + 8 = 21 >= 16 = 24 = 20.5(8) = 20.5(n)

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:

Fk+1 = Fk-1+1 + Fk-2+1 =


Fk + Fk-1 =
Fk-1 + Fk-2 + Fk-1 =
2·(Fk-1 + Fk-2) >= By Inductive Hypothesis
2·20.5k = 20.5k+1
We prove that Fk+1 >= 20.5k+1, for n>=6

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

There are 8 multiplications and 4 additions

(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

You might also like