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?

2 Answers 2

2

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

1

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

  • 2
    The finding by the last commenter works if $n \ge 1$ is required. If you want $n\ge 0$, your goose is cooked.2012-06-17