physics2u
Tier
⌕ Search ⌘K
physics2u.com/vault/variance-of-linear-combinations.html
Derivation

Variance of Linear Combinations and Covariance

D-109 Home PU-106 Threads chance Depends on Expectation, Variance and Their Algebra
Statement

For random variables X1, …, Xn with finite variances and fixed real constants a1, …, an, the variance of the linear combination S = ∑i ai Xi is the double sum Var(S) = ∑ij ai aj Cov(Xi, Xj), which collapses to the weighted sum of variances i ai2 Var(Xi) when the variables are pairwise uncorrelated.

Why it matters

Almost every measured quantity in physics is a combination of several noisy inputs: a resistance inferred from voltage and current, a rate averaged over many counts, a fitted slope built from many data points. This identity is the master formula of error propagation for linear functions — it tells you exactly how the uncertainties of the parts assemble into the uncertainty of the whole, and crucially, whether the pieces reinforce or cancel.

It also underpins the single most important result in all of statistical inference: that averaging n independent measurements shrinks the variance by a factor of n, so the standard error falls as 1/√n. The full covariance version warns you when that scaling silently breaks — correlated noise does not average away.

Assumptions
Each Xi has a finite second moment, E[Xi2] < ∞.If any variance is infinite (e.g. a Cauchy-distributed input), Var(S) is undefined and the whole identity is vacuous; the sum of a heavy-tailed input does not have a meaningful spread. The coefficients ai are deterministic constants, not random.If the weights are themselves random or correlated with the Xi, then Var(∑ ai Xi) picks up extra cross-terms from Var(ai) and Cov(ai, Xi), and this formula understates the true spread. Expectation is linear over the (possibly dependent) collection.Linearity of E holds for any integrable variables regardless of dependence, so no independence is needed to pull constants out or split sums; dropping integrability of the products XiXj (guaranteed here by Cauchy–Schwarz from finite variances) would make the covariances themselves ill-defined.
Derivation
1
S = ∑i=1n ai Xi
Define the linear combination whose variance we seek. A
2
μS = E[S] = E[∑i ai Xi] = ∑i ai E[Xi] = ∑i ai μi
Linearity of expectation moves the sum and the constants outside E; valid for dependent variables since no product is involved. A
3
S − μS = ∑i ai Xi − ∑i ai μi = ∑i ai (Xi − μi)
Subtract the mean and factor each term; the deviation of a linear combination is the linear combination of the deviations. A
4
(S − μS)2 = ( ∑i ai (Xi − μi) )( ∑j aj (Xj − μj) )
Write the square as a product of two copies, using an independent summation index j for the second factor. B
5
= ∑ij ai aj (Xi − μi)(Xj − μj)
Distribute the product of finite sums; every term of the first factor multiplies every term of the second, giving the full n×n grid of pairs. B
6
Var(S) = E[(S − μS)2] = E[ ∑ij ai aj (Xi − μi)(Xj − μj) ]
Apply the definition of variance from the prior result moments–expectation–variance: Var(S) = E[(S − μS)2]. B
7
= ∑ij ai aj E[(Xi − μi)(Xj − μj)]
Linearity of expectation over the finite double sum pulls the constants aiaj out and pushes E onto each term; the products are integrable by Cauchy–Schwarz. C
8
Cov(Xi, Xj) ≡ E[(Xi − μi)(Xj − μj)]
Recognise each inner expectation as the definition of covariance; the diagonal case i = j is Cov(Xi, Xi) = Var(Xi). A
9
Var(S) = ∑ij ai aj Cov(Xi, Xj)
Substitute the covariance name back in — the general identity. A
10
= ∑i ai2 Var(Xi) + 2 ∑i<j ai aj Cov(Xi, Xj)
Split the grid into diagonal (i = j) and off-diagonal terms; since Cov(Xi, Xj) = Cov(Xj, Xi) the two triangles are equal, giving the factor of 2. B
11
Xi ⊥ Xj for i ≠ j  ⇒  Cov(Xi, Xj) = 0  ⇒  Var(S) = ∑i ai2 Var(Xi)
Pairwise independence (indeed mere uncorrelatedness) kills every off-diagonal term, leaving additivity of variances. Only uncorrelatedness is required, not full independence. C
Result
Var( ∑i ai Xi ) = ∑ij ai aj Cov(Xi, Xj)  ⟶ uncorr.  ∑i ai2 Var(Xi)

