Loading…

Variance of X − Y (variance x-y) using covariance

In statistics, how is variance x-y computed for two random variables X and Y, and how do covariance and independence change the result?

Subject: Statistics Chapter: Discrete Random Variables and Their Probability Distributions Topic: Standard Deviation of a Discrete Random Variable Answer included
variance x-y Var(X-Y) variance of difference covariance Cov(X Y) correlation independence
Accepted answer Answer included

The keyword variance x-y refers to the variance of the difference \(X-Y\) for two random variables \(X\) and \(Y\). The correct formula depends on how strongly \(X\) and \(Y\) move together, measured by covariance.

Key result (variance x-y)

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

If \(X\) and \(Y\) are independent, then \(\mathrm{Cov}(X,Y)=0\), so \[ \mathrm{Var}(X-Y)=\mathrm{Var}(X)+\mathrm{Var}(Y). \]

Step-by-step derivation

Start from the identities \[ \mathrm{Var}(Z)=\mathbb{E}[Z^2]-\big(\mathbb{E}[Z]\big)^2, \quad \mathrm{Cov}(X,Y)=\mathbb{E}[XY]-\mathbb{E}[X]\mathbb{E}[Y]. \]

Let \(Z=X-Y\). Then \[ \mathrm{Var}(X-Y)=\mathbb{E}\big[(X-Y)^2\big]-\big(\mathbb{E}[X-Y]\big)^2. \]

Expand the square: \[ (X-Y)^2=X^2-2XY+Y^2. \] Taking expectations gives \[ \mathbb{E}\big[(X-Y)^2\big]=\mathbb{E}[X^2]-2\mathbb{E}[XY]+\mathbb{E}[Y^2]. \]

Expand the squared mean: \[ \big(\mathbb{E}[X-Y]\big)^2=\big(\mathbb{E}[X]-\mathbb{E}[Y]\big)^2 =\big(\mathbb{E}[X]\big)^2-2\mathbb{E}[X]\mathbb{E}[Y]+\big(\mathbb{E}[Y]\big)^2. \]

Subtracting, \[ \mathrm{Var}(X-Y) =\big(\mathbb{E}[X^2]-\big(\mathbb{E}[X]\big)^2\big) +\big(\mathbb{E}[Y^2]-\big(\mathbb{E}[Y]\big)^2\big) -2\big(\mathbb{E}[XY]-\mathbb{E}[X]\mathbb{E}[Y]\big). \]

Recognize the definitions: \[ \mathrm{Var}(X-Y)=\mathrm{Var}(X)+\mathrm{Var}(Y)-2\,\mathrm{Cov}(X,Y). \]

Interpretation: how covariance changes variance x-y

  • Positive covariance (\(\mathrm{Cov}(X,Y)>0\)) decreases \(\mathrm{Var}(X-Y)\): the variables tend to move together, so their difference is less variable.
  • Negative covariance (\(\mathrm{Cov}(X,Y)<0\)) increases \(\mathrm{Var}(X-Y)\): the variables tend to move in opposite directions, so their difference spreads out more.
  • Independence implies \(\mathrm{Cov}(X,Y)=0\) (but \(\mathrm{Cov}(X,Y)=0\) does not always imply independence).

Worked numeric example

Suppose \(\mathrm{Var}(X)=25\), \(\mathrm{Var}(Y)=9\), and \(\mathrm{Cov}(X,Y)=6\). Then \[ \mathrm{Var}(X-Y)=25+9-2\times 6=25+9-12=22. \] The standard deviation of \(X-Y\) is \[ \sqrt{22}\approx 4.690. \]

\(\mathrm{Var}(X)\) 25 \(\mathrm{Var}(Y)\) 9 \(\mathrm{Cov}(X,Y)\) 6 \(\mathrm{Var}(X-Y)\) 22
Scenario Covariance \(\mathrm{Var}(X-Y)\) Comment
Independent (common special case) \(0\) \(25+9=34\) No shared movement; spreads add.
Positively associated (example) \(6\) \(25+9-12=22\) Difference is less variable.
Negatively associated (illustration) \(-6\) \(25+9-2\times(-6)=46\) Difference is more variable.

