---
title: Logarithms, starting with counting zeros
heading: A logarithm counts zeros
eyebrow: A1 · Lesson 8 · Logarithms
xp: 40
---

::: hook
How many zeros does a million have? Six. A billion? Nine. A thousandth? Three, on the other side of the point. That count is a logarithm, and you already know how to take one for any power of ten. The interesting question is what the count should be for a number like 2000, which sits between two powers of ten.

::: play
- Slide x and watch the dot. The horizontal axis is a log scale, so 1, 10, 100 and 1000 are evenly spaced along it.
- Read $\log_{10} x$ in the strip. Put x on a power of ten, then halfway between two of them.
- Multiply x by 10 (move it one decade to the right). How much does $\log_{10} x$ change?
:::
:::

```sim plot
view: graph
x: x = 1m..1M log
y: L = -3..6
slider: X = 1m..1M = 2k log
plot: log10(x) | label: log₁₀ x
point: X, log10(X) | label: x
readout: x = X | format: decimal
readout: log₁₀ x = log10(X) | digits: 4
```

::: predict
## You multiply x by 10. What happens to $\log_{10} x$?

- [x] It goes up by 1
- [ ] It goes up 10 times
- [ ] It goes up by 10
- [ ] It doubles

::: reveal
It goes up by exactly 1, wherever x starts. Multiplying by 10 adds one zero, and the logarithm counts zeros. That's why the line on this graph is straight: every step of one decade to the right is one step of 1 up.
:::
:::

::: nameit
## The logarithm is the power of ten

$\log_{10} x$ is the power you have to raise 10 to in order to get $x$:

$$10^{\log_{10} x} = x \qquad \text{so} \qquad \log_{10} 1000 = 3, \quad \log_{10} 1 = 0, \quad \log_{10} 0.01 = -2$$

Numbers between powers of ten have logarithms between whole numbers. A handful are worth knowing by heart, because the rest follow from them:

| $x$ | 1 | 2 | 3 | 5 | 10 |
|---|---|---|---|---|---|
| $\log_{10} x$ | 0 | 0.301 | 0.477 | 0.699 | 1 |

They follow from three rules. Each one says that logarithms turn multiplying into adding:

$$\log(ab) = \log a + \log b \qquad \log\frac{a}{b} = \log a - \log b \qquad \log(a^{n}) = n \log a$$

So $\log_{10} 2000 = \log_{10} 2 + \log_{10} 1000 = 0.301 + 3 = 3.301$. The whole number part counts the zeros and the decimal part says where the number sits between them. And $\log_{10} 5 = \log_{10}(10/2) = 1 - 0.301 = 0.699$.

You'll also meet the **natural logarithm**, $\ln x$, which uses the number $e \approx 2.718$ in place of 10. It's the one calculus prefers, and $\ln x = 2.303 \log_{10} x$. Calculators usually label them log and ln, but in most programming languages `log` means $\ln$, so check which one you're getting.

Logarithms only exist for positive numbers. A number below 1 has a negative logarithm, since you divide by ten to get there.
:::

::: example
## Without a calculator, find $\log_{10} 5000$ and $\log_{10} 0.02$.

::: solution
1. **Split 5000 and take its log.** $5000 = 5 \times 10^3$, so
   $$\begin{aligned} \log_{10} 5000 &= \log_{10} 5 + 3 \\ &= 0.699 + 3 \\ &= 3.699 \end{aligned}$$
2. **Split 0.02 and take its log.** $0.02 = 2 \times 10^{-2}$, so
   $$\begin{aligned} \log_{10} 0.02 &= 0.301 - 2 \\ &= -1.699 \end{aligned}$$
3. **The method.** Split each number into a digit and a power of ten. The power counts the zeros; the digit adds its logarithm from the table.

**Answer:** $\log_{10} 5000 = 3.699$ and $\log_{10} 0.02 = -1.699$.
:::
:::

::: example
## A capacitor discharges as $v = V_0 e^{-t/\tau}$. How many time constants until it's down to 1% of where it started?

::: solution
1. **Set the curve to 1%.**
   $$e^{-t/\tau} = 0.01$$
2. **Take the natural logarithm of both sides.**
   $$\begin{aligned} -\frac{t}{\tau} &= \ln 0.01 \\ &= -\ln 100 \end{aligned}$$
   so $t = \tau \ln 100$.
3. **Evaluate ln 100.**
   $$\begin{aligned} \ln 100 &= 2.303 \times \log_{10} 100 \\ &= 2.303 \times 2 \\ &= 4.61 \end{aligned}$$
   so it takes about 4.6 time constants.

**Answer:** about 4.6 time constants. This is where the rule "five time constants and it's done" comes from.
:::
:::

::: check
given: m = 2 | 3 | 5; n = 2..9 int
answer: log10(m) + n
tolerance: 0.005

## Without a calculator, what is $\log_{10}(\given{m} \times 10^{\given{n}})$?

Use $\log_{10} 2 \approx 0.301$, $\log_{10} 3 \approx 0.477$ and $\log_{10} 5 \approx 0.699$.

::: right
Right. The log of a product is the sum of the logs: $\log_{10} \given{m}$ plus {n} for the zeros.
:::

::: misses
- [n] That counts the zeros, but the {m} in front adds a fraction to it. Add $\log_{10} \given{m}$.
- [n*log10(m)] The log of a product is a sum. Add the two logarithms together.
- [log10(m)] That leaves out the power of ten, which adds {n}.
- [any] Not yet. Split it into $\log_{10} \given{m} + \log_{10} 10^{\given{n}}$.
:::
:::

