Take the 2-minute tour ×
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It's 100% free, no registration required.

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|improve this question
3  
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
add comment

1 Answer

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|improve this answer
add comment

Your Answer

 
discard

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.