Visualization: decomposing variance x-y into its three terms

Variance x-y decomposition: Var(X-Y) = Var(X) + Var(Y) - 2Cov(X,Y) -10 0 10 20 30 \(\mathrm{Var}(X)=25\) \(\mathrm{Var}(Y)=9\) \(-2\mathrm{Cov}(X,Y)=-12\) \(\mathrm{Var}(X-Y)=22\) Terms in \(\mathrm{Var}(X-Y)=\mathrm{Var}(X)+\mathrm{Var}(Y)-2\mathrm{Cov}(X,Y)\)
Two positive contributions \(\mathrm{Var}(X)\) and \(\mathrm{Var}(Y)\) increase variance x-y, while a positive covariance produces the subtractive term \(-2\mathrm{Cov}(X,Y)\), reducing \(\mathrm{Var}(X-Y)\).

Common extensions

  • More generally, for constants \(a,b\): \(\mathrm{Var}(aX+bY)=a^2\mathrm{Var}(X)+b^2\mathrm{Var}(Y)+2ab\,\mathrm{Cov}(X,Y)\).
  • For \(X+Y\): \(\mathrm{Var}(X+Y)=\mathrm{Var}(X)+\mathrm{Var}(Y)+2\,\mathrm{Cov}(X,Y)\).
  • If \(X=Y\), then \(X-Y=0\) and \(\mathrm{Var}(X-Y)=0\); the formula matches because \(\mathrm{Cov}(X,X)=\mathrm{Var}(X)\).
Vote on the accepted answer
Upvotes: 0 Downvotes: 0 Score: 0
Community answers No approved answers yet

No approved community answers are published yet. You can submit one below.

Submit your answer Moderated before publishing

Plain text only. Your name is required. Links, HTML, and scripts are blocked.

Fresh

Most recent questions

109 questions · Sorted by newest first

Showing 1–10 of 109
per page
  1. Mar 5, 2026 Published
    Formula of the Variance (Population and Sample)
    Statistics Numerical Descriptive Measures Measures of Dispersion for Ungrouped Data
  2. Mar 5, 2026 Published
    Mean Median Mode Calculator (Formulas, Interpretation, and Example)
    Statistics Numerical Descriptive Measures Measures of Central Tendency for Ungrouped Data
  3. Mar 4, 2026 Published
    How to Calculate Standard Deviation in Excel (STDEV.S vs STDEV.P)
    Statistics Numerical Descriptive Measures Measures of Dispersion for Ungrouped Data
  4. Mar 4, 2026 Published
    Suppose T and Z Are Random Variables: How T Relates to Z in the t Distribution
    Statistics Estimation of the Mean and Proportion Estimation of a Population Mean σ Not Known the T Distribution
  5. Mar 4, 2026 Published
    What Does R Squared Mean in Statistics (Coefficient of Determination)
    Statistics Simple Linear Regression Coefficient of Determination
  6. Mar 3, 2026 Published
    Box and Plot Graph (Box Plot) Explained
    Statistics Numerical Descriptive Measures Box and Whisker Plot
  7. Mar 3, 2026 Published
    How to Calculate a Z Score
    Statistics Continuous Random Variables and the Normal Distribution Standardizing a Normal Distribution
  8. Mar 3, 2026 Published
    How to Calculate Relative Frequency
    Statistics Organizing and Graphing Data Organizing and Graphing Quantitative Data
  9. Mar 3, 2026 Published
    Is zero an even number?
    Statistics Numerical Descriptive Measures Measures of Central Tendency for Ungrouped Data
  10. Mar 3, 2026 Published
    Monty Hall Paradox (Conditional Probability Explained)
    Statistics Probability Marginal and Conditional Probabilities
Showing 1–10 of 109
Open the calculator for this topic