::: check
given: L = 1.699 | 2.301 | 3.477 | 4.699 | 5.301
answer: 10^L
tolerance: 1%

## $\log_{10} x = \given{L}$. What is $x$?

::: right
Right. The whole number part puts x between two powers of ten, and the decimal part says which number it is in between: {answer}.
:::

::: misses
- [10^floor(L)] That's the power of ten from the whole number part. The decimal part multiplies it by something between 1 and 10.
- [L*10] Undo the logarithm by raising 10 to that power.
- [any] Not yet. Split the logarithm into its whole part and decimal part, and look the decimal part up in the table.
:::
:::

::: check
kind: choice

## What is $\log_{10} 0.01$?

- [x] −2
- [ ] 0.01
- [ ] 2
- [ ] −0.01

::: right
Right. $0.01 = 10^{-2}$, so its logarithm is −2. Numbers below 1 have negative logarithms.
:::

::: misses
- [2] Close, but 0.01 is less than 1: it's 10 divided by itself twice more. That makes the logarithm negative.
- [any] The logarithm is the power of ten. Write 0.01 as a power of ten first.
:::
:::

::: check
kind: expression
answer: 3 + log10(x)
vars: x = 1..100

## Write $\log_{10}(1000\,x)$ using $\log_{10} x$.

Type log10(x) for $\log_{10} x$.

::: right
Right. $\log_{10}(1000\,x) = \log_{10} 1000 + \log_{10} x = 3 + \log_{10} x$.
:::

::: misses
- [1000*log10(x)] The 1000 is multiplying x inside the logarithm, and the log of a product is a sum.
- [3*log10(x)] The log of a product is a sum, so $\log_{10} 1000$ gets added to $\log_{10} x$.
- [any] Not yet. Use $\log(ab) = \log a + \log b$.
:::
:::

::: check
given: x = 6 | 12 | 18 | 0.6 | 1.5 | 45 | 360
answer: log(x)
tolerance: 0.003

## Using $\log_{10} 2 \approx 0.301$, $\log_{10} 3 \approx 0.477$ and $\log_{10} 5 \approx 0.699$, but no calculator, what is $\log_{10} \given{x}$?

::: right
Right. Break {x} into factors of 2, 3, 5 and 10, then add their logs: {answer}.
:::

::: misses
- [-log(x)] That has the wrong sign. Numbers above 1 have positive logs and numbers below 1 negative ones.
- [any] Not yet. Write {x} as a product of 2s, 3s, 5s and powers of ten, and add the logs of the factors.
:::
:::

::: check
given: T = 2m | 3m | 4m | 5m | 7m | 9m s; k = 10 | 50 | 100 | 1000
answer: T*log(k)/log(2)
unit: s
tolerance: 1%

## A disturbance in an unstable amplifier doubles every {T}. How long does it take to grow by a factor of {k}?

::: right
Right. It needs $\log_2 \given{k} = \log_{10} \given{k} / \log_{10} 2$ doublings, each taking {T}: {answer}.
:::

::: misses
- [T*k/2] That counts {k}/2 doublings. Growth is multiplied each time: the number of doublings is the power of 2 that makes {k}.
- [T*log(k)] That counts decades, not doublings. Divide by $\log_{10} 2$ to count doublings.
- [T*log(2)/log(k)] That's upside down. The number of doublings is $\log_{10} \given{k}$ divided by $\log_{10} 2$.
- [any] Not yet. Find how many doublings make a factor of {k}, then multiply by {T}.
:::
:::

::: explain
## On a log scale, 1, 10, 100 and 1000 are equally far apart. Why?

::: model
A log scale places each number at the position of its logarithm. The logarithms of 1, 10, 100 and 1000 are 0, 1, 2 and 3, which are evenly spaced. So equal steps along a log scale stand for equal factors, here a factor of ten each time.
:::
:::

::: practice

::: check
given: m = 2 | 3 | 5; n = -6..9 int
answer: log10(m) + n
tolerance: 0.005

## What is $\log_{10}(\given{m} \times 10^{\given{n}})$? Use $\log_{10} 2 \approx 0.301$, $\log_{10} 3 \approx 0.477$ and $\log_{10} 5 \approx 0.699$.

::: misses
- [n] Add $\log_{10} \given{m}$ for the {m} in front.
- [n*log10(m)] The log of a product is the sum of the logs.
- [any] Split it into $\log_{10} \given{m} + \log_{10} 10^{\given{n}}$.
:::
:::

::: check
given: L = -2.699 | -1.301 | 0.477 | 1.699 | 2.301 | 3.477 | 6.301
answer: 10^L
tolerance: 1%

## $\log_{10} x = \given{L}$. What is $x$?

::: misses
- [L*10] Undo the logarithm by raising 10 to that power.
- [any] Raise 10 to the power {L}. The whole number part counts the zeros.
:::
:::

::: check
given: x = 20 | 30 | 50 | 200 | 300 | 500
answer: -log10(x)
tolerance: 0.005

## What is $\log_{10}(1/\given{x})$?

::: misses
- [log10(x)] Dividing gives a negative logarithm: $\log(1/x) = -\log x$.
- [any] Use $\log(1/x) = -\log x$, and split {x} into a digit times a power of ten.
:::
:::
:::
