---
title: Propagating uncertainty
heading: How the errors in measured quantities combine
eyebrow: C11 · Lesson 2 · Propagating uncertainty
xp: 40
---

::: hook
You rarely measure the quantity you want directly. Resistance comes from a voltage divided by a current, power from a voltage squared over a resistance, a filter's corner from a resistor and a capacitor. Each input carries its own uncertainty, and the question is how big the result's is. Adding the uncertainties is the pessimist's answer, since it assumes every error is at its worst in the same direction at once. For independent errors there's a better rule, add them in quadrature, and knowing which applies is the difference between a design that's over-specified and one that's honestly characterized.
:::

::: play
- Each draw divides a noisy voltage reading (mean 10 V, standard deviation $s_a$) by a noisy current reading (mean 2 A, standard deviation $s_b$). The histogram shows the resulting resistance, centered on 5 Ω.
- The readouts compare the measured relative spread of the result with the quadrature prediction, $\sqrt{(s_a/10)^2 + (s_b/2)^2}$. With many draws they agree.
- Make one input's error much larger than the other's: the result's error is almost entirely that one. Small contributors hardly matter in quadrature.
:::
:::

```sim plot
view: random
x: R = 4..6 Ω
slider: sa = 0.01..0.5 step 0.01 = 0.2 V
slider: sb = 0.005..0.1 step 0.005 = 0.04 A
sample: (10 + sa*randn(1))/(2 + sb*randn(1)) | mean: M | sd: S
trials: 20000
bins: 60
readout: measured relative spread, % = 100*S/M | digits: 3
readout: quadrature prediction, % = 100*sqrt((sa/10)^2 + (sb/2)^2) | digits: 3
readout: simple sum, % = 100*(sa/10 + sb/2) | digits: 3
```

::: predict
## Power is found as $P = V^2/R$, with V known to 1% and R to 2% (independent). What is the uncertainty in P?

- [ ] 3%
- [x] About 2.8%
- [ ] 4%
- [ ] 2%

::: reveal
2.8%. Squaring V doubles its relative error to 2%; R contributes 2%; in quadrature, $\sqrt{2^2 + 2^2} = 2.83\%$. The worst case, if both errors happened to line up, would be 4%.
:::
:::

::: nameit
## Independent errors add in quadrature

For a result f computed from independent measured quantities $x_i$ with standard uncertainties $\sigma_i$,

$$\sigma_f^2 = \sum_i\left(\frac{\partial f}{\partial x_i}\sigma_i\right)^2$$

which gives the working rules:

| Result | Uncertainty |
|---|---|
| $a + b$ or $a - b$ | $\sigma_f = \sqrt{\sigma_a^2 + \sigma_b^2}$ |
| $ab$ or $a/b$ | $\dfrac{\sigma_f}{f} = \sqrt{\left(\dfrac{\sigma_a}{a}\right)^2 + \left(\dfrac{\sigma_b}{b}\right)^2}$ |
| $a^n$ | $\dfrac{\sigma_f}{f} = \lvert n\rvert\dfrac{\sigma_a}{a}$ |

Absolute uncertainties combine for sums; relative ones for products. The largest contribution dominates: one term three times another contributes nine times as much to the sum of squares.

## Worst case

Adding the uncertainties directly, $\sigma_a + \sigma_b$, gives a **worst-case** bound, right when errors can line up (tolerances on parts in a production design must all work at once) and pessimistic for random measurement errors.

## Correlated errors

