Distribution of a Function of a Random Variable | 随机变量函数的分布

📚 Distribution of a Function of a Random Variable | 随机变量函数的分布

In probability and statistics, we are often faced with the challenge of determining the distribution of a transformed random variable. Suppose X is a random variable with a known probability distribution, and we define a new variable Y = g(X) for some given function g. What can we say about the distribution of Y? This problem, known as the distribution of a function of a random variable, is fundamental in both theoretical and applied statistics. It appears explicitly in the IB Mathematics: Analysis and Approaches (AA) and Applications and Interpretation (AI) syllabi, where students are expected to handle both discrete and continuous cases using systematic methods. Whether we are dealing with the sum of independent measurements, the logarithm of a financial return, or the square of a physical quantity, being able to derive the probability mass function (PMF) or probability density function (PDF) of a transformed variable is essential. In this article, we will explore the core techniques: direct mapping for discrete variables, the cumulative distribution function (CDF) method, the change-of-variables formula for continuous monotonic transformations, and how to approach non-monotonic functions. By mastering these concepts, you will be well-prepared for any exam question on transformed distributions.

在概率与统计中,我们常常需要确定一个变换后的随机变量的分布。假设 X 是一个具有已知概率分布的随机变量,我们通过某个给定的函数 g 定义一个新变量 Y = g(X)。我们还能对 Y 的分布说什么?这个问题,即随机变量函数的分布,是理论统计和应用统计的基础。它明确出现在 IB 数学分析与方法 (AA) 和应用与解释 (AI) 课程中,学生需要掌握处理离散和连续情况的系统方法。无论我们是在处理独立测量值的和、金融收益的对数,还是物理量的平方,能够推导变换后变量的概率质量函数 (PMF) 或概率密度函数 (PDF) 都是至关重要的。在本文中,我们将探讨核心技巧:离散变量的直接映射、累积分布函数 (CDF) 方法、连续单调变换的换元公式,以及如何处理非单调函数。掌握这些概念,你将能从容应对任何关于变换分布的考试题。


1. Functions of Random Variables: The Basic Idea | 随机变量函数:基本思想

A function of a random variable is simply a new random variable created by applying a deterministic rule g to each outcome of X. That is, if the random experiment yields X = x, then Y takes on the value y = g(x). Since X is random, Y inherits randomness, but its distribution is generally different from that of X. The goal is to describe the probability law of Y — either its PMF in the discrete case or its PDF in the continuous case. Why does this matter? In many real-world situations, we measure X but are really interested in some function of it, such as its square root, its exponential, or a linear rescaling. Therefore, understanding how distributions transform is a crucial building block in statistical modelling.

随机变量函数就是将一个确定性规则 g 应用于 X 的每一个结果而产生的新随机变量。也就是说,如果随机试验得到 X = x,那么 Y 取值为 y = g(x)。由于 X 是随机的,Y 也继承了随机性,但它的分布通常与 X 不同。我们的目标是描述 Y 的概率规律——在离散情况下是其 PMF,在连续情况下是其 PDF。为什么这很重要?在许多实际情境中,我们测量了 X,但真正关心的却是它的某个函数,比如它的平方根、指数或线性缩放。因此,理解分布如何变换是统计建模中的关键基石。


2. Discrete Random Variables: Direct Mapping of the Probability Mass | 离散随机变量:概率质量的直接映射

When X is a discrete random variable, deriving the distribution of Y = g(X) is conceptually straightforward. For each possible value x_i of X, we compute y_i = g(x_i) and assign the same probability P(X = x_i) to the new value y_i. If g is not injective (i.e. two different x values yield the same y), the probabilities of those x values must be added together for that y. The resulting set of distinct y values, together with their summed probabilities, forms the PMF of Y.

当 X 是离散随机变量时,推导 Y = g(X) 的分布在概念上很简单。对于 X 的每一个可能取值 x_i,我们计算 y_i = g(x_i) 并将概率 P(X = x_i) 赋给新值 y_i。如果 g 不是单射(即两个不同的 x 值产生相同的 y),则必须将那些 x 值的概率相加给该 y。由此得到的不重复 y 值及其相加后的概率就构成了 Y 的 PMF。

