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.
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
Thus the centered deviations are negatives of one another. In particular, \(Y-E[Y]=-(X-E[X])\). Substitute this into the definition of covariance:
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.
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\),
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\):
Therefore,
The fixed-total theorem gives \(\operatorname{Cov}(X,Y)=-13\) and \(\operatorname{Var}(Y)=13\). Since the variance is positive, the correlation is
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
Applying the fixed-total result,
The variance is positive, so
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:
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
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\):
Since \(Y=100-X\), \(\operatorname{Var}(Y)=50\) and \(\operatorname{Cov}(X,Y)=-50\). The affine covariance rule gives
The variances are
Thus the correlation is
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\).
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.
- 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\))
- 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\))
- 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\))
- 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.)
- 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\))