Foundations to Frontier
Tests
A. Mathematical Foundations › A4 Probability Theory › Distributions

The Multivariate Gaussian: Marginals, Conditionals, Linear Transforms

The multivariate Gaussian is the workhorse of estimation. It's fully described by a mean vector and a covariance matrix, and it stays Gaussian when you marginalize, condition or apply a linear map, each with an exact closed-form formula. Those three facts are the Kalman filter, Gaussian-process regression, chi-square gating for outliers, and sensor fusion. The one subtlety is that 'uncorrelated means independent' needs joint Gaussianity.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

A bell curve in several dimensions

A robot’s position estimate is uncertain in both xx and yy. Picture a cloud of possible positions. In the most common case it’s shaped like an ellipse, dense in the middle and fading out. That’s a multivariate Gaussian. The ellipse’s size shows how uncertain you are. Its tilt shows how the errors are linked: if xx is probably too big, yy probably is too.

Here’s the magic. If you learn yy exactly, your uncertainty about xx shrinks, and the new uncertainty is again a bell curve, with a simple formula.

The 2-D Gaussian: ellipses, marginals and conditionals
marginal x₁ ~ N(0, 2.25)
conditional x₁ | x₂ = 1.00 ~ N(1.05, 1.15): mean μ₁ + ρ(σ₁/σ₂)c, variance σ₁²(1 − ρ²)
probe Mahalanobis² = 13.39 ❌ outside: rejected as an outlier
Solid ellipse: 1σ. Dashed: the 95% region (χ²₂ = 5.99). Purple: the slice x₂ = c and the conditional density along it, which is narrower than the marginal whenever ρ ≠ 0. Try a probe far from the centre along the minor axis: it's rejected even though it's close in plain distance.
Why engineers care

Every Kalman filter, from Apollo’s guidance computer to a phone’s GPS, keeps its belief as a multivariate Gaussian. Each new measurement updates that belief using the conditioning formula on this page.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A tilted uncertainty ellipse means the errors are…
  2. 2. Learning y (when correlated with x) makes x's uncertainty…
  3. 3. A z-score of 2 means the value is…

Level 1: Beginner

★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.

Definition

x∼N(μ,Σ)\mathbf x\sim\mathcal N(\boldsymbol\mu, \Sigma) in Rd\mathbb R^d has density

p(x)=1(2π)d/2∣Σ∣1/2exp⁡(−12(x−μ)⊤Σ−1(x−μ))p(\mathbf x) = \frac1{(2\pi)^{d/2}|\Sigma|^{1/2}}\exp\Big(-\tfrac12(\mathbf x - \boldsymbol\mu)^\top\Sigma^{-1}(\mathbf x - \boldsymbol\mu)\Big)

The level sets are ellipsoids. Their axes are Σ’s eigenvectors, and their radii are the square roots of its eigenvalues (A2.3-2). In 2-D, Σ=[σ12ρσ1σ2ρσ1σ2σ22]\Sigma = \begin{bmatrix}\sigma_1^2&\rho\sigma_1\sigma_2\\\rho\sigma_1\sigma_2&\sigma_2^2\end{bmatrix}.

The three closure properties

Partition x=(x1,x2)\mathbf x = (\mathbf x_1, \mathbf x_2), with μ=(μ1,μ2)\boldsymbol\mu = (\boldsymbol\mu_1,\boldsymbol\mu_2) and Σ=[Σ11Σ12Σ21Σ22]\Sigma = \begin{bmatrix}\Sigma_{11}&\Sigma_{12}\\\Sigma_{21}&\Sigma_{22}\end{bmatrix}.

Operation Result
marginal x1∼N(μ1,Σ11)\mathbf x_1\sim\mathcal N(\boldsymbol\mu_1, \Sigma_{11}), so just read off the block
conditional x1∣x2∼N(μ1+Σ12Σ22−1(x2−μ2), Σ11−Σ12Σ22−1Σ21)\mathbf x_1\mid\mathbf x_2\sim\mathcal N\big(\boldsymbol\mu_1 + \Sigma_{12}\Sigma_{22}^{-1}(\mathbf x_2 - \boldsymbol\mu_2),\ \Sigma_{11} - \Sigma_{12}\Sigma_{22}^{-1}\Sigma_{21}\big)
linear map Ax+b∼N(Aμ+b,AΣA⊤)A\mathbf x + \mathbf b\sim\mathcal N(A\boldsymbol\mu + \mathbf b, A\Sigma A^\top)

In 2-D: x1∣x2=cx_1\mid x_2 = c has mean μ1+ρσ1σ2(c−μ2)\mu_1 + \rho\frac{\sigma_1}{\sigma_2}(c - \mu_2) and variance σ12(1−ρ2)\sigma_1^2(1 - \rho^2). The conditional variance doesn’t depend on cc.

