2
$\begingroup$

This is in the context of algorithmic analysis and we're given the following definition: For non-negative functions $f(n)$ and $g(n)$, $f(n)$ is $O(g(n))$ if there exists positive constants $c, N$ such that for all $n \geq N$, $f(n) \leq cg(n)$.

The Problem: I can't come up with an example where a function $g(n)$ that could be made equal to $f(n)$ by multiplying $g(n)$ by a constant, couldn't also be made greater than $f(n)$.

In other words, it seems that if there exists a $c$ such that $cg(n) = f(n)$, then there necessarily exists a $k > c$ such that $kg(n) > f(n)$.

Is that wrong? If it is, what is a good way to think about a counter-example? And if it's right, then what's the point of including equality in the definition of Big O?

EDIT: Just to make it clear, I understand that there must be very good reasons; I'm not disputing the validity of that choice, just trying to understand the reasons behind it.

  • 0
    In an alternate universe, people defined big O using $<$. Some user on that universe's MSE named jeremiah rodcluff made the following observation: one could have just as easily used $\le$ instead of $<$ in the definition. Puzzled, rodcluff therefore asked why they used $<$ in the definition instead of $\le$. (Anywho, reflexivity is an axiom we use in our definition of [partial orders](https://en.wikipedia.org/wiki/Partially_ordered_set), so we might as well be consistent with that.) Additionally, it'd make the proof of e.g. $f=O(f)$ slightly unsightly, picking $1+\epsilon$ in lieu of $1$.2017-02-02
  • 0
    I think the only time it might make a difference is with functions like $g(n) = 0$. I don't think that there is a "very good reason" here.2017-02-02
  • 0
    `what's the point of including equality in the definition of Big O` Maybe just because there is no good reason to *exclude* it. Plus, as just noted, that would make the identical zero function *not* be Big-O equivalent to itself.2017-02-02
  • 0
    @arctictern I think OP is thinking "$\leq$ requires an extra dash or requires including the case of equality. Therefore, if they could have gotten by with 'just $<$', they would have".2017-02-02
  • 0
    @Omnomnomnom, yes exactly. I always proceed with the assumption that mathematicians want to use the least requirements for something to be true, so I figured there must be a good reason to include equality.2017-02-02
  • 0
    @jeremyradcliff `mathematicians want to use the least requirements` FWIW $\le$ is a *lesser* requirement than $\lt\,$.2017-02-02
  • 0
    @dxiv, the zero function would be a good reason, that's the kind of reason I was looking for. But is my reasoning correct that if some $c$ can make $cg(n) = f(n)$, then necessarily some $k>c$ can make $kg(n) > f(n)$? (serious question because I struggle with being sure of even basic stuff like this)2017-02-02
  • 0
    Also, tangent: seldom do we design definitions with logically minimalist criteria. For example, it is possible to define a group using only a single (rather unwieldy) axiom for the binary operation, but we don't do that. Better design criteria exist than minimalism: suggestiveness, simplicity, convenience, utility, flexibility, scope, etc.2017-02-02
  • 0
    @arctictern, thanks for the link, I don't know this stuff I'll check it out.2017-02-02
  • 0
    For the $f \equiv 0$ identical zero function $f=\mathcal{O}(f)$ only if the $\le$ is inclusive. If you replace it with $\lt$ then $f \ne \mathcal{O}(f)$ which would be quite odd, intuitively.2017-02-02
  • 0
    @dxiv, I agree, that makes sense. Is the zero case where we might want to have $f$ being BigO of itself the reflexivity axiom that arctic tern mentions for the definition of partial orders?2017-02-02
  • 0
    @jeremyradcliff Yes, more precisely the reflexivity of *non-strict* partial orders (which are in a 1-to-1 relation with the [*strict* relation orders](https://en.wikipedia.org/wiki/Partially_ordered_set#Strict_and_non-strict_partial_orders)). In the end, the definition of $\mathcal{O}$ is just that, a definition, and choosing $\le$ vs. $\lt$ was probably just a matter of convenience and general consistency with other limiting behaviors.2017-02-02
  • 1
    @dxiv, thank you for taking the time to explain, I really appreciate. I'm getting more and more comfortable with the idea that a lot of things are defined out of convenience in mathematics. In this case, I didn't have the background to see the relationship with partial oders and I couldn't (more unfortunate and a little disappointing) figure out the zero function case.2017-02-02
  • 0
    The $<$ choice would definitely cause problems. For example, $f(n)=1-(-1)^n$ and $g(n)=3\sin^2(n\pi/2)$ are such that $f(n)\in O(g(n))$ but there is no $c$ such that $f(n)$n$. – 2017-02-02
  • 0
    @Did, thank you for the great example and for clearing up the confusion in other answers; I always appreciate the clarity of your answers on MSE.2017-02-02
  • 0
    $\langle$ *Blushes...* $\rangle$2017-02-02

0 Answers 0