Example: Let X follow a Poisson distribution with mean λ, and define Y = 2X + 1. The possible values of X are 0, 1, 2, … with probabilities e^{-λ} λ^k / k!. Then Y takes values 1, 3, 5, … with exactly the same probabilities, and no merging is needed because the linear function is one-to-one on the non-negative integers. Hence, P(Y = 2k+1) = e^{-λ} λ^k / k! for k = 0, 1, 2, … . If instead we had Y = X², then both X=1 and X=-1 (if possible) would map to Y=1, so probabilities would be combined.

示例:设 X 服从均值为 λ 的泊松分布,定义 Y = 2X + 1。X 的可能取值为 0, 1, 2, …,概率为 e^{-λ} λ^k / k!。那么 Y 取值为 1, 3, 5, …,概率完全相同,因为线性函数在非负整数上是一一对应的。因此,P(Y = 2k+1) = e^{-λ} λ^k / k!,k = 0, 1, 2, …。如果改为 Y = X²,那么 X=1 和 X=-1(若可能)都会映射到 Y=1,所以概率要合并。


3. Continuous Random Variables: The CDF Method | 连续随机变量:累积分布函数 (CDF) 法

For continuous X, the most robust method for finding the distribution of Y = g(X) is to first find its cumulative distribution function (CDF), and then differentiate to obtain the PDF. The CDF of Y is defined as F_Y(y) = P(Y ≤ y) = P(g(X) ≤ y). To evaluate this probability, we solve the inequality g(X) ≤ y for X. The solution is typically an interval (or union of intervals) on the real line. Then we express this probability in terms of the known distribution of X — usually by integrating its PDF over that set. Once F_Y(y) is obtained, the PDF f_Y(y) equals the derivative F’_Y(y) (where differentiable).

对于连续型 X,求 Y = g(X) 的分布最可靠的方法是先求其累积分布函数 (CDF),然后求导得到 PDF。Y 的 CDF 定义为 F_Y(y) = P(Y ≤ y) = P(g(X) ≤ y)。为了计算这个概率,我们针对 X 解不等式 g(X) ≤ y。解通常是实轴上的一个区间(或区间的并集)。然后我们用 X 的已知分布来表达这个概率——通常是通过在该集合上对其 PDF 积分。一旦得到 F_Y(y),PDF f_Y(y) 就等于导数 F’_Y(y)(在可导处)。

For example, suppose X has an exponential distribution with rate λ, so f_X(x) = λ e^{-λ x} for x > 0. Define Y = X². Then for y ≥ 0: F_Y(y) = P(X² ≤ y) = P(0 ≤ X ≤ √y) = ∫_0^{√y} λ e^{-λ x} dx = 1 – e^{-λ √y}. Differentiating gives f_Y(y) = (λ / (2√y)) e^{-λ √y} for y > 0. This illustrates the CDF method’s power, even when the transformation is not one-to-one over the entire support.

例如,假设 X 服从比率为 λ 的指数分布,即 f_X(x) = λ e^{-λ x}, x > 0。定义 Y = X²。那么对于 y ≥ 0:F_Y(y) = P(X² ≤ y) = P(0 ≤ X ≤ √y) = ∫_0^{√y} λ e^{-λ x} dx = 1 – e^{-λ √y}。求导得到 f_Y(y) = (λ / (2√y)) e^{-λ √y}, y > 0。这展示了 CDF 方法的威力,即使变换在整个支集上不是一一的。


4. The Change-of-Variables Formula for Monotonic Functions | 单调函数的换元公式

If the function g is strictly monotonic (either strictly increasing or strictly decreasing) and differentiable on the support of X, there exists a direct formula for the PDF of Y = g(X). Let X have PDF f_X(x) and let g be invertible with inverse x = g^{-1}(y). Then the PDF of Y is given by:

f_Y(y) = f_X(g^{-1}(y)) × | d/dy g^{-1}(y) |.