📝 Quick check (Level 1)
0/3 answered
  1. 1. Σ = [[2, 0.8], [0.8, 1]], μ = 0: E[x₁ | x₂ = 1] = ?
  2. 2. Same: Var(x₁ | x₂) = ?
  3. 3. Var(x₁ + x₂) for that Σ?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Sampling and Mahalanobis distance

  • Sampling. Factor Σ=LL⊤\Sigma = LL^\top (Cholesky), then x=μ+Lz\mathbf x = \boldsymbol\mu + L\mathbf z with z∼N(0,I)\mathbf z\sim\mathcal N(0, I) has covariance LL⊤=ΣLL^\top = \Sigma. That’s the linear-map rule in reverse.
  • Mahalanobis distance: d2(x)=(x−μ)⊤Σ−1(x−μ)d^2(\mathbf x) = (\mathbf x - \boldsymbol\mu)^\top\Sigma^{-1}(\mathbf x - \boldsymbol\mu) measures distance in units of the uncertainty. For Gaussian x\mathbf x, d2∼χd2d^2\sim\chi^2_d. The 95% gate is d2≤5.99d^2\le5.99 in 2-D and 7.817.81 in 3-D. Trackers and SLAM front-ends use this to reject outlier measurements (chi-square gating) and to decide which measurement belongs to which target.

Sensor fusion in information form

Two Gaussian measurements of the same quantity combine by multiplying densities. The product is Gaussian, with

  • precisions adding: Σ−1=Σ1−1+Σ2−1\Sigma^{-1} = \Sigma_1^{-1} + \Sigma_2^{-1};
  • a precision-weighted mean: μ=Σ(Σ1−1μ1+Σ2−1μ2)\boldsymbol\mu = \Sigma(\Sigma_1^{-1}\boldsymbol\mu_1 + \Sigma_2^{-1}\boldsymbol\mu_2).

Each sensor dominates in the directions where it’s precise (Practice Code 5). This is the “information filter” and the factor-graph view of SLAM.

Jointly Gaussian: uncorrelated ⇒ independent

If (x1,x2)(\mathbf x_1, \mathbf x_2) is jointly Gaussian with Σ12=0\Sigma_{12} = 0, the density factorizes, so the blocks are independent. This is the only common family where uncorrelated implies independent. Gaussian marginals alone aren’t enough. With Y=SXY = SX and a random sign SS, YY is normal and uncorrelated with XX, yet ∣Y∣=∣X∣|Y| = |X| (Practice Code 4).

🐍 Exercise 1: sample, marginalize, condition, transform
Sample a 3-D Gaussian with Cholesky and compute its log-density. Implement the conditioning formula and verify it on a thin slab of samples, then confirm the linear-map rule AX + b ~ N(Aμ + b, AΣAᵀ).
📝 Quick check (Level 2)
0/3 answered
  1. 1. To sample N(μ, Σ), use x = μ + Lz with…
  2. 2. The 95% Mahalanobis gate in 2-D is d² ≤ …
  3. 3. Fusing two Gaussian estimates…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Deriving the conditional (Schur complement)

Write x1=μ1+K(x2−μ2)+e\mathbf x_1 = \boldsymbol\mu_1 + K(\mathbf x_2 - \boldsymbol\mu_2) + \mathbf e with K=Σ12Σ22−1K = \Sigma_{12}\Sigma_{22}^{-1}. Then Cov⁡(e,x2)=Σ12−KΣ22=0\operatorname{Cov}(\mathbf e, \mathbf x_2) = \Sigma_{12} - K\Sigma_{22} = 0. Because (e,x2)(\mathbf e, \mathbf x_2) is jointly Gaussian (a linear map of x\mathbf x), zero covariance means independence. So given x2\mathbf x_2, x1\mathbf x_1 equals a known shift plus independent noise e\mathbf e, with Cov⁡e=Σ11−KΣ21\operatorname{Cov}\mathbf e = \Sigma_{11} - K\Sigma_{21}, the Schur complement Σ/Σ22\Sigma/\Sigma_{22}. ∎

Linear maps stay Gaussian

The characteristic function of a Gaussian is φ(t)=eit⊤μ−12t⊤Σt\varphi(\mathbf t) = e^{i\mathbf t^\top\boldsymbol\mu - \frac12\mathbf t^\top\Sigma\mathbf t}. For y=Ax+b\mathbf y = A\mathbf x + \mathbf b, φy(t)=eit⊤bφx(A⊤t)\varphi_{\mathbf y}(\mathbf t) = e^{i\mathbf t^\top\mathbf b}\varphi_{\mathbf x}(A^\top\mathbf t), which is Gaussian with mean Aμ+bA\boldsymbol\mu + \mathbf b and covariance AΣA⊤A\Sigma A^\top. It’s valid even when AA is rank-deficient, giving a degenerate Gaussian on a subspace. ∎

The Kalman update is conditioning

