9

I have this question in my assignment. I need to prove, using only the definition of $O(\cdot)$, that $3^n$ is not $O(2^n)$. It is obviously true for any $n \geq 1$.

To prove $3^n \in O(2^n)$, we must find $n_0$, $c$ such that $f(n) \leq c \cdot g(n)$ for all $n \geq n_0$.

$$ \begin{aligned} 3^n &\leq c \cdot 2^n\\ \left(\frac{3}{2}\right)^n& \leq c \end{aligned} $$

I am stuck here.... I could use a log here, but I don't see the use

Any hint?

UPDATE

$$ \begin{aligned} 3^n &\geq c \cdot 2^n\\ \left(\frac{3}{2}\right)^n& \geq c\\ n \log(3/2) &\geq \frac{\log c}{\log 3/2}\\ n &\geq \log \frac{2c}{3} \end{aligned} $$

For every $n \geq \log \frac{2c}{3}$, $3^n \geq 2^n$. Therefore, $3^n$ is not $O(2^n)$.

Justin D.
  • 745

5 Answers5

3

Contradiction: Assume: $${3^n} \in O\;({2^n}) % MathType!MTEF!2!1!+- % feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiFu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaaG4mamaaCa % aaleqabaGaamOBaaaakiabgIGiolaad+eacaaMe8Uaaiikaiaaikda % daahaaWcbeqaaiaad6gaaaGccaGGPaaaaa!3EEE! $$ therefore: $${3^n} \le c{2^n} \to \frac{{{3^n}}}{{{2^n}}} \le c \to {(\frac{3}{2})^n} \le c \to \log {(\frac{3}{2})^n} \le \log c \to n \le \frac{{\log c}}{{\log 1.5}} % MathType!MTEF!2!1!+- % feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiFu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaaeaaaaaaaaa8 % qacaaIZaWdamaaCaaaleqabaWdbiaad6gaaaGcpaGaeyizImQaam4y % a8qacaaIYaWdamaaCaaaleqabaWdbiaad6gaaaGcpaGaeyOKH46aaS % aaaeaapeGaaG4ma8aadaahaaWcbeqaa8qacaWGUbaaaaGcpaqaa8qa % caaIYaWdamaaCaaaleqabaWdbiaad6gaaaaaaOWdaiabgsMiJkaado % gacqGHsgIRcaGGOaWaaSaaaeaapeGaaG4maaWdaeaapeGaaGOmaaaa % paGaaiykamaaCaaaleqabaGaamOBaaaakiabgsMiJkaadogacqGHsg % IRciGGSbGaai4BaiaacEgacaGGOaWaaSaaaeaapeGaaG4maaWdaeaa % peGaaGOmaaaapaGaaiykamaaCaaaleqabaGaamOBaaaakiabgsMiJk % GacYgacaGGVbGaai4zaiaadogacqGHsgIRcaWGUbGaeyizIm6aaSaa % aeaaciGGSbGaai4BaiaacEgacaWGJbaabaGaciiBaiaac+gacaGGNb % GaaGymaiaac6cacaaI1aaaaaaa!6A5D! $$

