第二章 概率论基础

Chapter 2   Primer on Probability Theory

本章目标:建立全书所需的概率工具箱。核心是三件事:(1)用概率密度函数描述不确定性;(2)用贝叶斯公式融合先验知识和新测量;(3)理解高斯分布的一切性质——因为后续几乎所有算法都建立在它之上。

Chapter goal: Build the probability toolkit for the entire book. Three essentials: (1) represent uncertainty with probability density functions; (2) fuse prior knowledge with new measurements via Bayes’ rule; (3) master Gaussian distributions—virtually every algorithm in this book relies on them.


2.0 从零开始:什么是概率? / Starting from Zero: What Is Probability?

中文

在进入数学之前,先建立直觉。

频率派 vs 贝叶斯派:概率有两种解释方式。

  • 频率派:概率是长期频率。掷骰子掷 1000 次,1 朝上出现约 167 次,所以 。概率是客观的、可重复实验的属性。
  • 贝叶斯派:概率是信念程度(degree of belief)。“明天下雨的概率是 70%“——这个事件只会发生一次,不能重复。但你可以用 0.7 这个数字表达你的信念强度。

本书采用贝叶斯观点。对我们来说,“机器人在位置 处的概率”不是”机器人走了无穷多次路径中有多少次在 “,而是”给定我迄今为止的所有测量,我相信机器人在 处的程度“。随着测量的增加,这个信念会不断更新。

连续 vs 离散:日常生活中的概率往往是离散的(骰子有6个面,抛硬币有2种结果)。但机器人的位置是连续的——它可以在空间中的任意一点。处理连续量需要概率密度函数(PDF),而不是简单的概率列表。


English

Before the mathematics, build intuition.

Frequentist vs Bayesian. Probability has two interpretations.

  • Frequentist: probability is long-run frequency. Roll a die 1000 times; “1” appears about 167 times, so . Probability is an objective property of repeatable experiments.
  • Bayesian: probability is a degree of belief. “70% chance of rain tomorrow”—this event happens only once, not repeatedly. The number 0.7 quantifies strength of belief.

This book adopts the Bayesian view. “The probability that the robot is at position ” means: given all measurements collected so far, how strongly do I believe the robot is at ? As measurements arrive, beliefs are updated.

Continuous vs discrete. Daily-life probabilities are often discrete (dice: 6 faces). But a robot’s position is continuous—it can be anywhere in space. Handling continuous quantities requires probability density functions (PDFs) rather than simple probability lists.


2.1 概率密度函数 / Probability Density Functions

2.1.1 定义 / Definitions

中文

基础概念:随机变量

是一个随机变量——它的值不是确定的,而是按某种概率分布取值。例如:

  • 机器人的位置估计 (一维情形)
  • 传感器的噪声

描述随机变量 在区间 内取各值可能性的函数,叫做概率密度函数(PDF) ,它满足两个条件:

  1. 非负性(概率不能为负)
  2. 归一性(全概率公理)\int_a^b p(x)\, dx = 1 \tag{2.1} 即所有可能结果的概率之和为 1。

密度 ≠ 概率 是概率密度,不是概率本身,它可以大于 1!概率是密度函数下的面积

类比:想象一块铁板,质量密度(单位面积质量)可以很大,但你要得到一小块的质量,需要用密度乘以面积(积分)。

落在区间 内的概率是: \Pr(c \leq x \leq d) = \int_c^d p(x)\, dx \tag{2.2}

累积分布函数(CDF) 给出 小于等于某值的概率: P(x) = \Pr(x' \leq x) = \int_{-\infty}^x p(x')\, dx' \tag{2.3}

是单调不减的,从 (在 处)增长到 (在 处)。

条件概率密度 表示”在已知 的条件下 的概率密度”,对每个固定的 ,它仍然是关于 的合法 PDF: (\forall y)\quad \int_a^b p(x \mid y)\, dx = 1 \tag{2.4}

多维情形:当状态向量 时,联合 PDF 满足: \int \cdots \int p(x_1, x_2, \ldots, x_N)\, dx_1\, dx_2 \cdots dx_N = 1 \tag{2.7}


English

Random variable. A random variable does not have a fixed value but instead takes values according to a probability distribution. Examples: a robot’s estimated position, sensor noise.

A probability density function (PDF) over the interval satisfies:

  1. Non-negativity:
  2. Total probability axiom:

Density ≠ probability. can exceed 1. Probability is the area under the density curve over an interval:

The CDF gives the probability that the variable is .


2.1.2 边缘化与贝叶斯定理 / Marginalization and Bayes’ Rule

中文

这一节是全书最重要的内容之一。

联合分布的因式分解

对于两个随机变量 的联合分布 ,有一个基本的分解: p(\mathbf{x}, \mathbf{y}) = p(\mathbf{x} \mid \mathbf{y})\, p(\mathbf{y}) = p(\mathbf{y} \mid \mathbf{x})\, p(\mathbf{x}) \tag{2.8}

这就是说,“x 和 y 同时发生”的概率 = “已知 y 时 x 发生的概率” × “y 发生的概率”。

