Tutorials › Introduction to Statistics › Worked Analysis of Two Independent Discrete Variables

Random Variables and Expected Value · Tutorial 374 of 996

Worked Analysis of Two Independent Discrete Variables

Learn how to combine two independent discrete distributions and check the sum’s moments using both its probability table and expectation rules.

Intermediate 10 min read

What You'll Learn

  • Combine pairs of outcomes to find the possible values of a sum.
  • Calculate the sum’s probability mass function using independence.
  • Handle different outcome pairs that produce the same sum.
  • Find the sum’s mean, variance, and standard deviation from its distribution.
  • Check those calculations using expectation and variance rules.
  • Distinguish independence from the more general zero-covariance condition for adding variances.

Why Analyze a Sum Directly?

Many probability questions involve the combined result of two sources of uncertainty. A package’s total weight might be the sum of two independently measured components; a game’s total score might combine results from two stages. Knowing the possible outcomes of each component is not quite enough: we need to determine how likely each possible total is.

For finite discrete random variables, this can be done exactly. List the possible pairs of outcomes, multiply their probabilities when the variables are independent, and combine the probabilities for pairs that give the same sum. The resulting probability mass function (pmf) describes the sum itself. Its mean, variance, and standard deviation can then be calculated directly and checked using rules for expectations and variances.

Definition: A finite discrete random variable \(X\) has a probability mass function \(p_X(x)=P(X=x)\), which assigns a probability to each possible value \(x\). For two independent finite discrete random variables \(X\) and \(Y\), their joint probabilities satisfy \(P(X=x,Y=y)=P(X=x)P(Y=y)\) for every possible pair \((x,y)\). Their sum is the random variable \(S=X+Y\).

Building the Distribution of the Sum

Each possible pair \((x,y)\) produces the sum \(x+y\). Independence tells us that the probability of that pair is the product \(p_X(x)p_Y(y)\). If several different pairs produce the same sum \(s\), their probabilities must be added. Thus the pmf of \(S=X+Y\) is

$$ P(S=s)=\sum_{x+y=s}p_X(x)p_Y(y). $$

The sum in this formula includes every possible pair of values whose total is \(s\). This is the convolution rule for the sum of independent discrete random variables. It is important to aggregate probabilities by the resulting total: a particular total may arise in more than one way.

Once the pmf of \(S\) has been constructed, use the usual finite-distribution formulas. If \(S\) takes values \(s\) with probabilities \(P(S=s)\), then

$$ E(S)=\sum_s sP(S=s),\qquad \operatorname{Var}(S)=\sum_s s^2P(S=s)-[E(S)]^2,\qquad SD(S)=\sqrt{\operatorname{Var}(S)}. $$

The variance formula uses the computational form \(E(S^2)-[E(S)]^2\). The standard deviation is expressed in the same units as the values of \(S\), while the variance is expressed in squared units.

Worked Example: A Three-Outcome Variable Plus a Binary Variable

Suppose \(X\) records a hypothetical component’s score, taking values 0, 1, and 2 with probabilities 0.20, 0.50, and 0.30. Independently, \(Y\) takes values 0 and 1 with probabilities 0.60 and 0.40. Find the pmf, mean, variance, and standard deviation of \(S=X+Y\).

Check the model. The two variables are specified as independent, so each pair has probability \(P(X=x,Y=y)=P(X=x)P(Y=y)\). For example, \(P(X=1,Y=0)=0.50(0.60)=0.30\). The marginal probabilities for each variable sum to 1, and independence supplies the joint probabilities needed for the calculation.

Construct the pmf. The total 0 can only come from \((0,0)\), so its probability is \(0.20(0.60)=0.12\). The total 1 can come from \((0,1)\) or \((1,0)\), so add both probabilities. The remaining totals are computed in the same way.

$$ \begin{aligned} P(S=0)&=0.20(0.60)=0.12,\\ P(S=1)&=0.20(0.40)+0.50(0.60)=0.08+0.30=0.38,\\ P(S=2)&=0.50(0.40)+0.30(0.60)=0.20+0.18=0.38,\\ P(S=3)&=0.30(0.40)=0.12. \end{aligned} $$

The probabilities sum to \(0.12+0.38+0.38+0.12=1.00\), as required for a pmf.

\(s\)\(P(S=s)\)\(sP(S=s)\)\(s^2P(S=s)\)
00.1200
10.380.380.38
20.380.761.52
30.120.361.08

