Tutorials › VEE Mathematical Statistics › Variance of a Two-Variable Linear Combination

VEE Mathematical Statistics · Covariance and Correlation · Tutorial 311 of 880

Variance of a Two-Variable Linear Combination

Learn to calculate the variance of a two-variable linear combination, interpret the covariance term, and avoid sign and coefficient errors.

Intermediate 12 min read

What You'll Learn

  • Derive the variance formula for aX plus bY from the definition of variance and covariance
  • Identify how the coefficients and covariance determine the cross term
  • Calculate variances for sums, differences, and other two-variable combinations
  • Recover an unknown covariance from a specified combination variance
  • Check whether supplied variances and covariance are mathematically consistent

Why Covariance Changes a Combined Variance

When two random quantities are combined, their individual variances do not tell the whole story. If unusually large values of one quantity tend to occur with unusually large values of the other, their combination is more variable than it would be if their movements offset. If one tends to be large when the other is small, a sum may be less variable. The covariance term records this joint movement.

The same issue appears in a difference. Subtracting one variable reverses its contribution to the variation, so the covariance term changes sign. Getting that sign right is essential in calculations involving paired costs, forecast errors, or other dependent quantities.

Definition: Let \(X\) and \(Y\) be random variables with finite variances, and let \(a\) and \(b\) be fixed real numbers. Their linear combination is \(aX+bY\). The coefficients may be positive, negative, or zero. The variance of this combination is determined by \(\operatorname{Var}(X)\), \(\operatorname{Var}(Y)\), and \(\operatorname{Cov}(X,Y)\).

The covariance convention used here is \(\operatorname{Cov}(X,Y)=E[(X-E[X])(Y-E[Y])]\). The variables need not be independent. No particular distribution family is required for the variance formula, but finite second moments are required so that the variances and covariance exist.

The Two-Variable Formula

For any fixed real coefficients \(a\) and \(b\), the formula is

$$ \operatorname{Var}(aX+bY) =a^2\operatorname{Var}(X)+b^2\operatorname{Var}(Y) +2ab\operatorname{Cov}(X,Y). $$

The first two terms are the separate contributions from \(X\) and \(Y\). The final term accounts for their joint variation. It contains both the product \(ab\) and the covariance, so its sign is not determined by the covariance alone.

1
Center the combination.
Subtract its expectation: \(aX+bY-E[aX+bY]=a(X-E[X])+b(Y-E[Y])\).
2
Square the centered expression.
Expanding the square produces two squared terms and a cross term with coefficient \(2ab\).
3
Take expectations.
The squared terms become the variances, while the expected product of the centered variables is the covariance.

Here is the full justification. Linearity of expectation gives \(E[aX+bY]=aE[X]+bE[Y]\). Therefore the centered combination is \(a(X-E[X])+b(Y-E[Y])\). Squaring and taking expectations gives

$$ \begin{aligned} \operatorname{Var}(aX+bY) &=E\left[\left(a(X-E[X])+b(Y-E[Y])\right)^2\right]\\ &=a^2E[(X-E[X])^2]+b^2E[(Y-E[Y])^2]\\ &\quad+2abE[(X-E[X])(Y-E[Y])]\\ &=a^2\operatorname{Var}(X)+b^2\operatorname{Var}(Y) +2ab\operatorname{Cov}(X,Y). \end{aligned} $$

This derivation also shows why the coefficient on covariance is \(2ab\): the cross product appears twice when the square is expanded. The formula remains valid whether or not \(X\) and \(Y\) have the same distribution, and whether or not they are independent.

Sums, Differences, and Coefficient Signs

Setting \(a=b=1\) gives the variance of a sum. Setting \(a=1\) and \(b=-1\) gives the variance of a difference. More generally, whenever a coefficient is negative, it must be used with its sign in the product \(ab\).