直觉:抛一枚硬币,再掷一个骰子。“硬币正面且骰子出现3”的概率 =

边缘化(Marginalization)

对联合分布 关于 积分,得到 边缘分布p(\mathbf{y}) = \int p(\mathbf{x}, \mathbf{y})\, d\mathbf{x} = \int p(\mathbf{x} \mid \mathbf{y})\, p(\mathbf{y})\, d\mathbf{x} = p(\mathbf{y}) \tag{2.9}

直觉:你知道北京今天是晴天还是阴天的联合概率 。如果你对温度不感兴趣,只想知道天气的概率,就把所有可能的温度”积分掉”,得到 。这就是边缘化——“抹去”不关心的变量。


贝叶斯定理(Bayes’ Rule)—— 全书的核心引擎

由公式 (2.8) 的两种因式分解,立刻得到: \boxed{p(\mathbf{x} \mid \mathbf{y}) = \frac{p(\mathbf{y} \mid \mathbf{x})\, p(\mathbf{x})}{p(\mathbf{y})}} \tag{2.10}

在状态估计中,各项的含义是:

符号名称含义
先验(prior)在获得测量之前,对状态的信念
似然(likelihood)传感器模型:如果状态是 ,得到测量 的概率
后验(posterior)获得测量 之后,对状态的更新信念
归一化常数 无关,确保后验积分为 1

用文字表达:

直觉:你站在一个房间里,不知道自己在哪里。先验 是你”蒙眼走进来”时各位置的概率分布(假设均匀分布)。然后你看到窗户——这是一个测量 。似然 告诉你:如果你在位置 ,看到窗户的可能性有多大。贝叶斯公式把这两个信息结合起来,给出后验 ——有窗户的墙附近概率更高。

分母通过边缘化计算: p(\mathbf{y}) = \int p(\mathbf{y} \mid \mathbf{x})\, p(\mathbf{x})\, d\mathbf{x} \tag{2.12}

这个积分在一般情形下计算量巨大。卡尔曼滤波器的伟大之处在于,当 都是高斯分布时,这个积分有解析解。


English

Joint factorization:

Marginalization: integrating a joint density over one variable yields the marginal of the other:

Bayes’ rule rearranges the factorization to give the posterior: p(\mathbf{x} \mid \mathbf{y}) = \frac{p(\mathbf{y} \mid \mathbf{x})\, p(\mathbf{x})}{p(\mathbf{y})} \tag{2.10}

In state estimation: is the prior (belief before measurement), is the sensor model (likelihood of seeing if the state is ), and is the posterior (updated belief after measurement). The denominator is a normalizing constant. In words:

The denominator requires computing , which is generally expensive. The Kalman filter achieves this in closed form when both the prior and likelihood are Gaussian.


2.1.3 期望与矩 / Expectations and Moments

中文

期望算子

期望算子 计算某个关于随机变量 的函数 的”平均值”: E[f(\mathbf{x})] = \int f(\mathbf{x})\, p(\mathbf{x})\, d\mathbf{x} \tag{2.13}

直觉:如果你把骰子掷 100 次,每次结果乘以它出现的次数再除以 100,就得到期望值 。连续情形把求和换成积分。

两个最重要的期望:均值与协方差

均值(mean) 是 PDF 的”重心”,即随机变量的期望值: \boldsymbol{\mu} = E[\mathbf{x}] = \int \mathbf{x}\, p(\mathbf{x})\, d\mathbf{x} \tag{2.16}

协方差矩阵(covariance matrix) 描述随机变量围绕均值的散布程度各分量之间的相关性\boldsymbol{\Sigma} = E\left[(\mathbf{x} - \boldsymbol{\mu})(\mathbf{x} - \boldsymbol{\mu})^T\right] \tag{2.17}

协方差矩阵的物理意义(以二维为例):

  • 的方差,即 偏离均值的平均平方距离。 是标准差。
  • 的方差。
  • 的协方差。若 ,则 大时 也倾向于大(正相关);若 ,反相关;若 ,不相关。

协方差矩阵始终是对称正定矩阵(symmetric positive-definite),这意味着对任意非零向量 ,有 。几何上,它定义了一个椭球形的不确定性区域。

两个联合分布变量 互协方差\text{cov}(\mathbf{x}, \mathbf{y}) = E\left[(\mathbf{x} - E[\mathbf{x}])(\mathbf{y} - E[\mathbf{y}])^T\right] = E[\mathbf{x}\mathbf{y}^T] - E[\mathbf{x}]E[\mathbf{y}]^T \tag{2.18}


English

The expectation of a function under PDF is its probability-weighted average:

The mean is the centre of mass of the PDF.

The covariance matrix encodes both the spread of each component (diagonal entries = variances) and pairwise correlations (off-diagonal entries). It is always symmetric positive-definite and geometrically defines an ellipsoidal uncertainty region.


2.1.4 统计独立与不相关 / Independence and Uncorrelatedness

中文

统计独立:如果知道 的值对 的概率分布没有任何影响,则 统计独立: p(\mathbf{x}, \mathbf{y}) = p(\mathbf{x})\, p(\mathbf{y}) \tag{2.19}

