Sub topic 4
Changing the base of a logarithm
This chapter assumes you can solve linear and quadratic equations, apply the product, quotient, and power rules for logarithms, and use a calculator's log and ln keys. You will learn the change of base formula, where it comes from, and how it lets you evaluate and compare logarithms in any base.
Why you need it
Most calculators have only two logarithm keys: log (base 10) and ln (base e). An expression such as log₅(40) has no key of its own. The change of base formula rewrites it as a ratio of logarithms you can compute.
The formula also helps when an equation contains logarithms in different bases, such as log₂(x) and log₄(x + 6). You can convert them to one base and then use the rules from the earlier chapters.
The formula
For any positive numbers b and c, both different from 1, and any x > 0:
logb(x) = logc(x) / log_c(b)
The new base c is your choice. You pick whichever base your tool supports, or whichever makes the algebra easiest. The two most common choices are:
| Choice of c | Formula | When to use it |
|---|---|---|
| 10 | log_b(x) = log(x) / log(b) | Calculator with a `log` key |
| e | log_b(x) = ln(x) / ln(b) | Calculator with an `ln` key, or code using `math.log` |
| Same as another log in the equation | log_b(x) = log_c(x) / log_c(b) | Combining logs in a mixed-base equation |
Where the formula comes from
The derivation uses only the inverse relationship and the power rule.
- Let y = log_b(x). By the definition of a logarithm, this means b^y = x.
- Take logc of both sides: logc(b^y) = log_c(x).
- Apply the power rule to bring the exponent down: y · logc(b) = logc(x).
- Divide by logc(b). This is allowed because b ≠ 1, so logc(b) ≠ 0.
The result is y = logc(x) / logc(b), which is the formula.
The restriction b ≠ 1 is not a technicality. Since 1 raised to any power is 1, log₁ is not defined. If b were 1, then log_c(b) would be 0 and step 4 would divide by zero.
Worked example: evaluating a logarithm
Evaluate log₅(40) using natural logarithms.
log₅(40) = ln(40) / ln(5) ≈ 3.6889 / 1.6094 ≈ 2.2920
Sanity check: 5² = 25 and 5³ = 125, and 40 lies between them, so the answer should be between 2 and 3. It is. Using base 10 gives the same value, because log(40)/log(5) ≈ 1.6021/0.6990 ≈ 2.2920.
You can confirm this in Python:
import math
def log_base(x, b):
"""Return log of x in base b using natural logarithms."""
return math.log(x) / math.log(b)
value = log_base(40, 5)
print(value) # about 2.2920
print(math.log(40, 5)) # the built-in two-argument form agrees
print(5 ** value) # about 40.0
# Different new bases give the same answer.
print(math.isclose(math.log10(40) / math.log10(5), value)) # TruePython's math.log(x, base) does the same division internally. Because it divides two rounded floating-point numbers, the result can be off in the last digit. For example, math.log(1000, 10) gives 2.9999999999999996, not 3. When you need an exact integer result, use math.log10 or math.log2, or compare with math.isclose.
Useful consequences
Two special cases save work and appear often in problems.
The reciprocal rule
Set x = c in the formula and then rename the variables. You get:
logb(a) = 1 / loga(b)
For example, log₂(8) = 3, so log₈(2) = 1/3. This is correct because 8^(1/3) = 2.
Bases that are powers of each other
When the old base is a power of the new base, the denominator is a simple number:
log{b^k}(x) = (1/k) · logb(x)
Here is an example that needs no calculator:
log₈(32) = log₂(32) / log₂(8) = 5 / 3
Both 8 and 32 are powers of 2, so choosing c = 2 turns the problem into whole numbers. When the numbers involved share a hidden common base, use that base as c.
Choosing the new base
Using it in an equation
Solving an exponential equation
In the chapter on solving exponential equations by taking logarithms, you wrote answers such as x = ln(12) / ln(7). That quotient is a change of base. Writing the answer as log₇(12) is the exact form, and the quotient evaluates it:
7^x = 12 gives x = log₇(12) = ln(12) / ln(7) ≈ 2.4849 / 1.9459 ≈ 1.2770
Both forms describe the same number. You can state the exact form and then give the decimal for the calculator.
Solving a mixed-base logarithmic equation
Solve log₂(x) = log₄(x + 6).
- Convert the right side to base 2. Since 4 = 2², we have log₄(x + 6) = log₂(x + 6) / log₂(4) = log₂(x + 6) / 2.
- The equation becomes log₂(x) = ½ · log₂(x + 6).
- Multiply by 2: 2 · log₂(x) = log₂(x + 6).
- Apply the power rule: log₂(x²) = log₂(x + 6).
- Use the one-to-one property: x² = x + 6, so x² − x − 6 = 0, so (x − 3)(x + 2) = 0.
- Check the domain. The argument of log₂(x) must be positive, so x > 0. This rejects x = −2 and leaves x = 3.
Check: log₂(3) ≈ 1.585, and log₄(9) = log₂(9) / 2 = 2 · log₂(3) / 2 = log₂(3). The two sides agree.
The root x = −2 is extraneous. It came from squaring in step 4, which discarded the information that x had to be positive. The change of base itself did not cause it. Always check the original equation's domain.
import math
# Solve log2(x) = log4(x + 6): candidates from x**2 - x - 6 = 0
candidates = [3, -2]
valid = []
for x in candidates:
if x > 0 and x + 6 > 0:
left = math.log2(x)
right = math.log(x + 6) / math.log(4)
if math.isclose(left, right):
valid.append(x)
print(valid) # [3]Common errors
- Dividing in the wrong order. The formula is logb(x) = logc(x) / log_c(b). The old base goes in the denominator. A quick test: log₂(8) must be 3, and ln(8)/ln(2) gives 3, while ln(2)/ln(8) gives 1/3.
- Cancelling the logs. The quotient ln(40) / ln(5) is not ln(40/5) and is not ln(8). The quotient rule applies to the log of a quotient, not to a quotient of logs.
- Distributing over addition. log(a + b) is not log(a) + log(b). The same applies to the denominator: log_c(b) is a single number you divide by.
- Rounding too early. Round ln(40) and ln(5) to two decimals and the quotient changes in the third digit. Keep full calculator precision until the last step.
- Using an invalid base. Bases must be positive and not equal to 1. A base of 0, 1, or a negative number gives no valid logarithm.
Summary of the key facts
- logb(x) = logc(x) / log_c(b), for b, c > 0, b ≠ 1, c ≠ 1, x > 0.
- The formula comes from b^y = x, taking log_c, and using the power rule.
- Choose c = 10 or e for numeric work. Choose a shared base when the numbers are powers of one number.
- logb(a) = 1 / loga(b).
- Converting to a common base lets you combine logarithms and use the one-to-one property, but you must still check the domain.
Exercise
Use the change of base formula to find log₃(50) to four decimal places, and explain why the answer must lie between 3 and 4.
Show answer
log₃(50) = ln(50) / ln(3) ≈ 3.9120 / 1.0986 ≈ 3.5608. Since 3³ = 27 and 3⁴ = 81, and 50 is between 27 and 81, the exponent that gives 50 must be between 3 and 4.
Exercise
Without a calculator, evaluate log₉(27) by changing to base 3.
Show answer
log₉(27) = log₃(27) / log₃(9) = 3 / 2 = 1.5. Check: 9^1.5 = (3²)^1.5 = 3³ = 27.
Exercise
Solve log₂(x) + log₄(x) = 3. Give the exact answer and state whether any candidate is extraneous.
Show answer
Write log₄(x) = log₂(x) / 2. The equation becomes log₂(x) + ½ · log₂(x) = 3, so (3/2) · log₂(x) = 3, so log₂(x) = 2, so x = 4. Check: log₂(4) + log₄(4) = 2 + 1 = 3. The only candidate is x = 4, it satisfies x > 0, and no candidate is extraneous.