Precalculus · Chapter 3

Chapter 3
Growth: exponentials and logarithms

Lectures 12–14  |  things that grow in proportion to themselves

In this chapter
  1. Exponential growth and decay
  2. Logarithms: turning hard operations into easy ones
  3. Laws of logarithms and the log scale

Chapter 2 was about functions that bend. This chapter is about one particular kind of bending, the kind that arises whenever a quantity grows in proportion to how much of it there already is. Money earning interest, a rumour spreading, a population, a signal decaying in a wire — all of these obey the same rule, and it is not the rule you get from adding a fixed amount each step.


Lecture 12 — Exponential growth and decay

Cartoon: a fixed daily payment against a doubling pennyOne stick figure boasts about five hundred dollars while the other stands beside a curve that is about to rise off the top of the frame. Day 5. I have $500.You have 16 cents.Day 20.
the penny wins, and then keeps winning

Adding versus multiplying

Take two savings schemes. The first adds \(\$100\) every day. The second starts with a single penny and doubles it every day. For seventeen days the first looks obviously better, and anyone watching would say so. Then it stops being better, permanently, and by a margin that keeps widening forever.

A penny doubling daily against a hundred dollars a day Two curves over twenty days. The straight line rises steadily to two thousand dollars. The doubling curve stays near zero for two weeks, crosses the line at about day seventeen, and reaches ten thousand dollars by day twenty. 500010000 05101520 daysdollars $100 a day a doubling penny they cross here, day 17
Adding \(\$100\) daily is a line: the same increase every day. Doubling a penny is an exponential: the increase on day \(n\) is as large as everything accumulated before it. The line is ahead for seventeen days and then irrelevant forever, which is the single most important fact about exponential growth.
definition

Let \(a>0\) and \(a\neq1\). The exponential function with base \(a\) is $$f(x)=a^{x}.$$ Its domain is all of \(\mathbb{R}\), its range is \((0,\infty)\), and the \(x\)-axis is a horizontal asymptote. It grows if \(a>1\) and decays if \(0<a<1\), and \(f(0)=1\) whatever \(a\) is.

spot check
Which of these quantities is growing exponentially?

The defining property is not the formula but the behaviour: equal steps in the input multiply the output by the same factor. A linear function adds a fixed amount per step; an exponential multiplies by a fixed amount per step. Everything else follows.

The graphs of two to the x, e to the x, and one half to the x Three curves through the point zero comma one. Two of them rise to the right at different rates, and the third falls, being the mirror image of one of the rising curves. (0, 1) 2ₛ eₛ (1/2)ₛ 1357
Every exponential passes through \((0,1)\), hugs the \(x\)-axis on one side, and climbs without bound on the other. Note that \((1/2)^{x}=2^{-x}\), so decay is growth read backwards — a reflection, in the sense of Lecture 4.
example 3.1 — which model fits?

Two accounts of the same outbreak are offered. In the first, the number of cases rises by 40 each day. In the second, it rises by 12% each day. Both start at 200 cases. Complete the table for days 0, 5, 10 and 30, and say which description you would want to be true.

dayadding 40multiplying by 1.12
0200200
5400352
10600621
3014005990

The linear model is the worse news for a week and a half and the better news forever after. By day 30 they differ by a factor of four; by day 60 the exponential is over 180,000 and the linear is 2,600.

The general forms are \(L(t)=200+40t\) and \(E(t)=200(1.12)^{t}\). A useful habit: when you see a percentage per unit time, you are looking at an exponential, and the base is \(1+r\), never \(r\).

example 3.2 — reading the base off two data points

A social post has 400 views after 2 hours and 2,500 views after 6 hours. Assuming exponential growth, find the hourly growth factor and predict the views at 10 hours.

Write \(V(t)=V_0a^{t}\). Dividing one equation by the other kills the unknown \(V_0\): $$\frac{V(6)}{V(2)}=\frac{V_0a^{6}}{V_0a^{2}}=a^{4}=\frac{2500}{400}=6.25.$$ So \(a=6.25^{1/4}\approx1.58\): about 58% growth per hour. Then \(V_0=400/a^{2}=400/2.5=160\).

At 10 hours, \(V(10)=160(1.58)^{10}\approx 15{,}600\). Equivalently, and more cheaply: 10 hours is another four-hour gap past 6 hours, so multiply 2,500 by 6.25 again.

That second route is worth noticing. For an exponential, what matters is the gap between two times, never where the times sit. Every four-hour window multiplies the count by 6.25, whether it starts at breakfast or midnight.

Compound interest, and a number nobody chose

Invest \(P\) dollars at an annual rate \(r\), compounded \(n\) times per year. Each compounding period multiplies the balance by \(1+r/n\), and there are \(nt\) of them in \(t\) years:

