3

How would you prove/disprove that $e^n = O(2n^2)$? It's unclear to me which function grows faster.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
Matilda
  • 31
  • 1
  • Rule of thumb: $(\log n)^a < n^c < b^n$ for sufficiently large $n$ for all $a,c > 0$ and $b > 1$. – G. Bach Feb 04 '14 at 01:19

2 Answers2

4

Try plotting them. You can also notice that as $n$ increases by one, $e^n$ increases by a multiplicative factor of $e^{n+1}/e^n=e$, while $2n^2$ increases by a multiplicative factor of $\frac{2(n+1)^2}{2n^2} \longrightarrow 1$.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
2

You can avoid $O(2n^2)$ by $O(n^2)$. On the other hand, you have:

$$ \lim_{n\to\infty} \frac{n^2}{e^n} = \lim_{n\to\infty} \frac{2n}{e^n} = \lim_{n\to\infty} \frac{2}{e^n} = 0 $$ So, $\lim_{n\to\infty} \frac{n^2}{e^n} = 0$ say us that $O(n^2) \subset O(e^n)$. Therefore, $O(2n^2) = O(n^2) \subset O(e^n)$.

Jonathan Prieto-Cubides
  • 2,219
  • 3
  • 18
  • 26
  • This is actually the way to go probably since if you don't use a limit rule, you'll have to fiddle around with the series expansion of $e^n$. – G. Bach Feb 04 '14 at 01:20
  • 5
    I think you have an error in your calculation: I assume you used L'Hospital's rule, but $\frac{d}{dn}e^{n} = e^{n}$. Hence $\lim\limits_{n \rightarrow \infty}\frac{n^2}{e^n} = \lim\limits_{n \rightarrow \infty} \frac{2n}{e^n} = 2 \lim\limits_{n \rightarrow \infty} \frac{1}{e^n} = 0$, by applying L'Hospital's rule twice – Gaste Feb 04 '14 at 08:35
  • @Gaste you're right, I posted it so fast and I forgot to review it. thanks. – Jonathan Prieto-Cubides Feb 12 '14 at 04:28