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)

A) Two variables: L = aX + bY + c

E[L] = a μX + b μY + c = —
Var(L) = a²σX² + b²σY² + 2ab·ρ·σXσY = — ; SD(L) = —
If independent: set ρ=0 → Var(L) = a²σX² + b²σY².
simulation: mean(L) ≈ — , sd(L) ≈ — (should be close to the formulas above)

B) Three variables (grade): L = w₁·HW + w₂·Mid + w₃·Final

E[L] = Σ wᵢ μᵢ = —
Var(L) = Σ wᵢ² σᵢ² + 2Σi<j wᵢ wⱼ ρᵢⱼ σᵢ σⱼ = — ; SD(L) = —
PairTerm
Total
simulation: mean(L) ≈ — , sd(L) ≈ —
Matrix view (Var(L) = wᵀ Σ w)
Σ is the covariance matrix; we compute u = Σw, then wᵀu = Var(L).

Σ (covariance)

w (weights)

Σ w

wᵀ Σ w = — (should equal Var(L) above)

Quick facts

Excel steps (copy/paste)
  1. 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))
  2. Independent case: set ρ=0 → Var(L) = a^2*σx^2 + b^2*σy^2.
  3. 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)
  4. 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.)
  5. 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.