compound interest $$A(t)=P\left(1+\frac{r}{n}\right)^{nt}.$$
spot check

\(\$1000\) at 6% a year, compounded monthly, for one year. What is the balance, to the nearest cent?

decimals, fractions, pi and sqrt( ) are all fine

Now ask a greedy question. More frequent compounding is better, so what if we compound every second? Every microsecond? Continuously? Put \(P=1\), \(r=1\), \(t=1\) and watch what \((1+1/n)^{n}\) does as \(n\) grows.

Compounding faster and faster

One dollar, 100% interest, one year, compounded \(n\) times. Drag \(n\) upward and watch the balance climb — and then refuse to climb any further.

e = 2.71828\u2026 $2.00$2.72

idea

The balance does not run away. It creeps up to \(2.718281828\dots\) and stops, and no amount of extra compounding gets you another cent. That ceiling is the number \(e\), and notice how it arrived: not as a definition somebody wrote down, but as the answer to a question about limits — what happens as the steps get infinitely fine?

This is the first time in the course that an infinite process has produced a specific finite number, and it will not be the last. It is exactly the move calculus is built on. Every derivative you ever compute will be a limit of difference quotients like the ones in Lecture 8, and \(e\) is the first genuine limit you have met. Precalculus builds the sequence; calculus names the destination.

With continuous compounding the formula becomes \(A(t)=Pe^{rt}\), and the function \(e^{x}\) becomes the standard exponential: every other base can be written in terms of it, and we will see in Lecture 13 exactly how.

example 3.3 — the same rate, four ways

\(\$5{,}000\) is invested at 6% for 10 years. Find the balance under annual, monthly, daily and continuous compounding.

compoundingcomputationbalance
annual\(5000(1.06)^{10}\)\$8,954.24
monthly\(5000(1+0.06/12)^{120}\)\$9,096.98
daily\(5000(1+0.06/365)^{3650}\)\$9,110.14
continuous\(5000e^{0.6}\)\$9,110.59

Annual to monthly is worth \$143. Monthly to daily is worth \$13. Daily to continuous is worth 45 cents. The gains die off fast, which is the same fact the widget above shows: after the first few refinements, the limit is already close.

history

Jacob Bernoulli asked this exact question in 1683 — what does continuous compounding pay? — and proved the answer was between 2 and 3, without being able to say what it was. The number had no name and no notation for fifty years, until Euler called it \(e\) in the 1720s and computed it to eighteen decimal places.

Which is a strange order of events. The most important constant in analysis entered mathematics through a question about bank interest, and it took half a century for anyone to realise it was not really about banks at all.

Decay, half-life, and doubling time

When \(0<a<1\) the same formula runs downhill. The natural way to describe such a process is not by its rate but by its half-life: the time it takes for half of whatever is present to disappear. If the half-life is \(h\), then

spot check

A dose of 80 mg has a half-life of 6 hours. How much remains after 18 hours?

decimals, fractions, pi and sqrt( ) are all fine

$$N(t)=N_0\left(\tfrac12\right)^{t/h}.$$
Exponential decay with a five-hour half-life A curve falling from 200 milligrams to about 12 milligrams over 24 hours, halving every five hours. 10050150200 05101524 hoursmg halfa quarter
A 200 mg dose of caffeine with a five-hour half-life. Each five hours removes half of what is left, never half of the original — which is why the curve flattens rather than hitting zero. A late-afternoon coffee still has a quarter of itself in you at midnight.
example 3.4 — doubling time without logarithms

An investment grows 8% a year. Roughly how long until it doubles? Estimate it before computing, using the fact that \(1.08^{9}\approx 2\).

We need \(1.08^{t}=2\). Trying values: \(1.08^{8}=1.851\), \(1.08^{9}=1.999\). So the doubling time is essentially 9 years.

There is a shortcut worth carrying around, known to every banker as the rule of 70: the doubling time is about \(70/(\text{percent rate})\). Here \(70/8=8.75\) years, which is within 3% of the truth. It works because of a logarithm fact we will prove in Lecture 13, and it works for any growth at all — inflation, population, followers, bacteria.

Notice what we could not do: solve \(1.08^{t}=2\) exactly. The unknown is stuck in the exponent, and nothing in Chapter 0 can get it out. That is precisely the hole the next lecture fills.

idea — where this is heading

Here is a fact you can check right now with the difference quotient from Lecture 8. Take \(f(x)=e^{x}\) at \(x=0\) and compute the average rate of change over a tiny interval: $$\frac{e^{0.001}-e^{0}}{0.001}=1.0005\ldots$$ Try \(h=0.0001\) and you get \(1.00005\). The rate of change of \(e^{x}\) at \(0\) appears to be exactly 1. Try it at \(x=2\) and you will get \(7.389\ldots\), which is \(e^{2}\) itself.

