Tutorials › VEE Mathematical Statistics › Effects of Shifting and Scaling Variables

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

Effects of Shifting and Scaling Variables

You will derive and apply the rules for how adding constants and multiplying random variables by constants change covariance.

Intermediate 11 min read

What You'll Learn

  • State the finite-moment condition needed for covariance transformation rules
  • Derive why adding constants does not change covariance
  • Calculate covariance after one or both variables are scaled
  • Track the sign and size of covariance under negative and positive scale factors
  • Expand covariance when transformed variables share underlying random variables
  • Identify when more information, such as a variance, is required

Why Shifts and Scales Matter

Covariance is often calculated for measurements that are not recorded in their original units. A loss amount might be expressed in thousands of dollars rather than dollars, or a score might be shifted by subtracting a benchmark. These changes affect the numerical value of covariance in systematic ways. Knowing those rules lets you transform a covariance without returning to a joint probability table or density.

The central points are simple, but easy to misapply: adding a fixed constant to either variable has no effect on covariance, while multiplying either variable by a constant multiplies covariance by that constant. If a transformed variable contains more than one random variable, however, every random-variable term must be included. In particular, a covariance involving the same variable twice is its variance.

Definition: For random variables \(X\) and \(Y\) with finite second moments, their covariance is $$ \operatorname{Cov}(X,Y)=E\left[(X-E[X])(Y-E[Y])\right]. $$ Equivalently, \(\operatorname{Cov}(X,Y)=E[XY]-E[X]E[Y]\). The finite-second-moment condition ensures the expectations used here are finite. No particular distributional family is required.

The covariance transformation rules below apply to discrete, continuous, and mixed distributions whenever the required moments exist. They do not require independence. The earlier material on covariance from joint distributions gives ways to calculate the original covariance; this tutorial focuses on how that covariance changes under shifts and scales.

The Affine Transformation Rule

Let \(a,b,c,d\) be fixed constants, and define \(U=aX+b\) and \(V=cY+d\). Then

Theorem: If \(X\) and \(Y\) have finite second moments, then $$ \operatorname{Cov}(aX+b,cY+d)=ac\operatorname{Cov}(X,Y). $$

The constants \(b\) and \(d\) do not appear in the result. The factors \(a\) and \(c\) do appear: each variable's scale factor contributes once. If either scale factor is zero, the corresponding transformed variable is constant and the covariance is zero. If a scale factor is negative, it reverses the direction of the covariance's sign; two negative factors reverse it twice.

1
Center each transformed variable.
Since \(E[aX+b]=aE[X]+b\), subtracting the mean gives \(U-E[U]=a(X-E[X])\). Similarly, \(V-E[V]=c(Y-E[Y])\).
2
Multiply the centered quantities.
Their product is \(ac(X-E[X])(Y-E[Y])\).
3
Take expectations.
The constants \(a\) and \(c\) factor out of expectation, leaving \(ac\operatorname{Cov}(X,Y)\).

This derivation explains why shifts disappear: centering removes each fixed shift exactly. It also explains why the scale factors multiply covariance rather than adding to it: covariance is an expected product of two centered quantities.

TransformationResultEffect
\(\operatorname{Cov}(X+b,Y)\)\(\operatorname{Cov}(X,Y)\)Shifting the first variable has no effect
\(\operatorname{Cov}(X,Y+d)\)\(\operatorname{Cov}(X,Y)\)Shifting the second variable has no effect
\(\operatorname{Cov}(aX,Y)\)\(a\operatorname{Cov}(X,Y)\)Scaling the first variable scales covariance
\(\operatorname{Cov}(X,cY)\)\(c\operatorname{Cov}(X,Y)\)Scaling the second variable scales covariance
\(\operatorname{Cov}(aX,bY)\)\(ab\operatorname{Cov}(X,Y)\)Both scale factors contribute

Worked Example: Shifting and Scaling Two Measurements

In a hypothetical risk-monitoring model, \(X\) and \(Y\) are two measurements with finite second moments, and \(\operatorname{Cov}(X,Y)=-2.5\). No distributional family is assumed. Define \(U=3X+2\) and \(V=-4Y+7\). Find \(\operatorname{Cov}(U,V)\), and verify that the result is consistent with the given means if \(E[X]=12\) and \(E[Y]=5\).

Method. Apply the affine transformation rule. The scale factors are \(3\) and \(-4\); the shifts \(2\) and \(7\) do not affect covariance:

$$ \operatorname{Cov}(U,V) =3(-4)\operatorname{Cov}(X,Y) =(-12)(-2.5)=30. $$

