Tutorials › Measure Theory › Distributions of Transformed Random Variables

Probability Spaces and Random Variables · Tutorial 733 of 798

Distributions of Transformed Random Variables

Use inverse images to compute transformed laws, handle atoms correctly, and derive distribution functions for affine maps, absolute values, and squares.

Intermediate 12 min read

What You'll Learn

  • Define the law of a measurable transformation using inverse images
  • Compute transformed point masses from entire fibers, not just individual input points
  • Derive distribution functions for positive, negative, and constant affine maps
  • Handle endpoint atoms in formulas for absolute values and squares
  • Work out transformed laws for discrete and uniform random variables
  • Identify a common error when transforming non-atomic random variables

Inverse Images Determine the Transformed Law

When a random variable is transformed, its new distribution is determined by asking which input outcomes produce values in a given target set. This inverse-image viewpoint works whether the input is discrete, continuous, or a mixture of the two. It also handles non-injective maps, for which several input values—or an entire interval of inputs—may lead to the same output.

Let \((\Omega,\mathcal{F},\mathbb{P})\) be a probability space, and let \(X:\Omega\to\mathbb{R}\) be a real-valued random variable, meaning that \(X\) is measurable from \((\Omega,\mathcal{F})\) to \((\mathbb{R},\mathcal{B}_{\mathbb{R}})\). Let \(g:\mathbb{R}\to\mathbb{R}\) be Borel measurable and define \(Y=g(X)\). For every Borel set \(B\subseteq\mathbb{R}\), the event \(\{Y\in B\}\) is measurable because it is the inverse image under \(X\) of the Borel set \(g^{-1}(B)\).

Definition: The law of \(Y=g(X)\) is the probability measure \(\mathbb{P}_Y\) on \((\mathbb{R},\mathcal{B}_{\mathbb{R}})\) given by \(\mathbb{P}_Y(B)=\mathbb{P}(Y\in B)=\mathbb{P}(X\in g^{-1}(B))\) for every Borel set \(B\). In particular, \(\mathbb{P}(Y=y)=\mathbb{P}(X\in g^{-1}(\{y\}))\).

The last formula concerns the entire fiber \(g^{-1}(\{y\})\), not just one input point. If \(X\) takes values in a countable set \(\{x_j\}\), with \(p_j=\mathbb{P}(X=x_j)\), countable additivity gives the useful special case

$$ \mathbb{P}(Y=y)=\sum_{\{j:\,g(x_j)=y\}}p_j. $$

Here the events \(\{X=x_j\}\) in the sum are disjoint. For a general \(X\), this countable sum formula need not apply: the fiber may contain uncountably many inputs, and point probabilities alone do not determine its probability.

Distribution Functions Under Common Transformations

The cumulative distribution function (CDF) of a real-valued random variable \(X\) is \(F_X(t)=\mathbb{P}(X\le t)\). Thus, for \(Y=g(X)\), its CDF is obtained from the event \(\{g(X)\le y\}\). The inequalities defining that event require care, especially when \(g\) is decreasing or not one-to-one.

Proposition: On any probability space \((\Omega,\mathcal{F},\mathbb{P})\), for real-valued \(X\) and Borel \(g:\mathbb{R}\to\mathbb{R}\), the CDF of \(Y=g(X)\) satisfies \(F_Y(y)=\mathbb{P}(X\in g^{-1}((-\infty,y]))\) for every \(y\in\mathbb{R}\).

Proof. By definition, \(F_Y(y)=\mathbb{P}(Y\le y)\). Since \(Y=g(X)\), the events \(\{Y\le y\}\) and \(\{X\in g^{-1}((-\infty,y])\}\) are equal: an outcome \(\omega\) belongs to the first precisely when \(g(X(\omega))\le y\), which is precisely the condition that \(X(\omega)\) belongs to that inverse image. Taking \(\mathbb{P}\) of these equal events proves the formula. \(\square\)

For affine maps, the inverse image is particularly simple. If \(a>0\), then \(aX+b\le y\) is equivalent to \(X\le (y-b)/a\). If \(a<0\), dividing reverses the inequality, so it is equivalent to \(X\ge (y-b)/a\). To write the latter in terms of a CDF, define \(F_X(c-)=\mathbb{P}(X<c)\). This identity follows, for example, by applying continuity of probability from below to the events \(\{X\le c-1/n\}\), whose union is \(\{X<c\}\). Therefore \(\mathbb{P}(X\ge c)=1-F_X(c-)\), including any mass at \(c\).