So \(e^{x}\) is a function whose rate of change, at every point, equals its own value. It is the mathematical statement of "grows in proportion to how much there is", and it is the reason \(e\) rather than 2 or 10 is the natural base. You cannot prove this yet. You can verify it numerically in two minutes, and that is worth doing, because when calculus hands you \(\frac{d}{dx}e^{x}=e^{x}\) in your first week, it should feel like a confirmation rather than a revelation.

for your toolbox
functiondomainrangefeatures
\(y=a^{x}\), \(a>1\)all reals\((0,\infty)\)through \((0,1)\); horizontal asymptote \(y=0\) on the left
\(y=a^{x}\), \(0<a<1\)all reals\((0,\infty)\)the same graph reflected; asymptote \(y=0\) on the right

The asymptote moves with a vertical shift: \(y=2^{x}-3\) has asymptote \(y=-3\), and its range is \((-3,\infty)\). Mark that line on every exponential sketch you draw — a graph that appears to touch the axis is the commonest error in this chapter.

spot check
What is the horizontal asymptote of \(y=2^{x}+3\)?
exercises 3.1
  1. Sketch \(y=3^{x}\), \(y=3^{-x}\) and \(y=3^{x}-2\) on one set of axes, and give the asymptote and range of each.
  2. A culture starts with 500 cells and triples every 4 hours. Write \(N(t)\), and find the population after 10 hours.
  3. A car worth \$28,000 loses 15% of its value each year. Write \(V(t)\) and find when it is first worth less than \$10,000, by trial.
  4. \(\$2{,}000\) is invested at 4.5%. Find the balance after 7 years under quarterly and under continuous compounding, and state the difference.
  5. A medicine has a 9-hour half-life. What fraction remains after 24 hours? After how many hours is less than 5% left?
  6. Two quantities start equal. One grows by 3 units per day, the other by 3% per day. On what day does the second overtake the first if both start at 100? (Trial and error is expected.)
  7. Use a calculator to evaluate \(\left(1+\frac1n\right)^{n}\) for \(n=10,100,1000,10^{6}\). What are these numbers approaching, and how many correct digits does each give?
  8. Show that for any exponential \(f(x)=a^{x}\), the ratio \(f(x+c)/f(x)\) does not depend on \(x\). Explain what this says in words, and why no polynomial has this property.
  1. All three have asymptote \(y=0\) except the last, whose asymptote is \(y=-2\). Ranges: \((0,\infty)\), \((0,\infty)\), \((-2,\infty)\). The second is the first reflected across the \(y\)-axis.
Three exponential graphs and their asymptotesThree curves through or near the point zero comma one. y equals three to the x rises steeply to the right and flattens toward the horizontal axis on the left. y equals three to the minus x is its mirror image. y equals three to the x minus two is the first curve slid down two units, so its asymptote is the line y equals minus two. y = 3ˣy = 3⁻ˣy = 3ˣ − 2asymptote y = 0asymptote y = −2−2−1122468−2
A vertical shift drags the asymptote with it. The first two flatten toward \(y=0\); the third flattens toward \(y=-2\), which is why its range is \((-2,\infty)\) rather than \((0,\infty)\). Draw the asymptote before you draw the curve.
  1. \(N(t)=500\cdot3^{t/4}\); at \(t=10\), \(N=500\cdot3^{2.5}\approx 7{,}794\) cells.
  2. \(V(t)=28000(0.85)^{t}\). \(V(6)=10{,}553\) and \(V(7)=8{,}970\), so during year 7.
  3. Quarterly: \(2000(1+0.045/4)^{28}=\$2{,}736.10\). Continuous: \(2000e^{0.315}=\$2{,}740.26\). About \$4 apart over seven years.
  4. \(0.5^{24/9}=0.158\), so about 15.8% remains. For under 5%: \(0.5^{t/9}<0.05\) first happens near \(t=39\) hours (at \(t=39\), 4.9%).
  5. Linear: \(100+3t\). Exponential: \(100(1.03)^{t}\). They tie exactly at \(t=1\) (both 103) and the exponential is ahead from \(t=2\) on (106.09 against 106). The overtake is almost immediate here because 3% of 100 is 3 — the two models start with identical first steps and then the exponential compounds. By \(t=50\) it is 438 against 250.
  6. \(2.5937,\ 2.7048,\ 2.7169,\ 2.718280\). They approach \(e=2.718281\ldots\), gaining roughly one correct digit each time \(n\) is multiplied by ten — slow convergence, and a bad way to compute \(e\) in practice.
  7. \(\dfrac{a^{x+c}}{a^{x}}=a^{c}\), independent of \(x\). In words: the growth over any window of length \(c\) is the same factor wherever the window sits. A polynomial cannot do this — for \(f(x)=x^{2}\), the ratio \((x+1)^2/x^2\) is 4 at \(x=1\) and 1.02 at \(x=10\). Polynomials grow by a shrinking proportion; exponentials never slow down.

