41
$\begingroup$

I am trying to gain a more intuitive feeling for the use of logarithms.

So, my questions: What do you use them for? Why were they invented? What are typical situations where one should think: "hey, let's take the $\log$!"?

Thanks for the great comments!

Here a short summary what we have so far:

History:

Logarithms were first published 1614 by John Napier (mathematician/astronomer) . He needed them for simplifying the multiplication of large numbers.

Today’s uses:

  • In regression analysis: If you expect a predictor variable to follow a power/exponential law, take the corresponding logarithm to linearize the relationship.
  • In finance to calculate compound interests.
  • Or more general: to calculate the time variable in growth/decay functions. (Nuclear decay, biological growth…)
  • In computer science to avoid underflow. (Cool trick! But seriously: 32-bit? Take a double ;-)
  • In the Prime Number Theorem
  • For handling very large/small numbers (pH, etc.)
  • Plotting (if your scale gets too large)
$\endgroup$
3
  • 12
    $\begingroup$ Whenever people report that they earn an "n-figure salary", they've taken a (base-10) log. (Well, a "log, plus 1".) $\endgroup$
    – Blue
    Apr 29, 2011 at 10:57
  • 5
    $\begingroup$ Somewhat akin to Don's answer: it allows us to more easily manipulate very huge and very tiny quantities into more "human sized" numbers. For instance, it's more convenient to express the acidity of some substance as the pH instead of the concentration of hydrogen ions. $\endgroup$ Apr 29, 2011 at 11:16
  • 5
    $\begingroup$ Logarithms are very useful for graphing. It's one way to get extreme values to fit on an x or y axis. $\endgroup$ Apr 29, 2011 at 14:53

12 Answers 12

28
$\begingroup$

Logarithms come in handy when searching for power laws. Suppose you have some data points given as pairs of numbers $(x,y)$. You could plot a graph directly of the two quantities, but you could also try taking logarithms of both variables. If there is a power law relationship between $y$ and $x$ like

$$y=a x^n$$

then taking the log turns it into a linear relationship:

$$\log(y) = n \log(x) + \log(a)$$

Finding the exponent $n$ of the power law is now a piece of cake, since it corresponds to the slope of the graph.

If the data do not follow a power law, but an exponential law or a logarithmic law, taking the log of only one of the variables will also reveal this. Say for an exponential law

$$y=a e^{b x}$$

taking the log of both sides gives

$$\log(y) = b x + \log(a)$$

Which means that there will be a linear relationship between $x$ and $\log(y)$.

$\endgroup$
3
  • 3
    $\begingroup$ As an additional note: sometimes it's more informative to plot data on log paper (or semi-log paper, depending on the circumstances) instead of usual graph paper. $\endgroup$ Apr 29, 2011 at 13:15
  • $\begingroup$ @J.M - I'm not certain they print actual "log paper" any more. $\endgroup$
    – nbubis
    Aug 22, 2012 at 16:58
  • 1
    $\begingroup$ @nbubis, in that case, thank goodness there are sites like this... $\endgroup$ Aug 22, 2012 at 17:02
25
$\begingroup$

Since logarithms convert multiplication into addition, they can be used to simplify basic arithmetic in the absence of computers.

$\endgroup$
7
  • 1
    $\begingroup$ Yes, in fact, that answers Alan's question, "why were they invented?" $\endgroup$ Apr 29, 2011 at 10:43
  • 4
    $\begingroup$ That's actually why Napier fooled around with these beasties in the first place (there were even tables for logarithms of trigonometric functions). The more intricate stuff like the logarithm being the integral of the reciprocal function came much later... $\endgroup$ Apr 29, 2011 at 11:12
  • 3
    $\begingroup$ It's hard for today's students to imagine what life was like before calculators were invented. Yes, to multiply two numbers with more than two digits or so, people would often use tables of logarithms. See e.g. obsoleteskills.wikispot.org/Reading_a_log_table $\endgroup$ Apr 29, 2011 at 16:43
  • 1
    $\begingroup$ @Robert: That's a neat site you linked to; thanks for sharing! $\endgroup$ Apr 29, 2011 at 17:04
  • 2
    $\begingroup$ I have the log tables my father used in his youth lying around somewhere. I also have his slide rule. Nowadays, kids in class can't even use their graphic calculators right. $\endgroup$ Apr 29, 2011 at 18:42
16
$\begingroup$

I can visualize a logarithm if I think of it as an answer for questions such as these:

  1. "How many places does this number have?"

  2. "How many levels does a (balanced) tree have which fits this number of leaf nodes?"

    • log: each node has 10 children
    • lb: each node has 2 children (a binary tree)
    • this is mostly helpful if you know something about graph theory. If you're good at visualizing things, you can use this to get a grasp of the approximate value at which a logarithm of a number would be.
    • it also helps to understand why binary search, tree map lookup and quicksort are so fast. The log function plays an important role in understanding algorithm complexity! The tree property can help to find fast algorithms for a problem.

Logarithms are also really helpful in the way that J.M. suggested in the comment to your question: getting minute quantities to a more usable scale.

