Why Linearity Matters
When two random quantities are combined, it is natural to ask how their expected values are related. For example, if \(X\) counts arrivals in the morning and \(Y\) counts arrivals in the afternoon, the total is \(X+Y\). If each has a known expectation, can we find the expected total without first working out every possible combination of morning and afternoon counts?
For finite random variables, the answer is yes. The expectation of a sum is the sum of the expectations, and the expectation of a difference is the difference of the expectations. More generally, multiplying random variables by fixed constants and adding the results behaves in the same way. Importantly, these facts do not require the random variables to be independent.
The expectation is a probability-weighted average of the possible values. A joint probability table gives enough information to calculate expectations involving both \(X\) and \(Y\). The separate expectations, \(E(X)\) and \(E(Y)\), can also be obtained from the marginal probabilities: \(P(X=x)\) is the sum of the joint probabilities over all possible \(y\), and \(P(Y=y)\) is the corresponding sum over all possible \(x\).
The Linearity Rule
Suppose \(X\) and \(Y\) take finitely many values in the same experiment, and let \(a\) and \(b\) be fixed numbers. The expectation of \(aX+bY\) is calculated by taking the value \(ax+by\) for each joint outcome \((x,y)\), weighting it by that outcome's probability, and adding the results.
Here is the derivation from the finite-sum definition. Write \(p(x,y)=P(X=x,Y=y)\). Summing over the possible pairs of values gives the expectation of the linear combination. The marginal probabilities are obtained by summing the joint probabilities across the other variable's possible values.
The second line follows by distributing the sums and taking the fixed constants \(a\) and \(b\) outside them. In the third line, summing \(p(x,y)\) over all \(y\) gives \(P(X=x)\), while summing over all \(x\) gives \(P(Y=y)\). These steps use the joint probabilities' marginal totals, not any assumption about how \(X\) and \(Y\) relate.
In particular, setting \(a=b=1\) gives \(E(X+Y)=E(X)+E(Y)\). Setting \(a=1\) and \(b=-1\) gives \(E(X-Y)=E(X)-E(Y)\). A fixed constant can also be added: since a constant \(c\) has expectation \(c\), \(E(aX+bY+c)=aE(X)+bE(Y)+c\).
Worked Example: A Linear Combination of Dependent Variables
Worked Example: A Linear Combination of Dependent Variables
Consider a hypothetical experiment with two finite random variables \(X\) and \(Y\). Their joint probability table is:
| \(X\) | \(Y=0\) | \(Y=2\) | Row total |
|---|---|---|---|
| \(X=0\) | 0.20 | 0.30 | 0.50 |
| \(X=1\) | 0.30 | 0.20 | 0.50 |
| Column total | 0.50 | 0.50 | 1.00 |
Find \(E(3X-2Y+4)\). First calculate the two expectations from the row and column totals:
The linearity rule gives:
A direct check uses the four joint outcomes. The values of \(3X-2Y+4\) are 4, 0, 7, and 3, respectively, for \((X,Y)=(0,0),(0,2),(1,0),(1,2)\). Therefore,
These variables are not independent: for example, \(P(X=0,Y=0)=0.20\), whereas \(P(X=0)P(Y=0)=0.50(0.50)=0.25\). The calculation still works. In this example, as in the theorem, the joint probabilities need not factor into products of marginal probabilities.
Using Linearity to Find an Expected Sum
When two counts refer to parts of the same overall process, their sum is often the quantity of interest. If their individual probability distributions are known, the expected total can be found without constructing a joint probability table. This is useful even when the counts may be related.
Worked Example: Expected Arrivals Across Two Time Periods
In a hypothetical clinic, let \(X\) be the number of specimens arriving during a randomly selected morning and \(Y\) the number arriving that afternoon. Suppose the marginal probability distributions are as follows. The two counts are observed on the same day, but their joint distribution has not been supplied.
| Morning count \(x\) | \(P(X=x)\) | Afternoon count \(y\) | \(P(Y=y)\) |
|---|---|---|---|
| 0 | 0.25 | 0 | 0.20 |
| 1 | 0.50 | 1 | 0.30 |
| 2 | 0.25 | 2 | 0.50 |
The morning expectation is:
The afternoon expectation is:
Let \(T=X+Y\) be the total number of specimens arriving that day. Linearity gives:
Thus the expected daily total is 2.30 specimens. The result does not say that 2.30 specimens must arrive on a particular day; a count is whole-numbered. It describes the probability-weighted average across repeated days under the stated distributions. No assumption about whether morning and afternoon counts are independent was needed.
Using Linearity to Find an Expected Difference
A difference can represent a signed comparison. For paired measurements, define \(D=X-Y\), so a positive value means \(X\) exceeds \(Y\), and a negative value means it is smaller. The expected difference is \(E(X)-E(Y)\), whether or not the two measurements vary together.
Worked Example: Expected Difference in Paired Waiting Times
In a hypothetical service comparison, a day is selected at random. Let \(X\) be the waiting time, in minutes, at desk A that day, and \(Y\) the waiting time at desk B on that same day. Suppose their marginal distributions are:
| Desk A time \(x\), minutes | \(P(X=x)\) | Desk B time \(y\), minutes | \(P(Y=y)\) |
|---|---|---|---|
| 4 | 0.25 | 3 | 0.50 |
| 8 | 0.50 | 9 | 0.25 |
| 12 | 0.25 | 15 | 0.25 |
Calculate each mean waiting time using its marginal distribution:
For the paired difference \(D=X-Y\), linearity gives:
The expected paired difference is 0.50 minutes, with desk A's waiting time higher on average by that signed amount. This does not imply that desk A has a longer wait on every day, or that the difference is 0.50 minutes on a typical day. The marginal distributions do not tell us how often \(X>Y\), because that also depends on which desk times occur together.
What Linearity Does and Does Not Tell Us
Linearity determines the expectation of a sum, difference, or fixed linear combination from the separate expectations. It does not determine the full probability distribution of that combination. For example, knowing \(E(X)\) and \(E(Y)\) is enough to find \(E(X+Y)\), but not enough to calculate the probability that \(X+Y\) equals a particular value. Such a probability depends on how the possible values of \(X\) and \(Y\) occur together.
The distinction matters because expectation is a summary, not a description of every possible outcome. Two pairs of variables could have the same separate expectations and therefore the same expected sum, while having different joint patterns and different probabilities for particular sums. To answer questions about those probabilities, more than linearity is needed.
Common Mistake
A common incorrect argument is: “I can add the expected values only if \(X\) and \(Y\) are independent.” Independence is not a condition of linearity of expectation. The derivation distributes a sum over joint probabilities and then uses the marginal totals; it does not require those joint probabilities to factor. Dependence may affect which pairs of values occur, but it does not change the expected value of a sum once the separate expectations are fixed.
A related overreach is to use \(E(X+Y)=E(X)+E(Y)\) to claim that the distribution of \(X+Y\) can be found from the two expectations alone. That is not what the rule says. The rule gives one number, the expectation; the distribution of the sum requires information about possible values and their joint probabilities.
Check Your Understanding
Use the finite-sum definition and linearity to answer these questions.
- If \(E(X)=4\) and \(E(Y)=1.5\), find \(E(2X+3Y)\). State whether independence is needed.
- Suppose \(E(A)=12\) minutes and \(E(B)=9\) minutes. What is \(E(A-B)\), and how should its sign be interpreted?
- In a joint probability table, \(P(X=0,Y=0)=0.18\), while \(P(X=0)=0.40\) and \(P(Y=0)=0.50\). Does this pair of probabilities support independence? Does it prevent applying linearity?
- Explain why separate expectations are enough to find \(E(X+Y)\), but may not be enough to find \(P(X+Y=2)\).
- For a constant \(c\), explain why \(E(X+c)=E(X)+c\).