What a logarithm is
A logarithm answers the question “what power?”. The logarithm of x to the base b is the exponent that b must be raised to in order to give x.
logb x = y means by = x
Here b is the base (positive and not equal to 1), x is the number (positive), and y is the logarithm, which can be any real number. So log2 8 = 3 because 23 = 8, and log10 1,000 = 3 because 103 = 1,000.
Three bases have their own names. Base 10 is the common logarithm. Base e, where e is about 2.71828, is the natural logarithm, written ln. Base 2 is the binary logarithm used in computing.
The change-of-base formula
logb x = ln x ÷ ln b = log10 x ÷ log10 b
Most calculators have only ln and log10 keys. This formula turns a logarithm to any base b into a division of two logarithms that the calculator does have. It does not matter which base is used on the right, as long as it is the same on the top and the bottom.
The laws of logarithms
log(a × c) = log a + log c log(a ÷ c) = log a − log c log(an) = n × log a
These hold for any base, with a and c positive. They are the laws of exponents seen from the other side: multiplying numbers adds their exponents. For example log10 2 + log10 5 = 0.30103 + 0.69897 = 1, which is log10 10. And log2 32 = log2(25) = 5 × log2 2 = 5.
Worked example: log of 100 to the base 5
- Estimate first. 52 = 25 and 53 = 125. Since 100 lies between them, the answer is between 2 and 3, and nearer 3.
- Take natural logs of both numbers. ln 100 = 4.6052 and ln 5 = 1.6094.
- Divide. 4.6052 ÷ 1.6094 = 2.8614.
- Cross-check with base 10. log10 100 = 2 and log10 5 = 0.69897, and 2 ÷ 0.69897 = 2.8614, the same answer.
- Check by going back. 52.8614 = 100.01, as close to 100 as four decimal places allow.
Finding the number or the base
Number: x = by Base: b = x1/y
Finding the number from its logarithm is called taking the antilogarithm. If log10 x = 2.5 then x = 102.5 = 316.23. To find a base, take a root: if logb 81 = 4 then b4 = 81, so b is the fourth root of 81, which is 3.
Reading and using the result
Check which base “log” means
On a calculator keypad and in school textbooks, “log” with no base means base 10. In higher mathematics and in most programming languages it means the natural logarithm. In computer science it often means base 2. Using the wrong one is the most common cause of a wrong answer, and the results differ by a constant factor: ln x is always about 2.3026 times log10 x.
There is no law for the log of a sum
log(a + c) cannot be split. log10(100 + 900) = log10 1,000 = 3, but log10 100 + log10 900 = 2 + 2.9542 = 4.9542, which is the log of the product 90,000.
Zero, negatives and numbers below 1
No power of a positive base gives zero or a negative number, so the logarithm of zero or of a negative number does not exist in real numbers. The logarithm of 1 is 0 in every base. For a base larger than 1, numbers between 0 and 1 have negative logarithms: ln 0.5 = −0.6931.
Each whole step is a multiplication
On a base-10 scale such as earthquake magnitude, sound level in bels or pH, a difference of 1 means a factor of 10 and a difference of 2 means a factor of 100. A solution with a hydrogen ion concentration of 0.00032 moles per litre has log10 0.00032 = −3.49, so its pH is 3.49.
Solving for time in growth problems
Logarithms pull an unknown out of an exponent. Money growing at 7% a year doubles when 1.07t = 2, so t = ln 2 ÷ ln 1.07 = 0.6931 ÷ 0.06766 = 10.24 years.