Sub topic 12
Solving Exponential Equations
This chapter assumes you know the definition of a logarithm, the power law (logb(x^k) = k·logb(x)), and the change-of-base formula from the earlier chapters. It also assumes you can solve linear equations. An exponential equation is an equation in which the unknown appears in an exponent, such as 5·2^x = 80. Logarithms are the tool that brings the unknown down to ground level.
The general strategy
Every exponential equation in this chapter follows the same plan:
- Isolate the power. Get the expression b^(something) alone on one side, using ordinary algebra (divide, subtract).
- Decide how to remove the base. If both sides are powers of the same base, equate the exponents. Otherwise, take a logarithm of both sides.
- Use the power law to move the exponent in front.
- Solve the resulting linear equation.
- Check the answer by substituting it back, or by a numeric check in code.
Case 1: the power equals a power of the same base
Take 5·2^x = 80. Divide both sides by 5 to isolate the power:
2^x = 16
Since 16 = 2^4, the exponents must match, so x = 4. This is the same as applying the base-2 logarithm to both sides: x = log₂(16) = 4. Writing it as a logarithm always works, even when the right side is not a clean power of 2.
import math
# Solve 5 * 2**x = 80 -> 2**x = 16 -> x = log2(16)
x = math.log2(80 / 5)
print(x) # 4.0
# log(a + b) is not log(a) + log(b)
a, b = 3.0, 5.0
print(math.isclose(math.log10(a + b), math.log10(a) + math.log10(b))) # FalseThe second half of that script is a warning that returns later in this chapter: a logarithm of a sum does not split into a sum of logarithms.
Case 2: the base does not match
Solve 3^x = 20. There is no integer x with 3^x = 20, because 3² = 9 and 3³ = 27. Take a logarithm of both sides. You may use any base, as long as you use the same one on both sides.
Using the natural logarithm:
ln(3^x) = ln(20) x·ln(3) = ln(20) x = ln(20) / ln(3)
This is exactly the change-of-base formula, so the answer is log₃(20). You could have written x = log₃(20) directly from the definition of a logarithm. Taking ln or log₁₀ of both sides is the step that lets a calculator evaluate it.
import math
# Evaluate 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)) # TrueRaising 3 to the computed value recovers 20, which is the check from step 5 of the strategy.
Case 3: the unknown is part of a larger exponent
Solve 7^(2x − 1) = 50. Take the natural logarithm of both sides and apply the power law:
(2x − 1)·ln(7) = ln(50)
Do not expand yet. Divide by ln(7):
2x − 1 = ln(50) / ln(7)
Then:
x = (ln(50)/ln(7) + 1) / 2
Numerically, ln(50)/ln(7) ≈ 2.0104, so x ≈ 1.5052. The key point is that ln(7) is just a number, so the equation is linear in x after the power law is applied.
import math
x = (math.log(50) / math.log(7) + 1) / 2
print(round(x, 4)) # 1.5052
print(math.isclose(7 ** (2 * x - 1), 50.0)) # TrueCase 4: the unknown appears on both sides
Solve 2^(x+1) = 5^(x−2). Take the logarithm of both sides:
(x + 1)·ln(2) = (x − 2)·ln(5)
Expand and collect the x terms on one side:
x·ln(2) + ln(2) = x·ln(5) − 2·ln(5) ln(2) + 2·ln(5) = x·(ln(5) − ln(2))
So:
x = (ln(2) + 2·ln(5)) / (ln(5) − ln(2))
Using the product and power laws, the numerator is ln(2·25) = ln(50) and the denominator is ln(5/2), so x = ln(50) / ln(2.5) ≈ 4.2693.
import math
x = math.log(50) / math.log(2.5)
print(round(x, 4)) # 4.2693
print(math.isclose(2 ** (x + 1), 5 ** (x - 2))) # TrueCase 5: a hidden quadratic
Some equations look exponential but are quadratic in disguise. Solve 4^x − 3·2^x − 4 = 0.
Notice that 4^x = (2^x)². Let u = 2^x. The equation becomes:
u² − 3u − 4 = 0 (u − 4)(u + 1) = 0
So u = 4 or u = −1. Now go back to x:
- u = 4 gives 2^x = 4, so x = 2.
- u = −1 gives 2^x = −1, which has no real solution, because 2^x is always positive.
The only solution is x = 2. Throwing away u = −1 is the exponential counterpart of rejecting extraneous solutions, which the next chapter treats for logarithmic equations.
import math
# 4**x - 3*2**x - 4 = 0 with u = 2**x
a, b, c = 1.0, -3.0, -4.0
disc = b * b - 4 * a * c
roots = [(-b + s * math.sqrt(disc)) / (2 * a) for s in (1, -1)]
print(roots) # [4.0, -1.0]
for u in roots:
if u > 0:
print(math.log2(u)) # 2.0
else:
print(u, "rejected: 2**x is always positive")When there is no solution
An exponential function b^x with b > 0 and b ≠ 1 only takes positive values. So an equation such as 3^x = −9 or 2^x = 0 has no real solution. After isolating the power, check the sign of the right side before you take a logarithm. If it is zero or negative, stop: ln is undefined there.
Edge cases and cautions
- Base 1. 1^x = 1 for every x, so 1^x = 5 has no solution and 1^x = 1 is true for all x. Logarithms with base 1 do not exist, so you cannot use them here.
- Isolate before you take the log. For 5·2^x = 80, taking ln of both sides immediately gives ln(5·2^x), which splits into ln(5) + x·ln(2). That works, but it is easier to divide by 5 first. Taking a log of a sum such as 2^x + 3 = 11 requires isolating 2^x first (2^x = 8), because ln(2^x + 3) does not simplify.
- Rounding. If you round ln(20)/ln(3) early, the error carries into the answer. Keep full precision until the last step.
- Negative coefficients. In 3^x = 20, dividing by ln(3) is safe because ln(3) > 0. If a base is between 0 and 1, its logarithm is negative, and dividing by it flips no sign in the equation but does change the sign of the answer. Keep the sign in your arithmetic.
Worked example with a real context
A savings account pays 4% interest per year, compounded annually. How many years n does it take a balance to double? Solve 1.04^n = 2.
n·ln(1.04) = ln(2) n = ln(2) / ln(1.04) ≈ 17.67
So the balance doubles after about 17.67 years, which means during the 18th year.
import math
n = math.log(2) / math.log(1.04)
print(round(n, 2)) # 17.67
print(math.isclose(1.04 ** n, 2.0)) # TrueSummary table
| Equation form | First move | Result |
|---|---|---|
| b^x = c, with c > 0 | Take log_b of both sides | x = log_b(c) |
| a·b^x = c | Divide by a, then take the log | x = log_b(c/a) |
| b^(f(x)) = c | Take any log, apply the power law | f(x) = ln(c)/ln(b) |
| b^(f(x)) = d^(g(x)) | Take the log of both sides | Linear equation in x |
| Quadratic in b^x | Substitute u = b^x | Solve for u, keep only u > 0 |
Exercise
Solve 3·5^(x+2) = 150 exactly, and then give x to three decimal places.
Show answer
Divide by 3 to get 5^(x+2) = 50. Take ln of both sides: (x + 2)·ln(5) = ln(50), so x = ln(50)/ln(5) − 2. Since ln(50)/ln(5) ≈ 2.4307, x ≈ 0.431.
Exercise
Solve 9^x − 4·3^x + 3 = 0.
Show answer
Let u = 3^x, so 9^x = u². Then u² − 4u + 3 = 0, which factors as (u − 1)(u − 3) = 0. So u = 1 or u = 3, giving 3^x = 1 (x = 0) and 3^x = 3 (x = 1). Both u values are positive, so both solutions are valid: x = 0 and x = 1.
Exercise
Why does 2^x + 6 = 2 have no real solution, and what mistake would a solver make by taking ln of both sides straight away?
Show answer
Isolating the power gives 2^x = −4, which is impossible because 2^x > 0 for every real x. Taking ln of both sides first gives ln(2^x + 6), which cannot be simplified, and ln(2^x) + ln(6) is wrong because the logarithm of a sum is not the sum of logarithms.