A logarithm answers a single question: what exponent do I need to raise the base to in order to get this number? If you know that 2 to the 3rd is 8, you already know that the base-2 logarithm of 8 is 3. Everything else follows from that sentence.

log⁡ba=x  ⟺  bx=a\log_b a = x \iff b^x = a
Definition: the logarithm is the exponent.

The names make problems easier to read: b is the base, a is the argument and x is the logarithm. There are three conditions: the base is positive, the base is not 1, and the argument is positive. They are not red tape; each one rules out a case where “which exponent?” would have no single answer.

Why the conditions exist

If the base were 1, every power would be 1, so “1 to what power gives 5?” would have no answer and “1 to what power gives 1?” would have infinitely many. With a negative base, powers such as (−2) to the 1/2 would not even be real numbers. And with a positive base every power is positive, so no real exponent gives zero or a negative number. That is why the argument must be greater than zero.

First examples

  • log⁡28=3\log_2 8 = 3, because 23=82^3 = 8.
  • log⁡101000=3\log_{10} 1000 = 3, because 103=100010^3 = 1000.
  • log⁡51=0\log_5 1 = 0, because 50=15^0 = 1. This holds for any base: the log of 1 is always 0.
  • log⁡77=1\log_7 7 = 1, because 71=77^1 = 7. The log of the base itself is always 1.
  • log⁡319=−2\log_3 \tfrac{1}{9} = -2, because 3−2=193^{-2} = \tfrac{1}{9}. A negative logarithm is fine; it is the argument that cannot be negative.

When the numbers are not obvious powers, rewrite everything in a common base. To find the base-9 logarithm of 27, write 9 as 3² and 27 as 3³. The question becomes “(3²) to the x equals 3³”, so 2x = 3 and x = 3/2. Check: 9 to the 1.5 is the square root of 9 cubed, 3³ = 27.

The shape of the logarithm

The logarithmic function is the inverse of the exponential. On a graph, the curve of log₂ x is the mirror image of 2^x across the line y = x: the points (1, 2), (2, 4) and (3, 8) of the exponential become (2, 1), (4, 2) and (8, 3) on the logarithm. Notice how slowly the logarithm grows: to climb from 2 to 3 it had to go from 4 to 8.

−202468−202468xyy = 2^xy = log₂ x
The exponential 2^x and the logarithm log₂ x mirror each other across the line y = x.

Properties

For valid bases and arguments the four rules below hold. They all come from the laws of exponents: multiplying powers of the same base adds exponents, dividing subtracts them, raising to a power multiplies them. Since the logarithm is the exponent, addition, subtraction and multiplication show up in it.

log⁡b(x⋅y)=log⁡bx+log⁡bylog⁡bxy=log⁡bx−log⁡bylog⁡bxn=n⋅log⁡bxlog⁡ba=log⁡calog⁡cb\begin{aligned} \log_b (x \cdot y) &= \log_b x + \log_b y \\ \log_b \frac{x}{y} &= \log_b x - \log_b y \\ \log_b x^n &= n \cdot \log_b x \\ \log_b a &= \frac{\log_c a}{\log_c b} \end{aligned}
Product, quotient, power and change of base.

With log 2 ≈ 0.301 and log 3 ≈ 0.477 (base 10) you can work out many others without a calculator. Since 12 = 2² · 3, log 12 = 2 · log 2 + log 3 ≈ 0.602 + 0.477 = 1.079. Since 5 = 10/2, log 5 = log 10 − log 2 ≈ 1 − 0.301 = 0.699. And since 2 to the 10th is 1,024, just over a thousand, log 1,024 = 10 · 0.301 ≈ 3.01, which matches 1,024 sitting just above 10³.

Change of base

Calculators usually offer only log (base 10) and ln (base e ≈ 2.718). For any other base, divide the log of the number by the log of the base, both in a base the calculator has. For example, log₂ 3 = log 3 / log 2 ≈ 0.477 / 0.301 ≈ 1.585. Sanity check: 2¹ = 2 < 3 < 4 = 2², so the answer must lie between 1 and 2, and it does.

Worked example: how long until your money doubles

A savings account pays 1% per month, compounded monthly. After how many months does the balance double? The unknown sits in the exponent, which is exactly the job a logarithm does.

1.01n=21.01^n = 2
The balance is multiplied by 1.01 each month, n times, and must reach double.
  1. Take the log of both sides (any base works; use your calculator’s): log(1.01ⁿ) = log 2.
  2. By the power rule the exponent comes down: n · log 1.01 = log 2.
  3. Solve for n: n = log 2 / log 1.01.
  4. On a calculator: log 2 ≈ 0.30103 and log 1.01 ≈ 0.0043214, so n ≈ 69.66.
  5. Interest is credited monthly, so the balance first passes double in month 70.

Check: 1.01 to the 69th is about 1.987, still below 2; 1.01 to the 70th is about 2.007, already above. So 70 months is right. Using ln instead gives the same n, because a ratio of two logarithms does not depend on the base.

Other exponential equations

You do not always need a calculator. In 3^(x+1) = 81, note that 81 = 3⁴ and match exponents: x + 1 = 4, so x = 3. In 2^x = 10 there is no common base, so take logs: x · log 2 = log 10 = 1, and x = 1 / log 2 ≈ 3.32. That makes sense, since 2³ = 8 and 2⁴ = 16 surround 10.

Where logarithms show up outside class

Scales that span many orders of magnitude are logarithmic: the pH of a solution, sound in decibels and earthquake magnitudes. On each one, adding 1 to the reading multiplies the underlying quantity by a fixed factor. In computer science, log₂ n counts how many times n can be halved, which is why a binary search through a million items takes only about 20 steps.

Common mistakes

  1. Writing log(a + b) = log a + log b. The rule is for products, not sums. Test it: log(1 + 1) = log 2 ≈ 0.301, but log 1 + log 1 = 0.
  2. Ignoring the domain. After solving a logarithmic equation, check that the solution keeps every argument positive; if not, throw it out.
  3. Mixing up log(xⁿ) and (log x)ⁿ. An exponent on the argument comes down as a factor; an exponent on the whole log does not.
  4. Dividing arguments instead of logs. log 8 / log 2 is 3, but log(8/2) = log 4 ≈ 0.602. Different calculations.
  5. Rounding too early. In interest problems, using log 1.01 ≈ 0.004 instead of 0.0043 moves the answer from 70 to about 76 months.

Frequently asked questions

Why can't the base of a logarithm be 1?

Because 1 to any power is 1. The equation 1^x = 5 has no solution and 1^x = 1 has infinitely many, so the logarithm would not be well defined.

Can you take the log of a negative number?

Not in the real numbers. With a positive base, b^x is always positive, so no real exponent gives a negative number or zero.

What does log mean with no base written?

In US high school math, log x means base 10 and ln x means base e ≈ 2.718. In computer science, log often means base 2, so check the convention of your textbook.

When should I use ln and when log?

For solving exponential equations it does not matter: a ratio of two logs is the same in any base. ln is natural for continuous growth and calculus; base-10 log for scales like pH and decibels.