Takeaway: For \(Y=aX+b\), if \(a>0\) then \(F_Y(y)=F_X((y-b)/a)\); if \(a<0\) then \(F_Y(y)=1-F_X(((y-b)/a)-)\). If \(a=0\), then \(Y=b\) with probability one, so \(F_Y(y)=0\) for \(y<b\) and \(F_Y(y)=1\) for \(y\ge b\).

For absolute values and squares, inverse images are intervals. For \(y\ge0\), \(|X|\le y\) holds exactly when \(-y\le X\le y\); likewise \(X^2\le y\) holds exactly when \(-\sqrt y\le X\le\sqrt y\). The endpoint convention matters if \(X\) has atoms. Since \(F_X(c-)=\mathbb{P}(X<c)\), subtraction gives the probability of a closed interval without discarding a possible atom at its left endpoint.

$$ F_{|X|}(y)= \begin{cases} 0,&y<0,\\ F_X(y)-F_X((-y)-),&y\ge0, \end{cases} \qquad F_{X^2}(y)= \begin{cases} 0,&y<0,\\ F_X(\sqrt y)-F_X((-\sqrt y)-),&y\ge0. \end{cases} $$

These formulas follow directly from the interval events just described. In particular, at \(y=0\) the absolute-value formula gives \(F_X(0)-F_X(0-)=\mathbb{P}(X=0)\), and the square formula gives the same probability. Replacing a left limit by \(F_X(-y)\) or \(F_X(-\sqrt y)\) without checking for an atom can change the answer.

Worked Transformations

Worked Example: Combining Atoms Under Absolute Value and Squaring

Suppose \(X\) takes the values \(-2,0,3\) on a probability space, with probabilities \(1/4,1/2,1/4\), respectively. Find the laws of \(Y=|X|\) and \(Z=X^2\).

For \(Y=0\), the fiber is \(\{0\}\), so \(\mathbb{P}(Y=0)=\mathbb{P}(X=0)=1/2\). For \(Y=2\), the fiber is \(\{-2,2\}\); only \(-2\) is an input value with positive probability, so \(\mathbb{P}(Y=2)=1/4\). For \(Y=3\), the fiber is \(\{-3,3\}\); only \(3\) occurs, so \(\mathbb{P}(Y=3)=1/4\). No other output value has positive probability. Thus the masses of \(Y\) at \(0,2,3\) are \(1/2,1/4,1/4\).

For \(Z\), the input values \(-2,0,3\) map to \(4,0,9\), respectively. Hence \(\mathbb{P}(Z=0)=1/2\), \(\mathbb{P}(Z=4)=1/4\), and \(\mathbb{P}(Z=9)=1/4\). Check: for each law, the displayed masses sum to \(1/2+1/4+1/4=1\). Directly, both transformations assign exactly one output to each of the three input cases, so the total probability must remain \(1\).

Worked Example: Absolute Value of a Uniform Random Variable

Let \(\Omega=[-1,1]\), let \(\mathcal{F}\) be its Borel sigma-algebra, and let \(\mathbb{P}(A)=m(A)/2\) for Borel \(A\subseteq[-1,1]\), where \(m\) is Lebesgue measure. Set \(X(\omega)=\omega\) and \(Y=|X|\). Compute the CDF of \(Y\).

If \(y<0\), the event \(\{|X|\le y\}\) is empty, so \(F_Y(y)=0\). If \(0\le y\le1\), the event is \(\{-y\le X\le y\}\), an interval of length \(2y\). Its probability is \(2y/2=y\). If \(y>1\), every input in \([-1,1]\) satisfies \(|X|\le y\), and \(F_Y(y)=1\). Therefore

$$ F_Y(y)= \begin{cases} 0,&y<0,\\ y,&0\le y\le1,\\ 1,&y>1. \end{cases} $$

Check: at \(y=1/4\), the inverse-image interval is \([-1/4,1/4]\), of length \(1/2\); its probability is \((1/2)/2=1/4\), agreeing with the CDF. At \(y=1\), the inverse image is all of \([-1,1]\), whose probability is \(2/2=1\). The endpoint \(X=0\) has probability zero because its singleton has Lebesgue measure zero, so there is no jump in this CDF at zero.

Worked Example: Squaring a Uniform Random Variable

Use the same probability space and \(X\) as in the preceding example, but now set \(Z=X^2\). Compute the CDF and check a probability using the inverse image directly.

For \(y<0\), the event \(X^2\le y\) is empty. For \(0\le y\le1\), it is the interval event \(-\sqrt y\le X\le\sqrt y\). That interval has length \(2\sqrt y\), so its probability under \(\mathbb{P}(A)=m(A)/2\) is \(2\sqrt y/2=\sqrt y\). For \(y>1\), all of \([-1,1]\) is included. Consequently

