Linear Combinations of Random Variables

A2 · S2 · 12 min

A linear combination of random variables is something like 3X+23X + 2, X−YX - Y or X1+X2+X3X_1 + X_2 + X_3: random quantities scaled, shifted, added and subtracted. Totals, differences, costs and conversions are all linear combinations, so this topic is the engine behind a large share of Paper 6, from "the total mass of five parcels" to the distribution of a sample mean. This note gives the rules for means and variances, which work for any distribution; the follow-up notes deal with the special cases where the distribution of the combination is also known (normal and Poisson).

Scaling and shifting one variable

Suppose XX is the temperature in degrees Celsius at noon, with mean 2020 and variance 1616. In Fahrenheit the temperature is F=1.8X+32F = 1.8X + 32.

Shifting by 3232 moves every value up by 3232, so it moves the mean up by 3232. It does not change how spread out the values are, so it does not change the variance.

Scaling by 1.81.8 multiplies every value, and every distance from the mean, by 1.81.8. So it multiplies the mean by 1.81.8 and the standard deviation by 1.81.8. Variance is measured in squared units, so it is multiplied by 1.82=3.241.8^2 = 3.24.

Key result

For any random variable XX and constants aa and bb:

E(aX+b)=aE(X)+bE(aX + b) = aE(X) + bVar(aX+b)=a2 Var(X)\text{Var}(aX + b) = a^2\,\text{Var}(X)

Consequently the standard deviation of aX+baX + b is ∣a∣|a| times the standard deviation of XX.

For the temperatures: E(F)=1.8×20+32=68E(F) = 1.8 \times 20 + 32 = 68 and Var(F)=3.24×16=51.84\text{Var}(F) = 3.24 \times 16 = 51.84, so the standard deviation is 7.27.2, which is 1.8×41.8 \times 4 as expected.

Two consequences are worth spelling out.

  • Adding a constant never changes the variance: Var(X+100)=Var(X)\text{Var}(X + 100) = \text{Var}(X).
  • A negative multiplier still increases or keeps the spread: Var(−X)=(−1)2 Var(X)=Var(X)\text{Var}(-X) = (-1)^2\,\text{Var}(X) = \text{Var}(X), and Var(5−2X)=4 Var(X)\text{Var}(5 - 2X) = 4\,\text{Var}(X). Variances can never be negative.
One variable, from a probability table

The random variable XX has the following probability distribution.

xx112233
P(X=x)P(X = x)0.20.20.50.50.30.3

Find E(5X−3)E(5X - 3) and Var(5X−3)\text{Var}(5X - 3).

SolutionE(X)=1(0.2)+2(0.5)+3(0.3)=2.1E(X) = 1(0.2) + 2(0.5) + 3(0.3) = 2.1E(X2)=1(0.2)+4(0.5)+9(0.3)=4.9,Var(X)=4.9−2.12=0.49E(X^2) = 1(0.2) + 4(0.5) + 9(0.3) = 4.9, \qquad \text{Var}(X) = 4.9 - 2.1^2 = 0.49

Then

E(5X−3)=5(2.1)−3=7.5,Var(5X−3)=52(0.49)=12.25E(5X - 3) = 5(2.1) - 3 = 7.5, \qquad \text{Var}(5X - 3) = 5^2(0.49) = 12.25

Combining two variables

Now take two random variables XX and YY, for example the scores of two players.

Means always add. On average, the total of two scores is the total of the two averages, whatever the relationship between the players. So E(X+Y)=E(X)+E(Y)E(X + Y) = E(X) + E(Y) and, more generally, E(aX+bY)=aE(X)+bE(Y)E(aX + bY) = aE(X) + bE(Y).

Variances add when the variables are independent. If the two scores have nothing to do with each other, then sometimes one is high while the other is low and they partly cancel, but just as often both are high or both low. On balance, the total is more variable than either score on its own. For independent variables the variances add exactly.

Key result

For any random variables XX and YY and constants aa and bb:

E(aX+bY)=aE(X)+bE(Y)E(aX + bY) = aE(X) + bE(Y)

If, in addition, XX and YY are independent:

Var(aX+bY)=a2 Var(X)+b2 Var(Y)\text{Var}(aX + bY) = a^2\,\text{Var}(X) + b^2\,\text{Var}(Y)

Proofs are not required.

Differences have added variances