Lecture 13 — Logarithms: turning hard operations into easy ones

Cartoon: a slide rule against a phoneTwo stick figures each hold a device: one a slide rule, one a phone. Mine flew Apollo.
“Mine has a flashlight.”

The last lecture ended stuck. We could write \(1.08^{t}=2\) but not solve it, because the unknown sat in the exponent and no amount of algebra would bring it down. Lecture 5 already told us what to do when a function needs undoing: check whether it is one-to-one, and if so, invert it. Exponentials pass the horizontal line test comfortably. So the inverse exists, and it has a name.

definition

For \(a>0\), \(a\neq1\), the logarithm base \(a\) is the inverse of \(x\mapsto a^{x}\): $$\log_a y = x \iff a^{x}=y.$$ In words: \(\log_a y\) is the exponent you must raise \(a\) to in order to get \(y\). Its domain is \((0,\infty)\) — only positive numbers are outputs of an exponential — and its range is all of \(\mathbb{R}\).

spot check

Evaluate \(\log_{2}64\).

decimals, fractions, pi and sqrt( ) are all fine

Say that sentence out loud a few times. Almost every mistake made with logarithms is made by someone who has not internalised it, and almost every logarithm question can be answered by asking it. What is \(\log_2 32\)? The exponent that turns 2 into 32, which is 5.

An exponential and a logarithm reflected in the line y equals x The curve y equals two to the x rising steeply, the curve y equals log base two of x rising slowly, and the dashed mirror line y equals x between them. (1, 2)(2, 1) y = 2ₛ y = log₂x y = x
The two dashed lines are the asymptotes: \(y=0\) for the exponential, \(x=0\) for the logarithm — and the reflection swaps them, as it swaps everything else. Two views of one relationship. The exponential climbs vertically and its asymptote is horizontal; the logarithm climbs horizontally and its asymptote is vertical. Swap the axes and each becomes the other, exactly as Lecture 5 said an inverse must.

Two bases are used so often they get their own notation: \(\log x\) means \(\log_{10}x\), and \(\ln x\) means \(\log_e x\), the natural logarithm. And because they are inverses, the two cancellation rules hold for every base:

spot check
What is \(\log_{3}(-9)\)?
$$\log_a(a^{x})=x \qquad\text{and}\qquad a^{\log_a x}=x.$$
example 3.5 — reading the definition off

Evaluate without a calculator: \(\log_3 81\), \(\log_5 \frac{1}{25}\), \(\log_{16}2\), \(\ln e^{7}\), \(\log_7 1\).

\(\log_3 81=4\), since \(3^4=81\).

\(\log_5\frac1{25}=-2\), since \(5^{-2}=\frac1{25}\). Logarithms of numbers below 1 are negative.

\(\log_{16}2=\frac14\), since \(16^{1/4}=2\). Fractional answers are perfectly normal.

\(\ln e^{7}=7\), straight from the cancellation rule.

\(\log_7 1=0\), and in fact \(\log_a 1=0\) for every base, since \(a^{0}=1\) always.

Two things have no answer at all: \(\log_a 0\) and \(\log_a(\text{negative})\). No exponent turns a positive base into zero or into a negative number. That is not a rule to memorise; it is the range of the exponential, seen from the other side.

example 3.6 — finally solving for the exponent

Solve \(1.08^{t}=2\), and then \(3\cdot 2^{x}+1=100\).

Take a logarithm of both sides — any base, as long as it is the same one on both sides: $$t=\log_{1.08}2 = \frac{\ln 2}{\ln 1.08}=\frac{0.6931}{0.07696}=9.006\ \text{years},$$ confirming the estimate from Lecture 12 exactly.

For the second, peel the outside first, as always: \(2^{x}=33\), so \(x=\log_2 33=\dfrac{\ln 33}{\ln 2}=5.044\).

The middle step used the change of base formula, $$\log_a y=\frac{\ln y}{\ln a},$$ which exists because your calculator has only two logarithm buttons and there are infinitely many bases. It also says something structural: all logarithms are the same function up to a constant multiple. The base is a choice of units, not a change of shape.

example 3.7 — why the rule of 70 works

