Tutorials › VEE Mathematical Statistics › Transforming Discrete Random Variables

VEE Mathematical Statistics · Functions of a Random Variable · Tutorial 246 of 880

Transforming Discrete Random Variables

Build the distribution of a transformed discrete random variable by identifying each output’s preimages and adding their probabilities.

Intermediate 11 min read

What You'll Learn

  • Define the support and probability mass function of a transformed discrete random variable
  • Find every input value that maps to a specified output
  • Add probabilities correctly when a transformation is many-to-one
  • Handle transformations of both finite-support and countable-support variables
  • Check a transformed probability mass function for completeness and arithmetic errors

Why Transforming a Discrete Variable Requires Grouping

A function of a random variable is itself a random variable. If \(X\) records a discrete outcome and \(Y=g(X)\), the possible values of \(Y\) depend on the function \(g\). When different values of \(X\) produce the same value of \(Y\), their probabilities must be combined. This is the key step in finding the probability mass function (pmf) of a discrete transformation.

For example, squaring removes the sign: both \(X=-1\) and \(X=1\) produce \(Y=1\). The probability of that output is therefore the probability that either input occurs. The transformation need not be one-to-one, and assuming it is can omit probability mass.

Definition: Suppose \(X\) is a discrete random variable with support \(\mathcal{S}_X\) and pmf \(p_X(x)=P(X=x)\). For a specified function \(g\), define \(Y=g(X)\). For each possible output \(y\), its preimage within the support is \(\{x\in\mathcal{S}_X:g(x)=y\}\). The pmf of \(Y\) is \[ p_Y(y)=P(Y=y)=\sum_{\substack{x\in\mathcal{S}_X\\g(x)=y}}p_X(x). \] If no value in the support maps to \(y\), then \(p_Y(y)=0\). For countably infinite support, the sum is an infinite series of nonnegative probabilities.

The support of \(Y\) consists of the output values with positive probability. It is contained in the set of values \(g(x)\) for \(x\in\mathcal{S}_X\), but outputs associated only with zero-probability inputs are not part of the support. In practice, make a list or table of the \(X\) values, their probabilities, and their transformed values. Then group the rows that have the same transformed value.

Why the Preimage Probabilities Add

For a fixed output \(y\), the event \(Y=y\) occurs exactly when \(g(X)=y\). That happens if \(X\) equals one of the input values that map to \(y\). The corresponding events \(X=x\) are mutually exclusive: \(X\) cannot equal two different values at once. Therefore, their probabilities add.

$$ \{Y=y\} = \bigcup_{\substack{x\in\mathcal{S}_X\\g(x)=y}}\{X=x\}, \qquad P(Y=y) = \sum_{\substack{x\in\mathcal{S}_X\\g(x)=y}}P(X=x). $$

For a finite preimage, the equality follows from additivity of probability over disjoint events. For a countably infinite preimage, countable additivity gives the same result. These arguments require \(X\) to be discrete; they do not provide a density transformation formula for a continuous variable.

Worked Example: Squaring a Variable With Unequal Probabilities

A discrete variable \(X\) has the following pmf: \(P(X=-2)=0.10\), \(P(X=-1)=0.10\), \(P(X=0)=0.20\), \(P(X=1)=0.30\), and \(P(X=2)=0.30\). Define \(Y=X^2\). Find the pmf of \(Y\) and verify it.

Method. List the transformed value for every possible \(X\), then group equal outputs. The input probabilities sum to \(0.10+0.10+0.20+0.30+0.30=1.00\), as required for a pmf.

$$ \begin{array}{c|ccccc} x & -2 & -1 & 0 & 1 & 2\\ \hline p_X(x) & 0.10 & 0.10 & 0.20 & 0.30 & 0.30\\ g(x)=x^2 & 4 & 1 & 0 & 1 & 4 \end{array} $$

The output \(Y=0\) has the single preimage \(X=0\), so \(P(Y=0)=0.20\). The output \(Y=1\) has preimages \(X=-1\) and \(X=1\), so \(P(Y=1)=0.10+0.30=0.40\). The output \(Y=4\) has preimages \(X=-2\) and \(X=2\), so \(P(Y=4)=0.10+0.30=0.40\).

