---
title: Log scales, decades and octaves
heading: Power laws are straight lines on log-log axes
eyebrow: A1 · Lesson 9 · Log scales
xp: 40
---

::: hook
Open almost any datasheet and the graphs have strange axes: 10, 100, 1k, 10k, evenly spaced. A filter's response, a capacitor's impedance against frequency, a transistor's gain against current, all on log scales. They're used because they let one picture span many decades. They also turn the most common relationship in engineering, the power law, into a straight line whose slope you can read off with a ruler.

::: play
- Both axes are logarithmic. The curve is $y = k x^n$.
- Set $n$ to 2, then to 1, then to −1. What shape do you get each time?
- Change $k$. What does it do to the line, and what does it leave alone?
:::
:::

```sim plot
view: graph
x: x = 0.1..100 log
y: y = 1m..1M log
slider: n = -2..3 step 0.5 = 2
slider: k = 0.1..10 = 1 log
plot: k*x^n | label: y = k·xⁿ
point: 1, k | label: x = 1
point: 10, k*10^n | label: x = 10
readout: decades of y per decade of x = log10(k*10^n) - log10(k) | digits: 3
```

::: predict
## On log-log axes, $y = x^2$ is a straight line. How many decades does it climb for each decade it moves right?

- [ ] 1
- [x] 2
- [ ] 10
- [ ] 100

::: reveal
Two. Multiplying $x$ by 10 multiplies $x^2$ by 100, which is two decades. On log-log axes the slope of a power law, measured in decades per decade, is its exponent. Changing $k$ slides the line up or down without tilting it.
:::
:::

::: nameit
## Equal distances mean equal ratios

On a log scale, a number sits at the position of its logarithm. So the distance between two points depends only on their ratio: 1 to 10, 10 to 100 and 3 to 30 are all the same length. Two ratios get their own names:

- a **decade** is a factor of 10;
- an **octave** is a factor of 2 (from music, where an octave doubles the pitch).

Counting them is taking a logarithm:

$$\text{decades from } a \text{ to } b = \log_{10}\frac{b}{a} \qquad \text{octaves from } a \text{ to } b = \log_{2}\frac{b}{a} = \frac{\log_{10}(b/a)}{\log_{10} 2}$$

One octave is 0.301 decade, and one decade is 3.32 octaves. Audio runs from 20 Hz to 20 kHz: three decades, or about ten octaves.

**Reading a log axis.** Inside one decade, a number $x$ times the decade's start sits $\log_{10} x$ of the way across: 2 is 30% of the way, 3 is 48%, 5 is 70%. That's why the gridlines bunch up toward the right end of each decade.

**The middle of a log axis** is the geometric mean. Halfway between $a$ and $b$ is the number with the same ratio to each:

$$x_{\text{mid}} = \sqrt{ab}$$

Halfway between 100 Hz and 10 kHz is 1 kHz, nowhere near the arithmetic mean of 5050 Hz. The center frequency of a band-pass filter is defined this way.

**Power laws are straight lines.** Take the logarithm of $y = k x^{n}$:

$$\log y = \log k + n \log x$$

On log-log axes that's a straight line with slope $n$, measured in decades of $y$ per decade of $x$. A few you'll meet constantly:
- $P = V^2/R$ against $V$: slope 2;
- a capacitor's impedance, $1/(2\pi f C)$, against $f$: slope −1, falling one decade per decade;
- the field of a point charge against distance: slope −2, the inverse-square law.

To find the exponent from a graph, pick two points on the line and divide: $n = \log(y_2/y_1) / \log(x_2/x_1)$.

**Exponentials want a different plot.** $y = A e^{-t/\tau}$ is straight on axes with a log $y$ and a linear $t$ (a semi-log plot), since $\ln y = \ln A - t/\tau$. That's how a capacitor's discharge or a radioactive decay is checked against theory.
:::

::: example
## A filter's response is plotted from 10 Hz to 100 kHz. How many decades and octaves does the axis span, and what frequency sits in the middle?

::: solution
1. **Decades.**
   $$\begin{aligned} \log_{10}\frac{100\,000}{10} &= \log_{10} 10^4 \\ &= 4 \end{aligned}$$
2. **Octaves.** Each decade is 3.32 octaves:
   $$4 \times 3.32 = 13.3$$
3. **Middle.** The middle is the geometric mean:
   $$\begin{aligned} f &= \sqrt{10 \times 100\,000}\ \text{Hz} \\ &= 1000\ \text{Hz} \end{aligned}$$
   On the page, 1 kHz sits exactly halfway across, two decades from each end.

**Answer:** the axis spans 4 decades, or 13.3 octaves, and 1 kHz sits in the middle.
:::
:::

