A logarithm answers a single question: what exponent do I need to raise the base to in order to get this number?

logba=x    bx=a\log_b a = x \iff b^x = a

with the existence conditions b>0b > 0, b1b \neq 1 and a>0a > 0.

First examples

  • log28=3\log_2 8 = 3, because 23=82^3 = 8.
  • log101000=3\log_{10} 1000 = 3, because 103=100010^3 = 1000.
  • log51=0\log_5 1 = 0, because 50=15^0 = 1.
  • log319=2\log_3 \tfrac{1}{9} = -2, because 32=193^{-2} = \tfrac{1}{9}.

Worked example: log927\log_9 27

  1. Write both numbers as powers of 3: 9=329 = 3^2 and 27=3327 = 3^3.
  2. Look for xx with 9x=279^x = 27: (32)x=3332x=33(3^2)^x = 3^3 \Rightarrow 3^{2x} = 3^3.
  3. 2x=32x = 3, so log927=32\log_9 27 = \dfrac{3}{2}.

Properties

For valid bases and arguments:

logb(xy)=logbx+logbylogbxy=logbxlogbylogbxn=nlogbxlogba=logcalogcb\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}

They all come from the rules of exponents: multiplying powers with the same base adds exponents, and a logarithm is exactly an exponent.

Worked example: log12\log 12 given log20.301\log 2 \approx 0.301 and log30.477\log 3 \approx 0.477

  1. Factor: 12=22312 = 2^2 \cdot 3.
  2. log12=2log2+log3\log 12 = 2 \log 2 + \log 3.
  3. log120.602+0.477=1.079\log 12 \approx 0.602 + 0.477 = 1.079.

Worked example: log5\log 5 with the same data

  1. 5=1025 = \dfrac{10}{2}.
  2. log5=log10log210.301=0.699\log 5 = \log 10 - \log 2 \approx 1 - 0.301 = 0.699.

Change of base

Calculators usually have only log\log (base 10) and ln\ln (base ee). For any other base, divide:

Worked example: log23\log_2 3

  1. log23=log3log2\log_2 3 = \dfrac{\log 3}{\log 2}.
  2. 0.4770.3011.585\approx \dfrac{0.477}{0.301} \approx 1.585.
  3. Rough check: 21=2<3<4=222^1 = 2 < 3 < 4 = 2^2, so the value lies between 1 and 2.

Exponential equations

When you cannot match the bases, take the logarithm of both sides and use the power rule.

Worked example: 2x=102^x = 10

  1. log2x=log10\log 2^x = \log 10.
  2. xlog2=1x \cdot \log 2 = 1.
  3. x=1log210.3013.32x = \dfrac{1}{\log 2} \approx \dfrac{1}{0.301} \approx 3.32.

Worked example: 3x+1=813^{x+1} = 81

  1. 81=3481 = 3^4, so the bases can be matched: x+1=4x + 1 = 4.
  2. x=3x = 3.

Common mistakes

  1. Writing log(a+b)=loga+logb\log(a + b) = \log a + \log b.
  2. Ignoring the existence conditions and accepting solutions that make the argument negative.
  3. Confusing logbxn=nlogbx\log_b x^n = n \log_b x with (logbx)n(\log_b x)^n.

Frequently asked questions

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

Because 1 raised 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.

Is there a logarithm of a negative number?

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

What does log mean with no base written?

In most 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.

Is log(a + b) equal to log a + log b?

No. The rule is for products: log(a · b) = log a + log b. For example, log(1 + 1) = log 2 ≈ 0.301, but log 1 + log 1 = 0.