Show that the doubling time at growth rate \(r\) (as a decimal) is \(\ln 2/\ln(1+r)\), and explain why \(70/(100r)\) is a good approximation for small \(r\).

Doubling means \((1+r)^{t}=2\), so \(t=\dfrac{\ln2}{\ln(1+r)}\).

Now, \(\ln 2=0.693\), and for small \(r\) it turns out that \(\ln(1+r)\approx r\) — at \(r=0.08\), \(\ln(1.08)=0.0770\), within 4%. So $$t\approx\frac{0.693}{r}=\frac{69.3}{100r},$$ and 70 is used because it is friendlier to divide by. At 8%: \(70/8=8.75\) years against the true 9.01.

Hold on to \(\ln(1+r)\approx r\). It is not a coincidence and not a numerical accident: it is the first-degree polynomial approximation to \(\ln(1+x)\) at \(x=0\), exactly the kind of object Lecture 11 built. The next term is \(-x^{2}/2\), and including it gives \(\ln(1.08)\approx 0.08-0.0032=0.0768\) — now within 0.3%. Approximation is not guesswork; it comes with a way to do better.

history

John Napier spent twenty years, from roughly 1594 to 1614, computing tables by hand so that astronomers could multiply by adding. The problem was real and enormous: a sixteenth-century astronomer doing planetary positions might multiply eight-digit numbers hundreds of times in one calculation, by hand, with every digit an opportunity for error. Laplace later said logarithms doubled the working life of an astronomer.

The idea reached its physical form in the slide rule, which encoded \(\log\) as distance so that sliding two scales past each other performed multiplication. Engineers used them for three centuries. They designed the Boeing 747 and got Apollo to the Moon with them, and within ten years of Apollo 11 they were gone, killed by the pocket calculator. There is a slide rule in a display case in most engineering departments, and every one of them was somebody's most important tool.

A working slide rule

Drag the lower scale, or focus it and nudge it with the arrow keys. Line its 1 up against a number on the top scale, and read off products under the other marks. You are adding lengths; the scales are logarithmic, so the numbers multiply.

idea

Look at what the slide rule really is. Multiplication is hard; addition is easy. The logarithm is a translation that turns one into the other, you do the easy work in the translated world, and then you translate back. Nothing about the multiplication got simpler — you changed where you were standing.

That manoeuvre is the deepest recurring idea in mathematics, and you have already seen it twice: coordinates translated geometry into algebra in Lecture 2, and Lecture 18 will translate repetition into position on a circle. Later, the Fourier transform will translate a signal into its frequencies because filtering is trivial there, and a change of basis in linear algebra will translate a hard matrix into a diagonal one. Same move every time. Find the world where the problem is easy, and build the bridge.

for your toolbox
functiondomainrangefeatures
\(y=\log_a x\), \(a>1\)\((0,\infty)\)all realsthrough \((1,0)\); vertical asymptote \(x=0\); rises forever, but slowly
\(y=\ln x\)\((0,\infty)\)all realsthe same shape, base \(e\)

The asymptote moves with a horizontal shift: \(y=\ln(x-2)\) has asymptote \(x=2\) and domain \((2,\infty)\). Finding the domain of a logarithm always means solving the inequality "whatever is inside \(>0\)".

spot check
What is the domain of \(y=\ln(x-2)\)?
exercises 3.2
  1. Evaluate without a calculator: \(\log_2 64\), \(\log_9 3\), \(\log_{10}0.001\), \(\ln 1\), \(\log_4 \frac18\).
  2. Rewrite in the other form: (a) \(\log_5 125=3\); (b) \(e^{x}=11\); (c) \(\log_a w=v\).
  3. Find the domain of \(f(x)=\log_3(5-2x)\) and of \(g(x)=\ln(x^{2}-4)\).
  4. Solve for \(x\): (a) \(4^{x}=70\); (b) \(e^{3x-1}=20\); (c) \(5^{2x}=3^{x+1}\).
  5. Sketch \(y=\ln x\), \(y=\ln(x-2)\) and \(y=-\ln x\), marking the asymptote of each.
  6. An account grows at 5.5% compounded continuously. How long until it triples?
  7. Show that \(\log_a b\) and \(\log_b a\) are reciprocals, and check it with \(a=2,b=8\).
  8. A quantity decays with half-life \(h\). Show that it can also be written as \(N_0e^{-kt}\), and find \(k\) in terms of \(h\). Which form would you rather use to answer "how much is left after 3 half-lives", and which for "how much is left after 7 hours"?
  1. \(6\); \(\tfrac12\); \(-3\); \(0\); \(-\tfrac32\) (since \(4^{-3/2}=\tfrac18\)).
  2. (a) \(5^{3}=125\); (b) \(x=\ln 11\); (c) \(a^{v}=w\).
  3. Need \(5-2x>0\), so \(x<\tfrac52\). Need \(x^{2}-4>0\), so \(x<-2\) or \(x>2\) — note that this domain has a hole in the middle.
  4. (a) \(x=\dfrac{\ln70}{\ln4}=3.064\); (b) \(x=\dfrac{1+\ln20}{3}=1.332\); (c) take logs of both sides: \(2x\ln5=(x+1)\ln3\), so \(x(2\ln5-\ln3)=\ln3\) and \(x=0.4587\).
  5. Asymptotes \(x=0\), \(x=2\), \(x=0\). The third is the first flipped upside down, so it falls instead of rising.
  6. \(e^{0.055t}=3\) gives \(t=\dfrac{\ln3}{0.055}=19.98\) years.
  7. If \(\log_a b=x\) then \(a^{x}=b\), so \(b^{1/x}=a\) and \(\log_b a=1/x\). Check: \(\log_2 8=3\) and \(\log_8 2=\tfrac13\).
  8. \(N_0(1/2)^{t/h}=N_0e^{-kt}\) requires \(e^{-k}= (1/2)^{1/h}\), so \(k=\dfrac{\ln 2}{h}\). Half-life form for whole numbers of half-lives (the answer is \(1/8\) instantly); the \(e^{-kt}\) form for awkward times, and it is the form that makes the rate of decay visible, which is why physics uses it.