Reading. The spread of a weighted sum is a weighted sum of all pairwise spreads — each variable with itself (variance) and each pair with the other (covariance). Weights enter squared on the diagonal, so scaling a variable by a scales its variance contribution by a2. Off-diagonal covariance terms can be positive (uncertainties reinforce) or negative (they partially cancel). When inputs are uncorrelated, only the diagonal survives and variances simply add.

Units check. If Xi carries physical units [xi] then ai carries [S]/[xi], so each ai is dimensionless times a ratio and every product ai aj Cov(Xi, Xj) has units [S]2/[xi][xj] × [xi][xj] = [S]2. A variance must have the squared units of S — consistent.

Limiting cases
  • Single variable (n = 1): Var(aX) = a2 Var(X) — the familiar scaling rule.
  • Difference of two uncorrelated variables: Var(X − Y) = Var(X) + Var(Y); variances add even for a difference, because the weight −1 squares to +1.
  • Perfectly correlated pair (Cov = σXσY): Var(X + Y) = (σX + σY)2, i.e. standard deviations add directly.
  • Sample mean of iid (ai = 1/n, Var(Xi) = σ2): Var(X̄) = σ2/n, the origin of the 1/√n standard error.
  • Zero net weight with anticorrelation: a suitably weighted difference of positively correlated variables can have vanishing variance, the principle behind differential measurement.
Breaks when
  • Infinite or undefined variance. If any input has heavy tails with E[Xi2] = ∞ (Cauchy, some power-law noise), the covariances and hence Var(S) do not exist; the formula returns a finite number only by illegally assuming convergence.
  • Random or data-dependent weights. If the ai are estimated from the same data (as in a fitted regression, or portfolio weights chosen after seeing returns), they correlate with the Xi and the treated-as-constant derivation omits genuine variance, systematically underestimating the true spread.
  • Nonlinear combination. For g(X1, …, Xn) that is not linear, this is only the first-order (delta-method) approximation with ai = ∂g/∂Xi evaluated at the mean; it breaks down when curvature or fluctuations are large.
  • Non-stationary / drifting means. If the μi shift during data collection, the empirical spread mixes true variance with mean drift and no fixed covariance matrix describes it.
Failure modes
  • Adding standard deviations instead of variances. Writing σS = |a11 + |a22 for uncorrelated inputs. Correct is σS2 = a12σ12 + a22σ22; linear addition of σ only holds for perfect correlation.
  • Forgetting the factor of 2 on cross terms — counting the (i,j) pair but not (j,i), halving the covariance contribution.
  • Sign error on Var(X − Y). Assuming subtraction subtracts variances; the weight is squared, so uncorrelated variances still add.
  • Dropping covariances by reflex. Assuming inputs are independent when they share a common systematic (same instrument, same calibration), which can dominate the total.
  • Confusing uncorrelated with independent. Using Cov = 0 to claim independence — the derivation needs only the former; the converse does not hold.
Discussion

The double sum is best read as a quadratic form. Collect the deviations into a vector and the coefficients into a vector a; then Var(S) = aT Σ a, where Σij = Cov(Xi, Xj) is the covariance matrix. Every derived identity — scaling, additivity, error propagation — is one geometric statement about how this quadratic form responds to the direction a. Because variance is non-negative for every choice of weights, Σ is positive semi-definite; that is not an extra assumption but a consequence of the formula.

Physically, the diagonal encodes each source's own noise while the off-diagonal encodes shared fluctuation. Two thermometers on the same bench drift together with room temperature: their readings are positively correlated, and a naive sum of their variances understates the uncertainty of their total while a difference (which cancels the common drift) can be far more precise than either alone. This is exactly why lock-in and differential techniques win — they choose weights a that place the measurement in a low-variance direction of the quadratic form.

The result requires strictly less than independence. Nothing in steps 6–9 assumes the joint distribution factorises; only the numerical value Cov(Xi, Xj) = 0 is needed to reach additivity, and uncorrelatedness is weaker than independence (independent ⇒ uncorrelated, but not conversely — e.g. X and X2 for symmetric X are uncorrelated yet dependent). Thus additivity of variances is a second-moment statement, blind to any higher-order structure in the dependence. The Central Limit Theorem inherits this: it is the σ2/n scaling, not full independence of every moment, that fixes the width of the limiting Gaussian.

Common misconceptions. "Variances always add" — only for uncorrelated inputs; correlation adds cross terms that can dominate. "Independent is the requirement" — only Cov = 0 is used. "A difference reduces uncertainty" — for uncorrelated inputs a difference has the same variance as the sum; reduction requires positive correlation to cancel.