Put a=1a = 1 and b=−1b = -1:

E(X−Y)=E(X)−E(Y),Var(X−Y)=Var(X)+(−1)2 Var(Y)=Var(X)+Var(Y).E(X - Y) = E(X) - E(Y), \qquad \text{Var}(X - Y) = \text{Var}(X) + (-1)^2\,\text{Var}(Y) = \text{Var}(X) + \text{Var}(Y).

The variance of a difference is the sum of the variances. This feels wrong the first time you see it, so think of an example: if the arrival time of your train is uncertain and the departure time of your connection is uncertain, the gap between them is more uncertain than either, not less. Subtracting does not cancel randomness; it adds a second source of it.

Two independent variables

XX and YY are independent random variables with E(X)=10E(X) = 10, Var(X)=4\text{Var}(X) = 4, E(Y)=6E(Y) = 6 and Var(Y)=9\text{Var}(Y) = 9. Find

(a) E(3X−2Y)E(3X - 2Y) and Var(3X−2Y)\text{Var}(3X - 2Y),

(b) the standard deviation of X−Y+7X - Y + 7.

Solution

(a)

E(3X−2Y)=3(10)−2(6)=18E(3X - 2Y) = 3(10) - 2(6) = 18Var(3X−2Y)=32(4)+(−2)2(9)=36+36=72\text{Var}(3X - 2Y) = 3^2(4) + (-2)^2(9) = 36 + 36 = 72

(b) The constant 77 does not affect the variance.

Var(X−Y+7)=4+9=13,standard deviation=13=3.61\text{Var}(X - Y + 7) = 4 + 9 = 13, \qquad \text{standard deviation} = \sqrt{13} = 3.61

Sums of several observations versus a multiple of one

This is the single most important distinction in the topic.

Let XX be the mass of one apple. Consider:

  • X1+X2+X3+X4X_1 + X_2 + X_3 + X_4: the total mass of four different apples, each with the same distribution as XX, independently;
  • 4X4X: four times the mass of one apple.

Both have mean 4E(X)4E(X). But their variances are very different:

Var(X1+X2+X3+X4)=4 Var(X),Var(4X)=16 Var(X).\text{Var}(X_1 + X_2 + X_3 + X_4) = 4\,\text{Var}(X), \qquad \text{Var}(4X) = 16\,\text{Var}(X).

With four different apples, a heavy one is likely to be offset by a lighter one, so the total varies less than four times one apple's mass would. With 4X4X there is no offsetting: one heavy apple is counted four times.

Key result

If X1,X2,…,XnX_1, X_2, \dots, X_n are independent observations of XX:

E(X1+X2+⋯+Xn)=nE(X),Var(X1+X2+⋯+Xn)=n Var(X)E(X_1 + X_2 + \cdots + X_n) = nE(X), \qquad \text{Var}(X_1 + X_2 + \cdots + X_n) = n\,\text{Var}(X)

whereas

E(nX)=nE(X),Var(nX)=n2 Var(X).E(nX) = nE(X), \qquad \text{Var}(nX) = n^2\,\text{Var}(X).
Deciding between a sum and a multiple
  1. Read the context and ask: are there several separate items, people or occasions, each with its own random value? Then it is a sum X1+⋯+XnX_1 + \cdots + X_n.
  2. Is a single random value being multiplied (a price per kilogram times one mass, a conversion, "twice the time taken")? Then it is a multiple nXnX.
  3. Write the expression in symbols before calculating its variance.
A sum or a multiple?

The score XX in one round of a game has mean 1212 and variance 55. Rounds are independent.

(a) Ali plays 44 rounds. Find the mean and variance of his total score.

(b) Bea plays one round and her score is multiplied by 44. Find the mean and variance of her final score.

(c) Find the mean and variance of the difference between Ali's total and Bea's final score.

Solution

(a) T=X1+X2+X3+X4T = X_1 + X_2 + X_3 + X_4: E(T)=4×12=48\quad E(T) = 4 \times 12 = 48, Var(T)=4×5=20\quad \text{Var}(T) = 4 \times 5 = 20.

(b) B=4XB = 4X: E(B)=48\quad E(B) = 48, Var(B)=42×5=80\quad \text{Var}(B) = 4^2 \times 5 = 80.

(c) Ali's and Bea's rounds are separate, so TT and BB are independent.

