# Finding $c$ and $n_0$ for a big-O bound

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?

• 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. Nov 17 '12 at 1:32
• @RanG.: Please post this as answer. 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.