Introduction to Logarithms and How to Calculate Them

A logarithm answers the question “to what power must the base be raised to get this number?”: logb x = y means by = x. In brief: log2 8 = 3 because 23 = 8, log10 1000 = 3 because 103 = 1000, and log5 (1/25) = −2 because 5−2 = 1/25. The base b must be positive and not equal to 1, and the argument x must be positive.

Logarithms are the inverse operation of exponentiation, in the same way that subtraction undoes addition. They turn multiplication into addition, make huge ranges of numbers manageable (decibels, pH, the Richter scale) and let you solve equations in which the unknown is an exponent. This guide explains the definition, special values, how to calculate logarithms by hand and with a calculator, and gives a table of common values.

What is a logarithm?

For b > 0, b ≠ 1 and x > 0, the equation y = logb x is equivalent to by = x. The number b is the base, x is the argument and y is the logarithm. The two forms say the same thing:

25 = 32 ⟺ log2 32 = 5.

2⁵ = 32 log₂ 32 = 5

The restrictions come from the exponential function y = bx, which is positive and takes each positive value exactly once. So you cannot take the logarithm of zero or of a negative number in the real numbers, and the base 1 is not allowed because 1y is always 1. The logarithm is the inverse of the exponential function.

Two bases have special names: log x or log10 x is the common logarithm (base 10), and ln x is the natural logarithm (base e ≈ 2.718). In computer science, log2 is often written lg or log.

What are the special values of logarithms?

How do you calculate a logarithm?

By rewriting as a power

  1. Set y = logb x.
  2. Rewrite as by = x.
  3. Express x as a power of b and read the exponent.

Example 1

log3 81 = y means 3y = 81 = 34, so y = 4.

Example 2

log4 8: 4y = 8, so 22y = 23, 2y = 3 and y = 3/2.

Example 3

log1/2 16: (1/2)y = 16 gives 2−y = 24, so y = −4.

Example 4

logx 49 = 2 means x2 = 49, so x = 7 (the base must be positive).

With a calculator

Calculators have keys for log (base 10) and ln. For other bases, use the change-of-base formula logb x = ln x/ln b. For example, log2 10 = ln 10/ln 2 = 2.3026/0.6931 ≈ 3.3219. Check: 23.3219 ≈ 10.

Estimating a logarithm

Between which two integers is log2 50? Since 25 = 32 and 26 = 64, the value lies between 5 and 6, close to 5.64. For common logarithms, the number of digits of an integer N is ⌊log N⌋ + 1: log 5,000,000 ≈ 6.699, so 5,000,000 has 7 digits.

565.64326450

Worked examples

Example 5: solving a simple equation

log2 (x + 1) = 4 means x + 1 = 24 = 16, so x = 15. Check: log2 16 = 4 ✓.

Example 6: a growth question

How many years until 1,000 dollars at 5% yearly interest becomes 2,000? 1.05t = 2, so t = log1.05 2 = ln 2/ln 1.05 ≈ 14.2 years.

Example 7: pH

pH = −log10[H+]. For a hydrogen ion concentration of 10−7 mol/L, pH = 7. For 3.2 × 10−4, pH = −log(3.2 × 10−4) = −(0.505 − 4) = 3.49.

Table of common logarithms

Logarithms of selected numbers in bases 2, 10 and e
x log2 x log10 x ln x
1000
210.30100.6931
31.58500.47711.0986
420.60211.3863
52.32190.69901.6094
830.90312.0794
103.321912.3026
1006.643924.6052
10009.965836.9078

Where do logarithms come from?

John Napier published the first table of logarithms in 1614, motivated by the need to simplify the multiplication of large numbers in astronomy. Henry Briggs soon produced tables of base-10 logarithms. For more than 300 years, logarithm tables and slide rules, which add lengths proportional to logarithms, were the standard tools of calculation, until electronic calculators replaced them in the 1970s. The word logarithm is built from Greek words meaning “ratio number”.

Where are logarithms used today?

Logarithmic scales compress large ranges: the loudness of sound in decibels (L = 10 log(I/I0)), the acidity pH, the magnitude of earthquakes and the brightness of stars. In computer science, the number of steps in a binary search is about log2 n: a sorted list of one million entries needs at most 20 comparisons. In finance and science, logarithms are used to solve for time and for growth rates.

Which mistakes are common?

Taking the logarithm of a non-positive number

logb 0 and logb (−4) are not defined in the real numbers.

Mixing up the base and the argument

In log2 8 the base is 2 and the argument is 8. The result is 3, not 1/3.

Treating log as a multiplication

log10 100 is not “log times 100”. It is the exponent 2.

Assuming log(a + b) = log a + log b

The correct rule is for products: log(ab) = log a + log b.