Session 5.6 – Linear Functions of Random Variables
Idea: A linear function looks like L = aX + bY + c (or more variables).
Rules you must know:
E[L] = aE[X] + bE[Y] + c (linearity of expectation — always true)
Var(L) = a²Var(X) + b²Var(Y) + 2ab·Cov(X,Y) (needs Cov/ρ; if independent, Cov=0)
Quick facts
- Linearity of expectation (always): E[aX+bY+c] = aE[X]+bE[Y]+c.
- Variance needs dependence info: Var(aX+bY) = a²Var(X)+b²Var(Y)+2abCov(X,Y).
- Independence ⇒ Cov=0. But Cov=0 does NOT always mean independent (except for bivariate normal).
- More variables: Var(Σ cᵢXᵢ) = Σ cᵢ²Var(Xᵢ) + 2Σi<j cᵢcⱼCov(Xᵢ,Xⱼ).
- Normal closure: Any linear combo of jointly normal variables is normal.
Excel steps (copy/paste)
- 2 variables (with correlation ρ):
E[L] = a*μx + b*μy + c
Var(L) = a^2*σx^2 + b^2*σy^2 + 2*a*b*ρ*σx*σy
SD(L) = SQRT(Var(L))
- Independent case: set ρ=0 → Var(L) = a^2*σx^2 + b^2*σy^2.
- 3 variables (pairwise correlations ρ12, ρ13, ρ23):
E[L] = SUMPRODUCT(w_range, mu_range)
Var(L) = SUMPRODUCT(w_range^2, var_range) + 2*(w1*w2*ρ12*σ1*σ2 + w1*w3*ρ13*σ1*σ3 + w2*w3*ρ23*σ2*σ3)
- Matrix method (general k): Put weights column w and covariance matrix Σ (σᵢσⱼρᵢⱼ; diagonals σᵢ²). Then
E[L] = SUMPRODUCT(w, mu)
Var(L) = MMULT( TRANSPOSE(w), MMULT( Σ, w ) )
(Use dynamic arrays or confirm with Ctrl+Shift+Enter in older Excel.)
- Simulate normals (for checking):
Two vars: Z1,Z2 ~ N(0,1). Set X = μx + σx*Z1; Y = μy + σy*(ρ*Z1 + SQRT(1-ρ^2)*Z2). Compute L and use AVERAGE, STDEV.S.