0

I am having difficulty understanding the Big-Oh rules. For example , here is a question :

Find example of functions ( which are not negative ) $d(n),f(n),e(n),g(n)$ such that $d(n)$ is $O(f(n))$ and $e(n)$ is $O(g(n))$, but $d(n)-e(n)$ is not $O(f(n)-g(n))$.

can someone please explain how to solve such a problem?

Andy M
  • 111

3 Answers3

1

Try $d = n, e = 1, f = n, g =n$

1

Let $f(n)=3n^2 + n$ and $g(n)=3n^2$.

Take $ d(n)= 2n^2= O(f(n)) $ and $e(n)=n^2= O(g(n))$ as $n \to \infty$.

However, $d(n)-e(n)=n^2$ whereas $f(n)-g(n)=n$.

Therefore, $d(n)-e(n)$ is not $O(f(n)-g(n))$ as $n \to \infty$.

Berkheimer
  • 2,086
  • 17
  • 31
1

Make the highest-order terms in $f(n)$ and $g(n)$ cancel. For example, $d(n) = 2n$, $e(n) = f(n) = g(n) = n$.

Tunococ
  • 10,303