Tutorials › Exam P - Probability › Negative Covariance Under a Fixed Total

Exam P · Covariance and Correlation · Tutorial 766 of 915

Negative Covariance Under a Fixed Total

Use the exact relationship between two quantities with a fixed sum to calculate their covariance and explain why their deviations move in opposite directions.

Intermediate 9 min read

What You'll Learn

  • Identify when a fixed-total constraint holds for every outcome, rather than only on average
  • Derive the covariance of two finite-variance quantities whose sum is constant
  • Calculate covariance and correlation from a discrete or continuous model
  • Handle positive affine transformations of quantities with a fixed sum
  • Avoid concluding that covariance is negative merely because the expected total is fixed
  • Recognize the zero-variance case where correlation is undefined

Why a Fixed Total Creates Opposing Deviations

Suppose a fixed amount is divided between two accounts. If the first account receives more than usual, the second must receive less, because their total cannot change. This exact constraint has a direct consequence for covariance: the two quantities move in opposite directions around their means.

The qualification exact matters. It is not enough for the total to have a fixed expected value. The sum must equal the same constant in every possible outcome, apart from events with probability zero. Under that condition, covariance is determined entirely by the variance of either quantity.

Definition: Random variables \(X\) and \(Y\) have a fixed total \(c\) if \(X+Y=c\) with probability 1. Assume \(X\) and \(Y\) have finite variances. Covariance is \(\operatorname{Cov}(X,Y)=E[(X-E[X])(Y-E[Y])]\). Under the fixed-total condition, \(Y=c-X\).

The fixed total means that \(X\) and \(Y\) are not free to vary independently. If \(X\) is above its mean by some amount, \(Y\) is below its mean by exactly the same amount. The following derivation makes this relationship precise.

Deriving the Covariance Formula

Take expectations of the fixed-total equation \(X+Y=c\). Since \(c\) is constant, \(E[X]+E[Y]=c\). Subtracting these means from the original equation gives

$$ (X-E[X])+(Y-E[Y])=0. $$

Thus the centered deviations are negatives of one another. In particular, \(Y-E[Y]=-(X-E[X])\). Substitute this into the definition of covariance:

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

Also, \(Y-E[Y]=-(X-E[X])\), so squaring both sides gives \(\operatorname{Var}(Y)=\operatorname{Var}(X)\). Therefore the same covariance can be written using either variance.

Theorem: If \(X+Y=c\) with probability 1 and both variables have finite variance, then $$ \operatorname{Cov}(X,Y)=-\operatorname{Var}(X)=-\operatorname{Var}(Y). $$ If their common variance is positive, their correlation is \(-1\). If that variance is zero, both variables are constant with probability 1, the covariance is zero, and the correlation is undefined.

For positive variance, the correlation result follows by dividing covariance by the product of the standard deviations. Since \(\operatorname{Var}(X)=\operatorname{Var}(Y)>0\),

$$ \operatorname{Corr}(X,Y) =\frac{-\operatorname{Var}(X)} {\sqrt{\operatorname{Var}(X)}\sqrt{\operatorname{Var}(Y)}} =-1. $$

The parentheses around the two square-root factors matter: the denominator is their product. Perfect negative correlation here is not a claim that the variables are unrelated in some general sense. Rather, one is exactly the constant minus the other.

Worked Example: A Discrete Allocation With a Fixed Total

A hypothetical grant of 12 units is divided between two programs. Let \(X\) be the units allocated to Program A and \(Y\) the units allocated to Program B. The allocation to A is 0, 4, or 10 units, with probabilities 0.2000, 0.5000, and 0.3000, respectively. Find the covariance and correlation of \(X\) and \(Y\).

Model and method. The grant is fully allocated in every outcome, so \(X+Y=12\) and \(Y=12-X\). The probabilities sum to \(0.2000+0.5000+0.3000=1.0000\). We will calculate the variance of \(X\), then use the fixed-total result.

First calculate the mean and second moment of \(X\):

$$ \begin{aligned} E[X]&=0(0.2000)+4(0.5000)+10(0.3000)=5,\\ E[X^2]&=0^2(0.2000)+4^2(0.5000)+10^2(0.3000)\\ &=0+8+30=38. \end{aligned} $$

Therefore,

$$ \operatorname{Var}(X)=E[X^2]-(E[X])^2=38-5^2=13. $$