If two readings share an error (the same meter's scale factor in a ratio), the rules above don't apply: in a ratio the shared scale error cancels exactly. Measuring both quantities with the same instrument is a classic way to remove a bias.
:::

::: example
## A resistance is found from V = 5.00 ± 0.02 V and I = 2.00 ± 0.01 mA. What is R and its uncertainty?

::: solution
1. **Resistance.**
   $$\begin{aligned} R &= \frac{5.00\ \text{V}}{2.00\ \text{mA}} \\ &= 2.50\ \text{k}\Omega \end{aligned}$$
2. **Relative errors.**
   $$\frac{0.02}{5.00} = 0.4\%, \qquad \frac{0.01}{2.00} = 0.5\%$$
3. **Combine in quadrature.**
   $$\begin{aligned} \frac{\Delta R}{R} &= \sqrt{0.4^2 + 0.5^2}\ \% \\ &= 0.64\% \end{aligned}$$
4. **Absolute uncertainty.**
   $$\begin{aligned} \Delta R &= 0.64\% \times 2.50\ \text{k}\Omega \\ &= 0.016\ \text{k}\Omega \end{aligned}$$

**Answer:** R = 2.500 ± 0.016 kΩ.
:::
:::

::: example
## An RC filter's corner $f_c = 1/(2\pi RC)$ uses a 1% resistor and a 5% capacitor. What is the corner's uncertainty?

::: solution
1. **Combine in quadrature.**
   $$\begin{aligned} \frac{\Delta f_c}{f_c} &= \sqrt{1^2 + 5^2}\ \% \\ &= 5.1\% \end{aligned}$$
2. **Which part matters.** The capacitor sets it almost entirely. A better resistor would change nothing; a better capacitor would.

**Answer:** the corner is uncertain by 5.1%, almost all of it from the capacitor.
:::
:::

::: example
## Power is found as $P = V^2/R$ with V known to 2% and R to 1%. What is P's relative uncertainty?

::: solution
1. **The rule.** For a product of powers, relative uncertainties scale by the exponents and add in quadrature.
2. **Each contribution.** V appears squared, so it contributes $2 \times 2\% = 4\%$, and R contributes 1%.
3. **Combine in quadrature.**
   $$\begin{aligned} \frac{\Delta P}{P} &= \sqrt{4^2 + 1^2}\ \% \\ &= 4.1\% \end{aligned}$$
4. **What dominates.** The voltage measurement dominates because it's squared: halving its uncertainty would nearly halve P's.

**Answer:** P's relative uncertainty is 4.1%, mostly from the squared voltage.
:::
:::

::: check
given: sa = 0.02 | 0.1; sb = 0.05 | 0.3
answer: sqrt(sa^2 + sb^2)
unit: V
tolerance: 0.5%

## Two independent voltages with uncertainties {sa} V and {sb} V are subtracted. What is the uncertainty of the difference?

::: right
Right. $\sqrt{\sigma_a^2 + \sigma_b^2}$ = {answer} V.
:::

::: misses
- [abs(sa - sb)] Uncertainties don't cancel in a difference; independent ones add in quadrature.
- [sa + sb] That's the worst case. For independent errors, add in quadrature.
- [any] Not yet. $\sqrt{\sigma_a^2 + \sigma_b^2}$.
:::
:::

::: check
given: ra = 0.5 | 1 | 2; rb = 1 | 3
answer: sqrt(ra^2 + rb^2)
unit: %
tolerance: 0.5%

## A result is the ratio of two independent quantities known to {ra}% and {rb}%. What is its relative uncertainty?

::: right
Right. In quadrature: {answer}%.
:::

::: misses
- [ra + rb] That's worst-case; independent relative errors add in quadrature.
- [any] Not yet. Relative errors in quadrature.
:::
:::

::: check
given: n = 2 | 3 | 0.5; r = 0.5 | 1.5
answer: abs(n)*r
unit: %
tolerance: 0.5%

## A quantity known to {r}% is raised to the power {n}. What is the result's relative uncertainty?

::: right
Right. |n| times: {answer}%.
:::

::: misses
- [r] A power multiplies the relative error by the exponent.
- [r^n] The relative error is multiplied by n, not raised to it.
- [any] Not yet. $\lvert n\rvert \times$ the relative error.
:::
:::

::: check
given: rv = 0.5 | 1 | 2; rr = 0.1 | 1 | 5
answer: sqrt((2*rv)^2 + rr^2)
unit: %
tolerance: 0.5%

## Power is computed as $V^2/R$ with V known to {rv}% and R to {rr}%. What is the relative uncertainty in P?

::: right
Right. V's error doubled, then combined in quadrature with R's: {answer}%.
:::

::: misses
- [sqrt(rv^2 + rr^2)] Squaring V doubles its relative error.
- [2*rv + rr] That's the worst case; combine in quadrature.
- [any] Not yet. Double V's error, then quadrature with R's.
:::
:::

::: check
given: rr = 0.1 | 1; rc = 2 | 5 | 10
answer: sqrt(rr^2 + rc^2)
unit: %
tolerance: 0.5%

## A filter's corner $1/(2\pi RC)$ uses an R known to {rr}% and a C known to {rc}%. What is the corner's relative uncertainty?

::: right
Right. {answer}%: the larger term dominates.
:::

::: misses
- [rr + rc] Independent errors add in quadrature.
- [any] Not yet. Relative errors in quadrature.
:::
:::

::: check
given: t1 = 1 | 5; t2 = 1 | 5; t3 = 2 | 10
answer: t1 + t2 + t3
unit: %
tolerance: 0.5%

## A product's gain is the product of three parts with tolerances of {t1}%, {t2}% and {t3}%. Every unit must work. What worst-case tolerance must the design allow?

::: right
Right. Tolerances can line up in a given unit: {answer}%.
:::

::: misses
- [sqrt(t1^2 + t2^2 + t3^2)] That's the typical spread; a guarantee for every unit needs the worst case.
- [any] Not yet. Add them.
:::
:::

::: check
kind: choice

## A voltage ratio is measured by reading both voltages with the same meter, whose scale factor is 1% off. How much does that 1% affect the ratio?

- [ ] 1%
- [ ] 1.4% (in quadrature)
- [ ] 2%
- [x] Not at all: the same scale error cancels in a ratio

::: misses
- [1] Both readings are 1% high together, so their ratio is exact.
- [2] Quadrature is for independent errors; these are perfectly correlated.
- [3] Correlated errors in a ratio cancel instead of adding.
:::
:::

::: check
kind: parts
given: a = 1 | 2 | 3; ux = 0.5 | 1 | 2; uy = 1 | 3

## $f = x^{\given{a}}y$, with x known to {ux}% and y to {uy}%.

::: part
answer: sqrt((a*ux)^2 + uy^2)
unit: %
tolerance: 0.5%

### What is f's relative uncertainty?

::: misses
- [a*ux + uy] Independent uncertainties add in quadrature.
- [any] $\sqrt{(a u_x)^2 + u_y^2}$.
:::
:::

::: part
answer: (a*ux)^2/((a*ux)^2 + uy^2)*100
unit: %
tolerance: 0.5%

### What share of the variance comes from x?

::: misses
- [any] $(au_x)^2$ over the total.
:::
:::
:::

::: check
kind: derivation
vars: a = -3..3, b = -3..3, u = 0.001..0.1, w = 0.001..0.1

## $f = x^ay^b$, with relative standard uncertainties u for x and w for y, independent.

::: step
answer: a*u

### What relative uncertainty does x contribute?
:::

::: step
answer: sqrt((a*u)^2 + (b*w)^2)

### What is f's relative uncertainty?
:::

::: right
Right. Exponents scale the contributions; independence makes them add in quadrature.
:::
:::

::: explain
## Why do independent uncertainties add in quadrature instead of directly?

::: model
Independent errors are as likely to push in opposite directions as in the same one, so in a combination they partly cancel on average. Treating each error as a random variable, the variance of a sum of independent variables is the sum of their variances: the squares add, so the standard deviations add like the sides of a right triangle. Adding them directly assumes every error is at its extreme in the same direction at once, which is possible but rare, so it overstates the typical uncertainty; it's the right rule only when a design must work for every combination.
:::
:::

::: practice

::: check
given: sa = 0.03 | 0.4; sb = 0.04 | 0.3
answer: sqrt(sa^2 + sb^2)
tolerance: 0.5%

## Uncertainty of a sum, with {sa} and {sb}?

::: misses
- [any] Quadrature.
:::
:::

::: check
given: ra = 0.2 | 3; rb = 0.5 | 4
answer: sqrt(ra^2 + rb^2)
unit: %
tolerance: 0.5%

## Relative uncertainty of a product of {ra}% and {rb}% quantities?

::: misses
- [any] Quadrature of the relative errors.
:::
:::

::: check
given: n = 2 | 4; r = 0.5 | 1.5
answer: n*r
unit: %
tolerance: 0.5%

## A {r}% quantity raised to the {n}th power?

::: misses
- [any] n × r.
:::
:::
:::
