[Note: this section is not part of the required
course material for CSC110. It is presented mainly for the nice
connection between Big-O notation and calculus.]
Our asymptotic notation of \(\cO\),
\(\Omega\), and \(\Theta\) are concerned with 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 of
a function as its input approaches infinity.
Let \(f: \N \to \R\) and \(L \in \R\). We have the following two
definitions:We’re restricting our attention here to functions with
domain \(\N\) because that’s our focus
in computer science.\[
\lim_{n \to \infty} f(n) = L:~ \forall \epsilon \in \R^+,~ \exists n_0
\in \N,~ \forall n \in \N,~ n \geq n_0 \IMP |f(n) - L| < \epsilon
\]\[
\lim_{n \to \infty} f(n) = \infty:~ \forall M \in \R^+,~ \exists n_0 \in
\N,~ \forall n \in \N,~ n \geq n_0 \IMP f(n) > M
\]
Using just these definitions and the definitions of our asymptotic
symbols \(\cO\), \(\Omega\), and \(\Theta\), we can prove the following pretty
remarkable results:
For all \(f, g: \N \to \R^{\geq
0}\), if \(g(n) \neq 0\) for all
\(n \in \N\), then the following
statements hold:
If there exists \(L \in \R^+\) such
that \(\displaystyle{\lim_{n \to \infty}
\frac{f(n)}{g(n)} = L}\), then \(g \in
\Theta(f)\).
If \(\displaystyle{\lim_{n \to \infty}
\frac{f(n)}{g(n)} = 0}\), then \(f \in
\cO(g)\) and \(f \notin
\Theta(g)\).
If \(\displaystyle{\lim_{n \to \infty}
\frac{f(n)}{g(n)} = \infty}\), then \(f
\in \Omega(g)\) and \(f \notin
\cO(g)\).
Proving this theorem is actually a very good (lengthy) exercise. The
proof involves 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 proving
asymptotic bounds like \(n^2 \in
\cO(1.01^n)\).
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 \(g
\in \Theta(f)\), but \(\displaystyle{\lim_{n \to \infty}
\frac{f(n)}{g(n)}}\) does not exist.