I would like to know if this statement is true: $f(n) + g(n) = O(g(n)\cdot f(n))$.

I thought of giving a counter example by defining: $f(n) = 3n^2$ ; $g(n) = n$ which will give us that $O(3n^3) = n^3$ but i'm not sure if it's possible to say that $O(3n^3) = 3n^2 + n$ because I suspect that it might be right because of the definition of Big O. And if that's right that means that the counter example i gave is not good.

Is this a valid approach?

  • 1
    $\begingroup$ Don't do funny stuff like arithmetics with $O$-terms. Go back to the definitions. $\endgroup$
    – Raphael
    Commented Nov 11, 2014 at 11:31

4 Answers 4


I don't get what you do with your choice of $f$ and $g$ but they don't work as a counter-example.

Here is how you see that:

$\qquad f(n) + g(n) = 3n^2 + n \in \Theta(n^2) \subseteq O(n^3) = O(f \cdot g)$.

See our reference question on how to show this.

It is easy to see that the same happens for all pairs of increasing functions:

$\qquad f+g \in \Theta(\max(f,g)) \subseteq O(f \cdot g)$.

So if you want to have a chance at disproving the claim, you'll have to look for decreasing functions -- if your definition of Landau symbols admits such.


For your choice of $f,g$ the statement is correct: $3n^2 + n = O(3n^3)$. However, if you choose $f(n)=g(n)=1/n$ then $f(n)+g(n)=2/n$ while $f(n)g(n) = 1/n^2$, the latter being much smaller.


An easy counterexample would be:

f(n) = 1/n
g(n) = n


f(n) + g(n) = (n + 1/n)  = O(n) 

Note that:

O(f(n) * g(n)) is O(1) which is not the same as the above.

(This is based on the mathematical notion of O(n).)


I'd like to clarify first that Big O notations aren't tighter bounds and hence,you are free to assume that

f(x) = x^2 + 2x + 4
     = O(x^2)
     = O(x^3)... and so on...

As an example, n² + 3n + 4 is O(n²), since n² + 3n + 4 < 2n² for all n > 10 (and many smaller values of n). Strictly speaking, 3n + 4 is O(n²), too, but big-O notation is often misused to mean "equal to" rather than "less than". The notion of "equal to" is expressed by Θ(n).

So,if you're going with the misuse, then your definition doesn't hold as posted by user 1952500. But,if you're going with the exact definition, then your example is well valid and hence, it satisfies the formula...

Now,coming to actual practice, we should go with the formal definition which will be always verified as

f(n) + g(n) = O(max(f(n) , g(n)))  // maximum in terms of power of n.

Also, O(max(f(n) , g(n))) <= O(f(n)* g(n)) // this is a generalised result and will always be correct as understood by your example...

One more thing to make others understand is f(x^-n) is always considered to be O(1).

  • 2
    $\begingroup$ Actually the misuse is by Computer Scientists. Big-O notation predates computer science. $\endgroup$ Commented Nov 11, 2014 at 7:33
  • $\begingroup$ @user1952500- That's why I posted this answer in context of CS. Your answer is well good and I agree. Big-O was derived in CS for algorithmic computation seeing it's various usage in Mathematics. $\endgroup$ Commented Nov 11, 2014 at 7:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.