::: example
## On a log-log plot, a part's impedance falls in a straight line from 1.59 kΩ at 100 Hz to 15.9 Ω at 10 kHz. What's the slope, and what is the part?

::: solution
1. **Slope.**
   $$\begin{aligned} n &= \frac{\log(15.9/1590)}{\log(10\,000/100)} \\ &= \frac{\log 0.01}{\log 100} \\ &= \frac{-2}{2} \\ &= -1 \end{aligned}$$
2. **Name the part.** Impedance falling as $1/f$ is a capacitor's signature, $1/(2\pi fC)$.
3. **Solve for C.** Either point works; at 100 Hz,
   $$\begin{aligned} C &= \frac{1}{2\pi \times 100 \times 1590}\ \text{F} \\ &= 1.00\ \mu\text{F} \end{aligned}$$

**Answer:** the slope is −1, and the part is a 1.00 µF capacitor.
:::
:::

::: example
## A capacitor discharging through a resistor is plotted on semi-log axes. Its voltage falls from 10 V to 1 V in 23 ms. What's the time constant?

::: solution
1. **Time for a tenfold fall.** For $V = V_0 e^{-t/\tau}$, a fall by a factor of 10 takes
   $$\tau \ln 10 = 2.30\tau$$
2. **Solve for the time constant.**
   $$\begin{aligned} \tau &= \frac{23\ \text{ms}}{2.30} \\ &= 10.0\ \text{ms} \end{aligned}$$
3. **Read the plot.** On the semi-log plot, every decade of fall takes the same 23 ms.
4. **Check the line.** If the points bent away from a straight line, the discharge wouldn't be a single exponential: a leaky capacitor could do that, or a resistor whose value changes with voltage.

**Answer:** the time constant is 10.0 ms.
:::
:::

::: check
given: f1 = 10 | 20 | 50; f2 = 20 | 50 | 100
answer: log10(f2*1000/f1)
tolerance: 1%

## A frequency response is plotted from {f1} Hz to {f2} kHz. How many decades does the axis span?

::: right
Right. The ratio is $\given{f2}\,000 / \given{f1}$, and its logarithm counts the decades: {answer}.
:::

::: misses
- [f2*1000/f1] That's the ratio of the ends. The number of decades is how many factors of ten fit in it: take $\log_{10}$.
- [log10(f2/f1)] Put both ends in the same unit first: {f2} kHz is $\given{f2} \times 1000$ Hz.
- [ln(f2*1000/f1)/ln(2)] That counts octaves, factors of 2. A decade is a factor of 10.
- [any] Not yet. Take $\log_{10}$ of the ratio of the two ends.
:::
:::

::: check
given: f1 = 100 | 220 | 440; f2 = 1000 | 3000 | 8000
answer: ln(f2/f1)/ln(2)
tolerance: 1%

## How many octaves are there from {f1} Hz to {f2} Hz?

::: right
Right. $\log_2(\given{f2}/\given{f1})$ = {answer} octaves.
:::

::: misses
- [log10(f2/f1)] That counts decades. An octave is a factor of 2, so use $\log_2$.
- [f2/f1/2] Halving the ratio doesn't count the doublings. Count how many times you double {f1} to reach {f2}: that's $\log_2$ of the ratio.
- [any] Not yet. Octaves are $\log_2$ of the ratio, which is $\log_{10}$ of the ratio divided by 0.301.
:::
:::

::: check
given: a = 10 | 20 | 50 | 100; b = 1000 | 4000 | 10000 | 50000
answer: sqrt(a*b)
tolerance: 1%

## What frequency sits halfway between {a} Hz and {b} Hz on a log axis?

::: right
Right. The geometric mean, $\sqrt{\given{a} \times \given{b}}$ = {answer} Hz, has the same ratio to both ends.
:::

::: misses
- [(a + b)/2] That's halfway on a linear axis. On a log axis halfway means the same ratio up from {a} as down from {b}.
- [any] Not yet. Halfway on a log axis is the square root of the product of the ends.
:::
:::

::: check
given: x = 2 | 3 | 4 | 5 | 6 | 8
answer: 10*log10(x)
tolerance: 1%

## A log axis runs from 1 to 10 over 10 cm. How many centimeters from its left end is the {x}?

::: right
Right. Each number sits at its logarithm: $10 \times \log_{10} \given{x}$ = {answer} cm.
:::

::: misses
- [10*(x - 1)/9] That's where {x} would sit on a linear axis. On a log axis the position is the logarithm.
- [x] The axis isn't marked in centimeters of value. Its position is $\log_{10} \given{x}$ of the way across.
- [any] Not yet. Find $\log_{10} \given{x}$, the fraction of the decade, and scale it to 10 cm.
:::
:::

