big-o notation - prove that $3n^2 - 1$ is or is not $O(n^2)$

1.2k Views Asked by At

Is $3n^2 - 1$ is or is not $O(n^2)$?

I tried to solve it by adding the constants to get $c: 3 + 1 = 4; c = 4$.

If $n \geq n_0$ and $n_0$ is $1$, $3n^2 - 1 \leq 4n^2$. However, to disprove it, I tried to substitute zero to the equation:

$3n^2 - 1 \leq cn^2$

$\implies 3(0^2) - 1 \leq 4(0^2)$

$\implies 0 - 1 \leq 0$

$\implies -1 \leq 0$

So it seems that for values lower than 1, it is still true. Can someone help me to explain this?

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

$f(n) = O(n^2)$ if there exist two positive $n_0,c$ such that $$0 \le f(n) \le cn^2$$ for all $n \ge n_0$. Therefore, $3n^2-1=O(n^2)$ since one can choose $n_0 = 2, c=3$.