Why subtraction of functions does not necessarily result in subtraction of their big O functions

39 Views Asked by At

How can I show that if $d(n)$ is $O(f(n))$ and $e(n)$ is $O(g(n))$, then $d(n) - e(n)$ is not necessarily $O(f(n) - g(n))$.

Could someone explain it please?

1

There are 1 best solutions below

0
On BEST ANSWER

Note that $2f(n)$ is $O(f(n))$ for any function $f$. Also, $f(n)$ is $O(f(n))$ as well.

If what you're saying was true, then $f(n)$ would be $O(0)$ for any function, which is very far from being true.