Take a prior x∼N(m,P)\mathbf x\sim\mathcal N(\mathbf m, P) and a measurement z=Hx+v\mathbf z = H\mathbf x + \mathbf v with v∼N(0,R)\mathbf v\sim\mathcal N(0, R). Then (x,z)(\mathbf x, \mathbf z) is jointly Gaussian, with Cov⁡(x,z)=PH⊤\operatorname{Cov}(\mathbf x,\mathbf z) = PH^\top and Cov⁡(z)=HPH⊤+R\operatorname{Cov}(\mathbf z) = HPH^\top + R. The conditioning formula gives

K=PH⊤(HPH⊤+R)−1,m+=m+K(z−Hm),P+=(I−KH)PK = PH^\top(HPH^\top + R)^{-1}, \qquad \mathbf m^+ = \mathbf m + K(\mathbf z - H\mathbf m), \qquad P^+ = (I - KH)P

That’s exactly the Kalman update (Kalman, 1960; Exercise 2).

Exercise 3.1: Scalar case. Prior N(0, 1), measurement z = x + v with v ~ N(0, 0.25). Find K and the posterior variance.

K=1/(1+0.25)=0.8K = 1/(1 + 0.25) = 0.8, and the posterior variance is (1−0.8)⋅1=0.2(1 - 0.8)\cdot1 = 0.2. Equivalently, the precisions add: 1+4=51 + 4 = 5.

📝 Quick check (Level 3)
0/3 answered
  1. 1. The conditional covariance is the…
  2. 2. The Kalman gain with P = 1, R = 0.25 (scalar, H = 1)?
  3. 3. Does the conditional covariance depend on the observed value x₂?

Level 4: Expert

★★★★★ Expert⏱ 45 minResearchers: original papers and open problems.

Filters and Gaussian processes: one idea

  • Kalman filtering. Predict with the linear-map rule (P←FPF⊤+QP\leftarrow FPF^\top + Q), then update by conditioning on the measurement. Exact for linear-Gaussian systems, it guided Apollo’s navigation (McGee and Schmidt, 1985) and runs in every GNSS/INS today. The EKF and UKF approximate nonlinear systems (A4.1-5).
  • Gaussian-process regression treats function values at any finite set of inputs as jointly Gaussian, with covariance given by a kernel. Predicting at new inputs is conditioning on the training values (Rasmussen and Williams, 2006). The posterior interpolates the data and returns to the prior far away. GPs model terrain, learned dynamics residuals and safe-exploration constraints in robotics (Berkenkamp et al., 2017).
🐍 Exercise 2 (research): Kalman filtering and GP regression as Gaussian conditioning
Track a constant-velocity target with a Kalman filter and verify that every measurement update equals conditioning the joint Gaussian of (state, measurement). Then do GP regression by conditioning, and check interpolation near the data and reversion to the prior far away.

More Gaussian machinery in AI and robotics

  • Factor graphs and SLAM. With Gaussian noise, MAP estimation becomes nonlinear least squares, and the information matrix’s sparsity mirrors the graph (Dellaert and Kaess, 2017).
  • Diffusion models add Gaussian noise step by step. The reverse step is a learned conditional Gaussian (Ho, Jain and Abbeel, 2020).
  • Gaussian policies in continuous-control RL, a∼N(μθ(s),Σθ(s))a\sim\mathcal N(\mu_\theta(s), \Sigma_\theta(s)), are trained with the log-density gradient (PPO, SAC).
  • Probabilistic motion planning propagates Gaussian state uncertainty along a trajectory, then uses chance constraints, such as keeping the 3σ ellipse clear of obstacles (Blackmore, Ono and Williams, 2011).

References

  1. R. E. Kalman (1960). “A new approach to linear filtering and prediction problems.” Journal of Basic Engineering, 82.
  2. L. McGee, S. Schmidt (1985). Discovery of the Kalman Filter as a Practical Tool for Aerospace and Industry. NASA TM-86847.
  3. C. Rasmussen, C. Williams (2006). Gaussian Processes for Machine Learning. MIT Press.
  4. Y. Bar-Shalom, X. R. Li, T. Kirubarajan (2001). Estimation with Applications to Tracking and Navigation. Wiley. (Gating.)
  5. F. Berkenkamp, M. Turchetta, A. Schoellig, A. Krause (2017). “Safe model-based reinforcement learning with stability guarantees.” NeurIPS.
  6. F. Dellaert, M. Kaess (2017). “Factor graphs for robot perception.” Foundations and Trends in Robotics, 6(1–2).
  7. J. Ho, A. Jain, P. Abbeel (2020). “Denoising diffusion probabilistic models.” NeurIPS.
  8. L. Blackmore, M. Ono, B. Williams (2011). “Chance-constrained optimal path planning with obstacles.” IEEE Transactions on Robotics, 27(6).
  9. K. Petersen, M. Pedersen (2012). The Matrix Cookbook. (Gaussian identities.)