---
title: Reducing noise by averaging
heading: Trading time for precision
eyebrow: A11 · Lesson 33 · Reducing noise by averaging
xp: 40
---

::: hook
A single reading from a sensitive voltmeter jumps around in the last digit. Take ten readings and average them, and the average jumps around less. Take a hundred and it's steadier still, but not ten times steadier. The rule for how much averaging helps is one of the most useful in measurement, and it explains why a scope's "average" mode can pull a tiny signal out of noise much bigger than it, and why it costs time to do so.

::: play
- Each draw is the average of $k$ readings of a true value of 2 V, each reading with Gaussian noise of σ = 0.5 V. The histogram shows how the averages scatter.
- Raise $k$ from 1 to 4, then to 16, then 64. How much narrower does the histogram get each time?
- In the second sim, a weak repeating signal sits under heavy noise. The scope averages $k$ sweeps. How many does it take before you can see the shape?
:::
:::

```sim plot
view: random
x: v = 0..4 V
slider: k = 1..100 step 1 = 1
sample: 2 + 0.5*randn(k) | mean: M | sd: S
trials: 10000
bins: 60
density: exp(-(v - 2)^2/(2*(0.5/sqrt(k))^2))/((0.5/sqrt(k))*sqrt(2*pi))
readout: spread of the averages = S V
readout: 0.5/√k = 0.5/sqrt(k) V
```

```sim plot
view: random
x: v = -3..3 V
slider: k = 1..256 = 1 log
sample: 0.3*sin(2*pi*i/50) + 0.3*sin(6*pi*i/50)/2 + 1*randn(k)
trials: 300
bins: 40
trace: 300
readout: noise left = 1/sqrt(k) V
readout: SNR gain = 10*log10(k) dB
```

::: predict
## You average 4 readings instead of 1. How much smaller does the random scatter get?

- [ ] 4 times smaller
- [x] 2 times smaller
- [ ] 16 times smaller
- [ ] No smaller

::: reveal
Two times smaller. The sum of 4 independent errors has a spread of $\sigma\sqrt4 = 2\sigma$ (variances add), and dividing by 4 to average gives $\sigma/2$. In general averaging $n$ readings divides the noise by $\sqrt n$: to cut it tenfold you need a hundred readings. Precision costs time, and it gets expensive fast.
:::
:::

::: nameit
## Averaging

**The square-root rule.** The average of $n$ independent readings, each with noise σ, has the same mean and a spread of

$$\sigma_\text{avg} = \frac{\sigma}{\sqrt n}$$

So the signal-to-noise ratio improves by a factor of $n$ in power: $10\log_{10}n$ dB, or 3 dB each time you double the number of readings.

**What averaging can't fix.** Only random, independent noise averages away. A systematic error, like an offset in the meter or a miscalibrated reference, is the same in every reading, so it's still there in the average, however many you take. Noise that's correlated from one reading to the next, like slow drift or 1/f noise, also averages away much more slowly than $1/\sqrt n$.

**Averaging in disguise.** Many instruments average without calling it that:

- A **scope's average mode** averages many sweeps point by point. The repeating signal adds up the same way each time; the noise doesn't. It needs a stable trigger, so every sweep lines up.
- A **low-pass filter** is a running average. Narrowing its bandwidth by a factor $n$ cuts white noise by $\sqrt n$, since noise power is proportional to bandwidth (lesson 45).
- An **integrating ADC**, in a good bench multimeter, averages over exactly one or more power-line cycles, so 50 or 60 Hz pickup averages to zero.
- A **lock-in amplifier** multiplies by a reference sinusoid and averages, the correlation of A10.2, to recover signals buried thousands of times below the noise.
:::

::: example
## Readings have 5 mV of noise each. What does averaging 100 of them give, and how many are needed for 0.1 mV?

::: solution
1. **Average 100 readings.**
   $$\frac{5\ \text{mV}}{\sqrt{100}} = 0.5\ \text{mV}$$
2. **Readings for 0.1 mV.** You need $\sqrt n = 50$, so
   $$n = 2500$$
3. **The cost.** Five times better costs 25 times the data.

**Answer:** averaging 100 readings gives 0.5 mV of noise, and 0.1 mV takes 2500 readings.
:::
:::

::: example
## A scope averages 64 triggered records. How much does the SNR improve, and what happens to a 2 mV offset in the probe?

::: solution
1. **SNR gain.** Noise power falls by 64, so the SNR improves by
   $$10\log_{10}64 = 18.1\ \text{dB}$$
2. **The offset.** The 2 mV offset is the same in every record, so averaging keeps it: averaging only removes errors that change from record to record.

**Answer:** the SNR improves by 18.1 dB, and the 2 mV offset stays.
:::
:::

::: example
## A moving average over 16 samples smooths white noise. By how much does it improve the SNR?

::: solution
1. **Noise.** Averaging 16 independent samples divides the noise standard deviation by
   $$\sqrt{16} = 4$$
   and leaves a slowly varying signal unchanged.
2. **SNR.** The SNR in power improves 16 times:
   $$10\log_{10}16 = 12\ \text{dB}$$
3. **The cost.** The cost is time resolution: the output responds to a step over 16 samples instead of one.

**Answer:** the SNR improves 16 times in power, or 12 dB.
:::
:::