$$ F_Z(y)= \begin{cases} 0,&y<0,\\ \sqrt y,&0\le y\le1,\\ 1,&y>1. \end{cases} $$

At \(y=1/4\), the condition \(X^2\le1/4\) is exactly \(-1/2\le X\le1/2\). This interval has length \(1\), hence probability \(1/2\), matching \(\sqrt{1/4}=1/2\). Independently, \(X^2>1/4\) corresponds to the two intervals \([-1,-1/2)\) and \((1/2,1]\), whose total length is \(1\); their probability is \(1/2\). Since the event \(X^2\le1/4\) and its complement partition the sample space, this also checks the CDF value.

Worked Example: A Decreasing Affine Transformation

Let \(\Omega=[0,1]\) with its Borel sigma-algebra and uniform probability \(\mathbb{P}(A)=m(A)\). Set \(X(\omega)=\omega\) and \(Y=1-2X\). Find \(F_Y\), paying attention to the reversed inequality.

The variable \(Y\) takes values in \([-1,1]\). If \(y<-1\), the event \(1-2X\le y\) is empty; if \(y>1\), it is the whole interval. For \(-1\le y\le1\), rearranging gives \(X\ge(1-y)/2\). The threshold belongs to \([0,1]\), and the event is the interval \([(1-y)/2,1]\). Its probability is its length:

$$ F_Y(y)=1-\frac{1-y}{2}=\frac{1+y}{2},\qquad -1\le y\le1. $$

Thus \(F_Y(y)=0\) for \(y<-1\), equals \((1+y)/2\) on \([-1,1]\), and equals \(1\) for \(y>1\). Check: at \(y=0\), the event is \(X\ge1/2\), of probability \(1/2\), agreeing with the formula. At \(y=-1\), it is \(X\ge1\), the singleton \(\{1\}\), of probability zero; the formula gives \((1-1)/2=0\). At \(y=1\), every \(X\in[0,1]\) qualifies and the formula gives \((1+1)/2=1\).

A Common Error: Summing Point Masses in the Wrong Setting

For a discrete random variable, it is legitimate to combine the probabilities of the input values that map to a specified output, as in the first example. It is not legitimate to assume that this procedure works by summing point probabilities for every random variable. The general rule is always the probability of the whole inverse image.

Worked Example: A Constant Map of a Uniform Input

Let \(X\) be uniform on \([0,1]\) with Lebesgue probability, and let \(g(x)=0\) for every real \(x\). Then \(Y=g(X)=0\) with probability one. For the output \(0\), the inverse image is \(g^{-1}(\{0\})=\mathbb{R}\), so \(\mathbb{P}(Y=0)=\mathbb{P}(X\in\mathbb{R})=1\).

A wrong calculation would say that every point \(x\in[0,1]\) has \(\mathbb{P}(X=x)=0\), then try to add these point probabilities and conclude that \(\mathbb{P}(Y=0)=0\). This is not a valid sum over the uncountable interval, and it contradicts the actual inverse-image event, which is the entire sample space. Correction: use the fiber formula \(\mathbb{P}(Y=0)=\mathbb{P}(X\in g^{-1}(\{0\}))=1\). For a countably supported \(X\), the sum formula is justified because the fiber selects a countable collection of disjoint point events; for a general input, use the inverse-image probability instead.

The inverse-image method is useful precisely because it does not require a transformation to be one-to-one or the input to have a particular type of law. For affine maps, absolute values, and squares, the method reduces CDF calculations to intervals and their probabilities. When endpoints may carry probability, retaining the correct strict or non-strict inequalities is essential.

Check Your Understanding

For each question, begin with the event defining the transformed variable and identify its inverse image.

  1. If \(Y=3X+2\), derive \(F_Y(y)\) in terms of \(F_X\), assuming \(X\) is real-valued on a probability space.
  2. Why does \(\mathbb{P}(|X|=y)\) for \(y>0\) involve both possible inputs \(y\) and \(-y\)? State the inverse-image formula.
  3. For a random variable taking countably many values \(x_j\) with masses \(p_j\), write the formula for \(\mathbb{P}(g(X)=y)\) and explain why the terms are added.
  4. If \(X\) is uniform on \([0,1]\) and \(Y=X^2\), find \(F_Y(y)\) for \(0\le y\le1\) by computing the inverse-image interval.
  5. For \(Y=-X\), explain why the event \(Y\le y\) becomes \(X\ge -y\), and why using \(1-F_X(-y)\) can be incorrect when \(X\) has an atom at \(-y\).