Since 'c' is a positive constant, $$\log c = Const. \to \frac{{\log c}}{{\log 1.5}} = Const. \to n \le Const. % MathType!MTEF!2!1!+- % feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiFu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaciiBaiaac+ % gacaGGNbGaam4yaiabg2da9iaadoeacaWGVbGaamOBaiaadohacaWG % 0bGaaiOlaiabgkziUoaalaaabaGaciiBaiaac+gacaGGNbGaam4yaa % qaaiGacYgacaGGVbGaai4zaiaaigdacaGGUaGaaGynaaaacqGH9aqp % caWGdbGaam4Baiaad6gacaWGZbGaamiDaiaac6cacqGHsgIRcaWGUb % GaeyizImQaam4qaiaad+gacaWGUbGaam4CaiaadshacaGGUaaaaa!5AE3! $$ But we have to find: $${n_0}\;{\rm{such}}\;{\rm{that}},{\rm{for}}\;any\;n \ge {n_0}\;(n \to \infty )\;{\rm{satisfies}}\;{\rm{our}}\;{\rm{inequality}}\;{\rm{(}}n \le Const.{\rm{)}} % MathType!MTEF!2!1!+- % feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiFu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamOBamaaBa % aaleaacaaIWaaabeaakiaaysW7caqGZbGaaeyDaiaabogacaqGObGa % aGjbVlaabshacaqGObGaaeyyaiaabshacaGGSaGaaeOzaiaab+gaca % qGYbGaaGjbVlaadggacaWGUbGaamyEaiaaysW7caWGUbGaeyyzImRa % amOBamaaBaaaleaacaaIWaaabeaakiaaysW7caGGOaGaamOBaiabgk % ziUkabg6HiLkaacMcacaaMe8Uaae4CaiaabggacaqG0bGaaeyAaiaa % bohacaqGMbGaaeyAaiaabwgacaqGZbGaaGjbVlaab+gacaqG1bGaae % OCaiaaysW7caqGPbGaaeOBaiaabwgacaqGXbGaaeyDaiaabggacaqG % SbGaaeyAaiaabshacaqG5bGaaGjbVlaabIcacaWGUbGaeyizImQaam % 4qaiaad+gacaWGUbGaam4CaiaadshacaGGUaGaaeykaaaa!7BCD! $$ $${\rm{Since}}\;{\rm{for}}\;{\rm{any}}\;{n_0},\;n \to \infty \;\;{\rm{conflicts}}\;{\rm{with}}\;\;n \le Const.,\;{\rm{we}}\;{\rm{can}}\;{\rm{say:}}\;{{\rm{3}}^n} \notin O\;({2^n}) % MathType!MTEF!2!1!+- % feaahqart1ev3aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn % hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr % 4rNCHbGeaGqiFu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq-Jc9 % vqaqpepm0xbba9pwe9Q8fs0-yqaqpepae9pg0FirpepeKkFr0xfr-x % fr-xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaae4uaiaabM % gacaqGUbGaae4yaiaabwgacaaMe8UaaeOzaiaab+gacaqGYbGaaGjb % VlaabggacaqGUbGaaeyEaiaaysW7caWGUbWaaSbaaSqaaiaaicdaae % qaaOGaaiilaiaaysW7caWGUbGaeyOKH4QaeyOhIuQaaGjbVlaaysW7 % caqGJbGaae4Baiaab6gacaqGMbGaaeiBaiaabMgacaqGJbGaaeiDai % aabohacaaMe8Uaae4DaiaabMgacaqG0bGaaeiAaiaaysW7caaMe8Ua % amOBaiabgsMiJkaadoeacaWGVbGaamOBaiaadohacaWG0bGaaiOlai % aacYcacaaMe8Uaae4DaiaabwgacaaMe8Uaae4yaiaabggacaqGUbGa % aGjbVlaabohacaqGHbGaaeyEaiaabQdacaaMe8Uaae4mamaaCaaale % qabaGaamOBaaaakiabgMGiplaad+eacaaMe8Uaaiikaiaaikdadaah % aaWcbeqaaiaad6gaaaGccaGGPaaaaa!811A! $$

MRK
  • 31
3

Your goal is to prove that no value of $c$ can work.

One way of doing so is to show that the equation $(3/2)^n \geq c$ has infinitely many solutions for $n$. Do you see why that is?

2

You have to prove this is not the case. Let's first rearrange your definition of $O(2^n)$ a little:

$f$ is $O(2^n)$ if there exist $n_0$ and $C$ such that, for any $n\geq n_0$, $f(n) \leq C\, 2^n$.

Now, work out carefully what it means to say $3^n$ is not $O(2^n)$:

$f$ is not $O(2^n)$ if, for every $n_0$ and $C$, there exists $n \geq n_0$ such that $f(n) > C \, 2^n$.

So, if I hand you any $C$ and $n_0$, you have to find $n \geq n_0$ so that $3^n > C \,2^n$. If it isn't clear how to prove it yet, try finding an appropriate $n$ if I give you $C = 700$ and $n_0 = 4$, then do the general case.

dfeuer
  • 9,069
BaronVT
  • 13,613
2

Your idea of taking a logarithm is a good one. $\log (3/2)^n = n\log (3/2)$. That should pretty much finish off your argument, as long as you know logarithms are increasing.

dfeuer
  • 9,069
1

Hint By Bernoulli inequality

$$(\frac{3}{2})^n \geq 1+\frac{n}{2}$$

N. S.
  • 132,525