A good example: probabilities.

In tasks such as speech-to-text programs and many other language-related computational problems, you deal with strings of elements (such as sentences composed of words) where each has an associated probability (numbers between 0 and 1, often near zero, such as 0.00763, 0.034 and 0.000069). To get the total probability over all such elements, i.e. the whole sentence, the individual probabilities are all multiplicated: for example 0.00763 * 0.034 * 0.000069, which yields 0.00000001789998. Those numbers would soon get too small for computers to handle easily, given that you want to use normal 32-bit precision (and even double precision does have its limits and you never know exactly how small the probabilites might get!) If that happens, the results become inaccurate and might even be rounded down to zero, which means that the whole calculation is lost.

However, if you –log-transform those numbers, you get two important advantages:

  1. the numbers stay in a range which is easily expressed in 32-bit floating point numbers;

  2. you can simply add the logarithmic values, which is the same as multiplying the original values, and addition is much faster in terms of processing time than multiplication. Example:

    • –log(0.00763) = 2.11747... (more places are irrelevant)
    • –log(0.034) = 1.46852...
    • –log(0.000069) = 4.16115...
    • 2,11747 + 1,46852 + 4,16115 = 7.74714
    • 10–7.74714 = 0.00000001790028...

    that's really, really close to the original number and we only had to keep track of six places per intermediate number!

$\endgroup$
9
$\begingroup$

The Log function is the inverse of the exponential function. So in short, use logarithms when given the answer to an exponent problem, and wish to know the question.

Exponent problem

"At 2% compound interest, how much will a $1000 investment be worth in 5 years?" (you are given the length of time and want to find the final value of the investment)

Logarithm problem

"At 2% compound interest, how long will it take for $1000 to grow to 1500?" (you are given find the final value of the investment, and want to know the lengh of time)

In short, functions are used to determain the y-coordinate of a graph when given the x-coordinate. Inverse functions (such as the log function) are the other way around. You use these to find the x-coordinate of a graph given the y-coordinate. In the examples above, the x-coordinate is elapsed time and the y-coordinate is the value of the investment.

$\endgroup$
6
$\begingroup$

This is related to Joe's answer, but I want to emphasize something else. The main point I want to make is that if $n^\text{th}$ roots are intuitive, then so are logarithms.

If you want to solve the equation $x^5=11$, you take a fifth root: $x=\sqrt[5]{11}$. But what does $\sqrt[5]{11}$ mean? Well, it means the unique real number $x$ such that $x^5=11$, so this alone doesn't tell you much. To get somewhat of an intuitive feel for it, you can look at the curve $y=x^5$, notice that it is always increasing, and that it crosses $y=11$ somewhere between $1$ and $2$ (because $1^5=1$ and $2^5=32$). But ultimately the definition of $\sqrt[5]{\ }$ relies on the notion of inverting the more familiar operation of multiplying 5 copies of a number, $x\mapsto x^5$.

What if you want to solve the equation $5^x=11$? You take a logarithm with base $5$, $x=\log_5(11)$. Again this is a solution by definition: $\log_5(11)$ is the unique real number $x$ such that $5^x=11$. To get a more intuitive feel for it, you can look at the curve $y=5^x$, notice that it is always increasing, and that it crosses $y=11$ somewhere between $1$ and $2$ (because $5^1=5$ and $5^2=25$). Ultimately the definition of $\log_5$ relies on the notion of inverting the more familiar operation of raising $5$ to a power, $x\mapsto 5^x$.

One way to get an intuitive feeling for the properties of logarithms is to see how the properties are derived from the more intuitive exponential function. For example, there is the familiar rule of exponents, $5^{a+b}=5^a\cdot 5^b$. This equation implies by the definition of the logarithm that $a+b=\log_5(5^a\cdot 5^b)$. On the other hand, $a=\log_5(5^a)$ and $b=\log_5(5^b)$ also by the definition of the logarithm, so the exponential identity becomes the logarithmic identity $\log_5(5^a)+\log_5(5^b)=\log_5(5^a\cdot 5^b)$. When $a$ and $b$ range over the real numbers, this implies the general product-to-sum identity, $\log_5(uv)=\log_5(u)+\log_5(v)$.

Everything comes from "switching $x$ and $y$," as Joe said. For example, every time $1$ is added to $x$, $y=5^x$ increases by a factor of five: $5^{x+1}=5\cdot 5^x$. Therefore, for the inverse, every time $x$ increases by a factor of $5$, $1$ is added to $y=\log_5(x)$.

Part of the answer to your question to when we would say "Let's take the $\log$" is whenever we are trying to solve for a quantity in an exponent, echoing Joe's answer somewhat (but devoid of the practical context given there). If you want to know when $(2t+1)^3 = 10$, a good first step is to say, "Let's take the cube root!" Analogously, if you want to know when $3^{2t+1}=10$, a good first step is to say, "Let's take the $\log$!"