不相关:若互协方差为零,即 ,则称不相关: E[\mathbf{x}\mathbf{y}^T] = E[\mathbf{x}]E[\mathbf{y}]^T \tag{2.20}

重要区别

  • 统计独立 不相关(可以证明)
  • 不相关 统计独立(一般情形)

例外:对于高斯分布,不相关等价于统计独立!(见 §2.2.3)这是高斯分布的一个特殊而美妙的性质,极大地简化了计算。


English

and are statistically independent if . They are uncorrelated if .

Independence implies uncorrelatedness, but not vice versa in general. For Gaussian distributions specifically, these conditions are equivalent (§2.2.3).


2.1.5 香农信息与互信息 / Shannon Information and Mutual Information

中文

香农熵(Shannon entropy) 衡量一个 PDF 的”不确定性”有多大: H(\mathbf{x}) = -E[\ln p(\mathbf{x})] = -\int p(\mathbf{x})\ln p(\mathbf{x})\, d\mathbf{x} \tag{2.21}

直觉

  • 如果 PDF 非常尖锐(集中在一点附近), 在峰值处很大, 很大(负号后变小),熵 小。→ 不确定性小。
  • 如果 PDF 非常平坦(均匀分布),所有值等可能, 最大。→ 不确定性最大。

互信息(mutual information) 衡量”知道 之后,对 的不确定性减少了多少”: I(\mathbf{x}, \mathbf{y}) = \iint p(\mathbf{x}, \mathbf{y})\ln\frac{p(\mathbf{x}, \mathbf{y})}{p(\mathbf{x})p(\mathbf{y})}\, d\mathbf{x}\, d\mathbf{y} \tag{2.22}

性质:

  • ,等号成立当且仅当 统计独立

互信息常用于传感器选择:选择那个能最大程度减少状态不确定性的传感器。


English

Shannon entropy quantifies the uncertainty of a PDF: a sharply peaked PDF has low entropy (low uncertainty); a flat PDF has high entropy (high uncertainty).

Mutual information measures how much knowing reduces uncertainty about . It equals zero if and only if and are independent.


2.1.6 KL 散度:衡量两个 PDF 的差异 / Kullback–Leibler Divergence

中文

给定两个关于同一随机变量的 PDF KL 散度衡量它们之间的”距离”: \text{KL}(p_2 \| p_1) = -\int p_2(\mathbf{x})\ln\frac{p_1(\mathbf{x})}{p_2(\mathbf{x})}\, d\mathbf{x} \geq 0 \tag{2.25}

性质:

  • 始终非负, 当且仅当
  • 不对称(所以不是严格意义上的”距离”)

KL 散度在第 6 章的变分推断中扮演核心角色,用于找到一个简单分布(高斯)来近似一个复杂的后验分布。


English

The KL divergence measures how different two PDFs are. It is zero only when they are identical, and is asymmetric (). It plays a central role in variational inference (Chapter 6).


2.1.7–2.1.9 随机采样与归一化乘积 / Sampling and Normalized Product

中文

随机采样:从 PDF 生成一个随机样本(记作 )就像”按照概率的权重随机抽签”。粒子滤波器(第 4 章)大量使用这一操作。

对于标量高斯,可以先从均匀分布 采样,再通过分位数函数(CDF 的反函数)变换得到高斯样本。多维情形见 §2.2.13。

样本均值与协方差:给定 个样本 ,用以下公式估计真实均值和协方差: \hat{\boldsymbol{\mu}} = \frac{1}{N}\sum_{i=1}^N \mathbf{x}_{i,\text{meas}}, \qquad \hat{\boldsymbol{\Sigma}} = \frac{1}{N-1}\sum_{i=1}^N (\mathbf{x}_{i,\text{meas}} - \hat{\boldsymbol{\mu}})(\mathbf{x}_{i,\text{meas}} - \hat{\boldsymbol{\mu}})^T \tag{2.29}

分母用 而非 ,称为 Bessel 修正,使样本协方差成为真实协方差的无偏估计。

归一化乘积:两个 PDF 的归一化乘积: p(\mathbf{x}) = \eta\, p_1(\mathbf{x})\, p_2(\mathbf{x}), \quad \eta = \left(\int p_1(\mathbf{x})\, p_2(\mathbf{x})\, d\mathbf{x}\right)^{-1} \tag{2.30}

在贝叶斯框架下,若两个独立测量 各自给出对 的估计,在均匀先验下可以通过归一化乘积来融合: p(\mathbf{x} \mid \mathbf{y}_1, \mathbf{y}_2) = \eta\, p(\mathbf{x} \mid \mathbf{y}_1)\, p(\mathbf{x} \mid \mathbf{y}_2) \tag{2.32}

这是传感器融合的数学基础。


English

Random sampling (): draw a realization of the random variable; fundamental to particle filters (Chapter 4).

Sample mean and covariance from samples use the Bessel-corrected denominator to give an unbiased covariance estimate.