Thus the pmf is \(P(Y=0)=0.20\), \(P(Y=1)=0.40\), and \(P(Y=4)=0.40\). Check: \(0.20+0.40+0.40=1.00\), and all masses are nonnegative.

Common mistake avoided. A tempting but incorrect reported mass for \(Y=1\) is \(0.50\). The correct addition is \(0.10+0.30=0.40\); the incorrect value \(0.50\) would give the wrong mass. The issue is not just remembering to combine preimages: the addition itself must also be checked.

Grouping Several Inputs Into Each Output

Some transformations collect values into groups rather than pairing them around a central value. Remainders are one example: if \(Y\) is the remainder when \(X\) is divided by 3, then every value of \(X\) with the same remainder contributes to the same output probability. Writing down the preimage for each remainder prevents missed values.

Worked Example: A Remainder Transformation

A discrete variable \(X\) takes values \(0,1,\ldots,7\), with probabilities, in that order, \(0.05, 0.10, 0.15, 0.20, 0.10, 0.15, 0.15, 0.10\). Define \(Y\) as the remainder when \(X\) is divided by 3. Find the pmf of \(Y\).

Step 1: Verify the input pmf. The listed probabilities sum to \(0.05+0.10+0.15+0.20+0.10+0.15+0.15+0.10=1.00\).

Step 2: Identify the preimages. The possible remainders are \(0,1,2\). Remainder 0 comes from \(X=0,3,6\), remainder 1 from \(X=1,4,7\), and remainder 2 from \(X=2,5\).

Step 3: Add the probabilities within each group.

$$ \begin{aligned} P(Y=0)&=P(X=0)+P(X=3)+P(X=6)\\ &=0.05+0.20+0.15=0.40,\\ P(Y=1)&=P(X=1)+P(X=4)+P(X=7)\\ &=0.10+0.10+0.10=0.30,\\ P(Y=2)&=P(X=2)+P(X=5)\\ &=0.15+0.15=0.30. \end{aligned} $$

Therefore, \(P(Y=0)=0.40\), \(P(Y=1)=0.30\), and \(P(Y=2)=0.30\). The check is \(0.40+0.30+0.30=1.00\). A common error is to group consecutive \(X\) values rather than values with the same remainder; listing each preimage makes the correct grouping explicit.

Infinite Support and Infinite Preimages

The same rule applies when \(X\) has countably infinite support. A transformed output may have infinitely many preimages, so its probability is an infinite sum. Alternatively, the complement of an output event may be easier to calculate; if \(P(Y=0)\) is found directly, then \(P(Y=1)=1-P(Y=0)\) for a variable taking only 0 and 1. The complement must describe exactly the remaining event.

Worked Example: An Indicator From a Poisson Variable

Let \(X\sim\operatorname{Poisson}(2)\), so \(P(X=k)=e^{-2}2^k/k!\) for \(k=0,1,2,\ldots\). Define \(Y=1\) when \(X\geq 2\), and \(Y=0\) when \(X<2\). Find both probabilities in the pmf of \(Y\), reporting probabilities to four decimal places.

Step 1: Find the preimage of zero. The condition \(Y=0\) holds for \(X=0\) or \(X=1\). Using the stated Poisson parameter, \(P(X=0)=e^{-2}2^0/0!=e^{-2}\) and \(P(X=1)=e^{-2}2^1/1!=2e^{-2}\). Hence \(P(Y=0)=3e^{-2}\).

Step 2: Find the probability of one. The event \(Y=1\) is \(X\geq 2\), which includes every integer value \(2,3,\ldots\). Its probability is the complement of \(X=0\) or \(X=1\): \(P(Y=1)=1-3e^{-2}\).

Step 3: Evaluate and check. Since \(e^{-2}\approx0.1353353\), \(3e^{-2}\approx0.4060059\), and \(1-3e^{-2}\approx0.5939941\). Rounded to four decimal places, \(P(Y=0)=0.4060\) and \(P(Y=1)=0.5940\). Their rounded values sum to \(1.0000\); the exact probabilities also sum to \(3e^{-2}+(1-3e^{-2})=1\).

Common mistake avoided. Using only \(P(X=2)\) for \(P(Y=1)\) would omit \(X=3,4,\ldots\), even though all those values also produce \(Y=1\). The complement calculation includes the entire infinite preimage.