Calculate the moments. Summing the last two columns gives \(E(S)=0.38+0.76+0.36=1.50\) and \(E(S^2)=0.38+1.52+1.08=2.98\). Therefore

$$ \operatorname{Var}(S)=2.98-(1.50)^2=2.98-2.25=0.73, \qquad SD(S)=\sqrt{0.73}\approx 0.8544. $$

Check by component rules. For \(X\), \(E(X)=0(0.20)+1(0.50)+2(0.30)=1.10\), and \(E(X^2)=0+0.50+4(0.30)=1.70\), so \(\operatorname{Var}(X)=1.70-(1.10)^2=0.49\). For \(Y\), \(E(Y)=0.40\) and \(E(Y^2)=0.40\), so \(\operatorname{Var}(Y)=0.40-(0.40)^2=0.24\). Independence gives \(E(X+Y)=E(X)+E(Y)=1.50\) and \(\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)=0.49+0.24=0.73\). These agree with the direct calculation.

Why the Moment Checks Work

For any two random variables with finite means, expectation is additive: \(E(X+Y)=E(X)+E(Y)\). This does not require independence. Variance has an additional term that describes how the variables vary together. Define their covariance as \(\operatorname{Cov}(X,Y)=E[(X-E(X))(Y-E(Y))]\). Expanding the squared deviation of the sum gives the general identity

$$ \begin{aligned} \operatorname{Var}(X+Y) &=E\left(\left[(X-E(X))+(Y-E(Y))\right]^2\right)\\ &=\operatorname{Var}(X)+\operatorname{Var}(Y)+2\operatorname{Cov}(X,Y). \end{aligned} $$

To see the final step, square the expression inside the expectation. The two squared terms have expectations \(\operatorname{Var}(X)\) and \(\operatorname{Var}(Y)\); the cross-product has expectation \(2\operatorname{Cov}(X,Y)\). If \(X\) and \(Y\) are independent, their covariance is zero, so their variances add. Independence is sufficient for this result, but it is not necessary: the variances also add whenever covariance is zero.

A direct calculation from the sum’s pmf is useful as a check because it does not rely on remembering which moment rule applies. The component rules are usually quicker once the pmf of the sum has been found, or when only its moments are needed.

Worked Example: A Different Pair of Independent Distributions

For a hypothetical two-stage score, let \(X\) equal 1 with probability 0.75 and 3 with probability 0.25. Let independent \(Y\) equal 0, 2, or 4 with probabilities 0.20, 0.50, or 0.30. Find the distribution and moments of the total \(S=X+Y\).

Check the model. Both sets of probabilities sum to 1, and the setup specifies that the stages are independent. Thus, for instance, the probability of \(X=3,Y=2\) is \(0.25(0.50)=0.125\).

Combine outcome pairs. The total 3 occurs through \((1,2)\) or \((3,0)\); the total 5 occurs through \((1,4)\) or \((3,2)\). Calculating each total’s probability gives

$$ \begin{aligned} P(S=1)&=0.75(0.20)=0.15,\\ P(S=3)&=0.75(0.50)+0.25(0.20)=0.375+0.050=0.425,\\ P(S=5)&=0.75(0.30)+0.25(0.50)=0.225+0.125=0.350,\\ P(S=7)&=0.25(0.30)=0.075. \end{aligned} $$

The probabilities total \(0.15+0.425+0.350+0.075=1.000\). From this pmf,

$$ \begin{aligned} E(S)&=1(0.15)+3(0.425)+5(0.350)+7(0.075)\\ &=0.15+1.275+1.750+0.525=3.70,\\ E(S^2)&=1(0.15)+9(0.425)+25(0.350)+49(0.075)\\ &=0.15+3.825+8.750+3.675=16.40,\\ \operatorname{Var}(S)&=16.40-(3.70)^2=16.40-13.69=2.71,\\ SD(S)&=\sqrt{2.71}\approx1.646. \end{aligned} $$

For a check, \(E(X)=1(0.75)+3(0.25)=1.50\), \(E(X^2)=1(0.75)+9(0.25)=3.00\), and \(\operatorname{Var}(X)=3.00-1.50^2=0.75\). Also, \(E(Y)=0(0.20)+2(0.50)+4(0.30)=2.20\), \(E(Y^2)=0+4(0.50)+16(0.30)=6.80\), and \(\operatorname{Var}(Y)=6.80-2.20^2=1.96\). The component means give \(1.50+2.20=3.70\), and the independent component variances give \(0.75+1.96=2.71\). Both checks match the moments from the sum’s pmf.