Lecture 14 — Laws of logarithms and the log scale

Cartoon: underestimating two points on a logarithmic scaleA stick figure stands beside a seismograph trace, describing an earthquake as only two points bigger. It was only 2 pointsbigger.
two points on a log scale is 500 times the energy

Every property of logarithms is a property of exponents, wearing a disguise. Since \(a^{m}a^{n}=a^{m+n}\), and a logarithm is just the exponent, the logarithm of a product must be the sum of the logarithms. That is the whole derivation.

laws of logarithms

For \(A,B>0\) and any base \(a\):

$$\log_a(AB)=\log_a A+\log_a B$$ $$\log_a\!\left(\frac{A}{B}\right)=\log_a A-\log_a B$$ $$\log_a(A^{c})=c\log_a A$$
spot check

\(\log_{2}8+\log_{2}4=\log_{2}(\,?\,)\). What goes in the bracket?

decimals, fractions, pi and sqrt( ) are all fine

what the laws do not say

\(\log(A+B)\) is not \(\log A+\log B\). There is no law for the logarithm of a sum — not because nobody has found it, but because none exists. Sums are what logarithms are bad at; that is the price of being so good at products.

Likewise \(\dfrac{\log A}{\log B}\) is not \(\log\!\left(\dfrac{A}{B}\right)\), and \((\log A)^{2}\) is not \(2\log A\). Check any suspicion with \(A=B=10\) in base 10, where every logarithm is 1 and wrong rules fall apart immediately.

spot check
\(\log(A+B)\) equals…
example 3.8 — expanding and combining

Expand \(\displaystyle \ln\frac{x^{3}\sqrt{y}}{z^{2}}\), then combine \(2\log x+\tfrac13\log y-4\log z\) into a single logarithm.

Expanding, one law at a time: $$\ln\frac{x^{3}y^{1/2}}{z^{2}}=3\ln x+\tfrac12\ln y-2\ln z.$$

Combining runs the same laws backwards. Coefficients become powers first, then products and quotients: $$2\log x+\tfrac13\log y-4\log z=\log\frac{x^{2}\sqrt[3]{y}}{z^{4}}.$$

Expanding turns one complicated logarithm into several simple ones, which is what you want when differentiating next year. Combining turns several into one, which is what you want when solving an equation. Knowing which direction you are heading is most of the skill.

example 3.9 — an answer that must be thrown away

Solve \(\log_2(x)+\log_2(x-2)=3\).

Combine the left side: \(\log_2\big(x(x-2)\big)=3\), so \(x(x-2)=2^{3}=8\), giving \(x^{2}-2x-8=0\) and \((x-4)(x+2)=0\). The candidates are \(x=4\) and \(x=-2\).

Now check them in the original equation. At \(x=-2\), the first term is \(\log_2(-2)\), which does not exist. So \(x=4\) is the only solution.

The extraneous root was created by the combining step: \(\log_2 x+\log_2(x-2)\) needs both \(x>0\) and \(x>2\), but \(\log_2(x(x-2))\) is happy whenever the product is positive, including when both factors are negative. Rewriting an expression can enlarge its domain, and the enlargement is where phantom answers come from — the same trap as clearing denominators in Chapter 0.

Log scales: making room for the very large

