How to Calculate E[XY] for Dependent Random Variables
At a glance
- 1. Find the joint behavior
Use the joint distribution, or a conditional distribution together with the distribution of one variable.
- 2. Calculate the product mean
Average each product xy using its joint probability, or integrate xy against the joint density.
- 3. Use covariance if known
When the covariance and both means are known, add the covariance to the product of the means.
- 4. Check dependence assumptions
Multiply the means only when independence or another condition that gives zero covariance is justified.
If and are dependent, their product’s expected value is not usually the product of their expected values. To calculate , you need information about how the variables occur together, such as their joint distribution or their covariance.
The key relationship is , when the relevant expectations and covariance exist. The covariance term accounts for how dependence changes the average product.
Calculate the expectation from the joint distribution
For discrete random variables with joint probability mass function ,
Each possible pair contributes its product, weighted by the probability that the pair occurs. For continuous variables with joint density , the corresponding formula is
provided the expectation is defined. In either case, it is the joint distribution that matters. The marginal distributions describe and separately, but do not necessarily say how their values are paired.
If the covariance is available instead, use its definition:
Rearranging gives
This identity applies when, for example, both variables have finite second moments. More generally, check that the expectations in the expression you use exist.
Why the marginal means are not enough
If and are independent and their expectations exist, then , so
But dependence alone does not tell you the value of the covariance. It could be positive, negative, or zero. In particular, zero covariance does not in general prove independence; it means only that the variables are uncorrelated.
For example, knowing that both variables are Bernoulli with probability gives their separate means, but not . If they always take the same value, the product is 1 half the time. If they are independent, the product is 1 only when both are 1, which occurs with probability 1/4. The marginals match in both cases, but the expected products differ.
Worked example: dependent Bernoulli variables
Suppose and have the following joint distribution:
| Probability | ||
|---|---|---|
| 0 | 0 | |
| 1 | 1 |
Here, , so the variables are dependent. Compute each mean:
For the product, the pair contributes 0 and the pair contributes 1:
The product of the means is instead . The difference is the covariance:
Now keep the same Bernoulli marginals but make and independent. Each pair , , , and then has probability . Only contributes to , giving . This comparison shows why separate means cannot determine the expected product.
Use conditional expectation when it is easier
Sometimes the joint distribution is cumbersome, but the conditional mean of one variable given the other is simple. The law of iterated expectation gives
assuming the product is integrable. In the dependent Bernoulli example, , so . Therefore,
since when is either 0 or 1. This method is useful when you know a conditional model such as and the distribution of .
Common mistakes
- Multiplying the means without checking independence. This gives the expected product only under independence (or another condition that makes the covariance zero).
- Treating dependence as a numerical answer. Knowing that variables are dependent does not reveal the sign or size of their covariance.
- Assuming zero covariance means independence. Some dependent variables have zero covariance; independence is a stronger property.
- Using only the marginal distributions. To compute the product expectation in general, you need their joint behavior or equivalent information, such as covariance together with both means.
References
- A First Course in Probability, Sheldon Ross
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.