Sub topic 3
Laws of Logarithms
This chapter assumes you can apply the laws of indices, simplify surds, solve quadratic equations, and read basic Python. The logarithm of a positive number $a$ to base $b$, written $\logb a$, is the exponent you raise $b$ to in order to get $a$. So $\logb a = c$ means $b^c = a$.
Product, quotient, and power laws
For positive $x$ and $y$ with a valid base $b$:
- $\logb(xy) = \logb x + \log_b y$
- $\logb(x/y) = \logb x - \log_b y$
- $\logb(x^n) = n\logb x$
The code below checks all three laws for one pair of values.
import math
x, y = 12.0, 5.0
assert math.isclose(math.log10(x * y), math.log10(x) + math.log10(y))
assert math.isclose(math.log10(x / y), math.log10(x) - math.log10(y))
assert math.isclose(math.log10(x ** 3), 3 * math.log10(x))
print("product, quotient, and power laws hold")Change of base and chain identities
The change of base formula is $\logb a = \dfrac{\logc a}{\logc b}$ for any valid base $c$. Two results follow directly. The reciprocal identity is $\logb a \cdot \loga b = 1$. The chain identity is $\log2 3 \cdot \log3 4 = \log2 4 = 2$.
import math
assert math.isclose(math.log(7, 5), math.log(7) / math.log(5))
assert math.isclose(math.log(3, 2) * math.log(4, 3), 2.0)
print("change of base and chain identity hold")Solving logarithmic equations and checking the domain
Combine the logs into one, convert to an ordinary equation, then check every root against the domain. Every log argument must be positive.
Solve $\log2 x + \log2(x-2) = 3$. Combining gives $x(x-2) = 8$, so $x^2 - 2x - 8 = 0$, which factors as $(x-4)(x+2) = 0$. The root $x = -2$ fails because $x$ must exceed 2.
Inequalities with logarithms and exponentials
When the base is greater than 1, the inequality direction stays the same. So $\log2 x > 3$ gives $x > 8$. When the base lies between 0 and 1, the direction flips. So $\log{0.5} x > 3$ gives $0 < x < 1/8$. For exponentials, $2^x > 16$ gives $x > 4$ because $16 = 2^4$.
Estimating logs and counting digits
The number of digits of a positive integer $N$ equals $\lfloor \log{10} N \rfloor + 1$. For $2^{100}$, this gives $\lfloor 100 \log{10} 2 \rfloor + 1 = 31$ digits.
import math
digits_by_log = math.floor(100 * math.log10(2)) + 1
assert digits_by_log == len(str(2 ** 100))
print(digits_by_log) # 31CAT problem patterns and quick checks
Combine logs with the product and power laws first. Convert to exponential form when a log equation appears. Always check the domain before accepting a root. For large powers, use $\log_{10}$ to estimate size rather than computing the number.
Exercise
Solve $\log2(x) + \log2(x-2) = 3$ and state whether each candidate root is valid.
Show answer
Combining gives $x(x-2) = 8$, so $(x-4)(x+2) = 0$. The root $x = 4$ is valid. The root $x = -2$ is rejected because $\log_2(-2)$ is undefined.