📚 Expected Value and Variance of a Function of X | 随机变量函数的期望与方差
uch as Y = aX + b, and a careful look at non-linear cases such as Y = X². Every formula is illustrated with a single worked distribution so that you can see exactly where each number comes from.
对于离散型随机变量 X,我们常常不仅需要计算 X 本身的均值与离散程度,还要计算由函数产生的新随机变量的期望与方差,例如 Y = aX + b 或 Y = X²。本文讲解如何计算 E[g(X)] 与 Var[g(X)],并重点关注线性变换;所有公式都用同一组分布数据贯穿演示,方便你逐项核对自己的计算过程。
1. Discrete Random Variables and Probability Distributions | 离散随机变量与概率分布
X = xᵢ). The probabilities must all be non-negative and must sum to 1 over the whole list.
离散型随机变量 X 有一组可能取值 x₁、x₂、x₃、... 以及相应的概率 P(X = xᵢ)。所有概率都必须是非负的,并且在整个取值范围内总和等于 1。
In Edexcel questions you are usually given a probability distribution table. Always check that the probabilities sum to 1 before calculating E(X) - if they do not, the table either contains a gap you must fill or an error you must correct.
在 Edexcel 考题中,通常会给出概率分布表。计算 E(X) 之前,务必先检查各概率之和是否等于 1;如果不等于 1,说明表中要么有你需要补上的空缺,要么存在需要你纠正的错误。
- A probability distribution is a complete description of the behaviour of X. | 概率分布是对 X 行为的完整描述。
- Probabilities are never negative, and never exceed 1. | 概率既不为负,也不大于 1。
- A single value xᵢ with probability 0 is normally left out of the table. | 概率为 0 的取值通常不列入表中。
2. Expected Value of X | X 的期望
The expected value, also called the mean, is written E(X) or μ. It is a probability-weighted average of all possible values, and it is not necessarily a value that X can actually take.
期望值又称均值,记作 E(X) 或 μ。它是所有可能取值按概率加权的平均值,不一定是 X 实际能取到的值。
al. The mean is a centre of gravity of the distribution, not a member of the sample space.
例如,若 X 表示一颗公平骰子的点数,则 E(X) = 3.5,而 X 永远不可能等于 3.5。均值是分布的"重心",而不是样本空间中的一个元素。
E(X) = Σ x · P(X = x) = μ
The summation runs over every value x in the support of X. Multiply each value by its own probability, then add the products. Because the probabilities sum to 1, the result is always a weighted average lying between the smallest and largest possible values.
求和是对 X 的所有可能取值 x 进行的。将每个取值乘以它自己的概率,再把所有乘积相加。由于概率之和为 1,结果一定是介于最小值与最大值之间的加权平均值。
3. Worked Example: The Mean of a Distribution | 例题:分布均值的计算
Consider a discrete random variable X with the following distribution. It will be used again in every later section, so keep the numbers to hand.
考虑如下分布的离散随机变量 X。后文每一小节都会反复用到这组数据,请先记住这些数字。
| x | 1 | 2 | 3 | 4 |
| P(X = x) | 0.1 | 0.3 | 0.4 | 0.2 |
the table is a valid probability distribution. Now apply the definition of expectation term by term.
先做检查:0.1 + 0.3 + 0.4 + 0.2 = 1,所以该表是有效的概率分布。现在逐项套用期望的定义。
E(X) = 1 × 0.1 + 2 × 0.3 + 3 × 0.4 + 4 × 0.2 = 0.1 + 0.6 + 1.2 + 0.8 = 2.7
value is 3, but the mean is pulled slightly below it by the relatively low value 1, which carries a probability of 0.1.
因此 μ = 2.7。注意最可能的取值是 3,但取值 1 以 0.1 的概率把均值略微拉低了一些。
4. Variance and Standard Deviation of X | X 的方差与标准差
X). A small variance means the values are concentrated near μ; a large variance means they are more spread out.
方差衡量 X 的取值相对于均值 μ = E(X) 的分散程度。方差小表示取值集中在 μ 附近;方差大表示取值更加分散。
The definition is the expected value of the squared deviation from the mean. Squaring removes the signs so that deviations above and below the mean cannot cancel each other out.
定义是"偏差平方的期望"。平方的作用是消除正负号,使均值两侧的偏差不会互相抵消。
Var(X) = E[(X − μ)²] = Σ (x − μ)² · P(X = x)
and (4 − 2.7)² × 0.2 = 0.338. Adding gives Var(X) = 0.289 + 0.147 + 0.036 + 0.338 = 0.81.
把定义用在本例上:(1 − 2.7)² × 0.1 = 0.289,(2 − 2.7)² × 0.3 = 0.147,(3 − 2.7)² × 0.4 = 0.036,(4 − 2.7)² × 0.2 = 0.338。相加得 Var(X) = 0.289 + 0.147 + 0.036 + 0.338 = 0.81。
The standard deviation is the positive square root of the variance and has the same units as X, which is why it is often easier to interpret than the variance.
标准差是方差的正平方根,与 X 的单位相同,因此通常比方差更容易解释。
SD(X) = √Var(X)
5. The Fast Formula for Variance | 方差的快捷公式
d in examination calculations because it avoids subtracting the mean from every single term.
定义式在概念上很重要,但考试计算中通常使用更快的公式 Var(X) = E(X²) − [E(X)]²,因为它避免了逐项减去均值。
Var(X) = E(X²) − μ²
+ μ² = E(X²) − μ². Expectation is linear, so it can be taken through the sum term by term.
该公式由展开平方得到:E[(X − μ)²] = E(X² − 2μX + μ²) = E(X²) − 2μE(X) + μ² = E(X²) − 2μ² + μ² = E(X²) − μ²。期望具有线性性质,可以逐项穿过求和号。
.6 + 3.2 = 8.1. Hence Var(X) = 8.1 − 2.7² = 8.1 − 7.29 = 0.81, matching Section 4 exactly.
对本例的分布,E(X²) = 1² × 0.1 + 2² × 0.3 + 3² × 0.4 + 4² × 0.2 = 0.1 + 1.2 + 3.6 + 3.2 = 8.1。因此 Var(X) = 8.1 − 2.7² = 8.1 − 7.29 = 0.81,与第 4 节结果完全一致。
Note the order of operations: square the mean first, then subtract. A very common error is to compute E(X²) − E(X)². Furthermore, E(X²) is not the square of E(X); in this example 8.1 ≠ 7.29.
注意运算顺序:先把均值平方,再做减法。一个很常见的错误是算成 E(X²) − E(X)²。另外,E(X²) 并不等于 [E(X)]²;在本例中 8.1 ≠ 7.29。
6. The Expected Value of a Function of X | 随机变量函数的期望 E[g(X)]
Y at all: you apply g to each value of X and weight by the original probability P(X = x).
设 Y = g(X) 是把函数 g 作用在 X 上得到的新随机变量。求 E[g(X)] 完全不需要先求出 Y 的分布:只需对 X 的每个取值先作用 g,再用原来的概率 P(X = x) 加权。
E[g(X)] = Σ g(x) · P(X = x)
This is sometimes called the substitution rule, or informally the "law of the unconscious statistician": calculating E[g(X)] as if it were E(X) with x replaced by g(x) turns out to be correct.
这条结论有时被称为"代入法则",也常被戏称为"无意识统计学家定律":把 E(X) 公式中的 x 直接替换成 g(x) 来计算 E[g(X)],结果恰好是正确的。
- If g(x) = x, the formula returns E(X). | 若 g(x) = x,公式退化为 E(X)。
- If g(x) = x², the formula returns E(X²), needed for the variance. | 若 g(x) = x²,公式给出 E(X²),这是计算方差所需要的。
- If g(x) = 3x − 2, the formula returns E(3X − 2). | 若 g(x) = 3x − 2,公式给出 E(3X − 2)。
The key requirement is that the weights are still the probabilities of X, not of Y. If you first build the distribution of Y you will get the same answer, but you will have done far more work and created more opportunities for error.
关键要求是:权重仍然是 X 的概率,而不是 Y 的概率。如果你先构造 Y 的分布也能得到同样的答案,但工作量更大,出错的机会也更多。
7. Why E[g(X)] Is Not g(E(X)) | 为什么 E[g(X)] 不等于 g(E(X))
A frequent misconception is that E[g(X)] can be found by simply substituting the mean into g. This is false in general: expectation does not commute with non-linear functions.
一个常见的误解是:把均值直接代入 g 就能得到 E[g(X)]。这在一般情况下是错误的:期望与非线性函数不可交换。
ues differ, and E(X²) is the larger of the two. Substituting the mean would understate the answer by 0.81.
用本例的分布和 g(x) = x² 来检验。我们已知 E(X²) = 8.1,而 [E(X)]² = 2.7² = 7.29。两者不相等,且 E(X²) 更大。若直接代入均值,答案会少算 0.81。
bstitution does work. This is exactly why linear transformations are treated separately in the next two sections.
有一类重要的例外:若 g 是线性的,即 g(x) = ax + b,则 E[g(X)] = g(E(X)),此时代入均值确实成立。这正是接下来两节要把线性变换单独处理的原因。
E[g(X)] = g(E(X)) if and only if g is linear
For a convex function such as x², Jensen' E[g(X)] ≥ g(E(X)), which is why the gap in the example above went in the direction it did.
对于 x² 这样的凸函数,Jensen 不等式保证 E[g(X)] ≥ g(E(X)),这就解释了上例中差值出现的方向。
8. Linear Transformations: E(aX + b) and Var(aX + b) | 线性变换的期望与方差
where a and b are constants, both the mean and the variance follow simple rules. These are the results most heavily examined in the Edexcel specification.
对于线性变换 Y = aX + b(其中 a、b 为常数),其均值与方差都遵循简单法则。这两条结论是 Edexcel 考试大纲中最常考的内容。
E(aX + b) = a·E(X) + b
Var(aX + b) = a²·Var(X)
The mean rule mirrors ordinary algebra: scaling X by a scales the mean by a, and shifting by b shifts the mean by b. The variance rule is different in two ways. Multiplying by a multiplies the variance by a², because variance is measured in squared units, and the shift b disappears entirely.
均值法则与普通代数一致:X 乘以 a,均值也乘以 a;X 加上 b,均值也加上 b。方差法则有两点不同。乘以 a 时方差要乘以 a²,因为方差是以平方单位度量的;而平移量 b 则完全消失。
Adding a constant slides the whole distribution along the number line without changing how spread out it is, so it cannot affect the variance. Multiplying by a negative value such as −3 reverses the order of the values but not their spread, which is why the variance uses a² rather than a.
加上常数只是把整个分布沿数轴平移,并不改变分散程度,所以不影响方差。乘以 −3 这样的负数会颠倒取值的顺序,但不改变分散程度,这正是方差用 a² 而不是 a 的原因。
SD(aX + b) = |a|·SD(X)
Standard deviation scales linearly with |a|, and like the variance it is unaffected by b. Both rules assume a and b are fixed constants, not themselves random.
标准差与 |a| 成线性关系,且与方差一样不受 b 影响。这两条法则都假定 a、b 是固定常数,而不是随机变量。
9. Worked Example: A Linear Transformation | 例题:线性变换的完整计算
(Y) = 3 × 2.7 − 2 = 8.1 − 2 = 6.1, and Var(Y) = 3² × 0.81 = 9 × 0.81 = 7.29. Hence SD(Y) = √7.29 = 2.7.
回到 E(X) = 2.7、Var(X) = 0.81 的那组分布,令 Y = 3X − 2。直接用公式:E(Y) = 3 × 2.7 − 2 = 8.1 − 2 = 6.1,Var(Y) = 3² × 0.81 = 9 × 0.81 = 7.29。因此 SD(Y) = √7.29 = 2.7。
4, 7, 10, with the same probabilities 0.1, 0.3, 0.4, 0.2 because a one-to-one transformation preserves the probabilities.
现在从基本原理出发,逐个变换 X 的取值来验证均值。当 X = 1、2、3、4 时,Y 分别取 1、4、7、10,概率仍是 0.1、0.3、0.4、0.2,因为一一对应的变换不改变概率。
E(Y) = 1 × 0.1 + 4 × 0.3 + 7 × 0.4 + 10 × 0.2 = 0.1 + 1.2 + 2.8 + 2 = 6.1
The direct calculation gives 6.1, confirming the shortcut. Reassuringly, Y always equals 3X − 2, so no information has been lost and a distribution table of Y is a legitimate alternative route.
直接计算得 6.1,与快捷公式一致。令人放心的是,Y 始终等于 3X − 2,因此没有信息丢失,列出 Y 的分布表是另一条合法路径。
- Negative a: if Y = −2X + 5, then E(Y) = −2(2.7) + 5 = −0.4 and Var(Y) = 4 × 0.81 = 3.24. | a 为负:若 Y = −2X + 5,则 E(Y) = −2(2.7) + 5 = −0.4,Var(Y) = 4 × 0.81 = 3.24。
- Pure shift: if Y = X + 10, then Var(Y) = Var(X) = 0.81 and SD(Y) = 0.9. | 纯平移:若 Y = X + 10,则 Var(Y) = Var(X) = 0.81,SD(Y) = 0.9。
- Pure scale: if Y = 0.5X, then E(Y) = 1.35 and Var(Y) = 0.25 × 0.81 = 0.2025. | 纯缩放:若 Y = 0.5X,则 E(Y) = 1.35,Var(Y) = 0.25 × 0.81 = 0.2025。
10. Non-Linear Functions: The Case Y = X² | 非线性函数:Y = X² 的情形
n is the standard exam example, because it is also the ingredient of the variance formula.
当 g 不是线性函数时就没有捷径可走:必须回到 E[g(X)] = Σ g(x)·P(X = x)。平方函数是考试中的标准例子,因为它也正是方差公式的组成部分。
ld need E(X⁴): 1⁴ × 0.1 + 2⁴ × 0.3 + 3⁴ × 0.4 + 4⁴ × 0.2 = 0.1 + 4.8 + 32.4 + 51.2 = 88.5.
我们已求出 E(X²) = 8.1,由此得到 Var(X) = 0.81。若要计算 Y = X² 的方差,还需要 E(X⁴):1⁴ × 0.1 + 2⁴ × 0.3 + 3⁴ × 0.4 + 4⁴ × 0.2 = 0.1 + 4.8 + 32.4 + 51.2 = 88.5。
Then Var(X²) = E(X⁴) − [E(X²)]² = 88.5 − 8.1² = 88.5 − 65.61 = 22.89, with SD(X²) = √22 ow much larger this is than Var(X) = 0.81, even though X² is a simple transformation of X.
于是 Var(X²) = E(X⁴) − [E(X²)]² = 88.5 − 8.1² = 88.5 − 65.61 = 22.89,SD(X²) = √22.89 ≈ 4.78。注意它比 Var(X) = 0.81 大得多,尽管 X² 只是 X 的一个简单变换。
can be written from Var(X) alone is the linear family g(x) = ax + b, where Var = a²Var(X).
不存在 Var(g(X)) = g(Var(X)) 这类通用法则。唯一能仅由 Var(X) 直接写出 Var(g(X)) 的变换族是线性族 g(x) = ax + b,此时 Var = a²Var(X)。
11. Exam Technique and Common Errors | 应试技巧与常见错误
Most marks are lost through small slips rather than conceptual gaps. In distribution questions, the first mark is nearly always for checking or completing the probability table, so never skip that step even when it feels trivial.
失分多半来自小失误而非概念空缺。在分布类题目中,第一个得分点几乎总是检查或补全概率表,所以哪怕看起来很简单也不要跳过这一步。
Keep working values exact or to at least four significant figures until the final line. Rounding E(X) to 2.7 and then squaring gives 7.29, but rounding to three decimal places first would shift the answer slightly; examiners compare against the full-precision value.
中间结果要保持精确或至少四位有效数字,直到最后一行再取整。把 E(X) 取成 2.7 再平方得 7.29,但若先取三位小数,结果会有细微偏移;评分标准是按全精度值对比的。
- Never multiply the variance by a instead of a². | 不要用 a 而要用 a²
广告 / Sponsored培生爱德思考试教材 统计数学3 Edexcel International A Level Mathematics S…数学 备考教辅 · 正版现货 · 与本文内容相关查看详情 / View on Taobao参考价 ¥156.0
更多咨询请联系16621398022(同微信)
备考资讯每日更新,关注不错过考纲变化 · 科目分析 · 学习方法
在微信里长按二维码识别关注
或截图后用「扫一扫 → 相册」选择本图公众号:tutorhao