A book I am reading demonstrates how $5n^3 + 2n^2 + 22n + 6 = O(n^3)$, which I believe is true. After all, there exists a value $c$ for which $cn^3$ is always greater than $5n^3 + 2n^2 + 22n + 6$ for all $n$ greater than or equal to some value $n_0$.

However, the book then casually notes that $c = 5$ and $n_0 = 10$. Where did these values come from? What algebraic calculations were done (if any) to derive the $c$ and $n_0$ values?

  • 3
    $\begingroup$ this is clearly wrong. It cannot be that $5n^3 > 5n^3+2n^2+...$. But $c=6$ (or any constant strictly larger than 5) should work for some $n_0$ large enough. $\endgroup$
    – Ran G.
    Nov 17 '12 at 1:32
  • $\begingroup$ @RanG.: Please post this as answer. $\endgroup$
    – A.Schulz
    Nov 17 '12 at 8:24

$c=5$ is clearly the wrong answer, since for any $n$, $$cn^3 < 5n^3 + \text{(positive terms)}$$

However, if we take $c>5$ then there will exists some $N_0$ such that for $n>N_0$ $$cn^3 \ge 5n^2+2n^2+22n+6$$

If we let $g(n)=(c-5)n^3-2n^2-22n-6$, then Since $\lim_{n\to\infty} g(n)=\infty$, by the limit definition there always exists $N_0$ such that for any $n>N_0$, $g(n) >0$. This implies the above claim.

To find that $N_0(c)$ you can try to find the roots of $g(n)$. $N_0$ will be the most positive root.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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