A repair visit has two parts, finding the fault and fixing it, and a quick diagnosis often comes with a long repair. To plan for the expected length of a visit, do you need the distribution of the total time, or a guarantee that the two parts are independent? You need neither. This lesson shows that the expectation of a sum is the sum of the expectations whenever those expectations are finite, whatever the dependence between the terms, and it marks where the shortcut stops, at products and squares.
Key terms
Finite expectation
Definition A random variable has finite expectation when . For a discrete variable with PMF this means
and then is a real number that does not depend on the order in which the terms are added. A variable with finitely many possible values has finite expectation, and so does every bounded variable. When , the expectation is , or undefined, and the rules on this page are stated only for finite expectations.
In plain words Before an expected value is used in arithmetic, check that it is an actual number. A valid distribution on infinitely many values can still have a weighted sum of values that grows without bound, and two infinite expectations of opposite sign cannot be combined into a meaningful answer.
Example Let take the value with probability for . These probabilities add to , because and the sum telescopes. Yet
Now let . The sum is the constant , so , but the expression would read , which has no value.
Expectation of a sum
Definition Let and be random variables defined on the same probability model, each with finite expectation. Then has finite expectation and
No independence is assumed. To see why in a model with finitely many outcomes , write , and . An expectation can be computed outcome by outcome, since grouping the outcomes that give the same value returns the PMF formula. So
The same splitting works with countably many outcomes, because finite expectations make both series absolutely convergent, and the rule holds for random variables in general, discrete or not.
In plain words To average a total, average each part and add. Which values of occur together with which values of matters for the distribution of , but not for its mean.
Example Three equally likely job types give the task durations , and in hours. The separate means are and . The totals are , and , so the direct calculation gives , which equals . The durations are strongly dependent, since the value of identifies the job type and therefore fixes , and the rule holds anyway.
Linearity of expectation
Definition A linear combination of random variables is a random variable , where the number of terms is fixed and the coefficients are fixed real numbers. Linearity of expectation states that if are defined on the same probability model and each has finite expectation, then for every fixed real number the variable has finite expectation and
It follows from the sum rule applied repeatedly, together with , since every value is multiplied by , and , since the probabilities add to . Negative coefficients are allowed, so . The number of terms has to be fixed. A sum with a random number of terms needs its own argument about how the count and the terms are related.
In plain words Expectation passes through sums, constant multiples and added constants. Combine the means in the same way the variables are combined, and ignore any dependence between them.
Example In the job table above, a fixed preparation time of half an hour adds to every total, so the expected total becomes hours. A charge of tokens per hour of task , less a discount of tokens, is , and linearity gives tokens. Directly, the three charges are , and tokens, whose average is .
Expectation of a product
Definition For random variables and on the same probability model, is the expectation of the single random variable , whose value on each outcome is the product of the values of and . In a finite outcome table with the notation above,
which depends on which values occur together. In general need not equal . If and are independent and both have finite expectations, then , a separate product rule with its own hypothesis. The converse is false, so the equation does not show that and are independent. Finite expectations of and also do not guarantee a finite , for example when and .
In plain words Linearity covers adding and scaling, not multiplying. The average of a product depends on whether large values of one variable come with large or with small values of the other, and multiplying two separate averages throws that information away.
Example In the job table, the products are , and square hours, so . The product of the means is , twice as large. Long first tasks come with short second tasks here, and that pairing makes the average product smaller than the product of the averages.
Expectation of a square
Definition The expectation of the square of is , the expectation of the random variable . For a discrete variable,
a sum of nonnegative terms that is either a finite number or . It should not be confused with the square of the expectation, . More generally, averages the values , while applies to a single number. The two agree for every with finite expectation when , by linearity, but they can differ for other functions, and is the standard example. For with finite expectation, the difference is the variance, the subject of a later lesson in this unit.
In plain words Read the brackets. Squaring each outcome and then averaging is a different instruction from averaging and then squaring. Squaring first lets outcomes far from zero count more heavily, and when has finite expectation the two results agree only if equals one value with probability one.
Example In the job table, takes the values , and , so . Squaring the mean gives , about . Both numbers are well defined, and they answer different questions.
Check yourself
- Three scenarios have probabilities , and and give the paired durations , and in hours. Find with linearity, then check it directly from the rows.
Show the answer
The separate means are hours and hours. Linearity gives hours. Directly, the rows give , and , and the weighted average is hours. The two durations are not assumed independent, and neither calculation needs that.
- A fair die is rolled. Let be the number shown and the number on the opposite face. Find , and .
Show the answer
The sum equals on every outcome, so , in agreement with . For the product, write . The second moment is , so linearity gives
Directly, the six products are , , , , and , with average . The product of the means is , larger than . Linearity applies to the sum and to , but not to the product itself.
- Let take the values , and with probability each, and let . Show that . Are and independent?
Show the answer
The product equals on every outcome, because each possible value satisfies . So , and also . The two sides agree. The variables are still dependent, since is determined by and is not constant. For instance, , while . Independence implies the product rule, but the product rule alone does not imply independence.