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.

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

So my question: 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 to large)
share|improve this question
10  
Whenever people report that they earn an "n-figure salary", they've taken a (base-10) log. (Well, a "log, plus 1".) –  Blue Apr 29 '11 at 10:57
5  
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. –  J. M. Apr 29 '11 at 11:16
5  
Logarithms are very useful for graphing. It's one way to get extreme values to fit on an x or y axis. –  Ralph Winters Apr 29 '11 at 14:53

10 Answers 10

up vote 17 down vote accepted

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)$.

share|improve this answer
2  
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. –  J. M. Apr 29 '11 at 13:15
    
@J.M - I'm not certain they print actual "log paper" any more. –  nbubis Aug 22 '12 at 16:58
    
@nbubis, in that case, thank goodness there are sites like this... –  J. M. Aug 22 '12 at 17:02

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

share|improve this answer
1  
Yes, in fact, that answers Alan's question, "why were they invented?" –  Gerry Myerson Apr 29 '11 at 10:43
3  
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... –  J. M. Apr 29 '11 at 11:12
2  
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 –  Robert Israel Apr 29 '11 at 16:43
1  
@Robert: That's a neat site you linked to; thanks for sharing! –  J. M. Apr 29 '11 at 17:04
1  
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. –  Raskolnikov Apr 29 '11 at 18:42

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.

share|improve this answer

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.

share|improve this answer

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$.

share|improve this answer

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!

share|improve this answer

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$!"

share|improve this answer
2  
In short: inverting useful functions is a reasonable endeavor, since the inverses can be useful themselves. –  J. M. Apr 29 '11 at 14:54

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).

share|improve this answer
    
This is more or less the same as Don's comment to the OP. –  J. M. Apr 29 '11 at 19:01
    
@J.M. Oh I did not see that. Sorry, Don. –  Puddingfox Apr 29 '11 at 19:04

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.

share|improve this answer
1  
Well gee, not even a summary? –  J. M. Jan 6 '12 at 11:05
6  
@Jay: Go here –  Zev Chonoles Jan 6 '12 at 11:40

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.

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.