Why Find the Distribution of a Difference?
When two discrete random quantities are observed together, their difference can answer a question that neither quantity answers alone. A difference might represent a score advantage, a change in a count, or how far one waiting time exceeds another. To calculate probabilities about that difference, we need its own probability mass function (pmf).
The key idea is to collect every pair of outcomes that gives the same difference. If \(X-Y=2\), for example, both \(X=2, Y=0\) and \(X=5, Y=3\) produce that result. When \(X\) and \(Y\) are independent, the probability of each pair is the product of its two marginal probabilities. Add those products to find the probability of the difference.
The support of a discrete random variable is the set of values to which it assigns positive probability. Thus, possible values of \(D\) come from differences \(x-y\) for which both \(p_X(x)>0\) and \(p_Y(y)>0\). A difference value may be produced by several pairs, so their probabilities must be combined. Some values between the smallest and largest possible differences may not be possible at all.
Why the Formula Works
For a fixed value \(d\), the event \(D=d\) is the event \(X-Y=d\). Rearranging gives \(X=y+d\) whenever \(Y=y\). The event can therefore be written as a collection of outcome pairs:
For different values of \(y\), these pair-events are mutually exclusive: \(Y\) cannot equal two different values in the same trial. Their probabilities can therefore be added. Independence says that the probability of each pair is the product of the marginal probabilities. Together, these facts give the formula:
This argument also explains why the independence condition matters. If \(X\) and \(Y\) are dependent, the pair probability \(P(X=y+d,Y=y)\) need not equal \(P(X=y+d)P(Y=y)\). The pair-event sum is still valid, but the products of the separate pmfs may not be.
A Reliable Calculation Method
For finite discrete distributions, organize the work by the value of \(D\). For each possible difference, list every pair that produces it, multiply the pair probabilities, and add. A table can prevent omitted pairs, especially when the same difference is produced in more than one way.
Confirm that \(X\) and \(Y\) are discrete and independent, and record each variable's possible values and probabilities.
Subtract each possible value of \(Y\) from each possible value of \(X\). Keep each distinct difference with positive probability.
For each difference \(d\), sum \(p_X(x)p_Y(y)\) over all pairs with \(x-y=d\).
Verify that every probability is nonnegative and that all probabilities in the distribution sum to one.
Worked Example: A Difference With Four Possible Values
Suppose independent random variables \(X\) and \(Y\) have the following distributions:
Find the pmf of \(D=X-Y\). The variables are specified to be independent, so each pair probability is the product of its \(X\) and \(Y\) probabilities. The possible differences range from \(0-1=-1\) to \(2-0=2\).
For \(D=-1\), the only pair is \((X,Y)=(0,1)\): \(P(D=-1)=0.20(0.60)=0.12\).
For \(D=0\), the pairs are \((0,0)\) and \((1,1)\): \(P(D=0)=0.20(0.40)+0.50(0.60)=0.08+0.30=0.38\).
For \(D=1\), the pairs are \((1,0)\) and \((2,1)\): \(P(D=1)=0.50(0.40)+0.30(0.60)=0.20+0.18=0.38\).
For \(D=2\), the only pair is \((2,0)\): \(P(D=2)=0.30(0.40)=0.12\).
The resulting pmf is \(P(D=-1)=0.12\), \(P(D=0)=0.38\), \(P(D=1)=0.38\), and \(P(D=2)=0.12\). The probabilities sum to \(0.12+0.38+0.38+0.12=1.00\), as required. For instance, the probability that \(X\) exceeds \(Y\) is \(P(D>0)=0.38+0.12=0.50\).
Differences Need Not Fill an Interval
The possible differences depend on the supports of both variables, not just on the smallest and largest outcomes. If the original variables take values on separated sets, their differences may also have gaps. The calculation should include only differences that can actually be formed by supported pairs.
Worked Example: A Difference Distribution With Gaps
Suppose two independent random variables, measured in points, have distributions \(P(X=1)=0.25,\;P(X=3)=0.50,\;P(X=5)=0.25\) and \(P(Y=0)=0.70,\;P(Y=2)=0.30\). Find the pmf of \(D=X-Y\).
Independence is part of the stated model, so each pair's probability is the product of its entries. Listing the pairs by the resulting difference gives:
| Difference \(d\) | Pairs \((x,y)\) with \(x-y=d\) | Calculation | \(P(D=d)\) |
|---|---|---|---|
| -1 | (1, 2) | 0.25(0.30) | 0.075 |
| 1 | (1, 0), (3, 2) | 0.25(0.70) + 0.50(0.30) | 0.325 |
| 3 | (3, 0), (5, 2) | 0.50(0.70) + 0.25(0.30) | 0.425 |
| 5 | (5, 0) | 0.25(0.70) | 0.175 |
The support of \(D\) is \(\{-1,1,3,5\}\); values such as \(0\) and \(2\) are impossible, even though they lie between the smallest and largest possible differences. The probabilities sum to \(0.075+0.325+0.425+0.175=1.000\). The negative value represents an outcome where \(X\) is one point below \(Y\).
Use the Pmf to Answer Event Questions
After finding the pmf, probabilities for events involving the difference are obtained by adding the probabilities of the relevant values. For example, \(P(D>0)\) is the sum of the pmf entries at positive differences. Be careful to use the defined order: \(D=X-Y\) is positive when \(X\) is larger than \(Y\), while \(Y-X\) reverses the signs.
Worked Example: Probability That One Score Exceeds Another
In a hypothetical model, \(X\) is one device's score and \(Y\) is a second device's score, both in points. Suppose \(X\) and \(Y\) are independent, with \(P(X=2)=0.20,\;P(X=4)=0.50,\;P(X=6)=0.30\) and \(P(Y=1)=0.60,\;P(Y=4)=0.40\). Find the distribution of \(D=X-Y\), then find the probability that \(X\) scores more points than \(Y\).
The independence assumption is explicitly part of this hypothetical probability model. The six possible pairs give the following differences and probabilities:
| \((x,y)\) | \(x-y\) | \(p_X(x)p_Y(y)\) |
|---|---|---|
| (2, 1) | 1 | 0.20(0.60) = 0.12 |
| (2, 4) | -2 | 0.20(0.40) = 0.08 |
| (4, 1) | 3 | 0.50(0.60) = 0.30 |
| (4, 4) | 0 | 0.50(0.40) = 0.20 |
| (6, 1) | 5 | 0.30(0.60) = 0.18 |
| (6, 4) | 2 | 0.30(0.40) = 0.12 |
No two pairs produce the same difference here, so each listed pair contributes one pmf value. In increasing order, the pmf is \(P(D=-2)=0.08\), \(P(D=0)=0.20\), \(P(D=1)=0.12\), \(P(D=2)=0.12\), \(P(D=3)=0.30\), and \(P(D=5)=0.18\). These probabilities sum to \(1.00\).
The event that \(X\) scores more points is \(D>0\), so \(P(X>Y)=P(D>0)=0.12+0.12+0.30+0.18=0.72\). Thus, under the specified model, the probability that the first device scores more than the second is 0.72.
Common Mistakes and Checks
A frequent error is to calculate only one pair probability for a difference, even when several pairs produce it. For instance, in the first example, \(D=0\) can occur as \((0,0)\) or \((1,1)\). Using only \(P(X=0)P(Y=0)=0.08\) misses the second way to obtain zero; the correct probability is \(0.08+0.30=0.38\).
Another mistake is to multiply probabilities from the two marginal pmfs without checking independence. The product rule applies here because independence is assumed. If the variables are dependent, use their joint probabilities for the relevant pairs instead. A final check is to sum the entire pmf: if the total is not one, a pair may have been omitted, counted twice, or assigned to the wrong difference.
Check Your Understanding
Use the pair-summing method to answer these questions.
- If \(P(X=0)=0.40,\;P(X=2)=0.60\) and \(P(Y=0)=0.25,\;P(Y=1)=0.75\), with \(X\) and \(Y\) independent, what are the possible values of \(X-Y\)?
- In Question 1, which pairs produce \(X-Y=0\), and what is \(P(X-Y=0)\)?
- Why can the probabilities \(P(X=x)P(Y=y)\) be used for pair outcomes in this calculation only when \(X\) and \(Y\) are independent?
- Suppose a difference value is produced by three distinct pairs. What operation combines those pairs into the pmf probability for that value?
- What does it suggest if the probabilities in a calculated pmf of \(X-Y\) sum to less than one?