E(T−B)=48−48=0,Var(T−B)=20+80=100E(T - B) = 48 - 48 = 0, \qquad \text{Var}(T - B) = 20 + 80 = 100

Combining different distributions

The rules hold whatever the distributions are, so you can mix binomial, Poisson and other variables, using their known means and variances:

DistributionMeanVariance
B(n,p)B(n, p)npnpnp(1−p)np(1 - p)
Po(λ)\text{Po}(\lambda)λ\lambdaλ\lambda
N(μ,σ2)N(\mu, \sigma^2)μ\muσ2\sigma^2
Geo(p)\text{Geo}(p)1p\dfrac{1}{p}(not required)
Mixing a Poisson and a binomial

A café sells coffees and cakes. The number of coffees sold in an hour, XX, has the distribution Po(30)\text{Po}(30). The number of cakes sold in the same hour, YY, has the distribution B(40,0.6)B(40, 0.6), independently of XX. Each coffee earns a profit of 33 dollars and each cake 22 dollars, and the hourly running cost is 5050 dollars.

Find the mean and standard deviation of the hourly profit, P=3X+2Y−50P = 3X + 2Y - 50 dollars.

Solution

E(X)=30E(X) = 30, Var(X)=30\text{Var}(X) = 30; E(Y)=40(0.6)=24E(Y) = 40(0.6) = 24, Var(Y)=40(0.6)(0.4)=9.6\text{Var}(Y) = 40(0.6)(0.4) = 9.6.

E(P)=3(30)+2(24)−50=88E(P) = 3(30) + 2(24) - 50 = 88Var(P)=32(30)+22(9.6)=270+38.4=308.4\text{Var}(P) = 3^2(30) + 2^2(9.6) = 270 + 38.4 = 308.4standard deviation=308.4=17.6 dollars (3 s.f.)\text{standard deviation} = \sqrt{308.4} = 17.6 \text{ dollars (3 s.f.)}

Working backwards and using E(X2)E(X^2)

Questions can give you facts about a combination and ask for the original parameters. Two tools help.

  • Set up equations from the expectation and variance rules and solve them simultaneously.
  • Remember Var(X)=E(X2)−[E(X)]2\text{Var}(X) = E(X^2) - [E(X)]^2, so E(X2)=Var(X)+[E(X)]2E(X^2) = \text{Var}(X) + [E(X)]^2. The rules say nothing directly about E(X2)E(X^2) or E(XY)E(XY); you get them through the variance.
Finding the parameters

X1X_1, X2X_2 and X3X_3 are independent observations of a random variable XX with mean μ\mu and variance σ2\sigma^2. It is given that E(X1+X2+X3)=15E(X_1 + X_2 + X_3) = 15 and Var(2X1−X2)=20\text{Var}(2X_1 - X_2) = 20.

(a) Find μ\mu and σ2\sigma^2.

(b) Find E(X2)E(X^2).

(c) Find E((X1−X2)2)E\big((X_1 - X_2)^2\big).

Solution

(a) E(X1+X2+X3)=3μ=15E(X_1 + X_2 + X_3) = 3\mu = 15, so μ=5\mu = 5.

Var(2X1−X2)=4σ2+σ2=5σ2=20\text{Var}(2X_1 - X_2) = 4\sigma^2 + \sigma^2 = 5\sigma^2 = 20, so σ2=4\sigma^2 = 4.

(b) E(X2)=Var(X)+[E(X)]2=4+25=29E(X^2) = \text{Var}(X) + [E(X)]^2 = 4 + 25 = 29.

(c) Let D=X1−X2D = X_1 - X_2. Then E(D)=0E(D) = 0 and Var(D)=4+4=8\text{Var}(D) = 4 + 4 = 8.

