0
$\begingroup$

Big O Notation is formally defined as:

Let $f(n)$ and $g(n)$ be function from positive integers to positive reals. We say $f = \theta(g)$ (which means that "$f$ grows no faster than $g$*) if there is a constant $c>0$ such that $f(n) ≤ c ⋅ g(n)$.

Using this definition how is:

  • $n^2 + n$ simplified to $n^2$
  • $n + 20$ simplified to $n$

I don't see a $c$ constant that defines their relationship. How do the above examples work?

$\endgroup$
2
$\begingroup$

Try to prove that if $n$ is a positive integer then $n^2+n\le2n^2$ and $n+20\le21n$.

$\endgroup$
1
$\begingroup$

More specifically, $|f(n)| \le c |g(n)|$ for $n$ sufficiently large. So $$|n + 20|\le 2n$$ if $n\ge 20$.

$\endgroup$
  • $\begingroup$ In this case we usually say, "as $n\to\infty$." $\endgroup$ – ncmathsadist Jun 17 '12 at 1:38
  • 2
    $\begingroup$ The definition the way OP has given it leaves no room for "sufficiently large". $\endgroup$ – Gerry Myerson Jun 17 '12 at 1:38
  • $\begingroup$ If you want for $n\ge 1$, use the last commenter's definition. If $n=0$, your goose is cooked. $\endgroup$ – ncmathsadist Jun 17 '12 at 1:39
  • 2
    $\begingroup$ The finding by the last commenter works if $n \ge 1$ is required. If you want $n\ge 0$, your goose is cooked. $\endgroup$ – ncmathsadist Jun 17 '12 at 1:40

Your Answer

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