I understand that log2
is useful for informatics, e.g. to determine how many bits I need to represent a given number. I understand that log10
is useful to determine the order of magnitude of numbers.
However, I’m having trouble understanding what makes ln
interesting. It seems like it’s used a lot, but to me it just looks like a logarithm with a very weird base. What are the uses for this logarithm?
It’s not a weird base, it’s really the most natural base to choose, which is why it’s called the natural logarithm. It doesn’t particularly matter what base you choose, because you can always convert from one base to another, but often the natural logarithm is simpler to work with. For example, the derivative of ln(x) is just 1/x. The derivative of log10(x) is 1/(x*ln(10)).
This is because ln(x) is the inverse of e^x, which has the unique property that it is its own derivative.
The simple derivative really is nice, thanks for pointing this out!
ln(x) and e^x are to simulate growth rates, which is why I assume it’s called the natural log. A great example is to use a natural log to show the growth of bacteria as they divide into two to grow, 1 -> 2 -> 4 -> 8 -> 16 etc. ln(x) will give you the time it will take to grow your population to size x. e^x will give you the size of your population after x time.
It’s the inverse of the natural exponential function. So if you want to solve something like e^x=49 you can apply ln to both sides and get X=ln(49). e is a very natural constant for various reasons. For example suppose that something doubles each year, which you could express as something like y = x*2. Now suppose that you want do distribute that growth over multiple steps each year. So it would for example increase by 50% each half year. So for a year you’d get two steps: y= x*1.5*1.5 = x*2.25. Which is more because of compound interest.
If you increase these intermediate steps towards infinity, that factor becomes e.
One word: differentiation.
So to be honest, 90% of the time the base of the logarithm doesn’t really matter as long as we are consistent. The main property we use logarithms for is that log_b(xy) = log_b(x) + log_b(y), and this holds for any base b. In fact, the change-of-base formula tells us that we can get from one base to another just by multiplying by a constant (log_a(x) = log_b(x) * 1/log_b(a)), and so there is a strong desire to pick one canonical “logarithm” function, and just take care of any base silliness by multiplying your final result by a scaling factor if needed.
Given that, the natural logarithm is quite “natural” because it is the inverse of the exponential function, exp(x) = e^x. The exponential function itself is quite natural as it is the unique function f such that f(0) = 1 and f’(x) = f(x). Really, I would argue that the function exp(x) is the fundamentally important mathematical object – the natural logarithm is important because it is that function’s inverse, and the number e just happens to be the value of exp(1).
Your explanation makes a lot of sense to me! I didn’t know that
exp'(x) = exp(x)
, but can see how this could be an interesting property and in turn makesln
interesting.You saying, that it often doesn’t matter which logarithm is used, made me check and realize that
log_a(x)/log_a(y)
is the same aslog_b(x)/log_b(y)
. Thus I understand that it really doesn’t make a difference which logarithm is used when “comparing the magnitude” (not sure if this is the right term) of numbers.I feel like I have a much better understanding of
ln
now. I’ll assume that the base of an algorithm is often basically a random choice and basee
is often used because of its “interesting trivia”.Thanks a lot!