4

does anyone knows how to perform such calculations Example:

O(n^2) + THETA(n) + OMEGA(n^3) = ?

or

O(n^2) * THETA(n) * OMEGA(n^3) = ?

In general, how to add and multiply different asymptotic notations?

Sławosz
  • 11,187
  • 15
  • 73
  • 106
  • Hi Sławosz. Your question is very vague. Could you be more specific about what : 1. interests you as result ; 2. domain of your problem (asymptotic notation is has different assumptions in general algebra and in computer science. I assume you mean CS, as you are not writing on [math.SE](http://math.stackexchange.com/) ), 3. kind of equations you like to perform (always with those tree parts? Finite amount of atoms, or infinite sum of O() allowed? etc...) 4. Ensure us, we talk about real numbers? 5. results you are interested in achieving ( O() ? Omega() ?) ? – Grzegorz Wierzowiecki Jan 09 '12 at 15:24
  • Here is an example [how O(n)+O(n) can be confusing](http://stackoverflow.com/questions/6687105/question-about-big-o-and-big-omega). As I asked for more criteria, I mean, that leaving constant O(n)+O(n)=O(n) might lead someone to induction step O(n)+O(n)+... = O(n) , **what is wrong**. Cause (O(n))^n = O(n^n). So being **very specific** is need here to avoid confusion. – Grzegorz Wierzowiecki Jan 09 '12 at 15:49

3 Answers3

5

O gives an upper bound;

Ω gives a lower bound;

Θ gives an asymptotic bound;

Wikipedia has a nice chart to explain these.

Therefore these really aren't comparable in general.

For your first case,

O(n^2) + Θ(n) + Ω(n^3)

Let's first tackle O. The first term tells us O(n^2), and the second term tells us O(n). Based on just these two, we know so far we have O(n^2) for an upper bound. However, the third term tells us nothing whatsoever about an upper bound! So we really cannot conclude anything about O.

The point here is that O and Θ gives you information about O only, and Ω and Θ gives you information about Ω only. This is because Θ(g(n)) implies both O(g(n)) and Ω(g(n)), so we can change Θ into whichever of O and Ω is appropriate for the given analysis.

However, the three together, or even just O and Ω, leaves you clueless since neither O nor Ω implies anything about the other.

PengOne
  • 48,188
  • 17
  • 130
  • 149
4

You can't. Suppose you know that a > 0 and b < 10. Then you have no information about a+b. It could be anything.

Big-O and Big-Omega act similarly for functions.

tskuzzy
  • 35,812
  • 14
  • 73
  • 140
1

While my above answer is correct for general functions and bounds, in computer science we typically consider only positive functions. Thus in your first example, we have:

O(n^2) + Theta(n) + Omega(n^3) = Omega(1)+Theta(n)+Omega(n^3) = Omega(n^3)

This stems from the assumption that the functions are all positive. That is, all functions are Omega(1).

tskuzzy
  • 35,812
  • 14
  • 73
  • 140