Skip to content
Tutorials Center
My learning

Topics

Lesson 24 of 38 · Exponential and Logarithmic Functions

Logarithms: The Inverse of Exponentials

Understand logarithms as exponents: convert between log and exponential form, evaluate common and natural logs, and graph y = log base b of x.

You can ask: "What is 2 raised to the power 3?" The answer is 8. Now turn it around: "2 raised to what power gives 8?" The answer, 3, is called a logarithm. A logarithm is simply an exponent, found backward.

Definition

For b > 0, b ≠ 1, and x > 0:

Text
log_b(x) = y   means   b^y = x

Read log_b(x) as "the logarithm of x to the base b", or "the power you raise b to in order to get x".

Exponential form Logarithmic form
2³ = 8 log₂(8) = 3
10² = 100 log₁₀(100) = 2
5⁰ = 1 log₅(1) = 0
2⁻³ = 1/8 log₂(1/8) = -3
9^(1/2) = 3 log₉(3) = 1/2

Evaluating logarithms

Ask the question "base to what power?"

  • log₃(81): 3⁴ = 81, so the answer is 4.
  • log₄(2): 4^(1/2) = 2, so the answer is 1/2.
  • log₁₀(0.001): 10⁻³ = 0.001, so the answer is -3.

Three facts always hold:

Text
log_b(1) = 0      log_b(b) = 1      log_b(bˣ) = x

and the reverse composition b^(log_b(x)) = x for x > 0. These say that exponential and logarithm functions undo each other: they are inverses.

Special bases

  • Common logarithm: base 10, written log(x) or log₁₀(x).
  • Natural logarithm: base e ≈ 2.71828, written ln(x). You meet e in the lesson on continuous growth.

Most calculators and programming languages have log10 and ln (often called log in code!). In Python, math.log(x) is the natural log, math.log10(x) is base 10, and math.log(x, b) is base b.

Domain and range

Because bʸ is always positive, you can only take logs of positive numbers. So for f(x) = log_b(x):

  • domain: x > 0,
  • range: all real numbers,
  • vertical asymptote: the line x = 0 (the y-axis),
  • x-intercept: (1, 0), since log_b(1) = 0,
  • passes through (b, 1).

Its graph is the reflection of y = bˣ in the line y = x. Swapping the roles of x and y is exactly what "inverse" means.

log(0) and log of a negative number are undefined in the real numbers. log₂(-4) asks "2 to what power gives -4?" and no real power does.

Logarithmic scales

Logs turn multiplication into addition, which lets us compare things of very different sizes. A step of 1 on the base-10 log scale means 10 times bigger. This idea is used for decibels (sound), the pH scale (acidity) and earthquake magnitudes. You do not need the exact definitions: the key idea is that equal steps on the scale are equal ratios in the quantity.

Computing logs from scratch

We can find log_b(x) by bisection, searching for the exponent y with bʸ = x.

Python Logarithm by bisection

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Plot an exponential and its inverse

Python y = 2^x, y = log2(x) and y = x

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is log₂(32)?

    2⁵ = 32, so the exponent is 5.
  2. 2. Which is the exponential form of log₅(25) = 2?

    log_b(x) = y means b^y = x, so 5² = 25.
  3. 3. What is the domain of f(x) = log₃(x)?

    Powers of 3 are always positive, so you can only take logs of positive numbers.
  4. 4. What is log₉(3)?

    9^(1/2) = 3, so log₉(3) = 1/2.

Summary

  • log_b(x) = y means b^y = x: a logarithm is an exponent.
  • log_b(1) = 0, log_b(b) = 1, and b^(log_b x) = x.
  • Common log is base 10; natural log ln is base e.
  • Domain x > 0, range all reals, vertical asymptote at x = 0; the graph mirrors y = bˣ in y = x.

Next: Properties of Logarithms