Skip to main content

Logarithms

It's a math concept used to describe many things. It gets confusing because it shows up in many places for different goals.

Meaning of word Logarithm

The word 'Logarithm' is derived from two Greek words: Logos and Arithmos.

  • Logos here means rational, logic, or ratios.
  • Arithmos means numbers.

It helps to see a logarithm as something that adds logic to a sequence of numbers. For example, take a sequence of population growth numbers. A logarithm helps us read the growth rate better.

# A logarithmic expression is written as below.
# Where base is 2 in this case. Which means the value doubled at each step in case of exponential
# and halves in case of logarithm.
log₂(x) = y
how to read the expression

Think of it as a function name. We pass the original value x to it and we get the logarithmic value y from it.

mental model for logarithms

Take a sequence where each value comes from multiplying the same number again and again. Logarithms can describe such sequences. You just multiply the base by itself N times to get the actual number. This N can be anything from 0.

This is exactly why logarithms of different bases differ by only a constant. The count of multiplications to reach the number changes by a constant factor.

Inverse of Exponential

The inverse of addition is subtraction. The inverse of multiplication is division. In the same way, the inverse of the exponential function is the logarithmic function.

Logarithm in big O notation

This is exactly why we use logarithmic functions for a process where the value drops at each step.

For example, in case of base 2,

  • exponential - Value doubles at each step.
  • logarithmic - Value halves at each step.
2ʸ = x
log₂(x) = y
number of steps to reach original number

In the two functions above, the logarithm tells us how many times to multiply the base to get the original number. Even for exponential growth, it tells us how many steps it took to reach a value.

The logarithm gives the count of multiplications to reach the original number.

Graphs

logarithm-graph

Important use cases

  1. Huge values can be shortened and represented using logarithmic functions.
  2. Turn an exponentially growing sequence into a linear one by inverting it.
  3. Helps us read the growth rate of fast-growing values. Here we see how many steps it took to reach a value.

Logarithmic Algebra

  1. log(ab)=loga+logb
  2. log(a/b)=loga−logb
  3. log(a^k)=kloga
  4. log₂(N) = log₁₀(N) / log₁₀(2) - this is change of base formula
use of logarithmic algebra

We mainly use this to simplify large multiplications and divisions. Multiplying large numbers is always hard. This turns multiplications into additions.