# Can anybody explain how these logarithms are transformed?

I'm learning for my algorithms exam and I can't derive two logarithm transformations:

1. $3^{log_{4}(n)}=n^{log_{4}(3)}$
2. $log_{3}(n)=log_{3}(e)*ln(n)$

I'm not very strong in logarithms, anybody can explain how I get in both cases from the left side of the equation to the right side?

Sorry if the terminology is wrong, I'm from Germany.

-
First of all do not say I am not strong in x, ask how can I become strong in x, Secondly there are two simple trick with these type of question: take the logarithm of both sides and then raise them to the power of e or what ever the base of logarithm is or, exponentiate to the power of the base and then take the logarithm, just play around with rules of logarithms that you know and you will learn, if not then we'll give you the answer. – Arjang Jan 6 '11 at 23:21
You are right, I think that was the wrong way of thinking. – Sam Jan 6 '11 at 23:36

Use $\log _a b = \frac{{\ln b}}{{\ln a}}$ and $e^{\ln x} = x$: $$3^{\log _4 n} = (e^{\ln 3} )^{^{\ln n/\ln 4} } = e^{\ln 3\ln n/\ln 4} = (e^{\ln n} )^{\ln 3/\ln 4} = n^{\ln 3/\ln 4} = n^{\log _4 3},$$ $$\log _3 n = \frac{{\ln n}}{{\ln 3}} = \frac{1}{{\ln 3}}\ln n = \frac{{\ln e}}{{\ln 3}}\ln n = (\log _3 e)\ln n.$$

-

For the first one: Remember that for any number $a$, $4^{\log_4(a)}=a$. Also, $(a^b)^c=a^{bc}$.

This gives us: $3^{\log_4(n)}=(4^{\log_4(3)})^{\log_4(n)}=4^{\log_4(3)\times\log_4(n)}$.

Similarly, $n^{\log_4(3)}=(4^{\log_4(n)})^{\log_4(3)}=4^{\log_4(n)\times\log_4(3)}$.

Finally, since $ab=ba$ for any numbers $a,b$, this gives us the result.

For the second, it is enough to check that $3^{\log_3(e)\times\ln(n)}=n$, because (by definition) the only number $a$ such that $3^a=n$ is $a=\log_3(n)$.

Now: $3^{\log_3(e)\times\ln(n)}=(3^{\log_3(e)})^{\ln(n)}=e^{\ln(n)}=n$, remembering that $\ln$ is just an abbreviation for $\log_e$.

Usually this is presented in a more condensed way, as a change of basis formula, saying that $$\log_a(b)/\log_a(c)=\log_c(b)$$ for any positive numbers $a,b,c$. This formula can be proved in exactly the same way as we checked the second of the transformations you asked about.

-
Thanks, this also helps a lot. – Sam Jan 6 '11 at 23:33

Let me also give some strategy points with these problems that I think will help.

One rule that should help is the equality $log_b(c^p) = p \cdot \log_b(c)$.

Because the second question is asking for an equality with multiplication, you can try substituting $b = 3$, $c = e$, and $p = ln(n)$ to get:

$log_3(e^{ln(n)}) = ln(n) \cdot \log_3(e)$ and $e^{ln(n)}$ simplifies to $n$ so you're good.

In the first problem, you want to change that $3$ to a $4$ because you know that $4^{log_4(n)} = n$. Thus you want $4^m = 3$ so $m = log_4(3)$. Expressing $3^{log_4(n)} = (4^{log_4(3)})^{log_4(n)} = (4^{log_4(n)})^{log_4(3)} = n^{log_4(3)}$.

-
1. Use $\rm\ x = 4^{\:\ell\ x}\ \$ in $\rm\ \ (4^{\:\ell\ 3})^{\:\ell\ n}\ =\ (4^{\:\ell\ n})^{\:\ell\ 3}\quad$ where $\rm\quad \ell\ x\ :=\ log_{\:4}\ x$

2. Use $\rm\ n = e^{ln\ n}\:,\ \$ take $\rm\ log_{\:3}\$ of it