Asymptotic notation
|
In mathematical analysis, and in particular in the analysis of algorithms, to classify the growth of functions one has recourse to asymptotic notations. Knuth advocated the following notations (other notations hold in various contexts, e.g., Landau and Hardy notation):
- O-notation (big-oh)
- o-notation (little-oh)
- Ω-notation
- ω-notation
- Θ-notation
The minute details of a function for arbitrary big values of its argument seldom matter. Often it is enough to compare its overall behaviour to standard sets of mathematical function so as qualify the function at hand along a restricted set of significant behaviours, such as bounded, oscillating, divergent, etc..., and to indicate the speed with which it reach this asymptotic behaviour.
For instance if a function tends to zero faster than a square integrable function, it is known that it has a well-defined Fourier transform, no matter what the function actually looks like.
The notation is an equality between the function at hand, and the known function it behaves like or is compared to in the asymptotic limit. For example, <math>g(x)=\Theta (x^2)<math> means that the function <math>g(x)<math> behaves asymptotically like the function <math>x^2<math> (see below for the meaning of each notation).
The notation is highly conventional and must not be assigned any mathematical significance. For example, if <math>g=\Theta(f)<math> and <math>h=\Theta(f)<math> it does not mean that <math>g=h<math>. A better notation would be <math>g \in \Theta (f)<math> as <math>\Theta(f)<math> (and others) can be regarded as the set of functions sharing a common asymptotic behavior.
Definitions
- (In all that follows, the asymptotic relations are considered with respect to x→+∞. Often another limit point is of interest (e.g. x→0 or x→a∈R). Then of course the definitions below must be modified adequately. To avoid misunderstandings, the limit point should be made precise, e.g. by writing (a) below the "=" sign or (x→a) behind the equation, as in <math>x\begin{matrix}=\\[-2ex]{}_{(\infty)}\end{matrix}o(x^2)~;~x^2=o(x)~~(x\to0)<math>.)
The O-notation means that the function is bounded from above (aka dominated) by a function which varies like <math>f<math>, i.e.,
- <math>g = O(f) \iff g\in O(f) \iff (\exists\alpha > 0)(\exists x_0)(\forall x>x_0)~ |g(x)|\le\alpha |f(x)|.<math>
Thus, <math>f = O(1)<math> means that <math>f<math> is bounded and <math>f = O(x)<math> means that <math>f<math> does not grow faster than linear (sub-linear growth). It corresponds for functions in asymptotic limit to the relation <math>\le<math> between numbers.
The o-notation restricts the O-notation to mean that the function is bounded from above but that the bound must not be tight, i.e., the function must grow strictly slower than its o-reference. Formally:
- <math>g = o(f)\iff g\in o(f)\iff (\forall\alpha>0)(\exists x_\alpha)(\forall x>x_\alpha)~ |g(x)|<\alpha |f(x)|<math>
so that for instance <math>2x^n = O(x^n)<math> but is not <math>o(x^n)<math>. (This relation is also pronounced g is negligible w.r.t. f.) Also, <math>x^n = o(x^m)<math> if <math>n < m<math> while it is O if <math>n \le m<math>. It corresponds for functions in asymptotic limit to the relation < between numbers.
The Ω-notation is the counterpart of O-notation for functions bounded from below:
- <math>g = \Omega(f)\iff g\in \Omega(f)\iff (\exists\alpha > 0)(\exists x_0)(\forall x>x_0)~ \alpha |f(x)|\le |g(x)|.<math>
Likewise ω-notation is the counterpart of o-notation for functions bounded from below without converging towards their reference:
- <math>g = \omega(f) \iff g\in \omega(f) \iff (\forall\alpha>0)(\exists x_\alpha)(\forall x>x_\alpha)~ \alpha |f(x)| < |g(x)|.<math>
Finally, Θ-notation means there is an asymptotically tight-bound, i.e., that the function really behaves like its reference function:
- <math>g = \Theta(f) \iff g\in \Theta(f) \iff (\exists\alpha>0)(\exists\beta>0)(\exists x_0)(\forall x>x_0)~ \alpha f(x)\le g(x)\le\beta f(x).<math>
The function can sandwiched by two representatives of its Θ-reference. For instance <math>x^2 + x = \Theta (x^2)<math>. This means that for high enough values of <math>x<math>, the function <math>x^2 + x<math> behaves like <math>x^2<math> only and its linear part has became irrelevant or negligible. It corresponds for functions in asymptotic limit to the relation <math>=<math> between numbers.
Note that the "=" sign used in the definition above does not mean equality. Although the use of "∈" is more logical and becomes frequent especially in computer science, the use of "=" is still the most current and well-established notation found in the literature.
In layman's terms, one would say that
- <math>f\in O(g)<math> means that f has order at most g,
- <math>f\in \Omega(g)<math> means that f has order at least g, and
- <math>f\in \Theta(g)<math> means that f has order g.
Properties
- All of the above are transitive relations:
- If <math>f\in O(g)<math> and <math>g\in O(h)<math>, then <math>f\in O(h)<math>, and the same holds for o, ω, Ω and Θ.
- Θ is the equivalence relation associated to the preorder O, thus
- <math>f\in\Theta(g) \iff g\in\Theta(f)<math>.
The following implications hold:
- If <math>f\in o(g)<math>, then <math>f\in O(g)<math>.
- If <math>f\in O(g)<math>, then <math>g\in\Theta(f)<math>.
These notations are widely used in algorithmics to estimate the complexity of an algorithm. Sometimes, in mathematics, the O-notation is used with the meaning of the Θ-notation.
References
[1] D. E. Knuth. Fundamental Algorithms, vol. 1 of The Art of Computer Programming.