$\endgroup$
1
  • 2
    $\begingroup$ In short: inverting useful functions is a reasonable endeavor, since the inverses can be useful themselves. $\endgroup$ Apr 29, 2011 at 14:54
5
$\begingroup$

When you see a sequence that is geometric like 1, 10, 100, 1000, 10000 , .... etc or 1,2, 4, 8, 16, 32, .. etc , you can instead look at their logs in what ever base that suites you, so you be looking at sequences 0,1,2,3,4,... instead of 1,10,100,1000,10000 in log base 10 . Or 0,1,2,3,4,... instead of 1,2, 4, 8, 16, 32, .. in base 2. This way you back working with simple numbers that we are used to, rather than huge ones. By the way you can get back your original sequences back by using the powers. Natural problems like radio active decay and cosmological decades or earth quakes magnitudes are easier expressed with logarithms.

$\endgroup$
5
$\begingroup$

Here's a cool use for logarithms: how many primes are there less than $10^{100}$? We may never know the exact answer, but the Prime Number Theorem says that a good approximation is given by $10^{100}/\log(10^{100})$.

Perhaps the main use for logarithms in higher mathematics is as the antiderivative of $1/x$.

$\endgroup$
3
$\begingroup$

I might be a bit late, but anyways I will try explaining.

log(n) to some base x, says how many powers of x are present in n.
So, log(100) to the base 10 is 2, which basically says that two powers of 10 are present in 100(10 ^ 2 = 100).
Cool? Another example. log(8) to the base 2 is 3 and like you guessed 2 ^ 3 = 8.

Now lets add a little complexity. What is log(10) to the base 2?
2 ^ 2 = 4
2 ^ 3 = 8
2 ^ 4 = 16
Woah wait! Where is 10? this is where rational powers come in. A simple Python code to calculate it:


from math import log
log(10, 2)
Will give you the answer as 3.3219280948873626. Now try raising 2 to the power 3.321 in your calculator and you will get an answer close to 10. So the 3.32192..th root of 10 is 2, or 2 raised to the power 3.32192 is approximately 10.

Now, lets see how its used in Power functions. As seen in the above answers, lets say you have a function like:


a = b ^ x

and you want to find out x, how do you do it? Take log on both sides(log to the base 10). You will get:


log(a) = log(b ^ x)
Lets just focus on
log(b ^ x)
now. What does it say? It says the total number of powers of 10 present in b ^ x.
Assume b = 10 and x = 5.
log(10) to the base 10 is 1.
What will be log(10 ^ 2)? Well, intuitively you could see that it will be twice the log(10), because 100 contains 10 times 10 and it only makes sense to add log(10) to the log(10) value to get log(100).
log(10^3)? log(10) + log(10) + log(10).
.
.
.
log(10^n)? log(10) + ...... + log(10) (n times), which is equivalent to saying n * log(10).

So, now we have log(b ^ x) = x * log(b).
Coming back to our original equation, log(a) = log(b ^ x)
log(a) = x * log(b)
x = log(a) / log(b)

which can be easily calculated. Of course, there are plenty of other use cases, which the other answer cleanly explain.

$\endgroup$
1
  • $\begingroup$ very good answer, thanks for taking out time & explaining:) $\endgroup$
    – anekix
    Jun 23, 2018 at 8:42
1
$\begingroup$

Logarithms can be used to determine the character length of a number. i.e. in base-10, the number 1234 has a length of 4. be any valid logarithmic base. For example, let us consider a number system with base b:

b = [some positive integer]
x = [some number in base-b]
length_of_x = floor(log_b(x)) + 1

Example:

b = 10
x = 1234
log10(x) == 3.0913...
floor(log10(x)) = 3.0
length_of_x = floor(log10(x)) + 1 == 4.0

Note that b can of course be any number. Also note that for systems where log_b isn't defined, you can simulate like so:

log_b(x) == log(x) / log(b)

This is true for at least all positive integer b and all x valid in the domain of log (the base of log() can also be any valid logarithmic base).

$\endgroup$
2
  • $\begingroup$ This is more or less the same as Don's comment to the OP. $\endgroup$ Apr 29, 2011 at 19:01
  • $\begingroup$ @J.M. Oh I did not see that. Sorry, Don. $\endgroup$
    – jamesbtate
    Apr 29, 2011 at 19:04
1
$\begingroup$

Go here This site provides an intuitive explanation for 'ln' and also to some other mathematical functions and concepts like exponent, permutations/combinations, calculus etc.

$\endgroup$
2
0
$\begingroup$

One weird fact is that our senses work on a logarithmic scale: what we feel is "a bit louder, and again the same bit louder" is really the same factor in loudness.

$\endgroup$
0
$\begingroup$

One of the most notable application of the logarithm in science is definitely the concept of Entropy either in Thermodynamics and in Information Theory. Beyond the nice computational properties of the logarithm, Entropy provides an impressive demonstration of how the logarithm of the number of possible microstates naturally relies with the other macro thermal functions, like $$ \delta Q_{rev} = TdS $$ where the definition of heat and temperature proceed from physical considerations independent from the use of the logarithm.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .