📏 Error Propagation & Uncertainty

If z = f(x,y), then σ_z² = (∂f/∂x)²σ_x² + (∂f/∂y)²σ_y² (linear propagation). Monte Carlo confirms analytical results. Interactive formula builder for addition, multiplication, and arbitrary functions.

StatisticsInteractive
MC histogram of z · Analytical Gaussian overlay · R resample

How it Works

Linear error propagation (first-order Taylor expansion) gives the output uncertainty as a quadrature sum of partial derivatives times input uncertainties. For uncorrelated inputs x and y with standard deviations σ_x and σ_y:

σ_z² = (∂f/∂x)²·σ_x² + (∂f/∂y)²·σ_y² z = x+y: σ_z = √(σ_x²+σ_y²) z = x·y: σ_z/z = √((σ_x/x)²+(σ_y/y)²) z = x/y: σ_z/z = √((σ_x/x)²+(σ_y/y)²) z = x^n: σ_z/z = |n|·σ_x/x z=√(x²+y²): σ_z = √((x²σ_x²+y²σ_y²)/(x²+y²))

Monte Carlo simulation draws N samples from the Gaussian input distributions, evaluates z for each sample, and computes the empirical mean and standard deviation. The histogram should match the analytical Gaussian for linear functions and reveal skew/asymmetry for nonlinear ones.

Frequently Asked Questions

What is error propagation?

Error propagation (uncertainty propagation) is the effect of input uncertainties on the uncertainty of a computed output. If z = f(x, y), the output uncertainty σ_z depends on the input uncertainties σ_x, σ_y and the partial derivatives of f.

What is the linear (first-order) error propagation formula?

For uncorrelated inputs: σ_z² = (∂f/∂x)²σ_x² + (∂f/∂y)²σ_y². This is derived from a first-order Taylor expansion of f around the mean values. It is exact for linear functions and approximate for nonlinear ones.

When does linear error propagation fail?

Linear propagation fails when the function is strongly nonlinear over the range of input uncertainty, or when input uncertainties are large relative to the function's scale. In these cases, Monte Carlo simulation gives more accurate results.

How does Monte Carlo uncertainty work?

Monte Carlo uncertainty analysis draws many random samples from the input distributions (usually Gaussian with mean ± standard deviation), evaluates the function for each sample, and computes the standard deviation of the output samples.

What is the uncertainty of a sum z = x + y?

For z = x + y with uncorrelated x, y: σ_z = √(σ_x² + σ_y²). The absolute uncertainties add in quadrature.

What is the uncertainty of a product z = x·y?

For z = x·y: (σ_z/z)² = (σ_x/x)² + (σ_y/y)². The relative uncertainties add in quadrature.

What is the uncertainty of z = x^n?

For z = x^n: σ_z/z = |n| · σ_x/x. Powers amplify relative uncertainty by factor |n|.

What is a coverage factor and confidence interval?

A coverage factor k multiplies the standard uncertainty to give expanded uncertainty at a desired confidence level. k=1 gives 68%, k=2 gives 95%, k=3 gives 99.7% for normal distributions.

What is the difference between accuracy and precision?

Accuracy describes closeness to the true value (systematic error / bias). Precision describes reproducibility — closeness of repeated measurements (random error / standard deviation).

What is the GUM and why is it important?

The Guide to the Expression of Uncertainty in Measurement (GUM) by BIPM provides internationally standardized methods for evaluating and expressing measurement uncertainty. It defines Type A (statistical) and Type B evaluations.

About this simulation

This simulation compares two ways of finding the uncertainty of z = f(x,y): the analytical first-order Taylor formula σ_z² = (∂f/∂x)²σ_x² + (∂f/∂y)²σ_y², and a brute-force Monte Carlo approach that draws thousands of random (x,y) pairs from Gaussian distributions and computes z for each one directly. The red analytical Gaussian curve overlays the blue Monte Carlo histogram so you can see exactly when the two methods agree and when they diverge.

🔬 What it shows

A histogram of Monte Carlo-sampled z values with an overlaid analytical Gaussian curve, a dashed line marking the Monte Carlo mean, a shaded ±1σ band, and a stats panel comparing analytic and Monte Carlo means, standard deviations, and their relative difference.

🎮 How to use

Choose a formula (sum, difference, product, ratio, square, or hypotenuse) from the dropdown, set the mean and σ for x and y with the sliders, adjust the number of Monte Carlo samples, and click Resample to redraw the comparison.

💡 Did you know?

For the linear formulas z=x+y and z=x−y, the analytical and Monte Carlo curves should overlay almost perfectly no matter how large σ_x and σ_y get — but switch to z=√(x²+y²) or z=x·y and push the input uncertainties up, and you'll watch the histogram visibly skew away from the symmetric Gaussian the linear formula predicts, exposing exactly where first-order error propagation breaks down.

Frequently asked questions

Why do the analytic and Monte Carlo σ_z values sometimes disagree?

The analytical formula is a first-order Taylor approximation valid only when the function is nearly linear across the range spanned by the input uncertainties; for genuinely nonlinear formulas like z=x² or z=√(x²+y²), pushing σ_x or σ_y larger relative to the mean makes the true distribution skew away from Gaussian, which the "Relative diff" stat quantifies directly.

Why does z = x² behave so differently from z = x + y?

Addition is exactly linear, so its partial derivatives (both equal to 1) are constant everywhere and the first-order formula is exact regardless of σ; squaring has a derivative 2x that changes with x itself, so the propagated uncertainty is only a local linear approximation — increasing σ_x on the z=x² formula is the fastest way to see the histogram visibly depart from the red analytical curve.

What does raising the MC samples slider actually improve?

More samples reduce the statistical noise in the Monte Carlo estimate itself (the empirical mean and standard deviation converge toward their true values as sample count grows), producing a smoother histogram — it does not change whether the underlying function is linear or not, so it won't fix disagreement caused by genuine nonlinearity.

Why does the product formula z = x·y need relative uncertainties, not absolute ones?

Because ∂(xy)/∂x = y and ∂(xy)/∂y = x, substituting into the general formula and dividing through by z=xy algebraically simplifies to (σ_z/z)² = (σ_x/x)² + (σ_y/y)² — this is exactly why product and ratio formulas are conventionally expressed in fractional/percentage uncertainty rather than absolute uncertainty.

Why does the histogram sometimes look asymmetric even when both inputs are perfectly Gaussian?

Any nonlinear transformation of a symmetric distribution can introduce skew — for instance, dividing two Gaussians (z=x/y) produces a distribution with heavier tails than either input, especially when y's uncertainty is large enough that samples can approach zero, a case the linear formula's constant-derivative assumption cannot capture.