::: check
given: y1 = 2 | 5 | 8; n = -2 | -1 | 2 | 3; x1 = 1 | 3 | 20; let x2 = 10*x1; let y2 = y1*10^n
answer: n
tolerance: 1%

## On log-log axes, a straight line passes through $x$ = {x1}, $y$ = {y1} and $x$ = {x2}, $y$ = {y2}. It's a power law $y = kx^n$. What is $n$?

::: right
Right. $x$ moves one decade and $y$ moves $\log_{10}(\given{y2}/\given{y1})$ = {n} decades, so the exponent is {n}.
:::

::: misses
- [(y2 - y1)/(x2 - x1)] That's the slope on linear axes. On log-log axes, measure both moves in decades.
- [y2/y1] That's how many times bigger $y$ got. Count it in decades: take $\log_{10}$.
- [any] Not yet. Divide the decades $y$ moves by the decades $x$ moves.
:::
:::

::: check
kind: choice

## Which axes make $y = 5e^{-t/2}$ a straight line?

- [ ] Linear $t$, linear $y$
- [ ] Log $t$, linear $y$
- [x] Linear $t$, log $y$
- [ ] Log $t$, log $y$

::: right
Right. $\ln y = \ln 5 - t/2$ is a straight line in $t$, so the $y$ axis needs to be logarithmic and the $t$ axis linear.
:::

::: misses
- [4] Log-log axes straighten power laws, $kx^n$. An exponential has $t$ up in the exponent, so only $y$ needs the logarithm.
- [any] Take the logarithm of both sides. Which variable ends up appearing linearly?
:::
:::

::: explain
## Explain why changing $k$ in $y = kx^n$ moves the line on log-log axes without changing its slope.

::: model
On log-log axes the line is $\log y = \log k + n \log x$. The slope is the factor in front of $\log x$, which is $n$. The constant $k$ only adds $\log k$ to every point, so it lifts or lowers the whole line by the same number of decades everywhere without tilting it.
:::
:::

::: practice

::: check
given: f1 = 1 | 5 | 20 | 50; f2 = 10 | 200 | 500
answer: log10(f2*1000/f1)
tolerance: 1%

## How many decades is it from {f1} Hz to {f2} kHz?

::: misses
- [log10(f2/f1)] Convert {f2} kHz to hertz first.
- [ln(f2*1000/f1)/ln(2)] That's octaves.
- [any] $\log_{10}$ of the ratio of the ends.
:::
:::

::: check
given: f = 50 | 100 | 440 | 1000; k = 3 | 4 | 5 | 6
answer: f*2^k
tolerance: 0.5%

## What frequency is {k} octaves above {f} Hz?

::: misses
- [f*2*k] Each octave doubles the frequency, so {k} octaves multiply it by $2^{\given{k}}$.
- [f*10^k] That's {k} decades up. An octave is a factor of 2.
- [any] Multiply by 2 once for each octave.
:::
:::

::: check
given: n = 1 | 2 | 3 | 5 | 10
answer: n*log10(2)
tolerance: 1%

## How many decades is {n} octaves?

::: misses
- [n/log10(2)] That turns decades into octaves. An octave is the smaller step, 0.301 of a decade.
- [n*2/10] Count in logarithms: an octave is $\log_{10} 2$ = 0.301 decade.
- [any] Multiply by $\log_{10} 2 \approx 0.301$.
:::
:::

::: check
given: a = 1 | 5 | 30; b = 200 | 2000 | 20000
answer: sqrt(a*b)
tolerance: 1%

## What is halfway between {a} and {b} on a log axis?

::: misses
- [(a + b)/2] That's the linear midpoint. On a log axis, take the geometric mean.
- [any] $\sqrt{ab}$.
:::
:::

::: check
given: y1 = 3 | 4 | 6; n = -2 | -1 | 2 | 3; x1 = 2 | 5 | 50; let x2 = 100*x1; let y2 = y1*100^n
answer: n
tolerance: 1%

## A power law passes through $x$ = {x1}, $y$ = {y1} and $x$ = {x2}, $y$ = {y2}. What is its exponent?

::: misses
- [(y2 - y1)/(x2 - x1)] That's the linear slope. Count both moves in decades.
- [2*n] $x$ moved two decades here. Divide $y$'s decades by 2.
- [any] Decades of $y$ divided by decades of $x$.
:::
:::

::: check
given: x = 1.5 | 2 | 2.5 | 4 | 7; L = 5 | 8 | 12
answer: L*log10(x)
unit: cm
tolerance: 1%

## A decade on a log axis is {L} cm long, from 1 to 10. How far from the 1 is the {x}, in centimeters?

::: misses
- [L*(x - 1)/9] That's the linear position. On a log axis the position is the logarithm.
- [any] $\log_{10} \given{x}$ is the fraction of the decade.
:::
:::
:::
