Aymptotic notation and limits - Department of Computer Science

Aymptotic notation and limits
David Liu & Toniann Pitassi
March 3, 2017
Our asymptotic notation of O, Ω, and Θ are concerned with the comparing the long-term
behaviour of two functions. It turns out that the concept of “long-term behaviour” is captured in
another object of mathematical study, familiar to us from calculus: the limit.
Disclaimer: this note is not part of the course material, and is presented mainly to illustrate
a nice connection between CSC165 and calculus. You are not responsible for the definitions
here, nor may you use the theorem presented here in this course.
In calculus, we capture the intuitive notion of the “long-term behaviour” of a function f (n) by
discussing the limit of this function as n approaches infinity. Formally, we have the following two
definitions:1
lim f (n) = L : ∀ ∈ R+ , ∃n0 ∈ N, ∀n ∈ N, n ≥ n0 ⇒ |f (n) − L| < n→∞
(where f : N → R and L ∈ R)
+
lim f (n) = ∞ : ∀M ∈ R , ∃n0 ∈ N, ∀n ∈ N, n ≥ n0 ⇒ f (n) > M
n→∞
(where f : N → R)
Using just these definitions and the definitions of our asymptotic symbols O, Ω, and Θ, we can
prove the following pretty remarkable results:
Theorem 1 (Limits and Big-Oh). For all f, g : N → R≥0 , if g(n) 6= 0 for all n ∈ N, then the
following statements hold:
f (n)
= L, then f ∈ O(f ) and g ∈ O(f ). (In other
n→∞ g(n)
(i) If there exists L ∈ R+ such that lim
words, g ∈ Θ(f ).)
f (n)
= 0, then f ∈ O(g) and g ∈
/ O(f ).
n→∞ g(n)
(ii) If lim
f (n)
= ∞, then g ∈ O(f ) and f ∈
/ O(g).
n→∞ g(n)
(iii) If lim
Proving this theorem is actually a very good (lengthy) exercise for a CSC165 student; they
involve keeping track of variables and manipulating inequalities, two key skills you’re developing
in this course! And they do tend to be useful in practice (although again, not for this course) to
1
We’re restricting our attention here to functions with domain N because that’s our focus in computer science.
1
proving asymptotic bounds like n2 ∈ O(1.01n ). But note that the converse of these statements is
not true; for example, it is possible (and another nice exercise) to find functions f and g such that
f (n)
is undefined.
g ∈ Θ(f ), but lim
n→∞ g(n)
2