Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In one of the algorithms textbooks I was reading, it states that $O(3^{\log_2n})$ can be rewritten as $O(n^{\log_23})$. Why is this the case?

share|improve this question
    
Please note that you are able to accept answers and also to upvote answers you think have shown effort and are helpful. (Not just answers to your own questions but also others on the site.) –  TooTone Mar 17 at 12:28

2 Answers 2

up vote 2 down vote accepted

Recall the following log rule:

$$\log_2 (x^k) = (k)(\log_2 x) \tag{1}$$

Now to prove that $3^{\log_2 n} = n^{\log_2 3}$, it suffices to prove that their logs (base $2$) are equal. Indeed, observe that: \begin{align*} \log_2(3^{\log_2 n}) &= (\log_2 n)(\log_2 3) &\text{by (1), where $x = 3$ and $k = \log_2 n$} \\ &= (\log_2 3)(\log_2 n) &\text{by the commutativity of multiplication} \\ &= \log_2(n^{\log_2 3}) &\text{by (1), where $x = n$ and $k = \log_2 3$} \\ \end{align*} as desired. $~~\blacksquare$

share|improve this answer
    
Brilliant, thank you! –  LifeinHD Mar 17 at 22:14

$\textbf{Hint}: x^{\log_by}=y^{\log_b x}$

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.