Sub topic 3
Changing the base
This chapter assumes you know the laws of exponents, can solve linear equations, and can run short Python scripts. It builds on the product, quotient, and power laws from earlier chapters.
Changing the base
Most calculators only compute logarithms in base 10 and base e. The change-of-base formula converts any logarithm into a ratio of logarithms in a base you can compute:
log_b(x) = ln(x) / ln(b)
import math
# log base 3 of 20, using natural logarithms
value = math.log(20) / math.log(3)
print(round(value, 3)) # 2.727
print(math.isclose(3 ** value, 20.0)) # TrueThe formula works with any base for the numerator and denominator, as long as both use the same base.
Solving exponential equations
To solve an exponential equation, isolate the power first, then take the logarithm of both sides. For example, solve 5 · 2^x = 80. Dividing by 5 gives 2^x = 16, so x = log_2(16) = 4.
import math
x = math.log2(80 / 5)
print(x) # 4.0Solving logarithmic equations and checking for extraneous solutions
Solve log2(x) + log2(x − 2) = 3. The product law gives log_2(x(x − 2)) = 3, so x(x − 2) = 2³ = 8. This becomes x² − 2x − 8 = 0, which factors as (x − 4)(x + 2) = 0. The candidates are x = 4 and x = −2.
Check the domain. Each logarithm needs a positive argument, so x > 0 and x > 2. The value x = −2 fails, so it is extraneous. The only solution is x = 4.
Common mistakes to avoid
- Writing log(a + b) as log(a) + log(b). The product law applies to products, not sums.
- Writing (log x)² as 2 log x. The power law applies to the argument, so log(x²) = 2 log x.
- Keeping a candidate solution without checking the domain.
Logarithms in practice
Logarithmic scales compress very large ranges into small numbers:
- Decibels: L = 10 · log₁₀(I / I₀) measures sound intensity.
- pH: pH = −log₁₀[H⁺] measures acidity from the hydrogen ion concentration.
- Algorithms: binary search on n items needs about log₂(n) steps. For one million items, that is about 20 steps.
Exercise
Solve 4^x = 50 using the change-of-base formula. Give x to three decimal places.
Show answer
x = ln(50) / ln(4) ≈ 3.912 / 1.386 ≈ 2.822