The absolute value of the derivative ensures positivity, and this factor is often called the ‘Jacobian’ of the transformation. This method is much faster than the CDF method when g is monotonic. It comes from the CDF method by differentiating F_Y(y) and applying the chain rule.

如果函数 g 在 X 的支集上严格单调(严格递增或严格递减)且可微,那么存在一个直接公式给出 Y = g(X) 的 PDF。设 X 具有 PDF f_X(x),且 g 可逆,其逆函数为 x = g^{-1}(y)。那么 Y 的 PDF 为:

f_Y(y) = f_X(g^{-1}(y)) × | d/dy g^{-1}(y) |.

导数的绝对值保证非负性,这个因子通常被称为变换的“雅可比”。当 g 单调时,此方法比 CDF 法快得多。它来源于对 CDF F_Y(y) 求导并应用链式法则。

Example: If X ~ Normal(μ, σ²) and Y = aX + b with a ≠ 0, then the inverse is x = (y – b)/a, and the derivative is 1/a. Thus, f_Y(y) = (1/(|a|)) × (1/√(2πσ²)) exp[ – ( ( (y-b)/a – μ )² / (2σ²) ) ] = (1/√(2π (aσ)²)) exp[ – (y – (aμ+b))² / (2a²σ²) ]. So Y is normally distributed with mean aμ+b and variance a²σ². This confirms the well-known property of the normal distribution under linear transformations.

例子:若 X ~ N(μ, σ²) 且 Y = aX + b,a ≠ 0,则逆变换为 x = (y – b)/a,导数为 1/a。于是 f_Y(y) = (1/(|a|)) × (1/√(2πσ²)) exp[ – ( ( (y-b)/a – μ )² / (2σ²) ) ] = (1/√(2π (aσ)²)) exp[ – (y – (aμ+b))² / (2a²σ²) ]。因此 Y 服从均值为 aμ+b、方差为 a²σ² 的正态分布。这证实了正态分布在线性变换下的熟知的特性。


5. Linear Transformations: Special Properties | 线性变换的特殊性质

Linear transformations Y = aX + b are extremely common and possess elegant properties. For any random variable X (discrete or continuous) with finite expectation and variance:

  • E(aX + b) = a E(X) + b
  • Var(aX + b) = a² Var(X)

For many standard families, the distributional form is preserved: normal goes to normal, uniform goes to uniform (if the support remains an interval), and exponential scales to exponential (with b=0). The CDF method or change-of-variables formula easily demonstrates these facts. When a < 0, the transformation reverses order, which is handled naturally by the absolute value in the Jacobian.

线性变换 Y = aX + b 极为常见,并具有优美的性质。对于任何具有有限期望和方差的随机变量 X(离散或连续):

  • E(aX + b) = a E(X) + b
  • Var(aX + b) = a² Var(X)

对于许多标准分布族,分布形式得以保持:正态变为正态,均匀变为均匀(如果支集仍为区间),指数缩放后仍为指数(当 b=0 时)。CDF 法或换元公式可以轻松证明这些事实。当 a < 0 时,变换会逆转顺序,雅可比中的绝对值自然地处理了这一点。

From an exam perspective, always check the sign of a: a negative a flips the direction of inequalities in the CDF method but is correctly accounted for by the absolute value in the PDF formula. Also note that if X is discrete, the PMF is simply reassigned using the mapping formula, and the linear structure ensures no merging unless a is zero (a degenerate case).

从考试的角度,始终要检查 a 的符号:负的 a 会在 CDF 法中翻转不等式的方向,但 PDF 公式中的绝对值正确地处理了这一点。还要注意,如果 X 是离散的,PMF 只需用映射公式重新分配,线性结构确保不会合并,除非 a 为零(退化情况)。


6. Non-Monotonic Transformations: Handling the Square Function | 非单调变换:处理平方函数

When g is not monotonic over the whole support of X, we cannot apply the simple change-of-variables formula blindly. Instead, the CDF method becomes essential, or we can break the support of X into intervals where g is monotonic and apply the PDF formula piecewise. A classic example is Y = X², where X can take both positive and negative values. Suppose X is a continuous random variable with PDF f_X(x) defined on the real line. For y ≥ 0,

