Sub topic 8
The product law: logs turn products into sums
Prerequisites and scope
This chapter assumes you can do the following:
- Use the laws of exponents, especially b^m · b^n = b^(m+n).
- Convert between exponential form (b^y = x) and logarithmic form (log_b(x) = y).
- State that log_b(x) is defined only for x > 0, with b > 0 and b ≠ 1.
The chapter states the product law, derives it, and uses it to expand and combine expressions. It then covers its limits: the domain conditions, the case of negative factors, and the errors that follow from misreading it. The quotient and power laws have their own chapters, so they appear here only in passing.
The statement
For a base b with b > 0 and b ≠ 1, and for all x > 0 and y > 0:
logb(xy) = logb(x) + log_b(y)
The logarithm of a product equals the sum of the logarithms of the factors. The base must be the same on all three logarithms.
A quick check with powers of 2, where every logarithm is a whole number:
import math
x, y = 8.0, 32.0
lhs = math.log2(x * y)
rhs = math.log2(x) + math.log2(y)
print(lhs, rhs) # 8.0 8.0, because 8 * 32 = 256 = 2**8 and 3 + 5 = 8Here 8 = 2^3 and 32 = 2^5. Multiplying them gives 2^(3+5) = 2^8 = 256. The multiplication of the numbers turned into an addition of the exponents.
Derivation from the exponent law
The product law is the exponent law b^m · b^n = b^(m+n) written in logarithmic form. The derivation has four steps.
- Let m = logb(x) and n = logb(y). By the definition of a logarithm, b^m = x and b^n = y.
- Multiply: xy = b^m · b^n.
- Apply the exponent law: xy = b^(m+n).
- Rewrite in logarithmic form: logb(xy) = m + n = logb(x) + log_b(y).
Step 1 needs x > 0 and y > 0. A positive base raised to any real power gives a positive number, so m and n exist only when x and y are positive. That is where the domain condition comes from.
Reading the law in both directions
The law can be applied left to right (expanding) or right to left (combining). The two directions are used in different situations.
| Direction | Starting form | Result | Typical use |
|---|---|---|---|
| Expand | log_b(xy) | log_b(x) + log_b(y) | Splitting a hard argument into easy pieces |
| Combine | log_b(x) + log_b(y) | log_b(xy) | Reducing an equation to a single logarithm |
Expanding
Evaluate log10(2000) given log10(2) ≈ 0.3010.
- Factor the argument: 2000 = 2 · 1000.
- Apply the law: log10(2000) = log10(2) + log_10(1000).
- Substitute: log_10(1000) = 3, so the result is 0.3010 + 3 = 3.3010.
The same idea explains why the whole-number part of a common logarithm tracks the number of digits, while the decimal part depends only on the digits themselves.
Combining
Write log3(6) + log3(9/2) as a single logarithm and simplify.
- Apply the law right to left: log3(6 · 9/2) = log3(27).
- Since 27 = 3^3, the value is 3.
Extending to more than two factors
The law extends to any number of positive factors by applying it repeatedly:
logb(x₁x₂…xk) = logb(x₁) + logb(x₂) + … + logb(xk)
For example, log2(3 · 5 · 7) = log2(3) + log2(5) + log2(7). Each application peels one factor off the front.
Working with variable expressions
When the arguments contain variables, you must track the domain. Consider:
log2(x) + log2(x − 3)
Combining gives log2(x(x − 3)). The original expression is defined only when x > 0 and x − 3 > 0, which means x > 3. The combined form log2(x(x − 3)) is defined whenever x(x − 3) > 0, which is true for x > 3 and also for x < 0. So the two forms agree only for x > 3. Whenever you combine, state the domain of the original expression and keep it.
Expanding with constants
Expand log_5(25x²) for x > 0.
- Split the product: log5(25) + log5(x²).
- Evaluate log_5(25) = 2.
- The result is 2 + log5(x²). The power law (covered in its own chapter) would further turn log5(x²) into 2·log_5(x).
When a factor is negative
The law requires x > 0 and y > 0. If both factors are negative, the product is positive and the left side is defined, but the right side is not. For example, (−4)(−9) = 36, so log10(36) exists. But log10(−4) and log_10(−9) do not exist over the real numbers, so the right side has no meaning.
A common way to handle this is to use absolute values when the sign is unknown:
logb(|xy|) = logb(|x|) + log_b(|y|), for x ≠ 0 and y ≠ 0
This version holds for any nonzero real x and y, because |x| and |y| are positive. It appears often when a variable factor may be negative, such as log(x²) = 2·log|x|.
What the law does not say
The law concerns the logarithm of a product. It says nothing about a sum or a product of logarithms. These are the usual errors.
| Incorrect statement | Why it fails | Correct fact |
|---|---|---|
| log(a + b) = log(a) + log(b) | The law needs a product inside the log | log(ab) = log(a) + log(b) |
| log(a) · log(b) = log(ab) | A product of logs is not a log of a product | log(a) + log(b) = log(ab) |
| log_2(x) + log_3(y) = log(xy) | The bases differ | Convert to a common base first |
| log(x) + log(y) = log(x) · log(y) | No such identity exists | None; keep the sum |
A numeric check shows the first error. With a = 3 and b = 5, log10(3 + 5) = log10(8) ≈ 0.903, while log10(3) + log10(5) = log_10(15) ≈ 1.176.
import math
a, b = 3.0, 5.0
print(math.isclose(math.log10(a + b), math.log10(a) + math.log10(b))) # False
print(math.isclose(math.log10(a * b), math.log10(a) + math.log10(b))) # TrueThe second line confirms that the sum of the logarithms equals the logarithm of the product, 15.
Floating-point behavior
In code, the identity holds mathematically but computed values may differ in the last digits. Compare with math.isclose instead of ==.
import math
x, y = 0.1, 0.3
lhs = math.log10(x * y)
rhs = math.log10(x) + math.log10(y)
print(lhs == rhs) # may be False because of rounding
print(math.isclose(lhs, rhs)) # TrueA second practical point concerns overflow and underflow. Multiplying many small probabilities can underflow to 0.0, but summing their logarithms stays in a safe range:
import math
probabilities = [1e-200, 1e-200, 1e-200]
direct = 1.0
for p in probabilities:
direct *= p
print(direct) # 0.0, the product underflows
log_total = sum(math.log10(p) for p in probabilities)
print(log_total) # -600.0 (approximately), the sum is fineThe true product is 10^(−600). It is too small for a 64-bit float, but its base-10 logarithm is an ordinary number. This is the same property that made logarithm tables useful for hand calculation, and it is why many probability and machine-learning programs store log-probabilities.
The product law as a tool for equations
A logarithmic equation often contains several logarithms with the same base. The product law merges them so the equation can be rewritten in exponential form.
Solve log2(x) + log2(x − 2) = 3.
- Combine: log_2(x(x − 2)) = 3.
- Convert to exponential form: x(x − 2) = 2^3 = 8.
- Expand: x² − 2x − 8 = 0, which factors as (x − 4)(x + 2) = 0.
- Candidates are x = 4 and x = −2.
- Check the domain of the original equation: x > 0 and x − 2 > 0, so x > 2. The value x = −2 is rejected.
- Verify x = 4: log2(4) + log2(2) = 2 + 1 = 3. ✓
The only solution is x = 4. The rejected value −2 is an extraneous solution: it solves the combined equation but not the original. The combined form has a larger domain than the original, which is the same mismatch described earlier.
Summary of rules of use
- Use the law only when the argument is a product of positive factors, and the bases match.
- When combining logarithms of expressions with variables, record the original domain first.
- Use absolute values when a factor may be negative.
- Compare floating-point results with a tolerance.
Exercise
Solve log3(x) + log3(x + 6) = 3. State the domain, show the algebra, and say which candidate (if any) is rejected.
Show answer
The original expression requires x > 0 and x + 6 > 0, so the domain is x > 0. Combine: log3(x(x + 6)) = 3, so x(x + 6) = 3^3 = 27. This gives x² + 6x − 27 = 0, which factors as (x + 9)(x − 3) = 0. The candidates are x = −9 and x = 3. The value x = −9 is outside the domain and is rejected. Check x = 3: log3(3) + log_3(9) = 1 + 2 = 3. The solution is x = 3.
Exercise
Explain why log10((−5)(−20)) = 2 is a true statement, but log10(−5) + log_10(−20) = 2 is not a valid way to compute it.
Show answer
The product (−5)(−20) = 100 is positive, so log10(100) = 2 is defined and true. The product law needs both factors to be positive, and log10(−5) and log10(−20) are undefined over the real numbers, so the right-hand sum has no meaning. To split the product legitimately, use absolute values: log10(5) + log10(20) = log10(100) = 2.