A Reliable Calculation Procedure

For an exam problem, a short table is often the safest approach when the support is finite. For an infinite support, write the event \(g(X)=y\) as a condition on \(X\), then sum over all qualifying values or use a complement when it is simpler. In either case, do not infer that \(g\) is one-to-one unless the problem establishes that property.

1
State the input pmf and support.
Check that the probabilities of all possible values of \(X\) sum to 1.
2
Determine the outputs.
Evaluate \(g(x)\) for each support value, or characterize the possible outputs when the support is infinite.
3
Find each preimage.
For a given \(y\), solve \(g(x)=y\) and retain only solutions in the support of \(X\).
4
Sum the input probabilities.
Add \(p_X(x)\) over every value in that preimage. Use a convergent infinite sum or a justified complement if needed.
5
Check the resulting pmf.
Confirm that each mass is nonnegative and that the masses over all possible outputs sum to 1.

This method is aligned with the SOA VEE Mathematical Statistics syllabus. It is useful whenever a model records a transformed discrete outcome rather than the original count or category—for example, a parity indicator, a grouped count, or a threshold flag. The transformation changes which output values are reported, but it does not discard the probability of any input outcome: that probability is assigned to the output it produces.

Common Errors to Avoid

  • Keeping only one preimage. If \(g(x)=y\) for several support values, include every one of them in the sum.
  • Including values outside the support. An algebraic solution of \(g(x)=y\) contributes nothing if \(X\) cannot take that value.
  • Grouping by appearance instead of by the function. Two inputs belong together precisely when they have the same transformed output, not simply because their inputs are close.
  • Forgetting the infinite tail. For a countably infinite variable, an event such as \(X\geq 2\) includes all qualifying integers, not just the first one.
  • Skipping the total-probability check. A sum different from 1 often signals a missing preimage, duplicated input value, or arithmetic error.
Key takeaway: For a discrete transformation \(Y=g(X)\), the mass at \(y\) is the sum of the probabilities of all support values \(x\) satisfying \(g(x)=y\). Identify the full preimage first, then add and check.

Check Your Understanding

For each problem, identify all preimages before computing the output probabilities.

  1. \(X\) takes values \(-1,0,1,2\) with probabilities \(0.20,0.10,0.40,0.30\), respectively. Let \(Y=X^2\). Find the pmf of \(Y\). (Answer: \(P(Y=0)=0.10,\ P(Y=1)=0.60,\ P(Y=4)=0.30\).)
  2. \(X\) takes values \(1,2,3,4,5,6\) with probabilities \(0.05,0.10,0.20,0.25,0.15,0.25\), respectively. Let \(Y=\lceil X/2\rceil\), where \(\lceil z\rceil\) is the least integer greater than or equal to \(z\). Find the pmf of \(Y\). (Answer: \(P(Y=1)=0.15,\ P(Y=2)=0.45,\ P(Y=3)=0.40\).)
  3. Let \(X\sim\operatorname{Poisson}(1.5)\), with \(P(X=k)=e^{-1.5}1.5^k/k!\), and set \(Y=0\) if \(X=0\), \(Y=2\) otherwise. Find the two output probabilities to four decimals. (Answer: \(P(Y=0)=0.2231,\ P(Y=2)=0.7769\).)
  4. \(X\) takes values \(-2,-1,0,1,2,3\) with probabilities \(0.10,0.20,0.10,0.25,0.15,0.20\), respectively. Let \(Y=|X-1|\). Find the pmf and check its total. (Answer: \(P(Y=0)=0.25,\ P(Y=1)=0.25,\ P(Y=2)=0.40,\ P(Y=3)=0.10\); total \(1.00\).)
  5. \(X\) takes values \(0,1,2,3,4,5\) with probabilities \(0.05,0.10,0.15,0.20,0.25,0.25\), respectively. Let \(Y=(X-1)^2\). Find the pmf of \(Y\). (Answer: \(P(Y=0)=0.10,\ P(Y=1)=0.20,\ P(Y=4)=0.20,\ P(Y=9)=0.25,\ P(Y=16)=0.25\).)
Clinical Biostats