Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
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. – Ran G. Nov 17 '12 at 1:32
@RanG.: Please post this as answer. – A.Schulz Nov 17 '12 at 8:24
up vote 4 down vote accepted

$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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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