physics2u
Depth
PU-106 / L04 · lecture

Functions of Random Variables and Variance of Combinations

~7 min read · Tier toggle changes depth (T1 plain · T2 standard · T3 rigour)

BEFORE YOU START

You should be comfortable calculating the expectation and variance of a single random variable, and you should understand that the variance measures the spread of a distribution around its mean.

Why this matters

In the laboratory, we rarely measure a fundamental constant directly; we measure a combination of other quantities.

When you calculate the density of a material from its mass and volume, or the speed of a projectile from its displacement and time, you are creating a new random variable that is a function of several others. The core question of this lecture is how the uncertainty in the inputs propagates to the output. While the next lecture will focus on the linear approximation, this lecture establishes the general rules for how variance behaves when we add, subtract, or scale random variables, including the critical role of correlation.

The Intuition of Combining Uncertainties

Imagine you are measuring the length of a table with a ruler that has a small wobble, and the width with a different ruler that also wobbles. If you want the area, you multiply the two. Intuitively, if the length measurement is high, the area is high. If the width is high, the area is high. The errors tend to "add up" in their effect on the final result. However, if you were measuring the difference between two lengths, and the first ruler wobbled high, the difference would be small, but if the second ruler wobbled high, the difference would be large. The errors work in opposite directions. The key insight is that variance is not simply additive in a naive way; it depends on how the variables relate to each other. If two measurements are independent, their random wobbles are uncorrelated, and the variances add in a specific quadratic way. If they are correlated, the cross-terms become significant, and the total uncertainty can be larger or smaller than the simple sum of individual uncertainties.

Variance of Sums and Differences

Let \( X \) and \( Y \) be two random variables. We first consider the variance of their sum, \( S = X + Y \). By the definition of variance, \( \mathrm{Var}(S) = \mathrm{E}[(S - \mathrm{E}[S])^2] \). Expanding this square leads to terms involving the variances of \( X \) and \( Y \), as well as a cross-term involving the covariance. The covariance, \( \mathrm{Cov}(X, Y) \), measures how much \( X \) and \( Y \) vary together. If \( X \) and \( Y \) are independent, their covariance is zero. In this common case, the variance of the sum is simply the sum of the variances.

\[ \mathrm{Var}(X + Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) + 2\mathrm{Cov}(X, Y) \]

If \( X \) and \( Y \) are uncorrelated, \( \mathrm{Cov}(X, Y) = 0 \), and we recover the familiar rule: \( \mathrm{Var}(X + Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) \). This is often called the "root-sum-square" rule when taking the square root to get the standard deviation. Note that for the difference \( D = X - Y \), the variance is \( \mathrm{Var}(X - Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) - 2\mathrm{Cov}(X, Y) \). For independent variables, the variance of the difference is also the sum of the variances. This is a frequent source of confusion: subtracting two noisy measurements does not reduce the noise; it adds the variances.

Scaling and Linear Combinations

What happens if we scale a random variable? If \( Y = aX \) where \( a \) is a constant, the spread of the distribution is scaled by \( |a| \). Therefore, the variance, which is the mean squared deviation, is scaled by \( a^2 \). This is a crucial distinction: variance is quadratic in the scaling factor, while standard deviation is linear. For a general linear combination \( S = aX + bY \), the variance is derived by expanding the square of the deviation. The result includes the variances of \( X \) and \( Y \) weighted by the squares of their coefficients, plus a covariance term weighted by the product of the coefficients.

\[ \mathrm{Var}(aX + bY) = a^2 \mathrm{Var}(X) + b^2 \mathrm{Var}(Y) + 2ab \mathrm{Cov}(X, Y) \]

This formula generalizes to any number of variables. If we have \( n \) random variables \( X_1, \dots, X_n \) and constants \( a_1, \dots, a_n \), the variance of the sum \( S = \sum_{i=1}^n a_i X_i \) is given by the double sum of the covariances weighted by the products of the coefficients. This is the general result cited in the derivation card D-109. When the variables are pairwise uncorrelated, all off-diagonal covariance terms vanish, and the formula simplifies to the sum of the weighted variances.

The Role of Covariance

The term \( \mathrm{Cov}(X, Y) \) is the bridge between the individual uncertainties and the combined uncertainty. It is defined as \( \mathrm{Cov}(X, Y) = \mathrm{E}[(X - \mu_X)(Y - \mu_Y)] \). If \( X \) and \( Y \) tend to be above their means simultaneously, the covariance is positive. If one tends to be above its mean when the other is below, the covariance is negative. In experimental physics, positive covariance often arises from systematic errors that affect multiple measurements in the same direction. For example, if a temperature sensor is biased high, it will bias all temperature readings high, creating a positive covariance between readings taken at different times. Ignoring this covariance leads to an underestimation of the total uncertainty. Conversely, if two measurements are designed to cancel out a specific systematic error, they may exhibit negative covariance, reducing the total variance of the difference. Always ask: are my measurements truly independent, or do they share a common source of error?