Human senses are roughly logarithmic. A sound that seems twice as loud carries about ten times the power; a star that looks a little dimmer may be a hundred times fainter. So it is not an accident that so many measurement scales are logarithmic — they were built to match perception, or to fit an enormous range onto a small ruler.

The same numbers on a linear and a logarithmic scale On a linear ruler from 0 to 1000, the values 1, 10 and 100 are crushed against the left end. On a logarithmic ruler the same values are evenly spaced. linear scale 1101001000 log scale 1101001000
Four quantities spanning three orders of magnitude. On the linear ruler, three of them are indistinguishable from zero. On the logarithmic ruler, equal spacing means equal ratios — each step is ten times the last.
scaledefinitionwhat one unit means
decibels\(L=10\log_{10}(I/I_0)\)+10 dB is ten times the power
Richter\(M=\log_{10}(A/A_0)\)+1 is ten times the ground motion, about 32 times the energy
pH\(\mathrm{pH}=-\log_{10}[\mathrm{H}^{+}]\)−1 is ten times as acidic
stellar magnitude\(m=-2.5\log_{10}(F/F_0)\)−1 is about 2.5 times brighter
spot check

How many times more sound power does an 80 dB sound carry than a 50 dB sound?

decimals, fractions, pi and sqrt( ) are all fine

example 3.10 — a concert and a conversation

A conversation runs at 60 dB and a concert at 110 dB. How many times more sound power is the concert? And if a second identical stack of speakers is switched on, doubling the power, how much does the reading rise?

The difference is 50 dB, and each 10 dB is a factor of ten, so the concert carries \(10^{5}=100{,}000\) times the power. Not twice as loud — a hundred thousand times the energy arriving at your ear.

Doubling the power adds \(10\log_{10}2=3.01\) dB. Three decibels. To gain another 10 dB you would need ten times the speakers.

That asymmetry is worth sitting with. Perception compresses: enormous changes in the physical quantity produce modest changes in what you notice. It is also why hearing damage is sneaky — the sound that does harm does not feel a hundred thousand times more intense, it just feels loud.

example 3.11 — comparing two earthquakes

One earthquake measures 7.2 and another 5.4. Compare their ground motion and their energy, given that energy scales as \(10^{1.5M}\).

Ground motion: \(10^{7.2-5.4}=10^{1.8}\approx 63\) times greater.

Energy: \(10^{1.5(1.8)}=10^{2.7}\approx 500\) times greater.

A difference of 1.8 on a scale that runs from about 2 to about 9 sounds small. It is a factor of five hundred. Whenever a number is a logarithm, small differences are never small — and headline writers who report that one quake was "slightly stronger" than another are making exactly this mistake.

Straightening a curve: how to spot a growth law

Here is the practical payoff. Suppose you have data and want to know what kind of growth it shows. Plotting it usually will not tell you: many curves bend upward, and the eye is terrible at distinguishing them. But logarithms can flatten the candidates into lines, and the eye is excellent at judging straightness.

the two straightening tricks

If \(y=Ca^{x}\) (exponential), then \(\log y=\log C+x\log a\): plotting \(\log y\) against \(x\) gives a straight line. This is a semi-log plot.

If \(y=Cx^{k}\) (power law), then \(\log y=\log C+k\log x\): plotting \(\log y\) against \(\log x\) gives a straight line of slope \(k\). This is a log-log plot.

spot check

Data that forms a straight line on a semi-log plot (\(\log y\) against \(x\)) is .

The same data on a linear and a semi-logarithmic vertical axis On the left, thirteen data points curving steeply upward. On the right, the same points plotted against a logarithmic vertical axis, where they fall almost exactly on a straight line. linear axis 0100 log axis 110100 timetime
The same thirteen measurements. On the left they curve, and a dozen different models would fit them equally badly. On the right the logarithm has straightened them, which settles the question: the data is exponential, and the slope of the line gives the growth rate.
lab — identify the growth law

Work with the data above (read the points from the left panel: at times 0 through 12 the values are approximately 2.7, 4.3, 6.4, 7.9, 10.4, 16.1, 23.5, 34.5, 40.2, 55.9, 91.8, 126.2, 192.3).

  1. Compute \(\log_{10}y\) for \(t=0,4,8,12\).
  2. Find the slope of the line through the first and last of those points.
  3. That slope is \(\log_{10}a\). Recover \(a\), the growth factor per unit time.
  4. Predict \(y\) at \(t=15\), and say how much you trust it.

The logarithms are \(0.431,\ 1.017,\ 1.604,\ 2.284\).

Slope \(=\dfrac{2.284-0.431}{12}=0.1544\).

