Functions of a Random Variable

Why Functions of Random Variables?

In practice, the quantity we observe is rarely the "raw" random variable β€” it is some function of it. A detector squares the received signal; an amplifier clips it; a phase estimator applies the arctangent. To analyze these systems, we need to derive the distribution of Y=g(X)Y = g(X) from the known distribution of XX. The tools in this section β€” the CDF method and the change-of-variables formula β€” are the workhorses for this task.

Theorem: The CDF Method

Let XX be a continuous RV with CDF FF and let Y=g(X)Y = g(X) for a Borel-measurable gg. Then the CDF of YY is

FY(y)=P(g(X)≀y)=P(X∈Bg(y)),F_Y(y) = \mathbb{P}(g(X) \leq y) = \mathbb{P}(X \in B_g(y)),

where Bg(y)={x:g(x)≀y}B_g(y) = \{x : g(x) \leq y\}. For continuous XX:

FY(y)=∫Bg(y)f(x) dx.F_Y(y) = \int_{B_g(y)} f(x)\,dx.

The PDF of YY (when it exists) is obtained by differentiating: fY(y)=FYβ€²(y)f_Y(y) = F_Y'(y).

The CDF method is completely general β€” it works for any measurable gg, monotone or not. The procedure is: (1) express the event {Y≀y}\{Y \leq y\} in terms of XX, (2) integrate the density of XX over the resulting region, (3) differentiate in yy if you want the PDF.

Theorem: Change of Variables for Monotonic Transformations

Let XX be a continuous RV with PDF ff and let gg be a strictly monotonic, differentiable function with inverse gβˆ’1g^{-1}. Then Y=g(X)Y = g(X) has PDF

fY(y)=f(gβˆ’1(y))β€‰βˆ£ddygβˆ’1(y)∣.f_Y(y) = f(g^{-1}(y))\,\left|\frac{d}{dy}g^{-1}(y)\right|.

Theorem: Non-Monotonic Transformations

Let g:Rβ†’Rg : \mathbb{R} \to \mathbb{R} be piecewise monotonic. Partition R\mathbb{R} into intervals A1,…,AmA_1, \ldots, A_m on each of which gg is strictly monotonic with inverse gkβˆ’1g_k^{-1}. Then Y=g(X)Y = g(X) has PDF

fY(y)=βˆ‘k=1mf(gkβˆ’1(y))β€‰βˆ£ddygkβˆ’1(y)βˆ£β€‰1{y∈g(Ak)}.f_Y(y) = \sum_{k=1}^{m} f(g_k^{-1}(y))\,\left|\frac{d}{dy}g_k^{-1}(y)\right|\,\mathbf{1}_{\{y \in g(A_k)\}}.

Example: Squared Gaussian β†’\to Chi-Squared

Let Z∼N(0,1)Z \sim \mathcal{N}(0, 1) and Y=Z2Y = Z^2. Derive the PDF of YY.

Example: Complex Gaussian Envelope β†’\to Rayleigh

Let Z=X+jYZ = X + jY where X,Y∼N(0,Οƒ2)X, Y \sim \mathcal{N}(0, \sigma^2) are independent. Derive the distribution of the envelope R=∣Z∣=X2+Y2R = |Z| = \sqrt{X^2 + Y^2}.

Example: Squared Envelope β†’\to Exponential

With RR Rayleigh as above, show that W=R2=∣Z∣2W = R^2 = |Z|^2 is exponentially distributed.

RV Transformation Visualizer

Visualize how the CDF method works: choose a transformation g(x)g(x) and see how the PDF of XX maps to the PDF of Y=g(X)Y = g(X). The shaded regions show corresponding probability masses.

Parameters
0
1

The CDF Method for Deriving Distributions

Input: PDF ff of XX, transformation gg
Output: PDF fYf_Y of Y=g(X)Y = g(X)
1. Write FY(y)=P(g(X)≀y)F_Y(y) = \mathbb{P}(g(X) \leq y)
2. Express {g(X)≀y}\{g(X) \leq y\} as {X∈Bg(y)}\{X \in B_g(y)\} where Bg(y)={x:g(x)≀y}B_g(y) = \{x : g(x) \leq y\}
3. Compute FY(y)=∫Bg(y)f(x) dxF_Y(y) = \int_{B_g(y)} f(x)\,dx
4. Differentiate: fY(y)=ddyFY(y)f_Y(y) = \frac{d}{dy} F_Y(y)
5. Verify: ∫fY(y) dy=1\int f_Y(y)\,dy = 1

Step 2 is the critical step. For monotone gg, Bg(y)B_g(y) is a half-line. For non-monotone gg (e.g., g(x)=x2g(x) = x^2), Bg(y)B_g(y) may be a union of intervals.

Common Mistake: Forgetting the Jacobian

Mistake:

Writing fY(y)=f(gβˆ’1(y))f_Y(y) = f(g^{-1}(y)) without the ∣(gβˆ’1)β€²(y)∣|(g^{-1})'(y)| factor.

Correction:

The correct formula is fY(y)=f(gβˆ’1(y))β€‰βˆ£(gβˆ’1)β€²(y)∣f_Y(y) = f(g^{-1}(y))\,|(g^{-1})'(y)|. The Jacobian factor accounts for the "stretching" or "compression" of probability mass under the transformation. Without it, fYf_Y will not integrate to 1.

Quick Check

If X∼N(0,1)X \sim \mathcal{N}(0, 1) and Y=3X+5Y = 3X + 5, what is the distribution of YY?

N(5,3)\mathcal{N}(5, 3)

N(5,9)\mathcal{N}(5, 9)

N(3,5)\mathcal{N}(3, 5)

N(15,9)\mathcal{N}(15, 9)

Jacobian

In the change-of-variables formula, the Jacobian ∣(gβˆ’1)β€²(y)∣|(g^{-1})'(y)| is the absolute value of the derivative of the inverse transformation. It corrects for the stretching or compression of the density under the mapping Y=g(X)Y = g(X).

Chi-Squared Distribution

The distribution of Y=Z2Y = Z^2 where Z∼N(0,1)Z \sim \mathcal{N}(0,1). More generally, Ο‡d2=Z12+β‹―+Zd2\chi^2_d = Z_1^2 + \cdots + Z_d^2 with dd i.i.d. standard normals. It is a special case of the Gamma distribution: Ο‡d2=Gamma(d/2,1/2)\chi^2_d = \text{Gamma}(d/2, 1/2).

Key Takeaway

The CDF method (FY(y)=P(g(X)≀y)F_Y(y) = \mathbb{P}(g(X) \leq y), then differentiate) is the universal technique for deriving the distribution of a transformed random variable. For monotonic gg, the change-of-variables shortcut with the Jacobian is faster. For non-monotonic gg, partition the domain and sum contributions from each monotonic piece.