Computing Covariance from Joint Distributions
You'll learn how to calculate covariance directly from the joint probability distribution of two random variables.
Core Idea
Covariance measures how two random variables vary together. While you've already seen its definition as ( \text{Cov}(X, Y) = E[(X - \mu_X)(Y - \mu_Y)] ), computing it from joint distributions requires integrating (or summing) over all possible pairs of values, weighted by their joint probabilities.
For Discrete Random Variables
When (X) and (Y) are discrete with joint PMF (p_{X,Y}(x, y)):
Or, using the computational shortcut:
Think of it as: For each possible outcome pair ((x, y)), you measure how far each is from its mean, multiply those deviations together, weight by the joint probability, and sum everything up.
For Continuous Random Variables
When (X) and (Y) are continuous with joint PDF (f_{X,Y}(x, y)):
Or using the shortcut:
The continuous case replaces sums with integrals, but the logic is identical.
Key Takeaway: Covariance is computed from joint distributions by summing (discrete) or integrating (continuous) the product of deviations or using (E[XY] - E[X]E[Y]), where (E[XY]) comes directly from the joint distribution.