Big O Notation – Why Is the Formal Definition Formulated This Way?

algorithmsbig ocomplexitycomputer science

Consider the formal definition:

f(n) = O(g(n))

Why is it not:

f(n) = O(f(n))

or

f(n) = O(c*f(n))

since for the Big O analysis, f(n)=2n and g(n)=n are identical?

I am confused by the function f(n) using another function.


Update

Why isn' t the definition as follows:

f(n) <= c*abs(g(n))

What does the formal O(g(x)) add to the definition? It seems like it overcomplicates things.

Best Answer

This is an extremely weird definition and is actually new to me. The symbols, as defined by Bachmann and Landau, are not defined like that.

Unfortunately, the German wikipedia is the only source, I can find exactly this, as of now, but I suppose you can see without much translation, that O(n) is defined as lim sup of the ratio of f and g smaller than infinity.
(Please note: the french wikipedia has the following similar definition french definition, which I suppose basically states the same, although I think it is incorrect, given that f(n) is something completely different than f).

As I explained in response to a different question, O means "the order of", and thus O(g) is actually the set of all functions, that have the same order as g. It makes only sense to say:

  • f is the same order as g (or more explicitely: the order of f is the order of g), which is O(f) = O(g)
  • f is in the order of g, which translates to f ∈ O(g)

So for the sake of nitpicking (which is the fun part in formalization), one can say the definition you criticize is indeed wrong.

Related Topic