F_Y(y) = P(-√y ≤ X ≤ √y) = F_X(√y) – F_X(-√y).

Differentiating gives the PDF:

f_Y(y) = (1/(2√y)) [ f_X(√y) + f_X(-√y) ], y > 0.

If X is symmetric about 0, the two terms become equal, yielding f_Y(y) = (1/√y) f_X(√y). As a special case, when X ~ N(0,1), Y = X² follows a chi-squared distribution with 1 degree of freedom, an important distribution in statistics.

当 g 在 X 的整个支集上非单调时,我们不能盲目套用简单的换元公式。此时 CDF 法变得至关重要,或者我们可以将 X 的支集分割成 g 单调的区间,然后分段应用 PDF 公式。一个经典的例子是 Y = X²,其中 X 可正可负。假设 X 是定义在整条实数轴上的连续随机变量,PDF 为 f_X(x)。对于 y ≥ 0,

F_Y(y) = P(-√y ≤ X ≤ √y) = F_X(√y) – F_X(-√y).

求导得到 PDF:

f_Y(y) = (1/(2√y)) [ f_X(√y) + f_X(-√y) ], y > 0.

如果 X 关于 0 对称,两项相等,得出 f_Y(y) = (1/√y) f_X(√y)。作为一个特例,当 X ~ N(0,1) 时,Y = X² 服从自由度为 1 的卡方分布,这是统计学中的一个重要分布。

Other non-monotonic transformations, such as Y = |X| or Y = sin(X), are handled similarly: define the CDF by solving the inequality for X and carefully accounting for all intervals that satisfy it.

其他非单调变换,如 Y = |X| 或 Y = sin(X),也类似处理:通过针对 X 解不等式来定义 CDF,并仔细考虑所有满足条件的区间。


7. Sum of Independent Random Variables: Convolution | 独立随机变量之和:卷积

When we consider a function of two or more independent random variables, such as Z = X + Y, the distribution of Z can be found using a convolution. If X and Y are independent continuous variables with PDFs f_X and f_Y, the PDF of Z is the convolution integral:

f_Z(z) = ∫_{-∞}^{∞} f_X(x) f_Y(z – x) dx.

For discrete independent variables, the PMF of the sum is the convolution sum: P(Z = z) = Σ_x P(X = x) P(Y = z – x). A well-known result is that the sum of two independent Poisson random variables with means λ₁ and λ₂ again follows a Poisson distribution with mean λ₁+λ₂. Similarly, the sum of independent normal variables is normal. Although this topic extends beyond simple univariate functions, IB syllabi often touch upon the sum of independent variables, and the convolution idea is a natural extension of function-of-variable methods.

当我们考虑两个或多个独立随机变量的函数,例如 Z = X + Y,Z 的分布可以用卷积求得。如果 X 和 Y 是独立的连续变量,PDF 分别为 f_X 和 f_Y,则 Z 的 PDF 是卷积积分:

f_Z(z) = ∫_{-∞}^{∞} f_X(x) f_Y(z – x) dx.

对于离散独立变量,和的 PMF 是卷积和:P(Z = z) = Σ_x P(X = x) P(Y = z – x)。一个众所周知的结果是,两个均值分别为 λ₁ 和 λ₂ 的独立泊松随机变量之和仍然服从均值为 λ₁+λ₂ 的泊松分布。类似地,独立正态变量之和仍为正态。尽管这一主题超出了简单的单变量函数,但 IB 课程大纲常常涉及独立变量之和,卷积思想是变量函数方法的自然延伸。


8. Functions of Discrete Random Variables: Further Examples | 离散随机变量函数的更多示例

Let’s consolidate the discrete case with additional examples. Suppose X follows a discrete uniform distribution on the integers 1, 2, 3, 4, 5, each with probability 1/5. Define Y = (X – 3)². Then possible values of Y are: when X=1 or 5, Y=4; X=2 or 4, Y=1; X=3, Y=0. So P(Y=0)=1/5, P(Y=1)=2/5, P(Y=4)=2/5. This illustrates how squaring collapses symmetry, and probabilities aggregate.