For a check using the expectation shortcut, first calculate \(E[XY]\):

$$ E[XY]=\operatorname{Cov}(X,Y)+E[X]E[Y] =-2.5+(12)(5)=57.5. $$

The transformed means are \(E[U]=3(12)+2=38\) and \(E[V]=-4(5)+7=-13\). Expanding the product gives

$$ E[UV] =E[(3X+2)(-4Y+7)] =-12E[XY]+21E[X]-8E[Y]+14 =-12(57.5)+21(12)-8(5)+14=-464. $$

Therefore, \(\operatorname{Cov}(U,V)=E[UV]-E[U]E[V]=-464-(38)(-13)=-464+494=30\), as required. The negative scale factor reverses the original negative covariance, and the additional positive scale factor changes its magnitude. The shifts do neither.

When Both Transformed Variables Contain the Same Random Variable

The affine rule applies directly when one transformed variable is a function of \(X\) alone and the other is a function of \(Y\) alone. A related calculation is needed when a transformed variable contains more than one random variable. Covariance is linear in each argument, so each term must be paired with every term in the other argument. The identity \(\operatorname{Cov}(X,X)=\operatorname{Var}(X)\) is especially important in these expansions.

Result: For random variables with finite second moments and constants \(a,b,c,d,r,s\), $$ \operatorname{Cov}(aX+b,cY+dX+s) =ac\operatorname{Cov}(X,Y)+ad\operatorname{Var}(X). $$ A term involving \(X\) in both arguments contributes a variance, not a covariance that can be found from \(\operatorname{Cov}(X,Y)\) alone.

To see the expansion, constants contribute zero, while the random terms give

$$ \begin{aligned} \operatorname{Cov}(aX+b,cY+dX+s) &=\operatorname{Cov}(aX,cY)+\operatorname{Cov}(aX,dX)\\ &=ac\operatorname{Cov}(X,Y)+ad\operatorname{Cov}(X,X)\\ &=ac\operatorname{Cov}(X,Y)+ad\operatorname{Var}(X). \end{aligned} $$

Thus, the covariance with \(Y\) alone is not enough if the second transformed variable also contains \(X\). The variance term must be known as well.

Worked Example: A Shared Variable Requires Its Variance

Suppose \(X\) and \(Y\) have finite second moments, \(\operatorname{Cov}(X,Y)=4\), and \(\operatorname{Var}(X)=6\). Their joint distribution is otherwise unspecified. Let \(R=3X+2\) and \(S=Y-2X+9\). Calculate \(\operatorname{Cov}(R,S)\).

Method. Expand using linearity in both arguments. The constant shifts contribute zero:

$$ \begin{aligned} \operatorname{Cov}(R,S) &=\operatorname{Cov}(3X+2,Y-2X+9)\\ &=\operatorname{Cov}(3X,Y)+\operatorname{Cov}(3X,-2X)\\ &=3\operatorname{Cov}(X,Y)-6\operatorname{Var}(X)\\ &=3(4)-6(6)=12-36=-24. \end{aligned} $$

The result is \(-24\). The term \(-6\operatorname{Var}(X)\) is essential because \(X\) occurs in both \(R\) and \(S\). The common mistake is to calculate only \(3\operatorname{Cov}(X,Y)=12\), as if \(S\) were just \(Y\) plus a constant. That omits the \(-2X\) term. If \(\operatorname{Var}(X)\) had not been supplied, the requested covariance could not be determined from \(\operatorname{Cov}(X,Y)\) alone.

Expanding More General Transformed Variables

The same approach handles two transformed variables that each contain both \(X\) and \(Y\). For constants \(a,b,c,d\) and shifts \(e,f\), write \(U=aX+bY+e\) and \(V=cX+dY+f\). By expanding term by term,

$$ \operatorname{Cov}(U,V) =ac\operatorname{Var}(X) +(ad+bc)\operatorname{Cov}(X,Y) +bd\operatorname{Var}(Y). $$

This is a covariance calculation, not a variance calculation: \(U\) and \(V\) need not be the same variable. The formula follows because the four random-variable pairings are \(ac\operatorname{Cov}(X,X)\), \(ad\operatorname{Cov}(X,Y)\), \(bc\operatorname{Cov}(Y,X)\), and \(bd\operatorname{Cov}(Y,Y)\). Since \(\operatorname{Cov}(Y,X)=\operatorname{Cov}(X,Y)\), the two cross terms combine.

Worked Example: Covariance of Two Linear Transformations