$$ \begin{aligned} \operatorname{Var}(X+Y) &=\operatorname{Var}(X)+\operatorname{Var}(Y)+2\operatorname{Cov}(X,Y),\\ \operatorname{Var}(X-Y) &=\operatorname{Var}(X)+\operatorname{Var}(Y)-2\operatorname{Cov}(X,Y). \end{aligned} $$

A positive covariance increases the variance of a sum relative to the sum of the individual variances, but decreases the variance of a difference. A negative covariance has the opposite effects. These statements concern the cross term; they do not say that a variance itself can be negative.

Consistency check: Any proposed moments must satisfy \(|\operatorname{Cov}(X,Y)|\leq\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}\). Also, the calculated variance of every linear combination must be nonnegative. These checks can reveal inconsistent input data or an arithmetic error.

Worked Example: Variance of a Weighted Sum of Forecast Errors

A hypothetical insurer models two annual cost forecast errors, \(X\) and \(Y\), in thousands of dollars. Assume they are jointly normally distributed with \(E[X]=E[Y]=0\), \(\operatorname{Var}(X)=9\), \(\operatorname{Var}(Y)=16\), and \(\operatorname{Cov}(X,Y)=6\). Find the variance of \(2X+3Y\). No interest rate or mortality assumption applies to this one-period forecast-error model.

Method. Apply the two-variable formula with \(a=2\) and \(b=3\):

$$ \begin{aligned} \operatorname{Var}(2X+3Y) &=2^2\operatorname{Var}(X)+3^2\operatorname{Var}(Y) +2(2)(3)\operatorname{Cov}(X,Y)\\ &=4(9)+9(16)+12(6)\\ &=36+144+72\\ &=252. \end{aligned} $$

Thus the variance is \(252\) square-thousands of dollars. As a parameter check, the covariance bound is \(\sqrt{9\cdot16}=12\), and the supplied covariance \(6\) is within that bound. The joint normal model is specified by its means and covariance matrix; no normality assumption is needed for the variance calculation itself. The common mistake avoided here is omitting the factor \(2ab=12\) from the covariance term.

Worked Example: Variance of a Difference of Forecast Errors

For a second hypothetical one-period model, let \(X\) and \(Y\) be jointly normally distributed forecast errors, measured in thousands of dollars, with means \(0\), variances \(25\) and \(9\), and covariance \(6\). Find the variance of \(X-Y\). No interest rate or mortality assumption is involved.

Method. The coefficient of \(Y\) is \(-1\), not \(+1\). Thus \(a=1\), \(b=-1\), and \(ab=-1\):

$$ \begin{aligned} \operatorname{Var}(X-Y) &=1^2(25)+(-1)^2(9)+2(1)(-1)(6)\\ &=25+9-12\\ &=22. \end{aligned} $$

The variance of the difference is \(22\) square-thousands of dollars. The result is nonnegative, as required. The supplied covariance is also consistent with the bound \(|6|\leq\sqrt{25\cdot9}=15\). For comparison, the corresponding sum has variance \(25+9+12=46\). The positive covariance makes the sum more variable and the difference less variable.

Common mistake. Using the sum formula for the difference would give \(25+9+2(6)=46\). The correction is to carry the negative coefficient through the product \(ab\), giving a cross term of \(-12\), not \(+12\).

Worked Example: Recovering an Unknown Covariance

In a hypothetical model, \(X\) and \(Y\) are jointly normally distributed asset-value changes, in thousands of dollars, with \(E[X]=8\), \(E[Y]=5\), \(\operatorname{Var}(X)=4\), and \(\operatorname{Var}(Y)=9\). The variance of the combined position \(3X-2Y\) is \(52\). Find \(\operatorname{Cov}(X,Y)\), and check whether the result is feasible. This is a one-period model, so no interest or mortality assumption applies.

Method. Let \(c=\operatorname{Cov}(X,Y)\). Use \(a=3\) and \(b=-2\), so \(2ab=2(3)(-2)=-12\). Substitute the known variances and the stated combination variance:

$$ \begin{aligned} 52 &=3^2(4)+(-2)^2(9)+2(3)(-2)c\\ &=36+36-12c\\ 52&=72-12c\\ 12c&=20\\ c&=\frac{5}{3}. \end{aligned} $$

The inferred covariance is \(5/3\) in squared-thousands-of-dollars units. Check feasibility: \(\sqrt{4\cdot9}=6\), and \(|5/3|\leq6\), so the covariance satisfies the necessary bound. The stated variance is also recovered by substitution: \(36+36-12(5/3)=72-20=52\). The expected position is \(E[3X-2Y]=3(8)-2(5)=14\), illustrating that the means affect the expectation but not this variance formula. The common mistake avoided is solving with \(+12c\); the negative coefficient on \(Y\) makes the covariance term \(-12c\).

Interpreting and Checking the Result

The coefficient signs and the covariance sign work together. For example, a positive covariance contributes positively to the variance of \(X+Y\), because both coefficients are positive. In \(X-Y\), the coefficient product is negative, so that same covariance contributes negatively. If the covariance itself is negative, each conclusion reverses.

The units provide another useful check. If \(X\) and \(Y\) are measured in dollars, their variances and covariance are measured in dollars squared. Multiplying a variable by a fixed coefficient scales its variance by the square of that coefficient. The covariance term has the same squared units because it is multiplied by the product of the coefficients.

A reliable calculation can be organized as follows:

  1. Write the exact combination, including every negative sign.
  2. Identify \(a\) and \(b\) from \(aX+bY\).
  3. Substitute into \(a^2\operatorname{Var}(X)+b^2\operatorname{Var}(Y)+2ab\operatorname{Cov}(X,Y)\).
  4. Evaluate the covariance term separately, preserving the signs of both coefficients and the covariance.
  5. Check that the final variance is nonnegative and that the input covariance is within its possible bound.

Do not infer independence from zero covariance unless additional assumptions justify that conclusion. The formula needs only the stated variances and covariance; it does not require an independence assumption. Conversely, knowing the two variances alone is not enough to calculate the variance of a combination when the covariance is unknown.

Key takeaway: For two variables, the covariance contribution is \(2ab\operatorname{Cov}(X,Y)\). Use the signed coefficients exactly as written. A sum and a difference have opposite covariance terms, and neither can generally be calculated from the two marginal variances alone.

Check Your Understanding

For each question, use the two-variable variance formula and retain the signs of the coefficients.

  1. In a hypothetical one-period model, \(\operatorname{Var}(U)=2\), \(\operatorname{Var}(V)=5\), and \(\operatorname{Cov}(U,V)=-1\). Find \(\operatorname{Var}(4U+V)\). (Answer: \(29\))
  2. Suppose \(\operatorname{Var}(A)=7\), \(\operatorname{Var}(B)=3\), and \(\operatorname{Cov}(A,B)=1\). Find \(\operatorname{Var}(A-2B)\). (Answer: \(15\))
  3. For \(C,D\) with \(\operatorname{Var}(C)=16\), \(\operatorname{Var}(D)=1\), and \(\operatorname{Cov}(C,D)=-2\), calculate \(\operatorname{Var}(0.5C+3D)\). (Answer: \(7\))
  4. If \(\operatorname{Var}(M)=6\), \(\operatorname{Var}(N)=5\), and \(\operatorname{Var}(2M+N)=41\), solve for \(\operatorname{Cov}(M,N)\) and check it against the covariance bound. (Answer: \(\operatorname{Cov}(M,N)=3\), which satisfies \(|3|\leq\sqrt{30}\))
  5. Two hypothetical models have \(\operatorname{Var}(X)=9\) and \(\operatorname{Var}(Y)=4\). Calculate \(\operatorname{Var}(X+Y)\) when \(\operatorname{Cov}(X,Y)=-4\), and when \(\operatorname{Cov}(X,Y)=4\). (Answer: \(5\) when covariance is \(-4\), and \(21\) when covariance is \(4\))
Clinical Biostats