让我们用更多示例巩固离散情况。假设 X 在整数 1, 2, 3, 4, 5 上服从离散均匀分布,每个值的概率为 1/5。定义 Y = (X – 3)²。那么 Y 的可能取值为:当 X=1 或 5 时,Y=4;X=2 或 4 时,Y=1;X=3 时,Y=0。所以 P(Y=0)=1/5,P(Y=1)=2/5,P(Y=4)=2/5。这说明了平方如何塌缩对称性以及概率如何聚合。

Another important case is a function that produces a smaller set of values, such as Y = X mod 2 (the remainder upon division by 2). If X is discrete uniform on {1,2,3,4,5}, Y takes only 0 and 1 with probabilities 2/5 and 3/5 respectively. Always remember: list all possible x, apply g, collect distinct y, and sum probabilities.

另一个重要情况是产生较小值集合的函数,如 Y = X mod 2(除以 2 的余数)。如果 X 在 {1,2,3,4,5} 上离散均匀,Y 仅取 0 和 1,概率分别为 2/5 和 3/5。务必记住:列出所有可能的 x,应用 g,收集不重复的 y,然后汇总概率。


9. Common Pitfalls and Examination Tips | 常见错误与考试技巧

Even though the methods are systematic, students often stumble over a few recurring issues. First, forgetting to take the absolute value of the derivative in the PDF change-of-variables formula; the Jacobian must be positive. Second, not checking whether the function is one-to-one over the entire support of X; if it is not, the simple formula will give an incorrect PDF unless the domain is split. Third, failing to update the support of Y correctly: the set of possible y values must be deduced from the range of g on the support of X. Fourth, in the CDF method, writing F_Y(y) as an integral of f_X but neglecting the limits properly. Always sketch the region corresponding to g(X) ≤ y to avoid inequality mistakes.

尽管方法是系统化的,学生常在几个反复出现的问题上栽跟头。第一,忘记在 PDF 换元公式中取导数的绝对值;雅可比必须为正。第二,未检查函数在 X 的整个支集上是否是一一映射;如果不是,除非将定义域分割,简单的公式会给出错误的 PDF。第三,未能正确更新 Y 的支集:必须从 g 在 X 支集上的值域推断 y 的可能取值集合。第四,在 CDF 法中,将 F_Y(y) 写为 f_X 的积分,但未能正确处理积分限。始终画出满足 g(X) ≤ y 的区域,以避免不等式错误。

In discrete cases, double-check that you have accounted for all possible x values and that probabilities sum to 1. When dealing with an unfamiliar transformation, always default to the CDF method — it works universally for continuous variables. Finally, remember that linear transformations are the easiest: for Y = aX + b, you can directly write the new expectation and variance, and often the distribution family is preserved.

在离散情况下,反复检查是否考虑了所有可能的 x 值,以及概率之和为 1。当遇到不熟悉的变换时,始终默认使用 CDF 法——它对连续变量普遍适用。最后,记住线性变换是最简单的:对于 Y = aX + b,可以直接写出新的期望和方差,而且分布族常常得以保持。


10. Summary and Key Takeaways | 总结与关键要点

The distribution of a function of a random variable is a central topic that bridges probability theory and statistical inference. For discrete X, the approach is a straightforward probability redistribution by mapping and summing. For continuous X, the two principal tools are the CDF method — always reliable — and the change-of-variables formula, which provides a shortcut when g is monotonic. Non-monotonic functions like squares and absolute values require careful interval splitting. Linear transformations preserve many distributional forms and have simple rules for expectation and variance. Convolution extends these ideas to sums of independent variables.

随机变量函数的分布是连接概率论与统计推断的核心主题。对于离散 X,方法是通过映射和求和进行直接的概率重新分配。对于连续 X,两个主要工具是 CDF 法——始终

Published by TutorHao | IB Mathematics Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading