1

Use the definition

$f(x) $ is in $O(g(n))$ if, for some constants $c$ and $n_0, f(n) ≤ g(x) $ for all $n > n_0$

To show that

$ x^4 + 9x^3 + 4x + 7$ is $O(x^4)$

I know I need to find $c$ and $n_0$ and I thought $c$ needed to be $2$. The problem is there is no positive $n_0$ for which this is true.

Martund
  • 14,706
  • 2
  • 13
  • 30

1 Answers1

0

For $n \ge 1$, all of $n^0, n^1, n^2, n^3$ are less than $n^4$. So $$n^4 + 9n^3 + 4n + 7 \le n^4 + 9n^4 + 4n^4 + 7n^4 = 21n^4.$$ This is the easy way to look at the problem.

It is also true, that if you have a polynomial $f(x) = a_4x^4 + a_3x^3 + x_2x^2 + a_1x^2 + a_0$ then $$f(n) \le (a_4 + \varepsilon) n^4$$

for any $\varepsilon > 0$ and all $n \ge n_0$ where $n_0$ will depend on $\varepsilon$. In your question, since $a_4 = 1$, you get $f(n) \le 2n^4$ ($\varepsilon = 1$) for $n \ge 10$ (see https://www.desmos.com/calculator/rdxgl82bb2).

To show this, you need to show that $$ a_3n^3 + x_2n^2 + a_1n^2 + a_0 \le \varepsilon n^4$$ for $n$ sufficiently large. The easiest way to do this is to consider the limit

$$ \lim_{x \to \infty} \frac{a_3x^3 + x_2x^2 + a_1x^2 + a_0}{x^4}. $$

Some questions you should think about:

  1. Why does $c$ need to be greater than $a_4$?
  2. What happens if some of the coefficients are negative?
  3. Is there a way to compute an $n_0$ given $\varepsilon$? Either the smallest $n_0$ that works or any $n_0$ that works.
Trevor Gunn
  • 27,041