Normalized product: is a valid PDF. Under a uniform prior, fusing two independent estimates via normalized product gives —the mathematical foundation of sensor fusion.


2.1.10 Cramér–Rao 下界与 Fisher 信息 / CRLB and Fisher Information

中文

问题:我有一个未知参数 (比如机器人的真实位置),通过传感器得到测量 。我用某种方法从测量中估计 。我能把这个估计做得多精确?

Cramér–Rao 下界(CRLB) 给出任何无偏估计器协方差的理论下界: \text{cov}(\hat{\boldsymbol{\theta}} \mid \mathbf{x}_\text{meas}) \geq \mathcal{I}_{\boldsymbol{\theta}}^{-1} \tag{2.39}

其中 Fisher 信息矩阵(FIM) 衡量测量中关于 包含多少信息: \mathcal{I}_{\boldsymbol{\theta}} = E\left[\frac{\partial^2(-\ln p(\mathbf{x} \mid \boldsymbol{\theta}))}{\partial \boldsymbol{\theta}^T \partial \boldsymbol{\theta}}\right] \tag{2.41}

直觉

  • Fisher 信息越大 → 测量对参数越”灵敏”→ 估计误差的下界越小
  • Fisher 信息越小 → 测量对参数不敏感 → 无论用什么估计器,误差都不可能太小

这给了我们一个基准:任何无偏估计器的精度都不可能超过 CRLB。能达到 CRLB 的估计器称为有效估计器(efficient estimator)


English

CRLB gives the theoretical lower bound on the covariance of any unbiased estimator : , where the Fisher information matrix measures how sensitive the measurement is to changes in . An estimator achieving this bound is called efficient. The CRLB sets a fundamental precision limit—no amount of clever algorithm design can beat it.


2.2 高斯概率密度函数 / Gaussian Probability Density Functions

中文

高斯分布(也叫正态分布)是本书的主角。为什么?

  1. 中心极限定理:大量独立随机变量之和趋向高斯分布。传感器噪声往往是许多小误差之和,自然呈高斯分布。
  2. 数学可处理性:高斯分布在线性变换、条件化、边缘化、乘积等操作下都保持封闭(结果还是高斯),这使得许多推断有解析解。
  3. 最大熵:在给定均值和协方差的所有分布中,高斯分布的熵最大——它是”最不假设额外信息”的分布。

English

The Gaussian is the central distribution in this book because:

  1. Central limit theorem: sums of many independent errors converge to Gaussian—sensor noise is naturally Gaussian.
  2. Closed-form tractability: Gaussian distributions stay Gaussian under linear transforms, conditioning, marginalisation, and products—enabling analytic solutions.
  3. Maximum entropy: among all distributions with a given mean and covariance, the Gaussian maximises entropy—it is the “least informative” choice.

2.2.1 定义 / Definitions

中文

一维高斯分布

p(x \mid \mu, \sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}}\exp\!\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \tag{2.42}

参数:

  • 均值(mean),PDF 的对称中心,也是最可能的值(众数)
  • 方差(variance) 称为标准差,描述散布宽度

记作

经验法则(3σ 规则)

  • 内包含约 68.3% 的概率
  • 内包含约 95.4% 的概率
  • 内包含约 99.7% 的概率

多维高斯分布

p(\mathbf{x} \mid \boldsymbol{\mu}, \boldsymbol{\Sigma}) = \frac{1}{\sqrt{(2\pi)^N \det\boldsymbol{\Sigma}}}\exp\!\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^T\boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right) \tag{2.45}

参数:

  • :均值向量
  • :协方差矩阵(对称正定)

记作

几何理解:多维高斯的等概率面是椭球面,满足: 椭球的形状和朝向由 的特征值和特征向量决定。 的特征值越大,椭球在那个方向越”胖”(不确定性越大)。

指数内部的量

公式中的二次型 称为马氏距离(Mahalanobis distance)的平方(见 §2.2.9),它是”用不确定性校正过的欧氏距离”。协方差矩阵的逆 称为精度矩阵(precision matrix)信息矩阵,见 §2.2.4。


English

Univariate Gaussian: , notation: .

Empirical rule (3σ): 68% of probability within ; 95% within ; 99.7% within .

Multivariate Gaussian: , notation: .

Equiprobability surfaces are ellipsoids; their shape and orientation are determined by the eigendecomposition of .


2.2.2 联合高斯与条件推断 / Joint Gaussian and Conditional Inference

中文

这一节是卡尔曼滤波器的数学核心。

联合高斯分布:两个向量 服从联合高斯: p(\mathbf{x}, \mathbf{y}) = \mathcal{N}\!\left(\begin{bmatrix}\boldsymbol{\mu}_x \\ \boldsymbol{\mu}_y\end{bmatrix},\, \begin{bmatrix}\boldsymbol{\Sigma}_{xx} & \boldsymbol{\Sigma}_{xy} \\ \boldsymbol{\Sigma}_{yx} & \boldsymbol{\Sigma}_{yy}\end{bmatrix}\right) \tag{2.48}

其中 ,互协方差描述 之间的相关性。

核心结论:条件高斯分布