::: check
given: s = 1 | 2 | 5 | 10; n = 4 | 16 | 25 | 100
answer: s/sqrt(n)
unit: mV
tolerance: 0.5%

## Each reading has {s} mV of random noise. What is the noise on the average of {n} readings?

::: right
Right. $\sigma/\sqrt n$ = {answer}.
:::

::: misses
- [s/n] Averaging divides the noise by $\sqrt n$, not by n.
- [s*sqrt(n)] That's the noise on the sum. The average divides it by n.
- [any] Not yet. $\sigma_\text{avg} = \sigma/\sqrt n$.
:::
:::

::: check
given: f = 3 | 4 | 5 | 10
answer: f^2
tolerance: 0.5%

## How many readings must you average to make the random noise {f} times smaller?

::: right
Right. Noise falls as $1/\sqrt n$, so $n = \given{f}^2$ = {answer}.
:::

::: misses
- [f] With {f} readings the noise only falls by $\sqrt{\given{f}}$.
- [2*f] Square it: noise falls as the square root of the count.
- [any] Not yet. Solve $\sqrt n = \given{f}$.
:::
:::

::: check
given: n = 2 | 10 | 64 | 1000
answer: 10*log10(n)
unit: dB
tolerance: 0.5%

## A scope averages {n} sweeps of a repeating signal. By how many dB does the SNR improve?

::: right
Right. Noise power falls by n while the signal stays put: $10\log_{10}n$ = {answer}.
:::

::: misses
- [20*log10(n)] Noise voltage falls by $\sqrt n$, so power by n: $10\log_{10}n$.
- [10*log10(sqrt(n))] The noise power falls by n, not $\sqrt n$.
- [any] Not yet. SNR improves by a factor n in power.
:::
:::

::: check
given: B1 = 100 | 20 | 10; B2 = 1 | 4
answer: sqrt(B1/B2)
tolerance: 0.5%

## You narrow a filter's bandwidth from {B1} kHz to {B2} kHz. By what factor does the white noise voltage at its output fall?

::: right
Right. Noise power is proportional to bandwidth, so the voltage falls by $\sqrt{\given{B1}/\given{B2}}$ = {answer}.
:::

::: misses
- [B1/B2] That's the factor for noise power. Voltage falls by its square root.
- [any] Not yet. Noise voltage goes as $\sqrt B$.
:::
:::

::: check
kind: choice

## A voltmeter reads 2 mV high on every measurement, plus random noise of 1 mV. You average 10,000 readings. What error remains?

- [ ] Almost none
- [x] About 2 mV: the offset doesn't average away
- [ ] About 0.01 mV
- [ ] About 1 mV

::: right
Right. The random part shrinks to 0.01 mV, but the 2 mV offset is in every reading, so it's in the average too.
:::

::: misses
- [1] Averaging only removes errors that change from reading to reading.
- [3] That's what's left of the random part. The offset is still there.
- [4] The random part is mostly gone; the offset is the problem.
:::
:::

::: check
kind: parts
given: N = 16 | 64 | 256

## A moving average over {N} samples smooths white noise.

::: part
answer: sqrt(N)
tolerance: 0.5%

### By what factor does the noise's standard deviation fall?

::: misses
- [N] That's the factor in power.
- [any] $\sqrt N$.
:::
:::

::: part
answer: 10*log(N)
unit: dB
tolerance: 0.5%

### By how many dB does the SNR improve?

::: misses
- [20*log(N)] SNR is a power ratio: $10\log_{10}N$.
- [any] $10\log_{10}N$.
:::
:::
:::

::: check
kind: derivation
vars: s = 0.1..10, e = 0.01..1

## Readings have noise $s$; you want the average's noise below $e$.

::: step
answer: (s/e)^2

### How many readings are needed?
:::

::: right
Right. $n = (\sigma/e)^2$: halving the target quadruples the count.
:::
:::

::: explain
## Why does averaging n readings reduce random noise by $\sqrt n$ and not by n?

::: model
Adding n independent errors doesn't add their sizes, because they point in random directions and partly cancel. Their variances add, so the sum's spread is $\sigma\sqrt n$. The signal, on the other hand, is the same in every reading, so it adds up to n times its value. Dividing by n to average leaves the signal unchanged and the noise at $\sigma\sqrt n/n = \sigma/\sqrt n$.
:::
:::

::: practice

::: check
given: s = 4 | 8 | 12; n = 4 | 16
answer: s/sqrt(n)
unit: µV
tolerance: 0.5%

## Noise is {s} µV per reading. What is it on an average of {n}?

::: misses
- [s/n] Divide by $\sqrt n$.
- [any] $\sigma/\sqrt n$.
:::
:::

::: check
given: d = 1 | 2 | 3 | 4
answer: 3*d
unit: dB
tolerance: 1%

## You double the number of averaged readings {d} times over. Roughly how much has the SNR improved?

::: misses
- [6*d] Each doubling gives 3 dB, not 6.
- [any] 3 dB per doubling.
:::
:::

::: check
given: t = 1 | 2 | 5; f = 2 | 4
answer: t*f^2
unit: s
tolerance: 0.5%

## A measurement takes {t} s and has too much noise. How long must you average to cut the noise {f} times?

::: misses
- [t*f] Noise falls as the square root of the time: you need $f^2$ times as long.
- [any] Time grows as the square of the improvement.
:::
:::
:::
