Sub topic 7
Solving exponential equations by taking logarithms
This chapter covers equations where the unknown sits in an exponent and the two sides cannot be rewritten with the same base. It assumes you can solve linear and quadratic equations, apply the exponent rules, and use a calculator for powers and logarithms. It also assumes you know the power rule for logarithms, log(a^k) = k·log(a), and the change of base formula from earlier chapters.
Why matching bases is not enough
Some exponential equations can be solved by matching bases. For example, 2^x = 32 becomes 2^x = 2^5, so x = 5. The one-to-one property then lets you equate the exponents.
Most equations do not work out this way. Consider 3^x = 20. The number 20 is not a power of 3, so you cannot write both sides with base 3 using an integer or simple fraction exponent. The solution is a number between 2 and 3, because 3^2 = 9 and 3^3 = 27.
The tool you need is the logarithm. Taking a logarithm of both sides moves the unknown out of the exponent. The power rule does the work:
log(3^x) = x · log(3)
After that step, the equation is linear in x.
The method
- Isolate the exponential expression on one side. Divide away any coefficient and move added or subtracted terms.
- Take a logarithm of both sides. Any base works, but
lnorlog(base 10) is convenient because calculators have them. - Use the power rule to bring the exponent down as a multiplier.
- Solve the resulting linear equation for the unknown.
- Check the answer numerically.
Worked example: the simplest case
Solve 3^x = 20.
- The exponential is already isolated.
- Take
lnof both sides:ln(3^x) = ln(20). - Apply the power rule:
x · ln(3) = ln(20). - Divide:
x = ln(20) / ln(3).
The exact answer is ln(20) / ln(3). A calculator gives about 2.7268, which sits between 2 and 3 as predicted.
Notice that this is the same as log_3(20). Taking a logarithm of both sides is the change of base formula in action. You can write the answer either way.
Worked example: an exponent that is an expression
Solve 3^(2x − 1) = 20.
Take ln of both sides and apply the power rule to the whole exponent:
(2x − 1) · ln(3) = ln(20)
The expression 2x − 1 is one multiplier, so keep it in parentheses. Divide by ln(3):
2x − 1 = ln(20) / ln(3)
Then solve the linear equation:
x = (1 + ln(20) / ln(3)) / 2
The following code computes this value and verifies it by substituting back into the original equation.
import math
# Solve 3**(2*x - 1) = 20
# Take logs: (2x - 1) * ln(3) = ln(20), so x = (1 + ln(20)/ln(3)) / 2
x = (1 + math.log(20) / math.log(3)) / 2
print(x) # about 1.8634
print(3 ** (2 * x - 1)) # about 20.0The second printed value is the check. It should reproduce the right-hand side, 20, up to floating-point rounding.
Which logarithm to use
The base you choose for the logarithm does not change the answer. It only changes how the answer looks along the way.
| Choice | When it helps | Result for `3^x = 20` |
|---|---|---|
| `ln` | The equation already contains `e`, such as `e^(0.05t) = 3`. | `x = ln(20) / ln(3)` |
| `log` (base 10) | The equation has base 10, such as `10^x = 450`. | `x = log(20) / log(3)` |
| A matching base | The base on one side equals the logarithm's base, so the log undoes it. | `x = log_3(20)` |
All three expressions in the right-hand column are equal, because the ratio log(20) / log(3) is the same for any base. This is the change of base formula.
Equations with a coefficient or an added term
Real equations rarely arrive in the form a^x = b. You usually need to isolate the exponential first.
Worked example: coefficient and constant
Solve 4 · 5^(x + 1) − 7 = 93.
- Add 7 to both sides:
4 · 5^(x + 1) = 100. - Divide by 4:
5^(x + 1) = 25. - Here you may notice that 25 is
5^2, so a common base works:x + 1 = 2, sox = 1.
This shows a useful habit. After isolating the exponential, check whether the right-hand side is a power of the base. If it is, matching bases is faster and gives an exact integer. If it is not, take a logarithm.
Now change the number: 4 · 5^(x + 1) − 7 = 95.
- Add 7:
4 · 5^(x + 1) = 102. - Divide by 4:
5^(x + 1) = 25.5. - Take
ln:(x + 1) · ln(5) = ln(25.5). - Divide by
ln(5)and subtract 1:x = ln(25.5) / ln(5) − 1.
The decimal value is about 1.0109, a little above 1, which makes sense because 25.5 is a little above 25.
Different bases on each side
Sometimes both sides are exponentials with different bases. Taking a logarithm of both sides still works, and you end up with x on both sides of a linear equation.
Worked example
Solve 2^(x + 3) = 5^x.
Take ln of both sides:
(x + 3) · ln(2) = x · ln(5)
Distribute and collect the x terms:
x · ln(2) + 3 · ln(2) = x · ln(5)
3 · ln(2) = x · ln(5) − x · ln(2)
3 · ln(2) = x · (ln(5) − ln(2))
x = 3 · ln(2) / (ln(5) − ln(2))
By the quotient rule, the denominator equals ln(5/2), so you can also write x = 3 · ln(2) / ln(2.5). Numerically, x is about 2.2692.
The key step is factoring x out of the two terms. Students often stall here, because ln(5) − ln(2) looks like it should be simplified before you divide. You do not need to simplify it. Treat each logarithm as a plain number.
import math
x = 3 * math.log(2) / (math.log(5) - math.log(2))
print(x) # about 2.2692
print(2 ** (x + 3), 5 ** x) # both about 38.0Common errors
These mistakes appear again and again with this method.
- Taking the logarithm term by term. The equation
2^x + 3 = 11does not becomex · ln(2) + ln(3) = ln(11)in any useful way, and the statementln(a + b) = ln(a) + ln(b)is false. Isolate first:2^x = 8, thenx = 3. - Treating the quotient as a difference. The expression
ln(20) / ln(3)is notln(20) − ln(3). The quotient of logarithms cannot be simplified into a single logarithm. The quotient rule applies toln(20/3), which is a different number. - Dropping parentheses. In
(2x − 1) · ln(3), the multiplier is the whole exponent. Writing2x − 1 · ln(3)changes the meaning. - Rounding too early. If you round
ln(20) / ln(3)to 2.7 before using it, errors grow in later steps. Keep full precision until the final line, then round once. - Taking a logarithm of a non-positive number. If isolation leaves a negative or zero right-hand side, as in
2^x = −4, there is no solution. An exponential with a positive base is always positive.
Checking the answer
Substituting the decimal value back into the original equation is a quick test, but it only confirms accuracy to the digits you kept. Two habits help:
- Estimate first. For
3^x = 20, you knowxmust lie between 2 and 3. If your final number is 6.1, something went wrong. - Substitute the exact form. In software, compute
3 ** (math.log(20) / math.log(3))and compare it with 20 usingmath.isclose, not==. Floating-point arithmetic makes exact equality unreliable.
Method at a glance
Exact answers and decimals
A complete answer usually gives both forms. The exact form, such as ln(20) / ln(3), carries no rounding error and can be used in later calculations. The decimal, about 2.7268, is easier to interpret. When a problem says "round to three decimal places," compute with the full calculator value and round once at the end.
Putting it to use
Exponential equations with unknown exponents appear whenever you ask "how long until." If an investment grows by A = P · (1.05)^t, then finding when it doubles means solving (1.05)^t = 2. Taking ln gives t = ln(2) / ln(1.05), which is about 14.21 years. The method is identical to the examples above. A later chapter develops these applications in full.
Exercises
Exercise
Solve 7^x = 90. Give the exact answer and a decimal rounded to three places.
Show answer
Take ln of both sides: x · ln(7) = ln(90), so x = ln(90) / ln(7). The decimal value is about 2.312. A quick check: 7^2 = 49 and 7^3 = 343, and 90 lies closer to 49, so an answer slightly above 2 is reasonable.
Exercise
Solve 3 · 2^(x − 1) + 5 = 29.
Show answer
Subtract 5: 3 · 2^(x − 1) = 24. Divide by 3: 2^(x − 1) = 8 = 2^3. Equate exponents: x − 1 = 3, so x = 4. A logarithm is not needed because 8 is a power of 2. Taking ln instead gives (x − 1) · ln(2) = ln(8) = 3 · ln(2), which leads to the same result.
Exercise
Solve 4^x = 3^(x + 2). Give the exact answer.
Show answer
Take ln of both sides: x · ln(4) = (x + 2) · ln(3). Expand: x · ln(4) = x · ln(3) + 2 · ln(3). Collect: x · (ln(4) − ln(3)) = 2 · ln(3). So x = 2 · ln(3) / (ln(4) − ln(3)), which equals 2 · ln(3) / ln(4/3) and is about 7.638.
Exercise
Explain why 5^x = −10 has no real solution, and what you should do before taking logarithms in general.
Show answer
For any real x, 5^x is positive, so it cannot equal −10. The logarithm ln(−10) is undefined over the reals, which is the same fact seen from the other side. Before taking a logarithm, isolate the exponential and confirm that the other side is positive.