2
$\begingroup$

I'm doing some Java code. As far as I can tell, Java only has functions that do natural log and base $10$ log. I have a requirement to specify the base. I've seen that doing $\ln x/ \ln b$ is the same as $\log_b x$.

I've done this and it seems to work. I'd like to better understand why though.

$\endgroup$
  • $\begingroup$ As an example: $\log_{100}(1\phantom,\!000\phantom,\!000)=3$; $\dfrac{\log(1\phantom,\!000\phantom,\!000)}{\log(100)}=\dfrac62=3$. (Using the base-10 logarithm here) $\endgroup$ – Akiva Weinberger May 5 '16 at 20:47
5
$\begingroup$

Let $y = \log_b x$. This is the same as $x = b^y$.

If you take the natural logarithm on both sides you get $$\ln x = \ln b^y = y \ln b$$ so that $y = \dfrac{\ln x}{\ln b}$. That is, $$ \log_b x = \frac{\ln x}{\ln b}.$$

$\endgroup$
  • $\begingroup$ Could you explain why \ln b^y = y \ln b$$. I follow up until that part and after. $\endgroup$ – Jeff May 5 '16 at 19:35
  • 1
    $\begingroup$ That is one of the laws of logarithms and can be proved in a similar way. If $z = y \ln b$ then $z/y = \ln b$ and $e^{z/y} = b$. Raise both sides to the $y$ power to get $e^z = b^y$ which is the same as $z = \ln b^y$. $\endgroup$ – Umberto P. May 5 '16 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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