A Zero Covariance Caution

It is inaccurate to say that variances add only when variables are independent. The general variance identity shows that zero covariance is enough. Independence guarantees zero covariance when the relevant expectations exist, but dependent variables can also have zero covariance.

Worked Example: Dependent Variables With Additive Variances

Let \(X\) be equally likely to be \(-1\), 0, or 1, and define \(Y=X^2\). These variables are dependent because the value of \(Y\) is determined by \(X\). Nevertheless, their covariance is zero.

The possible values of \(Y\) are 1, 0, and 1, respectively. Thus \(E(X)=(-1+0+1)/3=0\), \(E(Y)=(1+0+1)/3=2/3\), and \(E(XY)=((-1)(1)+0(0)+1(1))/3=0\). Therefore

$$ \operatorname{Cov}(X,Y)=E(XY)-E(X)E(Y)=0-(0)(2/3)=0. $$

Also, \(\operatorname{Var}(X)=E(X^2)-[E(X)]^2=2/3\). Since \(Y\) is 1 with probability \(2/3\) and 0 with probability \(1/3\), \(\operatorname{Var}(Y)=2/3-(2/3)^2=2/9\). The general identity gives \(\operatorname{Var}(X+Y)=2/3+2/9+2(0)=8/9\). This example shows why independence is a sufficient condition for adding variances, not a necessary one.

A Reliable Calculation Process

1
State the variables and assumptions.
List each variable’s possible values and probabilities. Confirm that each pmf sums to 1 and state whether independence is assumed.
2
Enumerate pairs and form totals.
For every possible pair \((x,y)\), compute \(x+y\). Do not assume that each total is produced by only one pair.
3
Calculate and combine probabilities.
For independent variables, multiply the probabilities for each pair, then add pair probabilities that yield the same total.
4
Check and summarize.
Verify that the sum’s probabilities total 1. Calculate its mean, variance, and standard deviation, then compare the moments with the applicable expectation and variance rules.

Why the Distribution Matters

A mean alone does not describe all the possible totals or their probabilities. The pmf can answer questions such as \(P(S\geq 5)\), show whether the total is concentrated at a few values, and make clear which outcomes are possible. The mean and standard deviation then provide concise summaries of the distribution’s center and spread.

Keep units consistent when interpreting these summaries. If \(X\) and \(Y\) are scores measured in points, then \(E(S)\) is in points, \(\operatorname{Var}(S)\) is in squared points, and \(SD(S)\) is in points. If the variables have different units, adding their values requires a meaningful common scale or a defined conversion before the sum can be interpreted.

Common Mistakes

  • Multiplying probabilities for dependent variables. The product \(p_X(x)p_Y(y)\) is the joint probability only under independence. For dependent variables, use their actual joint probabilities.
  • Forgetting to combine matching totals. If multiple pairs produce a total \(s\), add all their joint probabilities to obtain \(P(S=s)\).
  • Using the wrong variance shortcut. Independence gives \(\operatorname{Var}(X+Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)\), but the general formula includes \(2\operatorname{Cov}(X,Y)\). Zero covariance, not independence alone, is the exact condition for variance addition.
  • Stopping before checking the pmf. If the probabilities of all possible totals do not sum to 1, a pair may have been omitted, counted twice, or assigned the wrong probability.
  • Confusing variance and standard deviation. Variance is in squared units; take its nonnegative square root to obtain standard deviation in the original units.
Key takeaway: For independent finite discrete variables, the probability of each outcome pair is the product of its marginal probabilities. Add pair probabilities when pairs give the same sum, then calculate moments from the sum’s pmf and verify them with expectation and variance rules. Variances add when covariance is zero; independence is one condition that guarantees this.

Check Your Understanding

Try these questions using the definitions and calculation process above.

  1. If independent \(X\) and \(Y\) can produce the same total through three different outcome pairs, how should \(P(X+Y=s)\) be calculated?
  2. Suppose \(X\) and \(Y\) are independent with means 2 and 5 and variances 1.5 and 3.2. Find the mean and variance of \(X+Y\).
  3. Why must probabilities from different pairs be added when those pairs yield the same value of \(X+Y\)?
  4. Does variance addition require independence? State the general condition and explain independence’s role.
  5. A calculated pmf for a sum has probabilities totaling 0.92. Give two possible sources of the error.