A product is often assembled from parts whose sizes vary, and what matters is the total. If each part has a known average and a known spread, what are the average and the spread of the total? The average of the total follows from a rule that does not depend on how the parts are related, while its spread depends on how the parts vary together. This lesson defines expected value and variance for a probability model and shows exactly where independence and covariance enter.
Key terms
Expected value
Definition Let be a discrete random variable with PMF . If is finite, the expected value of is
with the sum running over the support of . The condition holds automatically when the support is finite. More generally, for a function the expected value of is , provided is finite. The expected value is also called the mean of and written or .
In plain words The expected value is a probability-weighted average of the possible values, the balance point of the PMF. Over many independent repetitions of the same model, the average of the observed values tends to settle near it. It need not be a value that can take, and a single trial need not come out near it.
Example Let be with probability and with probability . Then
No single trial gives , since is always or . The value is the point where the two masses balance, closer to because that value carries more probability.
Variance of a random variable
Definition Let be a discrete random variable whose second moment
is finite. Then the mean is finite too, and the variance of is the expected squared deviation from the mean,
The standard deviation is . Expanding the square gives the identity
The variance is never negative, and it equals exactly when with probability . For constants and ,
In plain words Variance measures spread as an average squared distance from the mean, so its unit is the square of the unit of , and the standard deviation returns to the original unit. The second moment measures squared distance from instead of from the mean, which is why the two are equal exactly when the mean is . Shifting moves the mean but not the spread, and multiplying by multiplies the spread by .
Example For the variable above, the deviations from are and , with squares and , so
Both values of square to , so the second moment is , and the identity gives again. The standard deviation is .
Linearity of expectation
Definition Let and be random variables defined on the same sample space, with finite expected values, and let , and be constants. Then
The rule extends to any finite sum, , and it holds whether or not the variables are independent. It applies to linear combinations. For a function that is not linear, need not equal .
In plain words The mean of a total is the total of the means, whatever the relation between the parts, as long as each part has a finite mean. Doubling a quantity doubles its mean, and adding a constant adds the same constant to the mean.
Example Let have the same distribution as the variable above. Then , whether is chosen independently of or on every trial. For , linearity gives . Squaring is not linear, and indeed while .
Independent random variables
Definition Discrete random variables and are independent if
for every pair of values and . Equivalently, for every with , the conditional distribution of given is the same as the distribution of . Several variables are independent if their joint probabilities factor in the same way for every list of values. If and are independent and have finite expected values, then . An independent copy of is a random variable that is independent of and has the same distribution.
In plain words Independent variables carry no information about each other, so learning the value of one leaves the probabilities for the other unchanged. Having the same distribution is a different property. A variable and itself have the same distribution, but they are not independent unless the variable is constant with probability .
Example Let be an independent copy of . The four pairs of values have the probabilities in the table, each the product of the two separate probabilities.
| Joint probability | ||
|---|---|---|
If instead , the pair and is impossible. Its probability is , while , so these two variables are not independent.
Covariance of random variables
Definition For random variables and with finite second moments and means and , the covariance is
In particular . Independent variables with finite second moments have covariance , because . The converse is false. Covariance does not imply independence, as the example below shows. When both standard deviations are positive, the correlation
lies between and . These are quantities of the model. The sample covariance and the sample correlation are their counterparts computed from observed data.
In plain words Covariance averages the product of the two deviations from the means, weighting by probability. Deviations with the same sign give a positive product and deviations with opposite signs a negative one, so the covariance is positive when the same-sign products outweigh the others, negative when they are outweighed, and when the two balance. Both the sizes of the deviations and how often each case occurs count. It reflects linear association, so even a strong curved relation can have covariance .
Example For with as above, and the correlation is . For an independent copy, the table gives , so the covariance is . To see that covariance does not imply independence, let take the values , and with probability each, and compare with its square . Here and , so . Yet is determined by , and differs from , so the two are not independent.
Variance of a sum
Definition For random variables and with finite second moments and constants and ,
When , in particular when and are independent, both and have variance . For a sum of variables, the variance is the sum of the variances plus twice the sum of the covariances over all pairs. Standard deviations do not add in general. The equality holds exactly when , which for two variables with positive standard deviations means correlation .
In plain words Variances add for uncorrelated parts, and the covariance term corrects for parts that move together or against each other. For two independent parts that both vary, their deviations from the means have the same sign in some trials and opposite signs in others, so the standard deviation of the total is smaller than the sum of the two standard deviations.
Example For an independent copy of , the sum takes the values , and with probabilities , and . Its mean is , and its variance is , which a direct computation from these three probabilities confirms. Its standard deviation is , less than . If instead , the sum is , with the same mean and variance
twice as large. Its standard deviation now equals the sum of the two standard deviations, because the correlation is .
Check yourself
- For the variable of this lesson, which is with probability and with probability , let . Find , and . Why does the change the mean but not the spread?
Show the answer
By linearity, . The variance is multiplied by , so , and the standard deviation is multiplied by , so . Subtracting moves every value and the mean by the same amount, so every deviation from the mean stays the same. Multiplying by triples every deviation, which multiplies every squared deviation by .
- Let be an independent copy of and . Someone argues that . Find and , and say when the variance of would be .
Show the answer
By linearity, . The coefficient of is , and it enters the variance squared, so with covariance
Directly, is or with probability each and with probability , so , which is because . The argument fails because variances of independent parts add even in a difference. If instead on every trial, then always, and the formula gives , the covariance term canceling both variances. More generally, the variance of is exactly when is constant with probability , and for a with the same distribution as that constant must be .
- A product’s total length is , where each of the three parts has a standard deviation of . A colleague reports . Find when the three lengths are independent, and say when the colleague’s value would be right.
Show the answer
For independent parts all covariances are , so
and . Adding the standard deviations gives , which is correct exactly when every pair of lengths has correlation , for example when the three parts always deviate from their means by the same amount. Then and . The expected total length is the sum of the three expected lengths in either case.