Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 37 · Exponential and Logarithmic Functions

Logarithms and Their Laws

Understand logarithms as inverse exponentials, learn the product, quotient and power laws and the change of base formula, with Python to verify.

Exponential functions answer "what do I get after x steps?". A logarithm answers the reverse question: "how many steps does it take?". If 2ˣ = 32, what is x? You know it is 5, because 2⁵ = 32. The logarithm gives that question a name and a notation, and it is the inverse function you found in the last chapter.

The definition

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

log_b(x) = y means bʸ = x

Read it as "the exponent to which b must be raised to get x". So log₂(32) = 5, log₁₀(1000) = 3, log₃(1/9) = -2 and log_b(1) = 0 for any base.

Two special bases have their own keys on a calculator:

  • Common log: log(x) or log₁₀(x), base 10.
  • Natural log: ln(x), base e ≈ 2.71828 (the next lessons explain e).

Because y = bˣ and y = log_b(x) are inverses, they cancel:

log_b(bˣ) = x and b^(log_b x) = x.

Graph and domain

The graph of y = log_b(x) is the reflection of y = bˣ in the line y = x:

  • Domain (0, ∞): you can only take logs of positive numbers.
  • Range: all real numbers.
  • It passes through (1, 0) and (b, 1).
  • The y-axis (x = 0) is a vertical asymptote.
Python Logarithms in Python

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.

The laws of logarithms

Because logs are exponents, the exponent laws turn into log laws. For M, N > 0:

Law Statement
Product log_b(MN) = log_b M + log_b N
Quotient log_b(M/N) = log_b M - log_b N
Power log_b(Mᵖ) = p · log_b M

Why does the product law hold? Let M = bᵐ and N = bⁿ. Then MN = bᵐ⁺ⁿ, so log_b(MN) = m + n. That is the exponent law bᵐ·bⁿ = bᵐ⁺ⁿ read backwards.

Use the laws to expand or condense. Expand log₂(8x³ / y):

= log₂ 8 + 3·log₂ x - log₂ y = 3 + 3·log₂ x - log₂ y.

There is no law for log(M + N) or log(M)·log(N). A common mistake is writing log(M + N) = log M + log N. It is false.

Python Verify the log laws numerically

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.

Change of base

Calculators usually offer only log and ln. To compute log_b(x) for any base, use

log_b(x) = ln(x) / ln(b) = log(x) / log(b).

Why: if y = log_b x, then bʸ = x. Take ln of both sides: y·ln b = ln x, so y = ln x / ln b.

Example: log₅(40) = ln 40 / ln 5 ≈ 3.689 / 1.609 ≈ 2.292.

Python Change of base

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.

Why logarithms matter

Logs turn multiplication into addition. Before calculators, people used log tables and slide rules to multiply large numbers. Today they appear in sound levels (decibels), earthquake magnitudes, pH and information theory, because they compress huge ranges of values into manageable scales. The lesson after next explores these scales.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is log₃(81)?

    3⁴ = 81, so the logarithm is 4.
  2. 2. Which is equal to log(x²y)?

    Product law then power law: log(x²) + log y = 2 log x + log y.
  3. 3. What is the domain of f(x) = log₂(x)?

    A logarithm is defined only for positive arguments.
  4. 4. Which statement is false?

    There is no such rule for a sum. Only products, quotients and powers have log laws.

Summary

  • log_b(x) = y means bʸ = x; logs and exponentials are inverses.
  • Domain (0, ∞), range all reals, through (1, 0), vertical asymptote x = 0.
  • Laws: product to sum, quotient to difference, power to multiplier; none for log(M + N).
  • Change of base: log_b x = ln x / ln b.

Next: Exponential and Logarithmic Equations