mindstair

Home / Courses / Probability / Unit 9

Probability Unit 9: Expectation, Variance and Covariance

This unit extends expectation and variance to several random variables. Covariance, conditional expectation and moment generating functions are the tools behind portfolio risk, compound claims and most limit theorems.

Covers: Expectations of functions of two variables, Covariance and correlation, Variance of sums and linear combinations, Conditional expectation and the law of total expectation, Law of total variance, Compound (random) sums, Moment generating functions

Study guide

For two random variables, E[g(X, Y)] is a double sum or double integral of g against the joint distribution. Linearity always holds: E[aX + bY] = aE[X] + bE[Y], with or without independence. Products are different: E[XY] = E[X]E[Y] holds when X and Y are independent but not in general. The covariance Cov(X, Y) = E[XY] − E[X]E[Y] measures how X and Y move together, and the correlation ρ = Cov/(σ_X σ_Y) rescales it to lie between −1 and 1. Covariance is bilinear and ignores added constants: Cov(aX + b, cY + d) = ac Cov(X, Y).

Variances of sums need covariances: Var(aX + bY) = a²Var(X) + b²Var(Y) + 2ab Cov(X, Y), and for many variables Var(ΣXᵢ) = ΣVar(Xᵢ) + 2Σ_{i<j}Cov(Xᵢ, Xⱼ). For independent variables the covariances vanish, so variances add, even for differences. Portfolio problems apply this directly, and diversification works because a correlation below 1 makes the combined variance smaller. Be careful with the converse: zero covariance does not imply independence, as Y = X² with X symmetric about 0 shows.

Conditional expectation E[X | Y] is itself a random variable, a function of Y. The law of total expectation says E[X] = E[E[X | Y]], which is the continuous form of averaging over cases. The law of total variance splits variability into two parts: Var(X) = E[Var(X | Y)] + Var(E[X | Y]), the average variance within groups plus the variance between group means. For a compound sum S = X₁ + ··· + X_N with N independent of the iid claims, E[S] = E[N]E[X] and Var(S) = E[N]Var(X) + Var(N)(E[X])², a key result in insurance.

The moment generating function M(t) = E[e^(tX)] encodes all moments: M⁽ⁿ⁾(0) = E[Xⁿ]. It also identifies distributions, since two variables with the same MGF near 0 have the same distribution. Learn the common MGFs: binomial (1 − p + peᵗ)ⁿ, Poisson e^(λ(eᵗ − 1)), exponential λ/(λ − t), and normal e^(μt + σ²t²/2). For independent variables, the MGF of a sum is the product of the MGFs, which is the fastest way to show that sums of independent Poissons are Poisson and sums of independent normals are normal.

Key ideas

Formulas and rules

Cov(X, Y) = E[XY] − E[X]E[Y]; ρ = Cov(X, Y)/(σ_X σ_Y)
Var(aX + bY) = a²Var(X) + b²Var(Y) + 2ab Cov(X, Y)
E[X] = E[E[X | Y]]; Var(X) = E[Var(X | Y)] + Var(E[X | Y])
Compound sum: E[S] = E[N]E[X]; Var(S) = E[N]Var(X) + Var(N)(E[X])²
MGF: M(t) = E[e^(tX)]; E[Xⁿ] = M⁽ⁿ⁾(0); M_{X+Y} = M_X M_Y if independent
Normal MGF e^(μt + σ²t²/2); Poisson e^(λ(eᵗ − 1)); binomial (1 − p + peᵗ)ⁿ

Common mistakes

Before the test, make sure you can

Words to know

Covariance
Cov(X, Y) = E[(X − μ_X)(Y − μ_Y)] = E[XY] − E[X]E[Y].
Correlation
ρ = Cov(X, Y)/(σ_X σ_Y), a unitless measure of linear association between −1 and 1.
Uncorrelated
Cov(X, Y) = 0; implied by independence but not equivalent to it.
Bilinearity
Cov(aX + bY, Z) = aCov(X, Z) + bCov(Y, Z).
Variance of a sum
Var(ΣXᵢ) = ΣVar(Xᵢ) + 2Σ_{i<j}Cov(Xᵢ, Xⱼ).
Conditional expectation
E[X | Y], a function of Y giving the mean of X for each value of Y.
Law of total expectation
E[X] = E[E[X | Y]].
Law of total variance
Var(X) = E[Var(X | Y)] + Var(E[X | Y]).
Compound sum
S = X₁ + ··· + X_N with a random number N of iid terms.
Moment generating function
M(t) = E[e^(tX)], whose derivatives at 0 give the moments.
MGF uniqueness
If two MGFs agree near 0, the distributions are the same.
MGF of a sum
For independent X and Y, M_{X+Y}(t) = M_X(t)M_Y(t).
Portfolio variance
Var(wX + (1 − w)Y) = w²σ_X² + (1 − w)²σ_Y² + 2w(1 − w)Cov(X, Y).
Cauchy–Schwarz inequality
|Cov(X, Y)| ≤ σ_X σ_Y, which forces |ρ| ≤ 1.

Sample practice questions

30 more questions like these, from level 1 to 5, are in the practice set.

Question 1 (level 1)

Which formula gives the covariance of X and Y?

  1. Cov(X, Y) = E[X]E[Y] − E[XY]
  2. Cov(X, Y) = Var(X) + Var(Y)
  3. Cov(X, Y) = E[XY] − E[X]E[Y]
  4. Cov(X, Y) = E[XY]/(E[X]E[Y])
Show the answer and steps

Answer: C) Cov(X, Y) = E[XY] − E[X]E[Y]

  1. By definition Cov(X, Y) = E[(X − μ_X)(Y − μ_Y)].
  2. Expanding gives E[XY] − μ_X μ_Y.
  3. The reversed order has the wrong sign.
Question 2 (level 1)

What is Var(X + Y) for any random variables X and Y?

  1. (SD(X) + SD(Y))²
  2. Var(X) + Var(Y)
  3. Var(X) + Var(Y) + 2Cov(X, Y)
  4. Var(X) + Var(Y) − 2Cov(X, Y)
Show the answer and steps

Answer: C) Var(X) + Var(Y) + 2Cov(X, Y)

  1. Expand E[(X + Y − μ_X − μ_Y)²].
  2. The cross term contributes 2Cov(X, Y).
  3. Var(X) + Var(Y) alone holds only when the covariance is 0.
Question 3 (level 3)

X and Y take values 0 and 1 with p(0,0) = 0.1, p(0,1) = 0.2, p(1,0) = 0.3 and p(1,1) = 0.4. Find Cov(X, Y).

  1. 0.4
  2. −0.02
  3. −0.42
  4. 0.02
Show the answer and steps

Answer: B) −0.02

  1. E[X] = 0.7, E[Y] = 0.6 and E[XY] = P(X = 1, Y = 1) = 0.4.
  2. Cov = 0.4 − 0.7 × 0.6 = 0.4 − 0.42.
  3. = −0.02; 0.4 is E[XY] alone.