Logarithms¶
Algebra · level 8, lesson 4 of 8
A question to start¶
How many digits does \(2^{100}\) have?
You could multiply 2 by itself a hundred times and count. Or you could notice that a number has 31 digits exactly when it lies between \(10^{30}\) and \(10^{31}\). So the real question is: what power of 10 is \(2^{100}\)? If we knew the power of 10 that makes 2, we would be almost done. That power is called the logarithm of 2, and it is about 0.30103. So \(2^{100} = \left(10^{0.30103}\right)^{100} = 10^{30.103}\), which is between \(10^{30}\) and \(10^{31}\): 31 digits. This lesson explains what logarithms are, why they work, and why they turn hard multiplying into easy adding.
The idea¶
A logarithm is an exponent¶
Read \(\log_b x\) as "the logarithm of \(x\) to base \(b\)", and think of it as the exponent you put on \(b\) to get \(x\).
- \(\log_2 8 = 3\), because \(2^3 = 8\).
- \(\log_{10} 1000 = 3\), because \(10^3 = 1000\).
- \(\log_3 \tfrac19 = -2\), because \(3^{-2} = \tfrac19\).
- \(\log_5 \sqrt5 = \tfrac12\), because \(5^{1/2} = \sqrt5\).
The base \(b\) must be positive and not 1, as for exponential functions. And \(x\) must be positive: \(b^y\) is always positive, so there is no exponent that gives 0 or a negative number. \(\log_2(-4)\) does not exist (in real numbers).
Two bases have their own names:
- base 10, the common logarithm, written just \(\log x\);
- base \(e \approx 2.71828\), the natural logarithm, written \(\ln x\). The number \(e\) comes from growth that happens continuously; why it is "natural" is a calculus story (see the links below).
Logarithms undo exponentials¶
The function \(f(x) = b^x\) is one-to-one, so it has an inverse function (level 7, lesson 6). Swap \(x\) and \(y\) in \(y = b^x\): \(x = b^y\), which means \(y = \log_b x\). So
That gives two "undo" rules:
The graph¶
The graph of \(y = \log x\) is the reflection of \(y = 10^x\) in the line \(y = x\):
Swap the coordinates of the features of \(10^x\):
| \(y = 10^x\) | \(y = \log x\) |
|---|---|
| passes through \((0, 1)\) and \((1, 10)\) | passes through \((1, 0)\) and \((10, 1)\) |
| horizontal asymptote \(y = 0\) | vertical asymptote \(x = 0\) |
| domain all reals, range \(y > 0\) | domain \(x > 0\), range all reals |
The log graph rises forever but very slowly: to go up 1, \(x\) must be multiplied by 10. \(\log x = 6\) needs \(x = 1\,000\,000\).
The laws of logarithms, and why they are true¶
Because a logarithm is an exponent, each exponent law gives a logarithm law. For \(M, N > 0\):
Proof of the product law. Let \(u = \log_b M\) and \(v = \log_b N\). That means \(M = b^u\) and \(N = b^v\). Then
by the exponent law for products. So the exponent that gives \(MN\) is \(u + v\): \(\log_b(MN) = u + v = \log_b M + \log_b N\). ∎
Proof of the quotient law. Same start: \(\dfrac{M}{N} = \dfrac{b^u}{b^v} = b^{u - v}\), so \(\log_b\dfrac{M}{N} = u - v\). ∎
Proof of the power law. \(M^k = \left(b^u\right)^k = b^{uk}\), so \(\log_b\left(M^k\right) = ku = k\log_b M\). ∎
Also: \(\log_b 1 = 0\) (since \(b^0 = 1\)) and \(\log_b b = 1\) (since \(b^1 = b\)).
The product law is why logarithms were invented. John Napier published the first tables of logarithms in 1614. To multiply two long numbers, a scientist looked up their logarithms, added them, and looked up the number with that logarithm. Adding is far quicker and safer than multiplying by hand. The slide rule, used by engineers until calculators arrived in the 1970s, is two logarithmic rulers sliding along each other, adding lengths.
Change of base¶
Calculators have \(\log\) and \(\ln\) buttons, but no \(\log_3\). To find \(\log_3 50\), let \(y = \log_3 50\), so \(3^y = 50\). Take \(\log\) of both sides and use the power law: \(y\log 3 = \log 50\). So
Counting digits¶
A whole number \(N\) has \(d\) digits exactly when \(10^{d - 1} \le N < 10^d\), that is when \(d - 1 \le \log N < d\). So the number of digits is the whole-number part of \(\log N\), plus 1.
Worked examples¶
1. Evaluating.
- \(\log_2 32 = 5\) (since \(2^5 = 32\)). \(\log 0.001 = -3\) (since \(10^{-3} = 0.001\)).
- \(\log_4 8\): write both as powers of 2. \(4^y = 8\) means \(2^{2y} = 2^3\), so \(y = \tfrac32\).
2. Expanding. Write \(\log_2\dfrac{8x^3}{y}\) using \(\log_2 x\) and \(\log_2 y\).
- Quotient law: \(\log_2(8x^3) - \log_2 y\). Product law: \(\log_2 8 + \log_2 x^3 - \log_2 y\).
- Power law, and \(\log_2 8 = 3\): \(3 + 3\log_2 x - \log_2 y\).
3. Condensing. Evaluate \(2\log 5 + \log 4\).
- \(2\log 5 = \log 25\). Then \(\log 25 + \log 4 = \log 100 = 2\).
4. Change of base. \(\log_3 50 = \dfrac{\log 50}{\log 3} \approx \dfrac{1.69897}{0.47712} \approx 3.561\). Check: \(3^3 = 27\) and \(3^4 = 81\), so the answer between 3 and 4 makes sense.
5. Digits. \(\log\left(3^{200}\right) = 200\log 3 \approx 200 \times 0.477121 = 95.42\). So \(3^{200}\) has \(95 + 1 = 96\) digits.
6. A transformed log graph. Sketch \(y = \log_2(x - 1) + 3\).
- \(\log_2 x\) moved right 1 and up 3. Vertical asymptote \(x = 1\); domain \(x > 1\).
- Points of \(\log_2 x\): \((1, 0), (2, 1), (4, 2)\) move to \((2, 3), (3, 4), (5, 5)\).
Try it¶
- Evaluate (a) \(\log_7 49\) (b) \(\log_2\tfrac{1}{16}\) (c) \(\log_9 3\) (d) \(\log_{1/2} 8\)
- Rewrite \(\log_5 125 = 3\) in exponential form, and \(10^{-2} = 0.01\) in logarithmic form.
- Evaluate \(\log_6 4 + \log_6 9\).
- Evaluate \(\log_3 54 - \log_3 2\).
- Expand \(\ln\dfrac{x^2\sqrt{y}}{z^3}\).
- Find \(\log_2 10\) to 4 decimal places.
- How many digits does \(7^{50}\) have? (\(\log 7 \approx 0.845098\).)
- Prove that \(\log_a b \cdot \log_b a = 1\) for positive \(a, b \ne 1\).
Answers
- (a) 2, since \(7^2 = 49\). (b) \(-4\), since \(2^{-4} = \tfrac{1}{16}\). (c) \(\tfrac12\), since \(9^{1/2} = 3\). (d) \(-3\), since \(\left(\tfrac12\right)^{-3} = 2^3 = 8\).
- \(5^3 = 125\). \(\log 0.01 = -2\) (that is, \(\log_{10} 0.01 = -2\)).
- \(\log_6(4 \times 9) = \log_6 36 = 2\).
- \(\log_3\tfrac{54}{2} = \log_3 27 = 3\).
- \(\ln x^2 + \ln y^{1/2} - \ln z^3 = 2\ln x + \tfrac12\ln y - 3\ln z\).
- \(\dfrac{\log 10}{\log 2} = \dfrac{1}{0.30103} \approx 3.3219\). Check: \(2^3 = 8\) and \(2^4 = 16\).
- \(50 \times 0.845098 \approx 42.25\), so \(7^{50}\) has \(42 + 1 = 43\) digits.
- By change of base, \(\log_a b = \dfrac{\log b}{\log a}\) and \(\log_b a = \dfrac{\log a}{\log b}\). Their product is \(\dfrac{\log b}{\log a} \cdot \dfrac{\log a}{\log b} = 1\). (Neither log is 0, because \(a, b \ne 1\).)
Common mistake¶
Inventing a law for sums. \(\log(M + N)\) is not \(\log M + \log N\). The law is for a product. Test: \(\log(10 + 10) = \log 20 \approx 1.301\), but \(\log 10 + \log 10 = 2\).
Treating \(\log\) like a number that multiplies. \(\dfrac{\log 8}{\log 2}\) is \(3\) (it is \(\log_2 8\)), but it is not \(\log 4\), and you cannot cancel the logs. Likewise \(\log 2x\) means \(\log(2x)\), not \((\log 2)x\).
Where it leads¶
- Back: Rational functions · Next: Exponential and logarithmic equations, where logs solve \(3^x = 20\).
- Level 8 page · Algebra topic page
- The exponent laws behind every log law: Exponential functions; inverses and reflections in \(y = x\): Inverse functions.
- Logarithmic scales in science, and the numbers \(e\) and \(\ln\): Ratio, Change.
- At university, \(\ln x\) is defined with an integral and \(e^x\) as its inverse: MAT137 Unit 4 (transcendental functions) and MAT158 Unit 11 (transcendental functions).