利用 Schur 补(一种矩阵分块求逆技巧),可以证明:给定 后, 的条件分布仍然是高斯分布

\boxed{p(\mathbf{x} \mid \mathbf{y}) = \mathcal{N}\!\left(\boldsymbol{\mu}_x + \boldsymbol{\Sigma}_{xy}\boldsymbol{\Sigma}_{yy}^{-1}(\mathbf{y} - \boldsymbol{\mu}_y),\;\; \boldsymbol{\Sigma}_{xx} - \boldsymbol{\Sigma}_{xy}\boldsymbol{\Sigma}_{yy}^{-1}\boldsymbol{\Sigma}_{yx}\right)} \tag{2.52b}

解读这个公式:

  1. 新均值 = 旧均值 + 修正项

    • 新息 = 实际测量值 - 预期测量值,即”测量给了我们什么惊喜”
    • 增益 = ,决定”惊喜”如何传播到状态估计
  2. 新协方差 = 旧协方差 - 减少量 协方差只会减小,不会增大——测量总是减少不确定性

这就是卡尔曼滤波更新步骤的本质! 第 3 章将把它系统地发展成完整的滤波算法。

直觉:你预测朋友会在某咖啡馆(均值 ,不确定度 )。你打了个电话(测量 ),听到附近有地铁声(不同于预期的地铁声)。你用这个”新息”更新位置估计:朝有地铁的地方偏移,不确定性减小。


English

Joint Gaussian: with block mean and covariance.

Key result — conditional Gaussian: Given a measured value , the posterior is also Gaussian:

The updated mean adds a correction proportional to the innovation (difference between actual and predicted measurement). The updated covariance is strictly smaller—measurements always reduce uncertainty. This formula is the mathematical heart of the Kalman filter update step (Chapter 3).


2.2.3 独立性与不相关:高斯的特殊性 / Independence and Uncorrelatedness for Gaussians

中文

一般情形下,独立 ⇒ 不相关,反之不成立。但高斯分布特殊:

高斯分布的重要性质 服从联合高斯分布时,不相关 统计独立

证明很简单:若 ,代入 (2.52b) 得到 ,即 的值不影响 的分布,就是独立的。

这个性质让我们可以用”互协方差为零”直接判断高斯随机变量的独立性,极大简化推导。


English

For jointly Gaussian and : uncorrelated statistically independent. This equivalence (unique to Gaussians) simplifies proofs throughout the book: checking is sufficient to establish independence.


2.2.4 信息形式 / Information Form

中文

高斯分布通常用 表达,称为矩形式(moment form)。另一种等价表达是信息形式(information form)

名称符号公式
精度矩阵(信息矩阵)协方差的逆
信息向量

高斯分布的指数部分可以写成:

为什么需要信息形式?

  • 当某个变量完全未知(no prior information),对应的协方差 (无穷大矩阵)。在矩形式中这无法表达,但在信息形式中,(全零矩阵),很好处理。
  • 多个独立测量的归一化乘积在信息形式下极其简单:精度矩阵相加(见 §2.2.8)。
  • 稀疏图优化(第 9–11 章)中,系统信息矩阵是稀疏的,可以高效求解。

English

The information form parameterises a Gaussian by precision matrix and information vector .

Advantages: (1) a completely uninformative prior has (vs ); (2) fusing independent measurements simply adds precision matrices; (3) the system information matrix in batch estimation problems is typically sparse, enabling efficient solvers.


2.2.5 联合高斯的边缘分布 / Marginals of a Joint Gaussian

中文

联合高斯的边缘分布直接从均值和协方差的对应子块读出: p(\mathbf{x}) = \mathcal{N}(\boldsymbol{\mu}_x, \boldsymbol{\Sigma}_{xx}), \qquad p(\mathbf{y}) = \mathcal{N}(\boldsymbol{\mu}_y, \boldsymbol{\Sigma}_{yy}) \tag{2.59}

在信息形式下的边缘化比较复杂,需要用 Schur 补:若信息矩阵为 ,则关于 的边缘分布精度矩阵为: \boldsymbol{\Sigma}_{xx}^{-1} = \mathbf{A}_{xx} - \mathbf{A}_{xy}\mathbf{A}_{yy}^{-1}\mathbf{A}_{yx} \tag{2.61}

这正是矩阵 Schur 补的形式,会在 SLAM(第 10 章)的稀疏求解中再次出现。


English

The marginals of a joint Gaussian are simply the diagonal blocks: . In information form, marginalisation requires the Schur complement: , a formula that recurs in sparse SLAM solvers (Chapters 9–10).


2.2.6 线性变量变换 / Linear Change of Variables

中文

(正向):设 (线性变换),则: \mathbf{y} \sim \mathcal{N}(\mathbf{G}\boldsymbol{\mu}_x,\; \mathbf{G}\boldsymbol{\Sigma}_{xx}\mathbf{G}^T) \tag{2.64}

证明思路:对均值,线性算子可以直接穿过期望算子:。对协方差,类似地得到

