# 随机变量

随机变量是一个函数，它为随机试验的每个结果指定一个数（更一般地，指定可测状态空间中的一个元素），形式上定义为概率空间上的可测函数。尽管名称如此，它既不是代数意义上的变量，本身也不随机：它是一个固定的函数 \( X \)，随机性通过从样本空间 \( \Omega \) 中抽取的结果 \( \omega \) 进入。<sup>[1](https://youyuanwu.github.io/misc-docs/math/11-probability/02-random-variables.html)</sup> 随机变量是核心对象，概率论通过它们将抽象试验与计数、测量和收益等数值量联系起来。<sup>[2](https://pages.stat.wisc.edu/~kdlevin/teaching/Fall2022/STAT340/lecs/L01_randomvariables.html)</sup>

| 关键事实 | 细节 |
|---|---|
| 形式定义 | 概率空间 \( (\Omega, \mathcal{F}, P) \) 上的函数 \( X : \Omega \to \mathbb{R} \)，使得对每个博雷尔集 \( B \) 都有 \( X^{-1}(B) \in \mathcal{F} \)<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> |
| 检验可测性 | 只需对所有 \( b \) 有 \( X^{-1}((-\infty, b]) \in \mathcal{F} \)，因为博雷尔 σ-代数由这类区间生成<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> |
| 律（分布） | 推前测度 \( \mu(A) = P(X \in A) \)，它携带关于 \( X \) 的全部概率信息<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> |
| 分布函数 | \( F(x) = P(X \le x) = \mu((-\infty, x]) \)，对每个实值随机变量都有定义<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> |
| 离散情形 | 可数取值域，完全由概率质量函数 \( p_X(x) = P(X = x) \) 确定<sup>[4](https://cni.iisc.ac.in/courses/random/Probability%20Foundations/lecture-04.html)</sup> |
| 连续情形 | 密度 \( f_X \ge 0 \)，使得对博雷尔集 \( B \) 有 \( P_X(B) = \int_B f_X(x)\,dx \)<sup>[5](https://encyclopediaofmath.org/wiki/Random_variable)</sup> |
| 测度论起源 | 柯尔莫哥洛夫（Andrey Kolmogorov）的1933年《概率论基础》（*Grundbegriffe der Wahrscheinlichkeitsrechnung*）首次给出完整的测度论阐述，明确随机变量就是概率空间上的可测函数<sup>[5](https://encyclopediaofmath.org/wiki/Random_variable)</sup> |

## 定义

设定是一个概率空间 \( (\Omega, \mathcal{F}, P) \)，其中 \( \Omega \) 是结果样本空间，\( \mathcal{F} \) 是定义概率的事件 σ-代数，\( P \) 是概率测度。函数 \( X : \Omega \to \mathbb{R} \) 是随机变量，如果它关于实数轴上的博雷尔 σ-代数 \( \mathcal{B} \) 可测，即对每个 \( B \in \mathcal{B} \) 有 \( X^{-1}(B) \in \mathcal{F} \)。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> 更一般地，任何映入装备了 σ-代数的状态空间 \( S \) 的可测映射 \( X : \Omega \to S \) 都符合定义，这涵盖了取向量值、复值或函数值的随机变量。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup>

可测性使关于 \( X \) 的陈述的概率有明确定义：对每个博雷尔集 \( B \)，事件 \( \{\omega \in \Omega : X(\omega) \in B\} \) 是可测的，因此 \( P(X \in B) \) 存在。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> 由于博雷尔 σ-代数由区间生成，只需检查形如 \( X^{-1}((-\infty, b]) \) 的集合，或等价地 \( X^{-1}((a,b)) \)，或 \( X^{-1}([a,b]) \)，对所有 \( a < b \)。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> 入门教材常正这样表述条件：对每个实数 \( a \)，\( \{X < a\} \in \mathcal{F} \)，由此可推出 \( \{X = a\} \)、\( \{X > a\} \) 以及区间事件的可测性。<sup>[6](https://www.math.cmu.edu/~gautam/c/2026-425/notes/probability-spaces.html)</sup>

当观察到某个结果 \( \omega \) 时，数 \( X(\omega) \) 称为该随机变量的一个实现。<sup>[6](https://www.math.cmu.edu/~gautam/c/2026-425/notes/probability-spaces.html)</sup> 一些高级处理更进一步，将随机变量定义为可测函数的等价类，其中两个函数若以概率一相等则等价；于是和、积和极限在这些等价类上有良好定义，不依赖于所选代表。<sup>[7](https://www.tamuz.caltech.edu/teaching/ma144a/lectures.pdf)</sup>

## 分布与律

随机变量 \( X : \Omega \to S \) 的概率分布，或称律，是 \( (S, \mathcal{A}) \) 上的测度 \( \mu \)，定义为 \( \mu(A) = P(\{\omega : X(\omega) \in A\}) \)；它是 \( P \) 在 \( X \) 下的推前，本身也是概率测度。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> 律捕捉了概率论所使用的关于 \( X \) 的一切：\( X \) 的所有统计性质都可从分布确定，而无需知道底层的样本空间。<sup>[6](https://www.math.cmu.edu/~gautam/c/2026-425/notes/probability-spaces.html)</sup> 这就是为什么样本空间 \( \Omega \) 在应用中通常只起次要作用。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup>

对实值 \( X \)，律由累积分布函数 \( F(x) = P(X \le x) = \mu((-\infty, x]) \) 描述，它对每个实值随机变量都存在。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> 每个分布函数都单调非减、右连续，并满足 \( \lim_{x \to \infty} F_X(x) = 1 \) 和 \( \lim_{x \to -\infty} F_X(x) = 0 \)。<sup>[4](https://cni.iisc.ac.in/courses/random/Probability%20Foundations/lecture-04.html)</sup>

## 离散与连续随机变量

取值域可数的随机变量称为离散随机变量。它完全由概率质量函数 \( p_X(x) = P(X = x) \) 确定，并且任何离散随机变量都可写成样本空间一个划分上的指示函数的线性组合。<sup>[4](https://cni.iisc.ac.in/courses/random/Probability%20Foundations/lecture-04.html)</sup> 取值域有限的离散随机变量称为简单随机变量。<sup>[4](https://cni.iisc.ac.in/courses/random/Probability%20Foundations/lecture-04.html)</sup>

当一个随机变量的律存在密度 \( f_X : \mathbb{R} \to [0, \infty) \)，使得对每个博雷尔集 \( B \) 有 \( P_X(B) = \int_B f_X(x)\,dx \) 时，它称为连续随机变量。<sup>[4](https://cni.iisc.ac.in/courses/random/Probability%20Foundations/lecture-04.html)</sup><sup> • </sup><sup>[5](https://encyclopediaofmath.org/wiki/Random_variable)</sup> 高斯（正态）随机变量是标准例子，具有钟形密度 \( f(t;\mu,\sigma^2) = \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left\{ \frac{-(t-\mu)^2}{2\sigma^2} \right\} \)。<sup>[2](https://pages.stat.wisc.edu/~kdlevin/teaching/Fall2022/STAT340/lecs/L01_randomvariables.html)</sup>

标准例子说明了这两类。在具有均匀测度的 \( n \) 次掷硬币空间上，第一次投掷的指示变量是伯努利型变量，其律为 \( \frac{1}{2}\delta_0 + \frac{1}{2}\delta_1 \)，而反面次数 \( X(\omega) = \omega_1 + \cdots + \omega_n \) 服从二项分布 \( B(n, 1/2) \)，其中 \( P(X = k) = \binom{n}{k} 2^{-n} \)。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup> 在 \( \Omega = [0,1] \) 上配备勒贝格测度时，恒等映射 \( U(\omega) = \omega \) 服从均匀分布，且 \( P(U \le a) = a \)。<sup>[3](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)</sup>

## 运算与结构

可测实值函数构成一个向量空间：可测函数的标量倍数 \( \lambda f \) 与和 \( f_1 + f_2 \) 都是可测的，且可测函数 \( f \) 与可测函数 \( g : \mathbb{R} \to \mathbb{R} \) 的复合仍给出可测函数，因此只要 \( f \) 是随机变量，\( g \circ f \) 也是随机变量。<sup>[7](https://www.tamuz.caltech.edu/teaching/ma144a/lectures.pdf)</sup> 极限也表现良好：对于一列介于0和1之间的可测函数，逐点下确界、下极限，甚至极限存在的结果集合都是可测的。<sup>[7](https://www.tamuz.caltech.edu/teaching/ma144a/lectures.pdf)</sup> 这些封闭性质使得期望——定义为 \( X \) 关于 \( P \) 的勒贝格积分——以及求和、方差和协方差的整套工具都能应用于随机变量。<sup>[8](https://doi.org/10.3390/math13050867)</sup>

一个结构要点在实践中很重要：定义在不同概率空间上的两个随机变量没有联合分布，此时 \( X + Y \) 这样的表达式没有意义。将它们放在同一个空间上——这一构造称为耦合——才使联合陈述成为可能；\( X \) 与 \( Y \) 的耦合是同一空间上的一对 \( (X', Y') \)，具有相同的边缘律。<sup>[9](https://tsoo-math.github.io/ucl/coupling-rev.html)</sup>

## 历史

随机变量及其期望的作用由帕夫努季·切比雪夫（Pafnuty Chebyshev）明确确立，他在1867年发表《论平均值》（*On mean values*），利用比安内梅不等式给出广义大数定律；柯尔莫哥洛夫后来写道，切比雪夫是第一个明确认识并运用“随机量”及其“期望（均值）”这类概念的人。<sup>[10](https://mathshistory.st-andrews.ac.uk//Biographies/Chebyshev/)</sup> 认识到随机变量是可测函数的特例则要晚得多。在测度论框架下对概率作完整阐述、摆脱多余限制，最早由安德烈·柯尔莫哥洛夫（Andrey Kolmogorov）在其1933年专著《概率论基础》（*Grundbegriffe der Wahrscheinlichkeitsrechnung*；英译名 *Foundations of the Theory of Probability*）中给出，该书明确指出随机变量不外乎概率空间上的可测函数；W. 费勒（W. Feller）后来在学术文献中采用了这一观点。<sup>[5](https://encyclopediaofmath.org/wiki/Random_variable)</sup> 柯尔莫哥洛夫的三元组 \( (E, \mathcal{F}, P) \) 是每本现代教材开篇的框架，其序言指出，在勒贝格的工作之后，函数的积分与随机变量的数学期望之间的类比已变得清楚。<sup>[11](https://jovanaeducation.com/library/kolmogorov-1933)</sup>

## 应用

将感兴趣的量作为随机变量来建模，远远超出数学领域而成为标准做法。在计量学中，美国国家标准与技术研究院（NIST）通过给某一属性赋予概率分布作为其特征，来刻画该属性估计值周围的不确定度，例如参考溶液中碲的质量分数；这并不意味着该属性以不可预测的方式变化，而只是说该分布描述其真值被了解得有多好。对一种 NIST 标准物质，所赋予的分布是经过缩放和平移的学生 t 分布，自由度为12.7，均值10.011 mg/g，标准差0.01755 mg/g。<sup>[12](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.260-202.pdf)</sup> 诸如 NIST不确定度机器（NIST Uncertainty Machine）之类的软件工具，通过将输入量和输出量建模为随机变量——其概率分布刻画不确定度——来评估输出量 \( y = f(x_0, \ldots, x_n) \) 的测量不确定度。<sup>[13](https://uncertainty.nist.gov/?example=Voltage)</sup> 在工程可靠性中，随机变量的函数是随机海况下波浪载荷分析以及系统可靠性中事件组合概率的基础。<sup>[14](https://ocw.mit.edu/courses/1-010-uncertainty-in-engineering-fall-2008/pages/application-examples/)</sup>

## References

1. [Random Variables and Distributions, youyuanwu.github.io](https://youyuanwu.github.io/misc-docs/math/11-probability/02-random-variables.html)
2. [STAT340 Lecture 01: Random Variables, UW–Madison](https://pages.stat.wisc.edu/~kdlevin/teaching/Fall2022/STAT340/lecs/L01_randomvariables.html)
3. [Advanced Probability lecture notes, University of Vienna](https://www.mat.univie.ac.at/~mathias/Advanced_Probability.pdf)
4. [Random Variable – Probability and Random Processes, IISc](https://cni.iisc.ac.in/courses/random/Probability%20Foundations/lecture-04.html)
5. [Random variable, Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Random_variable)
6. [Probability spaces and Random Variables, Carnegie Mellon University](https://www.math.cmu.edu/~gautam/c/2026-425/notes/probability-spaces.html)
7. [Lecture Notes on Probability, Caltech MA144A](https://www.tamuz.caltech.edu/teaching/ma144a/lectures.pdf)
8. [The Heroic Age of Probability: Kolmogorov, Doob, Lévy, Khinchin and Feller, Mathematics (MDPI)](https://doi.org/10.3390/math13050867)
9. [You always knew and did coupling, UCL](https://tsoo-math.github.io/ucl/coupling-rev.html)
10. [Pafnuty Chebyshev (1821–1894), MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk//Biographies/Chebyshev/)
11. [Kolmogorov: Foundations of the Theory of Probability (1933), JOVANA Education](https://jovanaeducation.com/library/kolmogorov-1933)
12. [Evaluating, Expressing, and Propagating Measurement Uncertainty for NIST Reference Materials, NIST SP 260-202](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.260-202.pdf)
13. [NIST Uncertainty Machine](https://uncertainty.nist.gov/?example=Voltage)
14. [Application Examples, Uncertainty in Engineering, MIT OpenCourseWare](https://ocw.mit.edu/courses/1-010-uncertainty-in-engineering-fall-2008/pages/application-examples/)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Probability theory › Random variables › Algebra and transformations of random variables › Algebra of random variables (overview)

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/random-variable

English original: https://www.edgepedia.org/random-variable