The fixed-total theorem gives \(\operatorname{Cov}(X,Y)=-13\) and \(\operatorname{Var}(Y)=13\). Since the variance is positive, the correlation is

$$ \operatorname{Corr}(X,Y)=\frac{-13}{\sqrt{13}\sqrt{13}}=-1. $$

Check. The possible values of \(Y\) are 12, 8, and 2. Its mean is \(12(0.2000)+8(0.5000)+2(0.3000)=7\), and \(E[Y^2]=144(0.2000)+64(0.5000)+4(0.3000)=62\). Thus \(\operatorname{Var}(Y)=62-7^2=13\), as required. The method avoids needing to calculate each joint product to obtain the covariance.

Using the Result for Continuous Quantities

The fixed-total relationship does not depend on whether the quantities are discrete or continuous. It depends on the equation \(Y=c-X\) and finite variance. For a continuous variable, the same centered-deviation argument applies; no additional distributional assumption is needed.

Worked Example: Two Continuous Measurements With a Fixed Sum

In a hypothetical calibration procedure, two measured lengths \(X\) and \(Y\), in centimeters, add to exactly 10 cm. The model for \(X\) is uniform on the interval from 0 to 8 cm, and \(Y=10-X\). Find \(\operatorname{Cov}(X,Y)\), \(\operatorname{Var}(Y)\), and the correlation.

Model and method. Here \(X\sim\operatorname{Uniform}(0,8)\), meaning its density is \(1/8\) on \(0\leq x\leq 8\) and zero otherwise. The fixed sum is \(X+Y=10\) for every outcome. A uniform distribution on an interval of width \(b-a\) has variance \((b-a)^2/12\).

The width of the interval for \(X\) is \(8-0=8\), so

$$ \operatorname{Var}(X)=\frac{8^2}{12}=\frac{64}{12}=\frac{16}{3}. $$

Applying the fixed-total result,

$$ \operatorname{Cov}(X,Y)=-\frac{16}{3}, \qquad \operatorname{Var}(Y)=\frac{16}{3}. $$

The variance is positive, so

$$ \operatorname{Corr}(X,Y) =\frac{-16/3}{\sqrt{16/3}\sqrt{16/3}} =-1. $$

Check. Since \(Y=10-X\), its range is from 2 to 10 cm, also of width 8 cm. Its variance is therefore \(8^2/12=16/3\), matching the result. The method avoids incorrectly assuming that the two lengths are independent merely because each has a range of possible values.

Affine Transformations and the Sign of Covariance

Exam problems may ask about transformed quantities rather than \(X\) and \(Y\) themselves. If \(A=aX+b\) and \(B=rY+s\), then constants do not affect covariance and scalar multipliers contribute their product:

$$ \operatorname{Cov}(A,B)=ar\operatorname{Cov}(X,Y). $$

This follows because \(A-E[A]=a(X-E[X])\) and \(B-E[B]=r(Y-E[Y])\); multiplying the centered quantities pulls out the factor \(ar\). In particular, if \(Y=c-X\), then

$$ \operatorname{Cov}(aX+b,rY+s)=-ar\operatorname{Var}(X). $$

The covariance of the transformed quantities is negative when \(ar>0\) and positive when \(ar<0\), provided \(\operatorname{Var}(X)>0\). A transformation that reverses the direction of one quantity can reverse the covariance sign. Consequently, the statement “a fixed total means negative covariance” applies to the original pair \(X,Y\), not automatically to every transformed pair.

Worked Example: Covariance After Rescaling the Quantities

A hypothetical 100-unit budget is divided between two activities. The amount \(X\) assigned to Activity A is 40, 50, or 60 units with probabilities 0.2500, 0.5000, and 0.2500. Activity B receives \(Y=100-X\). Define reported scores \(A=3X+2\) and \(B=4Y-7\). Find their covariance, variances, and correlation.

Model and method. The probabilities sum to 1, and \(X+Y=100\) in every outcome. First calculate the mean and variance of \(X\):

$$ \begin{aligned} E[X]&=40(0.2500)+50(0.5000)+60(0.2500)=50,\\ E[X^2]&=40^2(0.2500)+50^2(0.5000)+60^2(0.2500)\\ &=400+1250+900=2550,\\ \operatorname{Var}(X)&=2550-50^2=50. \end{aligned} $$

