Fundamentals / Numerical mathematics / Inverse problems and least squares

Bayesian inversion and the information supplied by a prior

Combine an explicit distribution for the parameters with a noise model. Calculate exactly which uncertainties an observation reduces.

From first principles

Derive a posterior from a prior and a noisy reading

Suppose the scalar parameter \(x\) has Gaussian prior mean \(m_0\) and variance \(v_0>0\), and a sensor reads \(y=x+\epsilon\), with independent Gaussian error of variance \(s^2>0\). Bayes’ rule multiplies the prior density by the probability of obtaining the reading at each trial \(x\). Its negative log, apart from constants, is

\[-\log p(x\mid y)=\frac{(x-m_0)^2}{2v_0}+\frac{(y-x)^2}{2s^2}+\mathrm{constant}.\]

The coefficient of \(x^2/2\) gives the inverse posterior variance. Matching the linear coefficient after completing the square determines the posterior mean,

\[v_1=\left(\frac1{v_0}+\frac1{s^2}\right)^{-1},\]
\[m_1=v_1\left(\frac{m_0}{v_0}+\frac{y}{s^2}\right).\]

Greater precision means larger weight. An extremely uncertain reading leaves the prior nearly unchanged, while an extremely precise measurement concentrates the posterior near the reading. These statements describe the specified prior and instrument model. They depend on the reliability of both inputs.

Derivation and applications

Predict a future reading using the full posterior uncertainty

A posterior can describe both an unknown state and measurements still to come. Suppose current data give \(x\mid y\sim N(m,C)\). A new independent instrument will observe \(y_*=a^Tx+\epsilon_*\), with known zero-mean Gaussian noise variance \(s_*^2\). Conditional on a fixed \(x\), the only variability is instrumental. Averaging over the posterior makes the expected new reading

\[\operatorname{E}[y_*\mid y]=\operatorname{E}_{x\mid y}[\operatorname{E}(y_*\mid x)]=a^Tm .\]

Apply the law of total variance. The expected conditional variance is the new instrument variance, and the variance of its conditional mean is the uncertainty in the latent signal,

\[\operatorname{var}(y_*\mid y)=\operatorname{E}_{x\mid y}[s_*^2]+\operatorname{var}_{x\mid y}(a^Tx)=s_*^2+a^TCa .\]

The new reading is Gaussian because it is a sum of independent Gaussian contributions. Two future readings along the same vector \(a\) share the latent uncertainty while retaining independent measurement errors. For \(n\) such readings of equal precision, their predicted mean has

\[\operatorname{var}(\overline y_*\mid y)=a^TCa+\frac{s_*^2}{n}.\]

Increasing the number of future repeats reduces only the noise of their average in this prediction. Once actually observed, those data can be used to update the state further. A predictive check is most informative when the new observations were excluded from the original inference and the instrument model applies under the future conditions.

Worked example

Compare a latent interval and a future reading

A posterior for one temperature has mean \(20.0\,^\circ\mathrm C\), variance \(0.16\,\mathrm{K^2}\). A new thermometer has deviation \(0.30\,\mathrm K\). Its predicted reading deviation is

\[\sqrt{0.16+0.09}=0.50\,\mathrm K.\]

A new reading of \(21.0\,^\circ\mathrm C\) lies two predictive standard deviations above the mean. Dividing its discrepancy by the latent deviation \(0.40\,\mathrm K\) would assess a different quantity.

Second application

Forecast the precision of an averaged observation

A separate model predicts a linear contrast with \(a^TCa=0.09\), and a single future reading has noise variance \(1.44\). Averaging 16 readings gives predictive deviation \(\sqrt{0.09+1.44/16}=0.424\). Even infinitely many future repeats would leave a prior-to-measurement predictive deviation \(0.300\). To reduce it to \(0.350\) would require \(n\ge1.44/(0.350^2-0.09)=44.31\), hence at least 45 readings.

From one answer to a distribution

In an experiment with \(y=Ax+\epsilon\), let the unknown have a Gaussian prior with mean \(m_0\) and covariance \(C_0\), and let measurement error be independent Gaussian with mean zero and covariance \(\Gamma\). The prior describes the state of knowledge before seeing these data. Bayes' rule multiplies the likelihood by that prior and normalises over parameters. For positive-definite covariances the negative log posterior, up to constants, is

\[\tfrac12(y-Ax)^\mathsf{T}\Gamma^{-1}(y-Ax)+\tfrac12(x-m_0)^\mathsf{T}C_0^{-1}(x-m_0).\]

The minimiser is the maximum a posteriori estimate. This objective has the same algebra as Tikhonov regularisation centred on a background. The probabilistic interpretation adds assumptions: if the distributions are taken seriously their scales and correlations imply uncertainty, not just a convenient stabiliser for a solver. A guessed smoothness penalty cannot be given calibrated probability intervals without justifying its scale.

Complete the square

Expanding the quadratic in \(x\) gives precision \(C_{\rm post}^{-1}=C_0^{-1}+A^\mathsf{T}\Gamma^{-1}A\) and mean \(m_{\rm post}=C_{\rm post}(C_0^{-1}m_0+A^\mathsf{T}\Gamma^{-1}y)\). Since the exponent is quadratic and the precision positive definite, the posterior is Gaussian and its mean is also its mode. For implementation, factor and solve the precision system. When data dimension is much smaller than parameter dimension, the equivalent data-space update can be cheaper:

\[m_{\rm post}=m_0+C_0 A^\mathsf{T}(AC_0A^\mathsf{T}+\Gamma)^{-1}(y-Am_0).\]