直觉:把圆形不确定椭球通过矩阵 拉伸,就得到新的椭球。 在某方向拉伸越多,那个方向的不确定性越大。

这个公式是机器人运动学中不确定性传播的基础:已知状态 的不确定性,通过雅可比矩阵 计算输出的不确定性。


English

If and , then:

This uncertainty propagation formula is fundamental in robotics: given state uncertainty and a Jacobian , it gives the output uncertainty .


2.2.7 通过非线性传播高斯 / Passing a Gaussian through a Nonlinearity

中文

真实传感器模型是非线性的(相机透视投影、距离-角度传感器等),因此我们常常需要计算: p(\mathbf{y}) = \int p(\mathbf{y} \mid \mathbf{x})\, p(\mathbf{x})\, d\mathbf{x}, \quad \text{其中} \quad p(\mathbf{y} \mid \mathbf{x}) = \mathcal{N}(\mathbf{g}(\mathbf{x}), \mathbf{R}) \tag{2.74}

是非线性函数, 是测量噪声协方差。

线性化近似(一阶泰勒展开):在均值 附近线性化: \mathbf{g}(\mathbf{x}) \approx \mathbf{g}(\boldsymbol{\mu}_x) + \mathbf{G}(\mathbf{x} - \boldsymbol{\mu}_x), \quad \mathbf{G} = \left.\frac{\partial \mathbf{g}(\mathbf{x})}{\partial \mathbf{x}}\right|_{\mathbf{x}=\boldsymbol{\mu}_x} \tag{2.83}

其中 在均值处的雅可比矩阵(Jacobian)

经过线性化后,代入 (2.74) 积分,结果是: \mathbf{y} \approx \mathcal{N}(\mathbf{g}(\boldsymbol{\mu}_x),\; \mathbf{R} + \mathbf{G}\boldsymbol{\Sigma}_{xx}\mathbf{G}^T) \tag{2.88}

解读

  • 均值:直接把均值代入非线性函数
  • 协方差:线性传播项 (状态不确定性经 Jacobian 传播)加上测量噪声

这个公式将直接导出扩展卡尔曼滤波器(EKF)的预测步骤(第 4 章)。

更精确的方法——Sigma 点变换:线性化在非线性较强时精度不足。一种更精确的方法是通过一组精心选择的”sigma 点”来捕捉非线性效果,见第 4 章。


English

For a stochastic nonlinearity , the integral has no closed form in general.

Linearization (first-order Taylor): approximate where is the Jacobian at the mean. This gives:

The output mean is evaluated at the input mean; the output covariance is the Jacobian-propagated input uncertainty plus measurement noise. This formula underlies the EKF prediction step (Chapter 4).


2.2.8 高斯的归一化乘积 / Normalized Product of Gaussians

中文

关键结论 个高斯 PDF 的归一化乘积仍然是高斯,且在信息形式下非常简洁:

\exp\!\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu})^T\boldsymbol{\Sigma}^{-1}(\mathbf{x}-\boldsymbol{\mu})\right) = \eta \prod_{k=1}^K \exp\!\left(-\frac{1}{2}(\mathbf{x}-\boldsymbol{\mu}_k)^T\boldsymbol{\Sigma}_k^{-1}(\mathbf{x}-\boldsymbol{\mu}_k)\right) \tag{2.89}

合并后的精度矩阵和信息向量为: \boldsymbol{\Sigma}^{-1} = \sum_{k=1}^K \boldsymbol{\Sigma}_k^{-1}, \qquad \boldsymbol{\Sigma}^{-1}\boldsymbol{\mu} = \sum_{k=1}^K \boldsymbol{\Sigma}_k^{-1}\boldsymbol{\mu}_k \tag{2.90}

直觉(1维情形):两个关于同一变量的高斯估计,信息量(精度 = 方差的倒数)直接相加,融合后的均值是精度加权平均: 融合后的方差比任意一个单独估计的方差都小——两个传感器总比一个好。

更一般的形式(带矩阵 ): \boldsymbol{\Sigma}^{-1} = \sum_{k=1}^K \mathbf{G}_k^T \boldsymbol{\Sigma}_k^{-1} \mathbf{G}_k, \qquad \boldsymbol{\Sigma}^{-1}\boldsymbol{\mu} = \sum_{k=1}^K \mathbf{G}_k^T \boldsymbol{\Sigma}_k^{-1}\boldsymbol{\mu}_k \tag{2.92}

这是批量估计(batch estimation)中最小二乘的矩阵形式,第 3 章将大量使用。


English

The normalized product of Gaussians is Gaussian. In information form, precision matrices simply add:

Fusion always reduces uncertainty: the combined variance is smaller than any individual variance. The generalized form with matrices is the matrix form of least squares, central to batch estimation (Chapter 3).


2.2.9 马氏距离与卡方分布 / Mahalanobis Distance and Chi-Squared

中文

马氏距离是”考虑了协方差结构的欧氏距离”: d_M^2 = (\mathbf{x} - \boldsymbol{\mu})^T \boldsymbol{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu}) \tag{2.94}

时, 服从卡方分布 为维数):

  • 均值 ,方差

