In this topic you compute covariance and correlation for two random variables. Covariance is E[XY] minus E[X]E[Y]. A positive value means large values of one tend to come with large values of the other. Correlation rescales covariance to a number between -1 and 1. Recognition cue: the problem involves two random variables at once, for example the variance of a sum or a two-asset portfolio. You will practice: covariance definition, bilinearity and shift rules, variance of sums, correlation and independence.
11 problems, each with a worked answer. Verified by an independent second solve.
Work them on paper, in order; difficulty ramps gently.
1.
Basic
A student's daily study hours X and coffee cups Y satisfy E[X] = 2, E[Y] = 3, and E[XY] = 10. Find Cov(X, Y).
Show answer
Answer: 4
Apply the computing formula for covariance directly.
Cov(X,Y)=E[XY]−E[X]E[Y]=10−(2)(3)=4
The positive covariance means more study hours tend to come with more coffee.
2.
Basic
A commute has two legs with durations X and Y (minutes), where Var(X) = 4, Var(Y) = 9, and Cov(X, Y) = 2. Find Var(X + Y), the variance of the total commute time.
Show answer
Answer: 17
Use the variance formula for a sum.
Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)=4+9+2(2)=17
The positive covariance, from traffic delaying both legs, adds variance beyond the independent case.
3.
Basic
Two exam scores satisfy Cov(X, Y) = 6, Var(X) = 9, Var(Y) = 16. Find the correlation ρ(X, Y).
Show answer
Answer: 0.5
Take square roots of the variances to get the standard deviations.
σX=3,σY=4
ρ=σXσYCov(X,Y)=126=0.5
This lies safely inside the interval from -1 to 1.
4.
Basic
Two independent noise sources have Var(X) = 5 and Var(Y) = 3. Find Var(X − Y).
Show answer
Answer: 8
Independence makes the covariance zero.
Var(X−Y)=Var(X)+Var(Y)−2Cov(X,Y)=5+3−0=8
Variances add even for a difference. They never subtract.
5.
Basic
Two food trucks on opposite sides of a city have daily sales X and Y. X and Y are independent. Find Cov(X, Y).
Show answer
Answer: 0
Independent random variables have zero covariance.
Cov(X,Y)=0
6.
Basic
The noon temperature X at a weather station has Var(X) = 6. Find Cov(X, X).
Show answer
Answer: 6
The covariance of a variable with itself is its variance.
Cov(X,X)=Var(X)=6
7.
Basic
A kitchen scale reads exactly 100 grams too high, so a dough's recorded weight is W = X + 100, where X is the true weight. The bake time is Y, and Cov(X, Y) = 7. Find Cov(W, Y).
Show answer
Answer: 7
Adding a constant does not change covariance.
Cov(X+100,Y)=Cov(X,Y)=7
8.
Basic
Roll a fair four-sided die once and let X be the number shown. Let Y = 2X. Find Cov(X, Y).
Show answer
Answer: 25
Pull the constant out: Cov(X, 2X) = 2 Var(X). Then compute Var(X) for the four-sided die.
Var(X)=41+4+9+16−(25)2=45
Cov(X,2X)=2⋅45=25
9.
Basic
Two swimmers race in the same pool. Their finishing times X and Y satisfy Var(X) = 10, Var(Y) = 6, and Cov(X, Y) = 3. Find Var(X − Y).
Show answer
Answer: 10
Use the variance formula for a difference.
Var(X−Y)=10+6−2⋅3=10
10.
Basic
For a breed of dogs, shoulder height X has standard deviation 2 cm and weight Y has standard deviation 5 kg. The correlation is ρ(X, Y) = 0.6. Find Cov(X, Y).
Show answer
Answer: 6
Covariance is the correlation times both standard deviations.
Cov(X,Y)=0.6⋅2⋅5=6
11.
Basic
Random variables X and Y satisfy ρ(X, Y) = −0.4. Let U = −2X + 7 and V = 3Y − 1. Find ρ(U, V).
Show answer
Answer: 52
Correlation is invariant under affine maps up to the sign of the product of the slopes. The slopes are −2 and 3, so the product is negative and the sign flips.
corr(U,V)=−corr(X,Y)=−(−0.4)=52