1 - Asymptotic Analysis

Recalling the definition Asymtotic Notation, we have the following problems: In the analysis of algorithms, we are mostly concerned with function of the type f from N to R+, where f(n) depicts the count of basic operations in the Word-RAM model, for an input size of n. f(n) is allowed to be real, just for relaxation.
Note that f is increasing in n, it would be kind of weird if a larger input required less computations in our model.

Any polynomial/sub-polynomial beats any logarithmic power

For any a,bR+, log(n)a=O(nb). But nbO(log(n)a).

proof:
First, we will show that there is an absolute constant C>0 such that log(n)aCnb. Notice the following series of equations, (exploiting the fact that log is increasing)

alog(logn)logC+blognlogCalog(logn)blog(n)

Now set g(x)=alog(logx)blogx. for x1 and xR. We claim that g(x) has an absolute maximum. $$g'(x) = \frac{1}{x}\left( \frac{a}{\log x} - b \right)$$
Notice that g(x)=0 at x=ea/b, and for x<ea/b, g(x)>0, for x>ea/b g(x)<0. Hence g(ea/b) is the absolute maximum of g. It's sufficient to set logCg(ea/b).

Now, we will show that there is no absolute constant D>0 such that nbD(logn)a. Again $$ b \log n \le \log D + a \log(\log n)$$

logDblognalog(logn)=g(n)

notice that g(x) is increasing, and unbounded for real x. We will leave it to the reader to prove this.


Informal

We will not be doing any additional problems for asymptotic analysis.

Asymptotics Exercises


  1. Find a simple, tight asymptotic bound for (n6006).

Solution: Definition yields n(n1)(n6005) in the numerator (a degree 6006 polynomial) and 6006! in the denominator (constant with respect to n ). So (n6006)=Θ(n6006).


  1. Find a simple, tight asymptotic bound for log6006((log(nn))2).

Solution: Recall exponent and logarithm rules: logab=loga+logb,log(ab)=bloga, and logab=logb/loga.

log6006((log(nn))2)=2log6006log(nlogn)=Θ(logn1/2+loglogn)=Θ(logn)
  1. Show that 2n+1Θ(2n), but that 22n+1O(22n).

Solution: In the first case, 2n+1=22n, which is a constant factor larger than 2n. In the second case, 22n+1=(22n)2, which is definitely more than a constant factor larger than 22n.


  1. Show that (logn)a=O(nb) for all positive constants a and b.

Solution: It's enough to show nb/(logn)a limits to as n, and this is equivalent to arguing that the log of this expression approaches :

limnlog(nb(logn)a)=limn(blognaloglogn)=limx(bxalogx)=,

as desired.
Note: for the same reasons, na=O(cn) for any c>1.


  1. Show that (logn)logn=Ω(n).

Solution: Note that mm=Ω(2m), so setting n=2m completes the proof.


  1. Show that (6n)!Θ(n!), but that log((6n)!)Θ(log(n!)).
    Solution: We invoke Sterling's approximation,
n!=2πn(ne)n(1+Θ(1n))

Substituting in 6n gives an expression that is at least 66n larger than the original. But taking the logarithm of Sterling's gives log(n!)=Θ(nlogn), and substituting in 6n yields only constant additional factors.


Asymptotic Analysis using limits

we can loosen our definition of big-O notation, by allowing f=O(g) if we have f(n)Cg(n) for each n>N0 for some N0N.
Using this definition, we have the following proposition:

Finite limiting ratio and Asymptotics

Let f,g:NR+ if limnf(n)g(n)=C>0, then f=O(g).

proof: Notice that for each ϵ>0 there exists N(ϵ) such that when n>N(ϵ): $$\Bigg|\frac{f(n)}{g(n)} - C \Bigg | < \epsilon$$
Rearranging, and choosing any small epsilon that we like :) we have f(n)<(C+ϵ)g(n) for each nN(ϵ). Hence f=O(g).

Informal

Notice that f=O(g) doesn't say too much about the limits, and is well defined when neither f nor g converge, however, since f(n)g(n)C for each nN, it is indeed true that the limit superior of f/g is at most C. (just look at all convergent subsequences of f/g, they are all bounded above by C, so the one with the largest limit is also bounded above by C).