Is my proof wrong for: $n^k \in O(2^n) \text{ for any constant } k$

61 Views Asked by At

I tried to prove this the following way, but not sure if this is correct?

$n^k \leq c \cdot 2^n$

$\log_2(n^k) \leq \log_2(c \cdot 2^n)$

$\log_2(n^k) \leq \log_2(c) + \log_2(2^n)$

$\log_2(n^k) \leq \log_2(c) + n$

$\text{If } n = k, \text{ then } \log_2(k^k) \leq \log_2(c) + k$

$\text{If } c = k^k, \text{ then } \log_2(k^k) \leq \log_2(k^k) + k$

1

There are 1 best solutions below

0
On

Yes, your proof is wrong.

By setting $n=k$, you're ignoring that the statement you were asked to prove is for any $n$ and for any $k$.

What you have proven is that any constant is asymptotically limited by $2^n$, not really interesting.