I came across logarithms in my 9th grade. For a long time I never really understood its use in real life. Logarithm of a number is simply the power to which 10 (or any other base) must be raised to equal the number in question.

log_{10}(100) is 2 because 10^{2}= 100 log_{10}(1000) is 3 because 10^{3}= 1000 log_{10}(10000) is 4 because 10^{4}= 10000

In the book The Joy of X – Steven Strogatz writes

Notice something magical here: as the numbers inside the logarithms grew multiplicatively, increasing tenfold each time from 100 to 1,000 to 10,000, their logarithms grew additively, increasing from 2 to 3 to 4. Our brains perform a similar trick when we listen to music. The frequencies of the notes in a scale – do, re, mi, fa, sol, la, ti, do – sound to use like they’re rising in equal steps. But objectively their vibrational frequencies are rising by equal multiplies.

We perceive pitch logarithmically.

Here is an excellent article which explains the basics of logarithms. Let us look at some of its uses in real life.

## 1. Safety Index

Consider the following statistic in the US

1 in 5,300 dies each year due to car crash. 1 in 800 dies each year due to diseases caused by smoking. 1 in 2,000,000 is killed by lightning.

Let us take logarithm for all these number

log_{10}(5300) = 3.7 [car crash] log_{10}(800) = 2.9 [smoking] log_{10}(2000000) = 6.3 [lightning]

If one in X person die as a result of doing some given activity each year, the **safety index** for that activity is simply the logarithm of X. Higher the safety index, the safer the activity in question. Logarithms helps to shrink the numbers of very **high magnitude** to a smaller one which our brains can deal with easily.

## 2. pH value

pH is an abbreviation for **power of hydrogen**. The pH scale measures how acidic or basic a substance is. It ranges from 0 to 14. A pH of 7 is neutral (**water**). A pH less than 7 is acidic, and a pH greater than 7 is basic.

The acidity depends on the hydrogen ion concentration in the liquid (in moles per liter) written as [**H ^{+}**]. The greater the hydrogen ion concentration, the more acidic the solution. It is defined as

pH =-log_{10}[H^{+}]

Pure water contains hydrogen ion concentration of 1 * 10^{-7} moles. To calculate the pH

pH = -log(1 * 10^{-7}) = -log(1) - log(10^{-7}) = 0 - (-7) = 7

Which is easier for human brain to deal with 1 * 10^{-7} moles or pH value of 7? Clearly 7 is easier for our brain to handle. Thus logarithms helps us to deal with numbers of very **small magnitudes**. Given below is the pH values for different substances.

## 3. Binary Search

In computer science binary search is a good example of an O(log n) algorithm. In the book The Algorithm Design Manual – Steve Skiena writes

To locate a particular person p in a telephone book containing n names, you start by comparing p against the middle, or (n/2)nd name, say Monroe, Marilyn. Regardless of whether p belongs before this middle name (Dean, James) or after it (Presley, Elvis), after only one comparison you can discard one half of all the names in the book. The number of steps the algorithm takes equals the number of times we can halve n until only one name is left. By definition, this is exactly

log. Thus,_{2}(n)twenty comparisonssuffice to find any name in themillion-nameManhattan phone book! Binary search is one of the most powerful ideas in algorithm design. This power apparent if we imagine being forced to live in a world with only unsorted telephone books.

Take a look at the table below. Binary search on 10 trillion items can be finished in around 44 steps.

#Items |
#Comparisions |

1000 | 9.97 |

100000 | 16.61 |

10000000 | 23.25 |

1000000000 | 29.9 |

100000000000 | 36.54 |

10000000000000 | 43.19 |

## Closing Thoughts

Exponents and Logarithms are inverses of each other. Any time you want to better understand numbers of very large and small magnitudes make use of logarithms. In life exponents (compound interest) is your friend when it comes to investing money. Logarithms is your friend when it comes to spending it.

Great explaination, much thanks!

Thanks.

Regards,

Jana

Great article! Loved it! 😉

Excellent stuff. You are a great teacher and constant source of worldly wisdom. Can you please expand a bit on that last thought of yours on how “Logarithms is your friend when it comes to spending it.”? How is this the case?

Juan,

Thanks. At each level logarithmic growth is very tiny. For example in base 10 we get log(100) = 2 and log(1000) =3. I meant spend your money carefully in little increments like logarithms.

Regards,

Jana

For a long while, I have been seeking answer of this question. Interestingly, a lot of grief statisticains and mathematicians could not explain clearly. Thanks a log.