E(D2)=Var(D)+[E(D)]2=8+0=8E(D^2) = \text{Var}(D) + [E(D)]^2 = 8 + 0 = 8
Common mistakes
  • Subtracting variances. Var(X−Y)=Var(X)+Var(Y)\text{Var}(X - Y) = \text{Var}(X) + \text{Var}(Y). A negative variance is a sure sign of this error.
  • Forgetting to square the coefficient. Var(3X)=9 Var(X)\text{Var}(3X) = 9\,\text{Var}(X), not 3 Var(X)3\,\text{Var}(X).
  • Including the constant in the variance. Var(2X+5)=4 Var(X)\text{Var}(2X + 5) = 4\,\text{Var}(X); the 55 disappears.
  • Confusing X1+X2X_1 + X_2 with 2X2X. Separate items give n Var(X)n\,\text{Var}(X); a multiple of one item gives n2 Var(X)n^2\,\text{Var}(X).
  • Adding standard deviations. Standard deviations do not add. Convert to variances, combine, then take the square root at the end.
  • Using the variance rule without independence. The rule Var(X+Y)=Var(X)+Var(Y)\text{Var}(X + Y) = \text{Var}(X) + \text{Var}(Y) needs independence; the mean rule does not.
Exam tip
  • Write the combination in symbols before calculating, for example "T=X1+X2+X3−2YT = X_1 + X_2 + X_3 - 2Y". This is where most errors happen, and a correct expression earns credit even if the arithmetic slips.
  • Show the variance calculation term by term: 32×30+22×9.63^2 \times 30 + 2^2 \times 9.6. Examiners can then award the method mark.
  • If asked for a standard deviation, find the variance first and square-root it as the very last step.
  • A question that says "state an assumption" for a variance calculation is looking for independence, in context: "the number of coffees sold is independent of the number of cakes sold".
  • These rules give means and variances only. If a question asks for a probability involving a combination, you need to know its distribution: see linear combinations of normal variables and sums of Poisson variables.
Summary
  • E(aX+b)=aE(X)+bE(aX + b) = aE(X) + b and Var(aX+b)=a2 Var(X)\text{Var}(aX + b) = a^2\,\text{Var}(X).
  • E(aX+bY)=aE(X)+bE(Y)E(aX + bY) = aE(X) + bE(Y) always.
  • Var(aX+bY)=a2 Var(X)+b2 Var(Y)\text{Var}(aX + bY) = a^2\,\text{Var}(X) + b^2\,\text{Var}(Y) when XX and YY are independent.
  • Var(X−Y)=Var(X)+Var(Y)\text{Var}(X - Y) = \text{Var}(X) + \text{Var}(Y): variances of differences add.
  • nn separate observations: variance n Var(X)n\,\text{Var}(X); one observation times nn: variance n2 Var(X)n^2\,\text{Var}(X).
  • Combine variances, never standard deviations.
  • E(X2)=Var(X)+[E(X)]2E(X^2) = \text{Var}(X) + [E(X)]^2.

Practice questions

Question
  1. E(X)=7E(X) = 7 and Var(X)=3\text{Var}(X) = 3. Find E(4X−5)E(4X - 5), Var(4X−5)\text{Var}(4X - 5) and Var(5−2X)\text{Var}(5 - 2X).
  2. XX and YY are independent with E(X)=20E(X) = 20, Var(X)=16\text{Var}(X) = 16, E(Y)=12E(Y) = 12 and Var(Y)=9\text{Var}(Y) = 9. Find (a) the mean and standard deviation of X−YX - Y, (b) E(2X+3Y)E(2X + 3Y) and Var(2X+3Y)\text{Var}(2X + 3Y).
  3. The random variable XX takes values 00, 11 and 22 with probabilities 0.50.5, 0.30.3 and 0.20.2. X1X_1 and X2X_2 are independent observations of XX. Find Var(X1+X2)\text{Var}(X_1 + X_2) and Var(2X)\text{Var}(2X).
  4. The number of letters delivered to a house each day has the distribution Po(3)\text{Po}(3), independently from day to day. Find the mean and variance of the total number of letters in 1010 days, and explain why this is not the same as the variance of 10X10X.
  5. X∼B(30,0.4)X \sim B(30, 0.4) and Y∼Po(5)Y \sim \text{Po}(5) are independent. Find E(3X−2Y+4)E(3X - 2Y + 4) and Var(3X−2Y+4)\text{Var}(3X - 2Y + 4).
  6. The noon temperature CC in degrees Celsius has mean 2020 and standard deviation 44. Find the mean and standard deviation of the temperature in degrees Fahrenheit, F=1.8C+32F = 1.8C + 32.
  7. XX has mean 66 and variance 2.252.25. The random variable Y=aX+bY = aX + b, where a>0a > 0, has mean 00 and variance 11. Find aa and bb.
  8. A taxi fare, in dollars, is F=3+1.5D+0.4WF = 3 + 1.5D + 0.4W, where the distance DD km has mean 88 and standard deviation 33, and the waiting time WW minutes has mean 55 and standard deviation 44. DD and WW are independent. (a) Find the mean and standard deviation of FF. (b) A driver takes 5050 independent fares in a week. Find the mean and standard deviation of the total of these fares. (c) Find the variance of the mean fare of these 5050 fares.
