Let m≤n. This implies that f(m)≤f(n) and g(m)≤g(n).
If we add up these inequalities, then we get f(m)+g(m)≤f(n)+g(n), thus proving that f(n)+g(n) is monotonically increasing. If we multiply these inequalities, provided that both f and g are nonnegative, then we get f(m)⋅g(m)≤f(n)⋅g(n), thus proving that f(n)⋅g(n) is monotonically increasing.
By definition f(g(m))≤f(g(n)), so the composition f(g(n)) is also monotonically increasing.
Exercise 3.3-2
Available in the latest revision of the IM.
Exercise 3.3-3
f(n)=o(n) implies that 0≤f(n)<cn for all c>0 and n≥n0. For n≥n0 we haven≤n+f(n)<(1+c)n, thus n+o(n)=Θ(n), since we can choose any constant greater than 1 for the upper bound. Consequently, (n+o(n))k=(Θ(n))k=Θ(nk) for any real k. As a side note, if k<0, then the inequalities of Θ are reverse of those when k>0.
Analogously, we can prove that n−o(n)=Θ(n) by simply reversing inequalities n≥n−f(n)>(1−c)n and choosing any positive constant less than 1 for the lower bound.
⌈n⌉=n+o(n), so ⌈n⌉k=Θ(nk). ⌊n⌋=n−o(n), so ⌊n⌋k=Θ(nk).
Theorem 3.1 implies that lgf(n)=Θ(lgn) for all n≥max{n0,1/c12,c2}. This concludes the proof.
Exercise 3.3-5
Available in the latest revision of the IM.
Exercise 3.3-6
Available in the latest revision of the IM.
Exercise 3.3-7
Available in the latest revision of the IM.
Exercise 3.3-8
Available in the latest revision of the IM.
Exercise 3.3-9
Available in the latest revision of the IM.
Problem 3-1
In all subproblems, we rely on the fact, stated in the book on page 65, that for an asymptotically positive polynomial p(n) of degree d, we have p(n)=Θ(nd). Consequently, for some positive constants it holds that 0≤c1nd≤p(n)≤c2nd for all n≥n0.
a.
nk≥nd for all n≥1, so 0≤p(n)≤c2nd≤c2nk for all n≥n0. Thus, p(n)=O(nk).
b.
nk≤nd for all n≥1, so 0≤c1nk≤c1nd≤p(n) for all n≥n0. Thus, p(n)=Ω(nk).
c.
k=d means that k≥d∧k≤d, so parts (a) and (b) apply. Theorem 3.1 implies that p(n)=Θ(nk).
d.
We fix a positive constant c and show that for sufficiently large n it is true that c2nd<cnk. We can rewrite this inequality as c2/c<nk−d. Apparently, it holds for all n>(c2/c)1/(k−d). Choosing n to be greater than this value and n0 ensures that 0≤p(n)≤c2nd<cnk. As the choice of c was arbitrary the derivation applies to all positive constants, hence p(n)=o(nk).
e.
We fix a positive constant c and show that for sufficiently large n it is true that c1nd>cnk. We can rewrite this inequality as c/c1<nd−k. Apparently, it holds for all n>(c/c1)1/(d−k). Choosing n to be greater than this value and n0 ensures that 0≤cnk<c1nd≤p(n). As the choice of c was arbitrary the derivation applies to all positive constants, hence p(n)=ω(nk).
Problem 3-2
Available in the latest revision of the IM.
Problem 3-3
Available in the latest revision of the IM.
Problem 3-4
Available in the latest revision of the IM.
Problem 3-5
Assume that all constants introduced in the subproblems are positive. Furthermore, we proceed from left to right in all identities.
a.
Let g(n)=Θ(f(n)), thus 0≤c1f(n)≤g(n)≤c2f(n) for all n≥ng. Let h(n)=Θ(g(n)), so 0≤d1g(n)≤h(n)≤d2g(n) for all n≥nh. Substituting g(n) with f(n) we get 0≤c1d1f(n)≤h(n)≤c2d2f(n) for all n≥max{ng,nh}. Therefore, h(n)=Θ(f(n)), which concludes the proof.
b.
Let g(n)=Θ(f(n)), thus 0≤c1f(n)≤g(n)≤c2f(n) for all n≥ng. Let h(n)=O(f(n)), so 0≤h(n)≤df(n) for all n≥nh. By combining these inequalities we get for all n≥max{ng,nh}
0≤c1f(n)≤g(n)+h(n)≤(c2+d)f(n)
Therefore, g(n)+h(n)=Θ(f(n)), which concludes the proof.
c.
Let h(n)=Θ(f(n)), thus 0≤c1f(n)≤h(n)≤c2f(n) for all n≥nh. Let q(n)=Θ(g(n)), so 0≤d1g(n)≤q(n)≤d2g(n) for all n≥nq. Adding together these inequalities we get for all n≥max{nh,nq}
Therefore, h(n)+q(n)=Θ(f(n)+g(n)), which concludes the proof.
d.
Let h(n)=Θ(f(n)), thus 0≤c1f(n)≤h(n)≤c2f(n) for all n≥nh. Let q(n)=Θ(g(n)), so 0≤d1g(n)≤q(n)≤d2g(n) for all n≥nq. Multiplying together these inequalities we get for all n≥max{nh,nq}
0≤c1d1(f(n)⋅g(n))≤h(n)⋅q(n)≤c2d2(f(n)⋅g(n))
Therefore, h(n)⋅q(n)=Θ(f(n)⋅g(n)), which concludes the proof.
e.
(a1n)k1lgk2(a2n)=a1k1nk1(lgn+lga2)k2=Θ(a1k1nk1)(lgn+o(lgn))k2=Θ(nk1)⋅Θ(lgk2n)=Θ(nk1lgk2n)(by reflexivity)(by Problem 3-4 part (h))(by part (d))
Problem 3-6
a.
If f(n)=O(g(n)) or f(n)=Ω(g(n)), then we are done. Observe that f(n)=Ω(g(n)) implies f(n)=Ω∞(g(n)).
Pick any positive constant c. There must be infinitely many points where f(n)>cg(n), otherwise we could find a positive threshold n0 such that f(n)≤cg(n) for all n≥n0. In other words, for any n0 there is some m>n0 where f(m)>cg(m). Consequently, f(n)=Ω∞(g(n)).
b.
See Problem 3-2 part (c).
c.
As shown in part (a), one advantage of using omega infinity over standard omega is that all asymptotically nonnegative functions become asymptotically comparable. On the other hand, from omega infinity we cannot deduce that one function is "larger" than the other. Oscillations are permitted. Furthermore, we don't know anything about how those infinitely many points are distributed. With classical omega notation it is clear that the condition holds for all n≥n0. Finally, omega infinity is rather an esoteric notation, unknown to most software engineers.
d.
f(n)=Θ(g(n)) implies that f(n)=∣f(n)∣ is an asymptotically nonnegative function, thus f(n)=O′(g(n)) immediately follows from f(n)=O(g(n)). Therefore, the "only if" direction remains valid after the substitution.
f(n)=Ω(g(n)) implies that f(n)=∣f(n)∣ is an asymptotically nonnegative function, thus f(n)=O(g(n)) immediately follows from f(n)=O′(g(n)). Therefore, the "if" direction also remains valid after the substitution.
e.
Ω(g(n))={f(n):Θ(g(n))={f(n):there exist positive constants c, k, and n0 such that0≤cg(n)lgkn≤f(n) for all n≥n0}there exist positive constants c1, c2, k1, k2, and n0 such that0≤c1g(n)lgk1n≤f(n)≤c2g(n)lgk2n for all n≥n0}
The proof of the corresponding analog to Theorem 3.1 is essentially the same as for the original version (see Exercise 3.2-4). The only difference is that we should use these new definitions.