The same matrix multiplying the data discrepancy determines how far knowledge moves from the prior. A reading much more precise than the prior prediction has high influence in its observed direction; an observation compatible with a broad noise distribution does less. In this linear Gaussian setting posterior covariance depends on design and noise, while the posterior mean also depends on the realised data values.

Recover a sum and ask about the difference

Take two independent prior components with means zero and variances 1. Observe their sum as 3 with noise variance 1. The predicted observation variance is \(1+1+1=3\), so the update gives \(m_{\rm post}=(1,1)\). The posterior covariance is \(I-\frac13\left(\begin{smallmatrix}1&1\\1&1\end{smallmatrix}\right)\). Thus the sum has posterior variance \(2/3\), down from 2, while the difference still has variance 2. A unique best estimate of the difference exists (zero), but here the measurement supplied no information about it. Reporting only the point estimate would conceal that distinction.

Interpret prior correlations and check their consequences

If nearby temperatures have positively correlated priors, observing one cell can reduce uncertainty in another even when its forward sensitivity is zero. That reduction is conditional on the correlation model. Change the correlation length, rerun the update and examine the target prediction. Before training, draw plausible prior fields or use representative quantiles and pass them through the forward operator. If almost every predicted data set violates basic instrument ranges or physical constraints, revisit the prior or parameterisation. This prior-predictive check uses no fitted residual and can uncover a consequential modelling error before a numerical optimiser converges.

Condition a second update on what the first already revealed

Suppose two observation errors share a known source, so processing each reading as an independent likelihood risks counting some information twice. For a scalar parameter and common response coefficient one, write \(y_1=x+e_1,\ y_2=x+e_2\). Let the errors be jointly Gaussian with variances \(v_1,v_2\), covariance \(c\), and independence from the prior parameter. Subtract \(\alpha=c/v_1\) times the first reading from the second. The transformed second error \(e_2-\alpha e_1\) has zero covariance with \(e_1\). Gaussianity strengthens that fact to independence. Its variance is \(v_2-c^2/v_1\) and its response coefficient is \(1-\alpha\).

The data can now be processed sequentially with the same result as a full joint update. If the new transformed coefficient is small, its effect is small even if the reading itself appears precise. The assumption that the original covariance is positive definite guarantees a positive residual variance. Perfectly correlated errors require a separate treatment of any exact difference equation. With non-Gaussian errors, decorrelation alone does not establish independent likelihoods, even when a linear unbiased estimator remains available.

Compare an independent replicate with a correlated one

Start with prior \(x\sim N(0,4)\). Two readings, 2 and 3, have unit marginal error variances and covariance \(1/2\). After the first observation, the precision rises from \(1/4\) to \(5/4\) and the precision-weighted mean rises from zero to 2. Thus the intermediate posterior has variance \(4/5\) and mean \(8/5\). The adjusted second datum is \(3-(1/2)2=2\), with observation coefficient \(1/2\) and noise variance \(1-1/4=3/4\). Its contribution to precision is \((1/2)^2/(3/4)=1/3\), much smaller than the unit contribution of an independent replicate.

The final precision is

\[5/4+1/3=19/12.\]

The adjusted datum adds \((1/2)2/(3/4)=4/3\) to the weighted mean, giving posterior variance \(12/19\) and mean \((2+4/3)(12/19)=40/19\). The mean is about 2.11 and the standard deviation about 0.795. Incorrectly treating both original readings as independent would give variance \(4/9\), mean \(20/9\), and standard deviation \(2/3\). The same pair of readings has therefore yielded a more confident answer solely by suppressing part of the noise model.

An independent check uses the average and difference of the two observations. Their respective signal coefficients are one and zero; equal marginal variances make these two errors uncorrelated and hence independent. The average is 2.5 with variance \((1+1+2\cdot0.5)/4=0.75\) and therefore adds precision \(4/3\) to the prior. The difference remains available for checking the joint error model, even though it supplies no information about \(x\). Both routes give the same posterior when each part of the evidence is used exactly once.

For the numbers used here the difference \(3-2=1\) has variance \(1+1-2(1/2)=1\). It is one standard deviation from the expected zero difference. Thus there is no substantial conflict between these two readings under their correlation model, even though treating them as independent would exaggerate the information available about their shared underlying value.

Update an unobserved parameter through prior correlation

Two cell values have prior means zero, unit variances and correlation \(\rho\). Only the first cell is observed, yielding 3 in measurement noise of variance one. The data-space update transfers information to the other cell through cross-covariance.

Update an unobserved parameter through prior correlation. Horizontal axis: Prior correlation between two cells. Vertical axis: Posterior mean increment or standard deviation. Data follow the figure.
At ρ = 0 the second cell is unaffected. At ρ = ±0.8 its mean moves by ±1.2 while both posterior standard deviations of that second cell equal √0.68. The magnitude of the uncertainty reduction hides the sign of the assumed physical relation.
Read values from the plot
Posterior mean increment or standard deviation at selected values of Prior correlation between two cells.
Prior correlation between two cellsSecond cell mean shiftSecond cell posterior σ
−0.95−1.4250.74078
−0.47−0.7050.94316
1.1102e−161.6653e−161
0.470.7050.94316
0.951.4250.74078

Download all 191 plotted samples (CSV)

Change parameters · Update an unobserved parameter through prior correlation

Change one input at a time and compare the recalculated curves with the argument above. The browser evaluates this small model locally; the accompanying numerical values state its assumptions and reference checks. Reset restores the reference inputs, and the data can be downloaded as CSV.

Study the full derivation

What each new sensor reading changes in a Gaussian inverse problem · Inferring parameters and fields from observations

Start with an uncertain vector, condition on one noisy linear observation, and reconstruct the posterior mean and covariance without repeating a batch inversion. Check shared calibration errors before treating repeated measurements as independent evidence.