Basic Probability & Statistics

SLAM is at its core a probabilistic estimation problem: given noisy sensor data, what is the most likely state (pose + map) of the robot? Probability theory provides the rigorous language for reasoning under uncertainty.

Gaussian Distribution

The univariate Gaussian (normal) distribution with mean μ\mu and standard deviation σ\sigma has probability density function:

p(x)=1σ2πexp ⁣((xμ)22σ2)p(x) = \frac{1}{\sigma\sqrt{2\pi}} \exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right)

SLAM states are multi-dimensional, so we use the multivariate Gaussian. For a random vector xRn\mathbf{x} \in \mathbb{R}^n with mean μ\boldsymbol{\mu} and covariance matrix Σ\boldsymbol{\Sigma} (symmetric positive definite):

p(x)=1(2π)n/2Σ1/2exp ⁣(12(xμ)TΣ1(xμ))p(\mathbf{x}) = \frac{1}{(2\pi)^{n/2}|\boldsymbol{\Sigma}|^{1/2}} \exp\!\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right)

The argument of the exponential, (xμ)TΣ1(xμ)(\mathbf{x}-\boldsymbol{\mu})^T\boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu}), is the Mahalanobis distance — a scale-invariant measure of how far x\mathbf{x} is from the mean. In SLAM, the covariance Σ\boldsymbol{\Sigma} encodes uncertainty: a large diagonal entry Σii\Sigma_{ii} means we are uncertain about the ii-th component of the state.

Two properties make Gaussians the workhorse of estimation:

Bayes’ Theorem

Bayes’ theorem is the engine of probabilistic SLAM. It relates the posterior p(xz)p(\mathbf{x}|\mathbf{z}) (our belief about state x\mathbf{x} given observation z\mathbf{z}) to the likelihood p(zx)p(\mathbf{z}|\mathbf{x}) and prior p(x)p(\mathbf{x}):

p(xz)=p(zx)p(x)p(z)p(zx)p(x)p(\mathbf{x} \mid \mathbf{z}) = \frac{p(\mathbf{z} \mid \mathbf{x})\, p(\mathbf{x})}{p(\mathbf{z})} \propto p(\mathbf{z} \mid \mathbf{x})\, p(\mathbf{x})

In SLAM, x\mathbf{x} is the robot pose (and map) and z\mathbf{z} is the camera image (or feature observations). The prior comes from a motion model; the likelihood comes from an observation model. Recursive application of Bayes’ theorem — predict then update — is the basis of the Extended Kalman Filter (EKF-SLAM) and particle filters.

MAP and MLE

Finding the state that maximizes the posterior is Maximum A Posteriori (MAP) estimation:

x=argmaxxp(xz)=argmaxxp(zx)p(x)\mathbf{x}^* = \arg\max_{\mathbf{x}}\, p(\mathbf{x} \mid \mathbf{z}) = \arg\max_{\mathbf{x}}\, p(\mathbf{z} \mid \mathbf{x})\, p(\mathbf{x})

When the prior is uniform, MAP reduces to Maximum Likelihood Estimation (MLE). For Gaussian noise models, MLE is equivalent to minimizing a sum of squared errors — which is precisely what bundle adjustment does.

From MLE to least squares (the key derivation)

Assume independent observations zi\mathbf{z}_i with Gaussian noise: zi=hi(x)+ϵi\mathbf{z}_i = \mathbf{h}_i(\mathbf{x}) + \boldsymbol{\epsilon}_i, ϵiN(0,Σi)\boldsymbol{\epsilon}_i \sim \mathcal{N}(\mathbf{0}, \boldsymbol{\Sigma}_i). The likelihood is a product, so its negative logarithm is a sum:

logip(zix)=12i(zihi(x))TΣi1(zihi(x))+const-\log \prod_i p(\mathbf{z}_i \mid \mathbf{x}) = \frac{1}{2}\sum_i \big(\mathbf{z}_i - \mathbf{h}_i(\mathbf{x})\big)^T \boldsymbol{\Sigma}_i^{-1} \big(\mathbf{z}_i - \mathbf{h}_i(\mathbf{x})\big) + \text{const}

Maximizing the likelihood therefore equals minimizing the sum of squared Mahalanobis-weighted residuals. This one line connects probability to optimization: bundle adjustment, pose graph optimization, and factor graph inference are all MAP estimation with Gaussian noise, and the information matrix Σi1\boldsymbol{\Sigma}_i^{-1} is exactly the weight each residual gets.

Common pitfalls

Why it matters for SLAM

The two dominant families of SLAM back-ends — filtering (EKF, particle filters) and smoothing (factor graphs, bundle adjustment) — are both direct applications of Bayesian estimation under Gaussian noise. Understanding Gaussians, Bayes’ theorem, and the MAP/MLE connection is what lets you see that a Kalman filter update and a least-squares solve are two views of the same underlying inference problem.