So \(a=10^{0.1544}=1.427\): the quantity grows about 43% per unit time. (It was generated from \(1.4\) with noise, so the estimate is honest.)

At \(t=15\): \(\log_{10}y=0.431+15(0.1544)=2.747\), so \(y\approx 558\). How much to trust it? The model fits well over the observed range, but nothing in the data justifies extrapolating three units past the last measurement — real exponential growth always stops eventually, when it runs out of whatever it was consuming. A confident prediction is a claim about a mechanism, not about a line.

Switch the axis

The same three data sets, drawn on a linear or a logarithmic vertical axis. Only one of them is exponential. On the linear axis, good luck; on the log axis it is the straight one.

quadratic exponential linear

idea

This is why loss curves in machine learning are almost always plotted with a logarithmic vertical axis. Training drives the error down by factors, not by amounts: from 1.0 to 0.1 to 0.01. On a linear axis the last two stages are invisible, squashed against the bottom, and you cannot tell a model that is still improving from one that has stopped. On a log axis, constant progress looks like a straight line, and the moment it flattens is the moment to stop.

There is a companion reason logarithms are everywhere in that field. A model's confidence over a whole dataset is a product of thousands of probabilities, each less than one — a number so small no computer can store it. Take the logarithm and the product becomes a sum, which is exactly Napier's trick, four centuries later, running inside every training loop on Earth.

exercises 3.3
  1. Expand: (a) \(\log_2\dfrac{8x^{4}}{y}\); (b) \(\ln\sqrt{\dfrac{a}{bc}}\).
  2. Combine into one logarithm: (a) \(3\ln x-\ln(x+1)\); (b) \(\tfrac12[\log z+\log(z-1)]-2\log w\).
  3. Solve: (a) \(\log_5(2x-3)=2\); (b) \(\log x+\log(x-3)=1\); (c) \(\ln(x+1)-\ln(x-1)=2\).
  4. A sound is measured at 94 dB. What happens to the reading if the power is cut to one quarter?
  5. Lemon juice has pH 2.2 and black coffee pH 5.0. How many times more acidic is the lemon juice?
  6. Data is collected and \(\log y\) is plotted against \(\log x\), producing a straight line of slope 1.5 through \((0, 0.6)\). Find the relationship between \(y\) and \(x\).
  7. Explain why the number of digits in a whole number \(n\) is \(\lfloor\log_{10}n\rfloor+1\), and use it to find the number of digits in \(2^{1000}\).
  8. Prove the quotient law from the product law and the power law, using nothing else.
  1. (a) \(3+4\log_2x-\log_2y\). (b) \(\tfrac12(\ln a-\ln b-\ln c)\).
  2. (a) \(\ln\dfrac{x^{3}}{x+1}\). (b) \(\log\dfrac{\sqrt{z(z-1)}}{w^{2}}\).
  3. (a) \(2x-3=25\), so \(x=14\). (b) \(x(x-3)=10\) gives \(x=5\) or \(x=-2\); only \(x=5\) survives. (c) \(\dfrac{x+1}{x-1}=e^{2}\), so \(x=\dfrac{e^{2}+1}{e^{2}-1}\approx1.313\).
  4. Quartering the power subtracts \(10\log_{10}4=6.02\) dB, giving about 88 dB.
  5. \(10^{5.0-2.2}=10^{2.8}\approx 631\) times.
  6. Slope 1.5 and intercept 0.6 means \(\log y=0.6+1.5\log x\), so \(y=10^{0.6}x^{1.5}\approx 3.98\,x^{1.5}\). A straight log-log plot means a power law, and the slope is the power.
  7. \(n\) has \(d\) digits exactly when \(10^{d-1}\le n<10^{d}\); taking \(\log_{10}\) gives \(d-1\le\log_{10}n<d\), which is the floor statement. For \(2^{1000}\): \(\log_{10}2^{1000}=1000(0.30103)=301.03\), so it has 302 digits — found without computing the number.
  8. \(\log_a\!\left(\dfrac{A}{B}\right)=\log_a(AB^{-1})=\log_a A+\log_a B^{-1}=\log_a A-\log_a B\), using the product law and then the power law with \(c=-1\).

Where this chapter leaves you

Exponentials are what growth looks like when the rate is proportional to the amount; logarithms are the inverse that lets you get at the exponent, and the translation that turns products into sums. Along the way a limit appeared and produced \(e\), a number nobody chose.

Chapter 4 turns to functions that come back around. It will start by defining sine and cosine as coordinates on a circle rather than as ratios in a triangle, which is the definition that makes them useful for modelling anything that repeats — and by the end of it you will pull the hidden frequencies out of a year of real data using nothing but finite sums.

Next: Chapter 4 — Trigonometry of circles.