multivariate probability
Covariance and Correlation
You should know: variance of a random variable, joint probability distributions
Overview
Covariance measures how two random variables change together: Cov(X,Y) = E[(X-μ_X)(Y-μ_Y)] = E[XY] - E[X]E[Y]. A positive covariance means X and Y tend to be above (or below) their means together; a negative covariance means one tends to be above its mean when the other is below. Because covariance's magnitude depends on the units and scale of X and Y, it is often normalized into the correlation coefficient ρ = Cov(X,Y)/(σ_Xσ_Y), which is unitless and always lies between -1 and 1. Independent random variables always have zero covariance, but zero covariance does not imply independence — it only rules out linear association.
Intuition
Imagine plotting many (X,Y) pairs on a scatterplot. If the cloud of points trends upward — high X tends to pair with high Y — the covariance is positive. If it trends downward, covariance is negative. If there's no discernible linear trend, covariance is near zero. Covariance itself doesn't tell you HOW STRONG the trend is, because its size depends on the scale of X and Y (measuring height in millimeters instead of meters would inflate the covariance). Correlation fixes this by dividing out the standard deviations, squashing the measure into the fixed range [-1, 1] so +1 means a perfect increasing line, -1 a perfect decreasing line, and 0 means no linear relationship.
Formal Definition
For random variables X and Y with means μ_X, μ_Y and standard deviations σ_X, σ_Y:
Worked Examples
Compute the means of X and Y.
Compute E[XY].
Apply the covariance shortcut formula.
Answer: Cov(X,Y) = 4/3 ≈ 1.33 (positive, since Y = 2X exactly).
Practice Problems
Var(X) = 16, Var(Y) = 25, Cov(X,Y) = -10. Find ρ_{X,Y}.
Var(X) = 9, Var(Y) = 4, Cov(X,Y) = 2. Find Var(X - Y).
A portfolio has two stocks with Var(X)=0.04, Var(Y)=0.09, and correlation ρ=0.6. Find Cov(X,Y) and Var(X+Y).
Quiz
Summary
- Cov(X,Y) = E[XY] - E[X]E[Y] measures the direction of the linear relationship between X and Y.
- Correlation ρ = Cov(X,Y)/(σ_Xσ_Y) normalizes covariance to always fall in [-1,1].
- Zero covariance follows from independence, but zero covariance alone does not imply independence.
Mathematics