# Growth of Functions

The analysis of algorithms often requires a body of mathematical tools. In this lecture, we introduce some important tools and standards of notation.
• Asymptotic notation
• Standard notation and common functions

## 1  Asymptotic Notation

The notation used to describe the asymptotic running time of an algorithm is defined in terms of functions whose domains are the set of natural numbers.
This notation refers to how the problem scales as the problem gets larger. In some cases it is important to look at how fast the problem is for small amounts of input, particularly when the same task is being done over and over again. However, we are mainly concerned with algorithms for large problems, hence how the performance scales as the problem size approaches infinity is what we will look at.

### 1.1$O$-notation

O-notation, pronounced "big-oh notation", is used to describe the asymptotic upper bound of an algorithm. Formally, it is defined as:
For a given function, $g\left(n\right)$ , we denote by $O\left(g\left(n\right)\right)$ the set of functions, $O\left(g\left(n\right)\right)$ $=$ { $f\left(n\right)$: there exist positive constants $c$ and ${n}_{0}$ such that $0\le f\left(n\right)\le cg\left(n\right)$ for all $n\ge {n}_{0}$}.
Less formally, this means that for all sufficiently big $n$, the running time (space requirements etc) of the algorithm is less than $g\left(n\right)$ multiplied by some constant. Even less formally, if $f\left(n\right)=O\left({n}^{2}\right)$ then we can say that $f\left(n\right)$ runs no slower than ${n}^{2}$.
Figure 1: "There exist positive constants $c$ and ${n}_{0}$ such that $0\le f\left(n\right)\le cg\left(n\right)$ for all $n\ge {n}_{0}$." $f\left(n\right)$ is thus $O\left(g\left(n\right)\right)$.
For example:
• Given $f\left(n\right)=3n+5$, then $f\left(n\right)=O\left(n\right)$.
• Given $f\left(n\right)={n}^{3}$, then $f\left(n\right)\ne O\left({n}^{2}\right)$.
• Given $f\left(n\right)={n}^{2}$, then $f\left(n\right)=O\left({n}^{3}-7{n}^{2}+3\right)$.

### 1.2$\Omega$-notation

$\Omega$-notation, pronounced "big-omega notation", is used to describe the asymptotic lower bound of an algorithm. Formally, it is defined as:
For a given function, $g\left(n\right)$, we denote by $\Omega \left(g\left(n\right)\right)$ the set of functions, $\Omega \left(g\left(n\right)\right)$ $=$ { $f\left(n\right)$: there exist positive constants $c$ and ${n}_{0}$ such that $0\le cg\left(n\right)\le f\left(n\right)$ for all $n\ge {n}_{0}$}.
Less formally, this means that for all sufficiently big $n$, the running time (space requirements etc) of the algorithm is greater than $g\left(n\right)$ multiplied by some constant. Even less formally, if $f\left(n\right)=\Omega \left({n}^{2}\right)$ then we can say that $f\left(n\right)$ runs no faster than ${n}^{2}$.
Figure 2: "There exist positive constants $c$ and ${n}_{0}$ such that $0\le cg\left(n\right)\le f\left(n\right)$ for all $n\ge {n}_{0}$." $f\left(n\right)$ is thus $\Omega \left(g\left(n\right)\right)$.
For example:
• Given $f\left(n\right)=3n+5$, then $f\left(n\right)=\Omega \left(n\right)$.
• Given $f\left(n\right)={n}^{2}$, then $f\left(n\right)\ne \Omega \left({n}^{3}\right)$.
• Given $f\left(n\right)={n}^{4}$, then $f\left(n\right)=\Omega \left({n}^{3}-7{n}^{2}+3\right)$.

### 1.3$\Theta$-notation

We can now talk about algorithms in terms of a limit to how fast or how slow they run. However, our notation is not asymptotically tight. If we say that an algorithm runs in $f\left(n\right)=O\left({n}^{2}\right)$, then that algorithm could actually run in $n$ time. Usually we want to have a tight bound, we want to be able to say that an algorithm runs no slower and no faster than a particular function. To do this, we use $\Theta$-notation.
For a given function, $g\left(n\right)$, we denote by $\Theta \left(g\left(n\right)\right)$ the set of functions $\Theta \left(g\left(n\right)\right)$ $=$ { $f\left(n\right)$: there exist positive constants ${c}_{1}$, ${c}_{2}$, and ${n}_{0}$ such that $0\le {c}_{1}g\left(n\right)\le f\left(n\right)\le {c}_{2}g\left(n\right)$ for all $n\ge {n}_{0}$}.
Figure 3: "There exist positive constants ${c}_{1}$, ${c}_{2}$, and ${n}_{0}$ such that $0\le {c}_{1}g\left(n\right)\le f\left(n\right)\le {c}_{2}g\left(n\right)$ for all $n\ge {n}_{0}$". $f\left(n\right)$ is thus $\Theta \left(g\left(n\right)\right)$.
For example:
• Given $f\left(n\right)=\frac{1}{2}{n}^{2}-3n+7$, then $f\left(n\right)=\Theta \left({n}^{2}\right)$.
• Given $f\left(n\right)=\sum _{i=1}^{n}i$, then $f\left(n\right)=\Theta \left({n}^{2}\right)$.

### 1.4$o$-notation

Sometimes we want to identify bounds that are not asymptotically tight, $o$-notation, pronounced little-oh notation. is used to denote an upper bound that is not asymptotically tight.
For a given function, $g\left(n\right)$, we denote by $o\left(g\left(n\right)\right)$ the set of functions $o\left(g\left(n\right)\right)$ $=$ { $f\left(n\right)$: for any positive constant $c>0$, there exists a constant ${n}_{0}>0$ such that $0\le f\left(n\right)\le \mathrm{cg}\left(n\right)$ for all $n\ge {n}_{0}$}.
The implication of this, is that $f\left(n\right)$ becomes insignificant relative to $g\left(n\right)$ as $n$ approaches infinity:

 $\underset{n\to \infty }{lim}\frac{f\left(n\right)}{g\left(n\right)}=0$

For example, $2n=o\left({n}^{2}\right)$ but $2{n}^{2}\ne o\left({n}^{2}\right)$.

### 1.5$\omega$-notation

$\omega$-notation, pronounced little-omega notation, is used to denote a lower bound that is not asymptotically tight.
For a given function, $g\left(n\right)$, we denote by $\omega \left(g\left(n\right)\right)$ the set of functions $\omega \left(g\left(n\right)\right)$ $=$ { $f\left(n\right)$: for any positive constant $c>0$, there exists a constant ${n}_{0}>0$ such that $0\le cg\left(n\right)\le f\left(n\right)$ for all $n\ge {n}_{0}$}.
The implication of this is that $g\left(n\right)$ becomes insignificant relative to $f\left(n\right)$ as $n$ approaches infinity:

 $\underset{n\to \infty }{lim}\frac{f\left(n\right)}{g\left(n\right)}=\infty$

For example $\frac{{n}^{2}}{2}=\omega \left(n\right)$ but $\frac{{n}^{2}}{2}\ne \omega \left({n}^{2}\right)$.

File translated from TEX by TTM, version 3.67.
On 31 Mar 2006, 18:12.