为什么要用马氏距离而非欧氏距离?

假设机器人位置的不确定性在东西方向很大(),南北方向很小()。用欧氏距离,偏东 5 m 和偏北 5 m 一样”远”。但用马氏距离,偏东 5 m(,很正常)比偏北 5 m(,很异常)小得多——符合直觉。

马氏距离用于:

  1. 检验点 是否属于某个高斯分布 太大则视为离群点)
  2. 估计器性能评估(见 §5.1 NEES/NIS 检验)
  3. 最大后验估计中的目标函数即马氏距离的平方和

English

The squared Mahalanobis distance is a covariance-weighted Euclidean distance. For , it follows with mean and variance .

Applications: outlier detection (a point with large is anomalous given the Gaussian model), estimator consistency testing (Chapter 5), and as the objective function in MAP estimation.


2.2.10–2.2.12 香农信息、互信息与 KL 散度(高斯情形)

中文

高斯 PDF 的香农熵H(\mathbf{x}) = \frac{1}{2}\ln\left((2\pi e)^N \det\boldsymbol{\Sigma}\right) \tag{2.99}

几何解释: 正比于不确定性椭球的体积。协方差越大 → 椭球越大 → 熵越高 → 不确定性越大。

联合高斯的互信息I(\mathbf{x}, \mathbf{y}) = -\frac{1}{2}\ln\det\!\left(\mathbf{1} - \boldsymbol{\Sigma}_{xx}^{-1}\boldsymbol{\Sigma}_{xy}\boldsymbol{\Sigma}_{yy}^{-1}\boldsymbol{\Sigma}_{yx}\right) \geq 0 \tag{2.105}

(不相关)时,,与独立性条件一致。

两个高斯的 KL 散度(闭合形式): \text{KL}(p_2 \| p_1) = \frac{1}{2}\left[(\boldsymbol{\mu}_2-\boldsymbol{\mu}_1)^T\boldsymbol{\Sigma}_1^{-1}(\boldsymbol{\mu}_2-\boldsymbol{\mu}_1) + \ln\frac{\det\boldsymbol{\Sigma}_1}{\det\boldsymbol{\Sigma}_2} + \text{tr}(\boldsymbol{\Sigma}_1^{-1}\boldsymbol{\Sigma}_2) - N\right] \tag{2.107}

这个解析公式在变分推断中极其重要(第 6 章)。


English

For Gaussian :

  • Shannon entropy: — depends only on ; proportional to log-volume of uncertainty ellipsoid.
  • Mutual information between and in a joint Gaussian has a closed-form expression involving the cross-covariance block.
  • KL divergence between two Gaussians has a closed-form expression involving mean differences and covariance ratios (eq. 2.107), essential for variational inference.

2.2.13 多维高斯采样 / Sampling from a Multivariate Gaussian

中文

要从 采样,步骤如下:

  1. 对协方差做 Cholesky 分解: 是下三角矩阵)
  2. 采样 个独立标准正态样本:
  3. 变换:

验证:。✓

这个采样方法在粒子滤波器和变分推断的随机梯度算法中广泛使用。


English

To sample from : (1) Cholesky-factor ; (2) draw ; (3) form .


2.2.14 CRLB 应用于高斯 / CRLB for Gaussians

中文

个独立同分布样本 ,估计均值 。Fisher 信息矩阵为: \mathcal{I}_{\boldsymbol{\mu}} = K\boldsymbol{\Sigma}^{-1} \tag{2.116}

CRLB 给出:

样本均值 恰好达到此下界,因此是有效估计器。结论符合直觉:测量越多( 越大),对均值的估计越精确。


English

With iid samples from , the CRLB gives . The sample mean achieves this bound exactly and is therefore efficient.


2.2.15 Sherman–Morrison–Woodbury 恒等式 / SMW Identity

中文

这是一组矩阵求逆恒等式,通过两种分解(LDU 和 UDL)推导得出:

\boxed{(\mathbf{A}^{-1} + \mathbf{B}\mathbf{D}^{-1}\mathbf{C})^{-1} = \mathbf{A} - \mathbf{A}\mathbf{B}(\mathbf{D} + \mathbf{C}\mathbf{A}\mathbf{B})^{-1}\mathbf{C}\mathbf{A}} \tag{2.124a}

为什么重要?

在估计中经常出现如下场景:状态维数很高( 大),但测量维数很低( 小)。直接求逆 需要 计算量。用 SMW 恒等式可以将其转化为只需求逆 矩阵:

时,这大幅降低计算量。卡尔曼滤波器的两种等价形式(协方差形式 vs 信息形式)之间的变换就依赖 SMW 恒等式。


English

The SMW identity allows efficient computation of matrix inverses of the form by reducing it to an inversion of a matrix the size of rather than . When the measurement dimension state dimension , this reduces inversion to —critical for the Kalman filter (Chapter 3).


2.2.16–2.2.17 Stein 引理与 Isserlis 定理 / Stein’s Lemma and Isserlis’ Theorem

中文

