Search code examples
algorithmbig-oanalysisnotation

Prove f(n) + d(n)= O(g(n)+ h(n))


If f(n) is Ο(g(n)) and d(n) is Ο(h(n)), then prove that f(n) + d(n)= O(g(n)+ h(n))

I'm having trouble coming up with a formal proof.

Here is what I have so far:

f(n)=O(g(n)) and d(n)=O(h(n)) so, O(g(n)) + O(h(n)) = O(g(n)+ h(n))

But I'm not sure for this because it seems very simple.

Any help appreciated.

EDIT: i must prove this, I cant prove this by saying an example, I have to solve it as a proof by using a C constant I think or some other way..


Solution

  • Formally by using the definition of the Big-O-Notation it could be done like Hans Hyttel did it here.

    The Proof:

    enter image description here