For a hypothetical pair of portfolio indicators \(X\) and \(Y\), assume finite second moments and the known values \(\operatorname{Var}(X)=5\), \(\operatorname{Var}(Y)=9\), and \(\operatorname{Cov}(X,Y)=-2\). No distributional family is specified or needed. Define \(U=2X-Y+6\) and \(V=-X+3Y-1\). Find \(\operatorname{Cov}(U,V)\).

Method. The coefficients of \(X,Y\) in \(U\) are \(2,-1\), and those in \(V\) are \(-1,3\). First expand by pairings:

$$ \begin{aligned} \operatorname{Cov}(U,V) &=\operatorname{Cov}(2X-Y,-X+3Y)\\ &=\operatorname{Cov}(2X,-X) +\operatorname{Cov}(2X,3Y) +\operatorname{Cov}(-Y,-X) +\operatorname{Cov}(-Y,3Y)\\ &=-2\operatorname{Var}(X)+6\operatorname{Cov}(X,Y) +\operatorname{Cov}(X,Y)-3\operatorname{Var}(Y)\\ &=-2(5)+6(-2)+(-2)-3(9)\\ &=-10-12-2-27=-51. \end{aligned} $$

As a check with the combined-coefficient formula,

$$ (2)(-1)(5)+\bigl((2)(3)+(-1)(-1)\bigr)(-2)+(-1)(3)(9) =-10+7(-2)-27=-51. $$

Both expansions give \(-51\). This check confirms that the shifts \(6\) and \(-1\) have no effect, while both variances and the covariance are needed for the shared-variable terms.

Common Exam Traps and Practical Checks

These rules are aligned with the SOA VEE Mathematical Statistics syllabus. In a calculation, make the transformations explicit before substituting numbers. That helps distinguish a shift, which disappears after centering, from a scale factor, which remains. It also prevents an omitted term when the same underlying variable appears in both transformed quantities.

  • Keeping a shift in the result. A term such as \(+7\) changes a mean but contributes nothing to covariance.
  • Using only one scale factor. For \(\operatorname{Cov}(aX,cY)\), the multiplier is \(ac\), not just \(a\) or just \(c\).
  • Losing a negative sign. If exactly one scale factor is negative, the covariance changes sign. If both are negative, the two sign reversals cancel.
  • Ignoring a shared-variable term. If a variable appears in both arguments, its pairing with itself contributes its variance. Covariance with a different variable does not supply that variance.
  • Assuming a numerical answer from incomplete information. When the expansion includes \(\operatorname{Var}(X)\), that variance must be known or derivable from additional stated information.

A useful final check is dimensional: covariance has the product of the units of its two variables. Changing the units of one variable by a factor \(a\) therefore changes covariance by that same factor; changing both units introduces both factors. This check does not determine the sign, so signs must still be tracked algebraically.

Key takeaway: For affine transformations of separate variables, \(\operatorname{Cov}(aX+b,cY+d)=ac\operatorname{Cov}(X,Y)\). Shifts vanish because covariance uses centered variables. When transformed variables share random-variable terms, expand every pairing and use \(\operatorname{Cov}(X,X)=\operatorname{Var}(X)\).

Check Your Understanding

For each problem, assume all stated variables have finite second moments. No distributional family is needed unless the problem specifies otherwise.

  1. If \(\operatorname{Cov}(X,Y)=-6\), find \(\operatorname{Cov}(2X+1,5Y-4)\). (Answer: \(-60\))
  2. Given \(\operatorname{Cov}(X,Y)=3\) and \(\operatorname{Var}(X)=4\), let \(R=2X+5\) and \(S=Y-3X+1\). Find \(\operatorname{Cov}(R,S)\). (Answer: \(-18\))
  3. Suppose \(\operatorname{Var}(X)=7\), \(\operatorname{Var}(Y)=2\), and \(\operatorname{Cov}(X,Y)=-1\). For \(U=-2X+3\) and \(V=4Y-5X+9\), calculate \(\operatorname{Cov}(U,V)\). (Answer: \(78\))
  4. Suppose \(\operatorname{Var}(X)=3\), \(\operatorname{Cov}(X,Y)=2\), and \(\operatorname{Cov}(X,Z)=-1\), \(\operatorname{Cov}(Y,Z)=4\). Find \(\operatorname{Cov}(X+2Y,3X-Z)\). (Answer: \(14\))
  5. If \(\operatorname{Cov}(X,Y)=-1.25\), calculate \(\operatorname{Cov}(7-X,2Y+3)\). State which shift and scale factors determine the result. (Answer: \(2.5\); the shifts have no effect, and the scale factors \(-1\) and \(2\) multiply the original covariance.)
Clinical Biostats