📚 Mean and Variance of Continuous Random Variables | 连续随机变量的均值与方差
In probability and statistics, continuous random variables are used to model quantities that can take any value inside an interval - waiting times, lengths, masses, temperatures and voltages are all typical examples. Understanding the central tendency and the spread of such variables is fundamental, because two distributions with the same average can behave completely differently. The mean (expected value) and the variance provide the two most important numerical summaries of a probability distribution, and knowing how to compute them from a probability density function is an essential skill in IB Mathematics and in any introductory university statistics course.
在概率与统计中,连续随机变量用于描述在一个区间内可取任意值的量——等待时间、长度、质量、温度、电压都是典型例子。理解这类变量的集中趋势与离散程度至关重要,因为平均值相同的两个分布,其实际表现可能完全不同。均值(期望值)和方差是对概率分布最重要的两个数值概括,而根据概率密度函数求出它们,则是 IB 数学以及任何入门统计学课程中必须掌握的基本功。
1. Continuous Random Variables and PDF | 连续随机变量与概率密度函数
A continuous random variable X takes values in a continuous interval, and its distribution is described by a probability density function (PDF), usually written f(x). Unlike a discrete probability mass function, f(x) does not give probabilities directly; it gives density, which must be integrated over an interval to produce a probability. This is why the shape of the curve, not the height at a single point, carries all the information.
连续随机变量 X 在一个连续区间上取值,其分布由概率密度函数(PDF)描述,通常记作 f(x)。与离散型概率质量函数不同,f(x) 并不直接给出概率,它给出的是"密度",必须对区间积分才能得到概率。因此承载全部信息的是曲线形状,而不是某一点处的高度。
0 ≤ x ≤ 0.5 has density f(x) = 2 throughout that interval, and its total area is still 1.
PDF 本身并非概率,因此它可以大于 1。例如,在区间 0 ≤ x ≤ 0.5 上的均匀分布,其密度在该区间内恒为 f(x) = 2,而曲线下的总面积仍然是 1。
e: f(x) ≥ 0 for all real x, because negative density would produce negative probabilities.
每个 PDF 都必须非负:对所有实数 x 有 f(x) ≥ 0,因为负的密度会产生负概率。
The total area under the curve is exactly 1, which reflects the fact that the variable must take some real value:
曲线下的总面积恰好等于 1,这反映了随机变量必定会取到某个实数值:
∫₋∞⁺∞ f(x) dx = 1
Probabilities are obtained by integration: the probability that X lies between a and b is the area under the curve from a to b. For a continuous variable, the probability of any single point is zero, so strict and non-strict inequalities give the same answer.
概率通过积分得到:X 落在 a 与 b 之间的概率就是曲线在 a 到 b 下方的面积。对于连续变量,任意单点的概率为零,因此严格不等号与不严格不等号给出的答案相同。
P(a ≤ X ≤ b) = ∫ₐᵇ f(x) dx and P(X = c) = 0
This last fact is the key difference from discrete random variables, and it is frequently tested in exams through a short conceptual question.
最后这一条正是连续随机变量与离散随机变量的关键区别,考试中常以简短的问答题形式考查。
2. Expected Value (Mean) | 期望值(均值)
The mean, or expected value, of a continuous random variable X with PDF f(x) is defined by an integral in which each value x is weighted by its density. In the discrete case we sum x times its probability; in the continuous case the sum becomes an integral.
具有 PDF f(x) 的连续随机变量 X 的均值(即期望值)由积分定义,其中每个取值 x 以其密度为权重。在离散情形中,我们把 x 与其概率相乘后求和;在连续情形中,求和变为积分。
E(X) = μ = ∫₋∞⁺∞ x f(x) dx
te interval such as [0, 2] or [0, ∞). The definition requires the integral to converge absolutely; if it does not, we say the mean does not exist.
积分是对整个实轴取的,但实际计算时 f(x) 在分布支撑集之外恒为 0,因此积分限通常缩小为有限区间,如 [0, 2] 或 [0, ∞)。该定义要求积分绝对收敛;若不收敛,则称均值不存在。
It represents the long-run average value of X if the experiment were repeated indefinitely, and it is also the balance point of the distribution: in physical terms, μ is the centre of mass of the density f(x). If the PDF is symmetric about a point c and the mean exists, then the mean equals c, a shortcut that saves a great deal of integration.
它表示若试验无限次重复,X 的长期平均值;它同时是分布的平衡点:从物理角度看,μ 就是密度 f(x) 的质心。如果 PDF 关于某点 c 对称且均值存在,那么均值就等于 c——这一捷径可以省去大量积分运算。
3. Variance and Standard Deviation | 方差与标准差
The variance of X measures the spread of the distribution around the mean. It is defined as the expected value of the squared deviation from μ, so deviations on both sides contribute positively and larger distances are penalised more heavily.
方差衡量分布围绕均值的离散程度。它定义为"偏离 μ 的平方"的期望值,因此两侧的偏差都同号相加,距离越大权重越大。
Var(X) = σ² = E[(X − μ)²] = ∫₋∞⁺∞ (x − μ)² f(x) dx
Because the deviations are squared, the variance is never negative, and it equals zero only when the variable is a constant with probability 1. Its square root is the standard deviation, which is measured in the same units as X and is therefore easier to interpret.
由于偏差取了平方,方差永不为负,且仅当随机变量以概率 1 取常数时才为零。方差的平方根是标准差,它与 X 具有相同的单位,因此更便于解释。
σ = √Var(X)
A useful way to read σ is as a typical distance of an observation from the mean. Two distributions described by the same mean but different standard deviations have the same centre but noticeably different shapes: the one with the larger σ is flatter and more spread out.
理解 σ 的一个好方法是把它视为"观测值与均值的典型距离"。均值相同而标准差不相同的两个分布,中心一致,但形状差别明显:σ 较大的那个更平缓、更分散。
4. Computing Variance: Definition vs Shortcut Formula | 方差的计算:定义式与简算公式
Applying the definition directly means integrating (x − μ)² f(x), which usually produces awkward algebra because the integrand has to be expanded first. A much more efficient route is the standard shortcut formula, obtained by expanding the square inside the integral.
直接使用定义式意味着要对 (x − μ)² f(x) 积分,通常需要先展开被积函数,代数过程繁琐。更高效的途径是使用标准简算公式,它来自对被积函数中平方项的展开。
Var(X) = E(X²) − μ² = E(X²) − [E(X)]²
where the second moment is computed with a single integral over x². This formula is the one used in almost every examination question, and it is worth memorising precisely, including the fact that the square is subtracted after evaluating both terms.
其中二阶矩只需对 x² 做一个积分即可得到。这个公式几乎是所有考题中使用的形式,值得精确记忆,尤其要记住:两项都算完之后才做减法。
E(X²) = ∫₋∞⁺∞ x² f(x) dx
The shortcut formula is a convenient way to check your work: repeating the calculation with the definition should give the same value. If the two answers disagree, the error is almost always an arithmetic slip in expanding (x − μ)² or in evaluating x² f(x).
简算公式也是检验答案的好办法:用定义式重算一遍,结果应当相同。若两者不一致,错误几乎总是出在展开 (x − μ)² 或计算 x² f(x) 时的算术失误上。
5. Properties of Expectation and Variance | 期望与方差的性质
Expectation is a linear operator, which means constants can be pulled out and sums can be split. This makes many questions that look difficult surprisingly quick, and the property holds whether or not the variables involved are independent.
期望是线性算子,这意味着常数可以提出,和式可以拆分。这使得许多看似困难的题目变得异常快捷,而且无论涉及的变量是否独立,该性质都成立。
E(aX + b) = aE(X) + b E(X + Y) = E(X) + E(Y)
les every deviation, so the constant is squared. The negative sign disappears automatically because a² ≥ 0.
方差的表现则不同:加上常数只是整体平移分布,不改变离散程度;乘以常数会把每个偏差按比例放大,因此常数要平方。负号会因为 a² ≥ 0 而自动消失。
Var(aX + b) = a² Var(X) Var(−X) = Var(X)
th care. A frequent exam trap is writing Var(2X) = 2Var(X); the correct result is 4Var(X).
需要注意,仅当 X 与 Y 相互独立时才有 Var(X + Y) = Var(X) + Var(Y),因此这条加法规则要谨慎使用。考试中常见的陷阱是把 Var(2X) 写成 2Var(X),而正确结果是 4Var(X)。
6. Two Standard Models: Uniform and Exponential | 两个标准模型:均匀分布与指数分布
Two continuous distributions appear again and again in IB questions and in applied work, and their means and variances can be quoted directly once the parameters are identified.
有两个连续分布在 IB 题目和实际应用中反复出现,只要识别出参数,它们的均值与方差就可以直接引用。
| Distribution | Mean | Variance | |
|---|---|---|---|
| Uniform on [a, b] | f(x) = 1/(b − a) | (a + b)/2 | (b − a)²/12 |
| Exponential (rate λ) | f(x) = λ exp(−λx), x ≥ 0 | 1/λ | 1/λ² |
The uniform mean is simply the midpoint of the interval, which agrees with the symmetry shortcut. The exponential distribution models waiting times between random events, and its most striking feature is that its mean and standard deviation are equal, both equal to 1/λ.
均匀分布的均值就是区间中点,这与对称性捷径一致。指数分布用于刻画随机事件之间的等待时间,它最显著的特征是均值与标准差相等,都等于 1/λ。
Both models can be derived from first principles with the integrals of the previous sections, and it is worth doing that derivation at least once so that the formulas feel earned rather than memorised.
两个模型都可以用前几节的积分从头推导出来,至少完整推一次是值得的,这样公式才像是"挣来的"而不是"背来的"。
7. Worked Example: A Polynomial PDF | 例题一:多项式型 PDF
lsewhere. The first step in any such question is always to check that the total area is 1.
设 X 的 PDF 为 f(x) = 3x²/8,0 ≤ x ≤ 2,其他处 f(x) = 0。此类题目的第一步永远是检验总面积为 1。
∫₀² 3x²/8 dx = [x³/8]₀² = 8/8 = 1 ✓
With the PDF verified, the mean follows from the definition, integrating x times the density over the support only.
验证 PDF 之后,按定义计算均值,只需在支撑集上对 x 乘以密度求积分。
E(X) = ∫₀² x · 3x²/8 dx = [3x⁴/32]₀² = 48/32 = 1.5
For the variance, compute the second moment first and then subtract the square of the mean. This ordering avoids fractions inside the integral.
计算方差时,先求二阶矩,再减去均值的平方。这个顺序可以避免积分内部出现复杂分式。
E(X²) = ∫₀² x² · 3x²/8 dx = [3x⁵/40]₀² = 96/40 = 2.4
Var(X) = 2.4 − (1.5)² = 2.4 − 2.25 = 0.15 σ = √0.15 ≈ 0.387
The distribution is skewed to the right, since the density grows as x increases, and this is consistent with the mean 1.5 lying above the midpoint 1 of the interval.
该分布右偏,因为密度随 x 增大而增大,这与均值 1.5 落在区间中点 1 的右侧是一致的。
8. Worked Example: The Exponential Distribution | 例题二:指数分布
d f(x) = 0 for x < 0. The mean is found by integration by parts, treating λ as a constant.
设 X 的 PDF 为 f(x) = λ exp(−λx),x ≥ 0,其中 λ 为正的常数,且 x < 0 时 f(x) = 0。用分部积分求均值,把 λ 视为常数。
E(X) = ∫₀∞ x λ exp(−λx) dx = 1/λ
The second moment requires the same technique twice, and the integral is a standard result that can be quoted once it has been derived.
二阶矩需要用同样的技巧做两次,这个积分是标准结果,推导一次之后即可直接引用。
E(X²) = ∫₀∞ x² λ exp(−λx) dx = 2/λ²
Subtracting the square of the mean gives the variance and then the standard deviation, which turns out to be identical to the mean.
减去均值的平方,得到方差,进而得到标准差,结果恰好与均值相等。
Var(X) = 2/λ² − 1/λ² = 1/λ² σ = 1/λ = E(X)
0.25 per minute, the mean wait is 4 minutes and the standard deviation is also 4 minutes.
当考题给出带有给定速率的等待时间,例如每分钟 λ = 0.25,则平均等待时间为 4 分钟,标准差同样是 4 分钟。
9. Symmetry, Median, Mode and Mean | 对称性、中位数、众数与均值
x = c, then the balance point must lie on that line, so E(X) = c without any integration.
对称性是定位均值最快的方法。如果 f(x) 的图像关于直线 x = c 对称,那么平衡点必定落在这条线上,因此无需积分即可得出 E(X) = c。
The median m satisfies the equation below, and for a symmetric distribution with a single mode the mean, median and mode all coincide at the centre of symmetry.
中位数 m 满足下面的方程,而对于单峰的对称分布,均值、中位数和众数都重合于对称中心。
∫₋∞^m f(x) dx = 0.5
The mode is the value of x at which f(x) reaches its maximum, found by solving f' or a skewed distribution the three measures separate: in a right-skewed distribution the mode is smallest and the mean is largest, while in a left-skewed distribution the order is reversed. Recognising this ordering allows you to sanity-check an answer without recalculating anything.
众数是使 f(x) 取得最大值的 x,可通过解 f'(x) = 0 并检验符号变化得到。对于偏态分布,这三个量会分离:右偏分布中众数最小、均值最大;左偏分布中顺序相反。掌握这一顺序,就能在不重算的情况下对答案做合理性检验。
10. Using the Calculator Efficiently | 高效使用图形计算器
In an examination with a graphical calculator, the integral for the mean and the integral for the second moment can both be evaluated numerically, which saves time and reduces algebraic errors. The function is entered once and the same expression is reused with x² in place of x.
在允许使用图形计算器的考试中,均值的积分与二阶矩的积分都可以用数值方法计算,既节省时间又减少代数错误。只需输入一次函数,再把 x 换成 x² 重复使用同一表达式即可。
Enter f(x) into the function list, then use the numerical integration tool with the correct lower and upper limits taken from the support of the distribution, not from negative infinity unless the question genuinely requires it. On most models the integral sign is available directly from the mathematics menu.
把 f(x) 输入函数列表,然后使用数值积分工具,积分上下限取自分布的支撑集;除非题目确实需要,否则不要写成负无穷。多数型号的积分符号可以直接从数学菜单中调出。
Store the values of E(X) and E(X
更多咨询请联系16621398022(同微信)

或截图后用「扫一扫 → 相册」选择本图