Since \(Y=100-X\), \(\operatorname{Var}(Y)=50\) and \(\operatorname{Cov}(X,Y)=-50\). The affine covariance rule gives

$$ \operatorname{Cov}(A,B) =(3)(4)\operatorname{Cov}(X,Y) =12(-50)=-600. $$

The variances are

$$ \operatorname{Var}(A)=3^2(50)=450, \qquad \operatorname{Var}(B)=4^2(50)=800. $$

Thus the correlation is

$$ \operatorname{Corr}(A,B) =\frac{-600}{\sqrt{450}\sqrt{800}} =\frac{-600}{(15\sqrt{2})(20\sqrt{2})} =\frac{-600}{600} =-1. $$

Check. The transformed values of \(A\) are 122, 152, and 182; those of \(B\) are 233, 193, and 153. Their means are 152 and 193. Relative to those means, the deviations are \((-30,0,30)\) for \(A\) and \((40,0,-40)\) for \(B\), paired with probabilities \(0.2500,0.5000,0.2500\). Their expected product is \((-1200)(0.2500)+0+( -1200)(0.2500)=-600\). This confirms the covariance and avoids dropping the multiplier 12 or treating the added constants as if they affected covariance.

What a Fixed Expected Total Does Not Tell You

A common exam trap is to confuse \(X+Y=c\) in every outcome with \(E[X+Y]=c\). The latter only says that the average total is \(c\); the total itself may vary. It does not determine the covariance.

For example, let \(X\) and \(Y\) be independent Bernoulli random variables, each equal to 0 or 1 with probability 0.5000. Then \(E[X]=E[Y]=0.5\), so \(E[X+Y]=1\). But the total is not fixed: it can be 0, 1, or 2. Independence gives \(\operatorname{Cov}(X,Y)=0\), not \(-\operatorname{Var}(X)\). Here \(\operatorname{Var}(X)=0.25\), so incorrectly applying the fixed-total formula would give \(-0.25\).

Common mistake: “The expected total is constant, so covariance is the negative variance.” This is not valid. The formula \(\operatorname{Cov}(X,Y)=-\operatorname{Var}(X)\) requires \(X+Y=c\) with probability 1. A constant expected total alone is insufficient.

A reliable solution starts by checking the model statement: does the sum equal the same number in every outcome? If yes, use the fixed-total result. If only the expected sum is given, calculate covariance from the joint model or other information provided; do not infer its sign from the expected total alone.

Check Your Understanding

For each problem, identify whether the total is fixed in every outcome before applying the covariance result.

  1. Random variables \(X\) and \(Y\) satisfy \(X+Y=40\) with probability 1, and \(\operatorname{Var}(X)=9\). Find \(\operatorname{Cov}(X,Y)\), \(\operatorname{Var}(Y)\), and \(\operatorname{Corr}(X,Y)\). (Answer: \(-9,\ 9,\ -1\))
  2. A quantity \(X\) takes values 2, 5, and 8 with probabilities 0.2000, 0.5000, and 0.3000. Let \(Y=10-X\). Find the covariance and correlation. (Answer: \(\operatorname{Cov}(X,Y)=-4.41,\ \operatorname{Corr}(X,Y)=-1\))
  3. Let \(X\sim\operatorname{Uniform}(2,8)\) and \(Y=14-X\). Find \(\operatorname{Var}(X)\), \(\operatorname{Cov}(X,Y)\), and \(\operatorname{Corr}(X,Y)\). (Answer: \(3,\ -3,\ -1\))
  4. Let \(X\) and \(Y\) be independent Bernoulli variables with success probability 0.5000. Their expected sum is 1. Find their covariance and explain why the fixed-total formula does not apply. (Answer: \(\operatorname{Cov}(X,Y)=0\); the sum can be 0, 1, or 2, so it is not fixed in every outcome.)
  5. Suppose \(X+Y=20\) with probability 1 and \(\operatorname{Var}(X)=7\). Set \(A=2X+5\) and \(B=3Y-4\). Find \(\operatorname{Cov}(A,B)\), both variances, and their correlation. (Answer: \(\operatorname{Cov}(A,B)=-42,\ \operatorname{Var}(A)=28,\ \operatorname{Var}(B)=63,\ \operatorname{Corr}(A,B)=-1\))
Clinical Biostats