Stein 引理:设 是可微标量函数,则: E\left[(\mathbf{x} - \boldsymbol{\mu})\, f(\mathbf{x})\right] = \boldsymbol{\Sigma}\, E\left[\frac{\partial f(\mathbf{x})}{\partial \mathbf{x}^T}\right] \tag{2.125}

直觉:高斯分布的一个深刻性质——“与均值的偏差”和”函数值”之间的期望相关性,可以通过函数的导数来计算,而不需要对整个分布积分。在变分推断(第 6 章)中,Stein 引理让我们可以用样本(而非积分)来估计期望梯度。

Isserlis 定理(Wick 定理):高斯分布的高阶矩可以分解为二阶矩的乘积之和: E[x_i x_j x_k x_\ell] = E[x_i x_j]E[x_k x_\ell] + E[x_i x_k]E[x_j x_\ell] + E[x_i x_\ell]E[x_j x_k] \tag{2.129}

这意味着高斯分布被均值和协方差完全确定——所有高阶矩都可以由二阶矩推算,无需单独指定。


English

Stein’s lemma: For : . Used in variational inference (Chapter 6) to compute gradient expectations from samples.

Isserlis’ theorem: higher-order moments of a Gaussian factor into sums of products of second-order moments. Since Gaussians are fully characterised by mean and covariance, all higher moments are determined.


2.3 高斯过程 / Gaussian Processes

中文

前面讨论的是离散随机变量 ——固定维数的向量。但机器人的轨迹是时间的连续函数 。如何对连续函数建立概率模型?

高斯过程(Gaussian Process, GP) 是对连续函数的概率分布。记: \mathbf{x}(t) \sim \mathcal{GP}(\boldsymbol{\mu}(t),\, \boldsymbol{\Sigma}(t, t')) \tag{2.139}

其中:

  • 均值函数,描述轨迹的”平均走向”
  • 协方差函数(核函数),描述时刻 处状态的相关性

直觉:想象你在画一条曲线,但手抖了(有随机性)。高斯过程描述了所有可能曲线的概率分布:

  • 均值函数告诉你”平均”的曲线形状
  • 协方差函数告诉你曲线的”抖动范围”和”平滑程度”——时刻 越接近,它们的值越相关,曲线越平滑

与离散高斯的关系:在任意有限时刻集合 处,GP 给出一个联合高斯分布。对单个时刻

白噪声过程:一个特殊的 GP 是零均值白噪声: \mathbf{w}(t) \sim \mathcal{GP}(\mathbf{0},\, Q\,\delta(t - t')) \tag{2.141}

功率谱密度矩阵 是 Dirac delta 函数。“白噪声”意味着不同时刻的噪声完全不相关( 时协方差为零)。

GP 与连续时间状态估计:第 3、4、11 章将展示,连续时间轨迹估计可以自然地视为高斯过程回归(GP regression)——在已知若干时刻观测值的条件下,推断轨迹在其他时刻的值及其不确定性。


English

A Gaussian process is a probability distribution over functions: any finite collection of time instants gives a joint Gaussian.

  • : mean function (the “average” trajectory)
  • : covariance kernel (controls smoothness; nearby times are more correlated)

Zero-mean white noise : different time instants are completely uncorrelated; is the power spectral density.

GP regression—inferring a continuous trajectory from discrete noisy observations—is the framework for continuous-time state estimation in Chapters 3, 4, and 11.


2.4 本章小结 / Chapter Summary

中文

本章建立了全书的概率论基础。核心要点:

  1. 概率密度函数(PDF) 用连续函数表达对连续状态的不确定性;所有可能状态下的密度积分为 1。

  2. 贝叶斯定理 是状态估计的核心引擎: 它将先验知识与新测量融合,得到更新的信念。

  3. 高斯分布 是本书的主要工具:

    • 在线性变换、条件化、边缘化、乘积等操作下保持封闭
    • 完全由均值 和协方差 确定
    • 对于高斯:不相关 ⟺ 统计独立
  4. 关键公式总结

操作公式
线性变换
条件化(高斯推断核心)
归一化乘积(传感器融合)
非线性传播(线性化)
  1. 高斯过程 将离散高斯推广到连续时间函数,是连续时间轨迹估计的数学基础。

English

Key takeaways:

  1. PDFs represent continuous-state uncertainty; the total probability axiom ensures they integrate to 1.
  2. Bayes’ rule is the core engine: it fuses prior beliefs with new measurements to form a posterior.
  3. Gaussians are the workhorse: closed under linear transforms, conditioning, marginalisation, and products; fully characterised by ; uncorrelated ⟺ independent.
  4. Four fundamental formulas (linear propagation, conditional Gaussian, normalised product, linearised nonlinear propagation) underlie every estimator in this book.
  5. Gaussian processes extend Gaussians to continuous-time functions, enabling continuous-time trajectory estimation.

下一章将用这里建立的工具,推导线性高斯系统的完整估计框架,从批量最大后验估计出发,导出卡尔曼滤波器和平滑器。/ The next chapter uses these tools to derive the complete estimation framework for linear-Gaussian systems—from batch MAP estimation to the Kalman filter and smoother.