1

This question is related to: Landau Notation, Definitions: Limits vs. Cormen's.

Consider functions $f, \ g : N \rightarrow R^{\geq0}$.

For small-$o$, the definition: $$f(n)\in o(g(n)) \iff \forall c>0,\exists n_0>0, \forall n\geq n_0: f(n) < c \ g(n)$$

Can also be expressed as a limit (i guess this assumes the limit exists): $$f(n)\in o(g(n)) \iff \lim_{n\to\infty}\frac{f(n)}{g(n)}=0 $$

This can be verified introducing the definition for $\lim_{n\to\infty}$ on $N$, and then both definitions are identical.

Now, the "standard" definition for big-O would be something like (near exactly to Cormen's, except the codomain here is $R^{\geq0}$): $$f(n)\in O(g(n)) \iff \exists c>0,\exists n_0>0, \forall n\geq n_0: f(n) \leq c \ g(n) \qquad (1)$$

Im trying to see if the following is true (again, this assumes the limit exists): $$f(n)\in O(g(n)) \stackrel{?}{\iff} \exists c>0: \lim_{n\to\infty}\frac{f(n)}{g(n)}=c$$

Im not sure both directions of the equivalence are true. More specifically, i am having trouble with the $\Rightarrow$. According to this general answer, both directions should be true for $\Theta(g(n))$, wich is stronger than $O(\_)$. On the contrary, this answer (for roughly the same question, but in math SE) says big-$O$ cant be defined in that way (it was downvoted).

So, the questions are:

  1. How exactly def (1) implies the $\lim$ definition?:

$$\forall \epsilon>0,\exists n_0>0, \forall n\geq n_0: \left| \frac{f(n)}{g(n)}-c\right| < \epsilon$$

  1. Is the above still true considering generic functions $f, \ g : X \rightarrow R^{\geq0}$, where $X$ is some reasonable domain, maybe $Z$, $N^k$ or even $R^k$ (although reals are not turing-computable, im thinking in algorithms in the more general sense possible).
jdoes
  • 13
  • 4
  • Second, in the the proposed equivalence, you are missing that $c = 0$ implies $f \in o(g) \subsetneq O(g)$. – Raphael Sep 23 '17 at 23:49
  • In summary, read the definitions more carefully, and you're good. – Raphael Sep 23 '17 at 23:50
  • @Raphael For your first comment, my $o$ definition is $\forall c ...$, the $O$ definition is $\exists c ...$, so i don't get what you mean with "you effectively define O". For the second, the proposed definition of $O$ with limits is with $c>0$. Could you elaborate more? – jdoes Sep 24 '17 at 00:04
  • Sorry, missed the different quantifier. Never mind. 2) Right, and that's why the equivalence doesn't hold. If such $c \in (0,\infty)$ exists, you have $f \in \Theta(g)$. You may want to read this. (Also, be aware that there are $f \in O(g)$ for which the limit does not exist, so the limit "definition" is not at all a definition.)
  • – Raphael Sep 24 '17 at 01:24
  • @Raphael Yes, one of the cited links in the question is to your answer, where you state that if If $c \in (0,\infty)$ exists then $f \in \Theta(g)$, but this also implies that $f \in O(g)$ and $f \in \Omega(g)$. So, let see if i finally get this, the $\Leftarrow$ direction holds, because if $f \in O(g)$ and $f \in \Theta(g)$ then is evident $f \in O(g)$, but the $\Rightarrow$ direction doesn't hold because if $f \in O(g)$, it doesn't implies also that $f \in \Theta(g)$. – jdoes Sep 24 '17 at 02:14
  • About the "limit definition", if we consider lim sup/inf, then it is a definition or not?. A periodic function doesn't have limit, but there exists some algorithm with a cost function over some measure in wich the function is not monotonous increasing?. – jdoes Sep 24 '17 at 02:19
  • Yes. 2) Yes, as I state in that other answer, lim sup provides an equivalent definition. 3) Yes. More importantly, many have oscillating components; if we want to bound those contributes ("error terms") using O, the definition should capture "limitless" functions as well.
  • – Raphael Sep 24 '17 at 13:06
  • @Raphael (3) Interesting, can you give me an example of an algorithm with that characteristics? (i assume you are considering "time" complexity). – jdoes Sep 24 '17 at 21:58
  • An algorithm that computes $n \mapsto n+1$ would be a popular example (in the bit-cost model). As for oscillating lower-order contributions, Mergesort is one example. – Raphael Sep 24 '17 at 23:21