Answers
  1. E(4X−5)=4(7)−5=23E(4X - 5) = 4(7) - 5 = 23; Var(4X−5)=16(3)=48\text{Var}(4X - 5) = 16(3) = 48; Var(5−2X)=(−2)2(3)=12\text{Var}(5 - 2X) = (-2)^2(3) = 12.

  2. (a) E(X−Y)=8E(X - Y) = 8; Var(X−Y)=16+9=25\text{Var}(X - Y) = 16 + 9 = 25, so the standard deviation is 55. (b) E(2X+3Y)=40+36=76E(2X + 3Y) = 40 + 36 = 76; Var(2X+3Y)=4(16)+9(9)=64+81=145\text{Var}(2X + 3Y) = 4(16) + 9(9) = 64 + 81 = 145.

  3. E(X)=0.3+0.4=0.7E(X) = 0.3 + 0.4 = 0.7; E(X2)=0.3+0.8=1.1E(X^2) = 0.3 + 0.8 = 1.1; Var(X)=1.1−0.49=0.61\text{Var}(X) = 1.1 - 0.49 = 0.61. Var(X1+X2)=2(0.61)=1.22\text{Var}(X_1 + X_2) = 2(0.61) = 1.22; Var(2X)=4(0.61)=2.44\text{Var}(2X) = 4(0.61) = 2.44.

  4. Total T=X1+⋯+X10T = X_1 + \cdots + X_{10}: E(T)=30E(T) = 30, Var(T)=10×3=30\text{Var}(T) = 10 \times 3 = 30. 10X10X would be ten times one day's letters, with variance 100×3=300100 \times 3 = 300. The total over ten different days is a sum of separate independent counts, so high and low days partly balance out, giving the smaller variance.

  5. E(X)=12E(X) = 12, Var(X)=30(0.4)(0.6)=7.2\text{Var}(X) = 30(0.4)(0.6) = 7.2; E(Y)=Var(Y)=5E(Y) = \text{Var}(Y) = 5. E(3X−2Y+4)=36−10+4=30E(3X - 2Y + 4) = 36 - 10 + 4 = 30; Var(3X−2Y+4)=9(7.2)+4(5)=64.8+20=84.8\text{Var}(3X - 2Y + 4) = 9(7.2) + 4(5) = 64.8 + 20 = 84.8.

  6. E(F)=1.8(20)+32=68E(F) = 1.8(20) + 32 = 68; standard deviation =1.8×4=7.2= 1.8 \times 4 = 7.2.

  7. Var(Y)=a2(2.25)=1⇒a=11.5=23\text{Var}(Y) = a^2(2.25) = 1 \Rightarrow a = \dfrac{1}{1.5} = \dfrac{2}{3} (positive root). E(Y)=23(6)+b=0⇒b=−4E(Y) = \tfrac{2}{3}(6) + b = 0 \Rightarrow b = -4. (This is standardising: Y=X−61.5Y = \dfrac{X - 6}{1.5}.)

  8. (a) E(F)=3+1.5(8)+0.4(5)=3+12+2=17E(F) = 3 + 1.5(8) + 0.4(5) = 3 + 12 + 2 = 17. Var(F)=1.52(9)+0.42(16)=20.25+2.56=22.81\text{Var}(F) = 1.5^2(9) + 0.4^2(16) = 20.25 + 2.56 = 22.81; standard deviation =22.81=4.78= \sqrt{22.81} = 4.78 dollars. (b) Total of 5050 separate fares: mean =50×17=850= 50 \times 17 = 850; variance =50×22.81=1140.5= 50 \times 22.81 = 1140.5; standard deviation =33.8= 33.8 dollars. (c) Mean fare =total50= \dfrac{\text{total}}{50}, so its variance is 1140.5502=0.456\dfrac{1140.5}{50^2} = 0.456 (equivalently 22.8150\dfrac{22.81}{50}).

How well do you know this?

Builds on

Where this leads

Console

Search notes, courses and tools, or run an action