Worked examples
1
Two-asset portfolio. Return R = w1R1 + w2R2. Given σ1 = 0.20, σ2 = 0.10, correlation ρ = −0.5, weights w1 = 0.4, w2 = 0.6 (dimensionless).
Set up the two-term instance of the identity. A
2
Var(R) = w12σ12 + w22σ22 + 2 w1 w2 ρ σ1 σ2
Use Cov = ρσ1σ2 in the n = 2 formula. A
3
= (0.4)2(0.20)2 + (0.6)2(0.10)2 + 2(0.4)(0.6)(−0.5)(0.20)(0.10)
Insert numbers only now that symbols are arranged. A
4
= 0.0064 + 0.0036 − 0.0048 = 0.0052
Arithmetic; the negative correlation subtracts, reducing risk. A
Var(R) = 0.0052,   σR = √0.0052 ≈ 0.072 (7.2%)

Reading. The blended portfolio (7.2%) is less volatile than either asset alone (20% and 10%) because the negative correlation lets one asset's swings partly offset the other's.

Units check. Returns are dimensionless fractions; variance is a pure number, σR a fraction — consistent.

1
Standard error of a mean. Estimate a length by averaging n = 25 independent caliper readings, each with σ = 0.30 mm. Estimator L̄ = (1/n) ∑i Xi, so ai = 1/n.
Identify weights and the common variance. A
2
Var(L̄) = ∑i (1/n)2 Var(Xi) = n · (1/n2) σ2 = σ2/n
Independent readings zero the covariances; the n identical diagonal terms sum. B
3
Var(L̄) = (0.30 mm)2 / 25 = 0.09 mm2 / 25 = 0.0036 mm2
Insert numbers. A
σ = √0.0036 mm2 = 0.060 mm = σ / √n

Reading. Averaging 25 readings cuts the uncertainty fivefold (√25 = 5), from 0.30 mm to 0.060 mm — the classic 1/√n improvement.

Units check. Var in mm2, standard error in mm — correct dimensions for a length uncertainty.

Problems
  1. Two uncorrelated timers each have σ = 0.5 s. Find the standard deviation of their difference T1 − T2.
    Solution Var(T1 − T2) = (1)2(0.5)2 + (−1)2(0.5)2 = 0.25 + 0.25 = 0.50 s2. So σ = √0.50 = 0.71 s. The variances add despite the subtraction, because both weights square to 1.
  2. A resistance is computed as R = V/I near V0 = 10 V, I0 = 2 A, with independent σV = 0.1 V, σI = 0.02 A. Using the linear (delta-method) approximation, find σR.
    Solution Partials: ∂R/∂V = 1/I0 = 0.5 Ω/V, ∂R/∂I = −V0/I02 = −10/4 = −2.5 Ω/A. Var(R) = (0.5)2(0.1)2 + (2.5)2(0.02)2 = 0.0025 + 0.0025 = 0.0050 Ω2. So σR = 0.071 Ω about R0 = 5 Ω (a 1.4% relative error, matching √(0.012 + 0.012)).
  3. Show that for constants a, b and any two variables, Var(aX + bY) = a2Var(X) + b2Var(Y) + 2ab Cov(X,Y), then find the value of b/a that minimises the variance for fixed a.
    Solution Expanding the n = 2 double sum gives the stated form directly. Treat as a function of b: d/db [b2Var(Y) + 2ab Cov] = 2b Var(Y) + 2a Cov = 0b/a = −Cov(X,Y)/Var(Y). This is the optimal hedge ratio; substituting back gives the minimum variance a2Var(X)(1 − ρ2).
  4. Ten counts of a radioactive source are summed, each Poisson with mean and variance λ = 100, mutually independent. Find the variance and the fractional uncertainty of the total N = ∑i=110 Xi.
    Solution All weights ai = 1, independent so covariances vanish: Var(N) = ∑ 12 · 100 = 1000. Mean total = 1000, so σN = √1000 ≈ 31.6, fractional uncertainty 31.6/1000 = 3.2% — consistent with Poisson 1/√(∑λ) = 1/√1000.
  5. Two sensors reading the same quantity have σ1 = σ2 = 2 units but share a systematic drift giving Cov = +3 units2. Compare the variance of the average (X1 + X2)/2 against the naive "independent" prediction.
    Solution With ai = 1/2: Var = (1/4)(4) + (1/4)(4) + 2(1/2)(1/2)(3) = 1 + 1 + 1.5 = 3.5 units2. The naive independent estimate would give only 1 + 1 = 2 units2. The positive covariance means averaging does not beat the common systematic down — the true spread (σ = 1.87) is larger than the σ = 1.41 one would wrongly predict.