The derivation

◆ DERIVATION EMBED · D-109 · not re-derived here

Variance of Linear Combinations and Covariance

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) = ∑i ∑j ai aj Cov(Xi, Xj), which collapses to the weighted sum of variances ∑i ai2 Var(Xi) when the variables are pairwise uncorrelated.

Var( ∑i ai Xi ) = ∑i ∑j ai aj Cov(Xi, Xj)  ⟶ uncorr.  ∑i ai2 Var(Xi)
Open full derivation →
Tier 3 ยท watch out

A common misconception is that if two variables are independent, their product is uncorrelated. This is false. Independence implies zero covariance, but zero covariance does not imply independence. More subtly, even if \( X \) and \( Y \) are independent, the variance of their product \( XY \) is not simply \( \mathrm{Var}(X)\mathrm{Var}(Y) \). It involves the expectations of the squares. Specifically, \( \mathrm{Var}(XY) = \mathrm{E}[X^2]\mathrm{E}[Y^2] - (\mathrm{E}[X]\mathrm{E}[Y])^2 \). This is why the first-order approximation in the next lecture is so useful: it linearizes the function, allowing us to use the simpler linear combination rules. For non-linear functions, the exact variance calculation can be complex, and the first-order formula is the standard practical tool. C

Worked example

Problem. A student measures the mass \( m \) of a block as \( 2.0 \pm 0.1 \ \mathrm{kg} \) and its volume \( V \) as \( 1.0 \pm 0.2 \ \mathrm{dm^3} \). The measurements are independent. Calculate the density \( \rho = m/V \) and its uncertainty using the first-order propagation of uncertainty formula (which relies on the variance of linear combinations of the partial derivatives).

  1. Identify the function: \( \rho = m/V \).
  2. Calculate the partial derivatives: \( \frac{\partial \rho}{\partial m} = \frac{1}{V} \) and \( \frac{\partial \rho}{\partial V} = -\frac{m}{V^2} \).
  3. Use the first-order variance formula: \( \mathrm{Var}(\rho) \approx \left(\frac{\partial \rho}{\partial m}\right)^2 \mathrm{Var}(m) + \left(\frac{\partial \rho}{\partial V}\right)^2 \mathrm{Var}(V) \). Note that the covariance term is zero because the measurements are independent.
  4. Substitute the values: \( \frac{\partial \rho}{\partial m} = \frac{1}{1.0} = 1.0 \ \mathrm{kg/dm^3} \) and \( \frac{\partial \rho}{\partial V} = -\frac{2.0}{1.0^2} = -2.0 \ \mathrm{kg/dm^3} \).
  5. Calculate the variance contributions: \( (1.0)^2 (0.1)^2 = 0.01 \) and \( (-2.0)^2 (0.2)^2 = 4.0 \times 0.04 = 0.16 \).
  6. Sum the variances: \( \mathrm{Var}(\rho) = 0.01 + 0.16 = 0.17 \ \mathrm{kg^2/dm^6} \).
  7. Take the square root to get the standard deviation: \( \sigma_\rho = \sqrt{0.17} \approx 0.41 \ \mathrm{kg/dm^3} \).
  8. Calculate the central value: \( \rho = 2.0 / 1.0 = 2.0 \ \mathrm{kg/dm^3} \).
\[ \rho = 2.0 \pm 0.4 \ \mathrm{kg/dm^3} \]

Units check. \(\partial\rho/\partial m = 1/V\) is in \(\mathrm{dm^{-3}}\) and \(\mathrm{Var}(m)\) in \(\mathrm{kg^2}\), giving \(\mathrm{kg^2/dm^6}\); \(\partial\rho/\partial V = -m/V^2\) is in \(\mathrm{kg/dm^6}\) and \(\mathrm{Var}(V)\) in \(\mathrm{dm^6}\), again giving \(\mathrm{kg^2/dm^6}\). Both terms have the units of \(\rho^2\), so \(\sigma_\rho\) is in \(\mathrm{kg/dm^3}\).

CHECK YOURSELF

Three quick tests

  1. If \( X \) and \( Y \) are independent, what is \( \mathrm{Cov}(X, Y) \)?
    AnswerZero.
  2. Does \( \mathrm{Var}(X - Y) \) equal \( \mathrm{Var}(X) - \mathrm{Var}(Y) \) for independent variables?
    AnswerNo, it equals \( \mathrm{Var}(X) + \mathrm{Var}(Y) \).
  3. If \( Y = 2X \), how does \( \mathrm{Var}(Y) \) relate to \( \mathrm{Var}(X) \)?
    Answer\( \mathrm{Var}(Y) = 4 \mathrm{Var}(X) \).
PROBLEMS

Problem set for PU-106 →

Each derivation in this unit ends with five graded problems with full solutions.

NOTES

Lecture notes drafted with a local model and checked line by line by the editor; every number in the worked example was recomputed.

Derivations cited: D-109 · Threads: chance