Skip to content
Family Table Math
Auto

Linear Combinations of Random Variables

Real quantities are often built from other random quantities: a total bill is a sum of item prices, a temperature in °F is a rescaled temperature in °C, and a profit is income minus cost. This page gives you the rules for the mean and variance of these combinations, so you can find them without ever listing a new probability distribution. The same rules explain why a sample mean is a good estimate of a population mean, which is the foundation for the central limit theorem and confidence intervals.

For a random variable XX, E(X)E(X) is its expected value (mean, μ\mu) and Var(X)\mathrm{Var}(X) is its variance (σ2\sigma^2). The standard deviation is Var(X)\sqrt{\mathrm{Var}(X)}. You’ll usually be given E(X)E(X) and Var(X)\mathrm{Var}(X), or find them with your GDC from a table of values; the IB guide says you won’t need the variance formula itself in exams.

If aa and bb are constants,

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

Why the difference? Adding bb slides every value along by the same amount, so the centre moves but the spread doesn’t change. Multiplying by aa stretches the distances between values by a factor of ∣a∣|a|, and variance is measured in squared units, so it is multiplied by a2a^2. The standard deviation is multiplied by ∣a∣|a|.

Notice that Var(−X)=(−1)2Var(X)=Var(X)\mathrm{Var}(-X) = (-1)^2\mathrm{Var}(X) = \mathrm{Var}(X): flipping a distribution doesn’t change its spread.

For any random variables X1,X2,…,XnX_1, X_2, \dots, X_n and constants a1,a2,…,ana_1, a_2, \dots, a_n,

E(a1X1±a2X2±⋯±anXn)=a1E(X1)±a2E(X2)±⋯±anE(Xn)E(a_1X_1 \pm a_2X_2 \pm \dots \pm a_nX_n) = a_1E(X_1) \pm a_2E(X_2) \pm \dots \pm a_nE(X_n)

Means simply combine the same way the variables do. This works whether or not the variables are independent.

Variance of a linear combination of independent variables

Section titled “Variance of a linear combination of independent variables”

If X1,X2,…,XnX_1, X_2, \dots, X_n are independent,

Var(a1X1±a2X2±⋯±anXn)=a12 Var(X1)+a22 Var(X2)+⋯+an2 Var(Xn)\mathrm{Var}(a_1X_1 \pm a_2X_2 \pm \dots \pm a_nX_n) = a_1^2\,\mathrm{Var}(X_1) + a_2^2\,\mathrm{Var}(X_2) + \dots + a_n^2\,\mathrm{Var}(X_n)

Two things to notice:

  • Each coefficient is squared, just like in Var(aX+b)\mathrm{Var}(aX + b).
  • The variances are always added, even when the variables are subtracted. In particular, Var(X−Y)=Var(X)+Var(Y)\mathrm{Var}(X - Y) = \mathrm{Var}(X) + \mathrm{Var}(Y). Subtracting a random quantity adds uncertainty; it can’t take uncertainty away.

You add variances, never standard deviations. Find the variance of the combination first, then take the square root at the end.

Suppose XX is the mass of one apple. Compare:

  • 2X2X: the mass of one apple, doubled (one random value, scaled).
  • X1+X2X_1 + X_2: the total mass of two different apples (two independent values, added).

They have the same mean, 2E(X)2E(X), but different variances:

MeanVariance
2X2X2E(X)2E(X)4 Var(X)4\,\mathrm{Var}(X)
X1+X2X_1 + X_22E(X)2E(X)2 Var(X)2\,\mathrm{Var}(X)

The sum of two independent apples varies less, because a heavy apple and a light apple often partly cancel out. Doubling one apple doubles its deviation from the mean, with nothing to cancel it. Read the question carefully: “the total of 55 items” means X1+⋯+X5X_1 + \dots + X_5, while ”55 times one item” means 5X5X.

Unbiased estimates of the mean and variance

Section titled “Unbiased estimates of the mean and variance”

When you don’t know a population’s μ\mu and σ2\sigma^2, you estimate them from a sample of size nn. An estimate is unbiased if, on average over many samples, it equals the true value.

  • The sample mean is an unbiased estimate of μ\mu:
xˉ=∑i=1nxin\bar{x} = \frac{\sum_{i=1}^{n} x_i}{n}
  • The unbiased estimate of σ2\sigma^2 divides by n−1n - 1, not nn. For a frequency table with kk values,
sn−12=∑i=1kfi(xi−xˉ)2n−1=nn−1 sn2,where n=∑i=1kfis_{n-1}^2 = \frac{\sum_{i=1}^{k} f_i(x_i - \bar{x})^2}{n - 1} = \frac{n}{n - 1}\,s_n^2, \qquad \text{where } n = \sum_{i=1}^{k} f_i

Here sn2s_n^2 is the variance of the sample itself (dividing by nn). The sample’s values sit a little closer to their own mean xˉ\bar{x} than to the true μ\mu, so sn2s_n^2 tends to underestimate σ2\sigma^2; multiplying by nn−1\dfrac{n}{n-1} corrects this. (See standard deviation for the same idea.)

On a GDC’s one-variable statistics screen, σx\sigma x (or σx\sigma_x) is sns_n and SxSx (or sxs_x) is sn−1s_{n-1}. Proving that E(Xˉ)=μE(\bar{X}) = \mu and E(Sn−12)=σ2E(S_{n-1}^2) = \sigma^2 is not examined, but practice question 9 shows the first one.

The midday temperature in a city in May, XX in °C, has E(X)=20E(X) = 20 and Var(X)=9\mathrm{Var}(X) = 9. The temperature in °F is F=1.8X+32F = 1.8X + 32. Find E(F)E(F), Var(F)\mathrm{Var}(F), and the standard deviation of FF.

Solution.

E(F)=1.8E(X)+32=1.8(20)+32=68 °FE(F) = 1.8E(X) + 32 = 1.8(20) + 32 = 68 \text{ °F} Var(F)=1.82 Var(X)=3.24(9)=29.16\mathrm{Var}(F) = 1.8^2\,\mathrm{Var}(X) = 3.24(9) = 29.16

The standard deviation is 29.16=5.4\sqrt{29.16} = 5.4 °F. Check: the standard deviation of XX is 33, and 1.8×3=5.41.8 \times 3 = 5.4. The +32+32 moves the mean but has no effect on the spread.

At a café, the number of coffees sold in an hour, XX, has E(X)=30E(X) = 30 and Var(X)=16\mathrm{Var}(X) = 16. The number of muffins sold, YY, has E(Y)=12E(Y) = 12 and Var(Y)=9\mathrm{Var}(Y) = 9. Assume XX and YY are independent. Coffees cost $4 and muffins cost $3.

  • (a) Find the mean and standard deviation of the hourly revenue R=4X+3YR = 4X + 3Y, in dollars.
  • (b) Find the mean and variance of X−YX - Y, the number of coffees sold minus the number of muffins.

Solution.

(a) The mean:

E(R)=4E(X)+3E(Y)=4(30)+3(12)=156E(R) = 4E(X) + 3E(Y) = 4(30) + 3(12) = 156

The variance (independent, so the variances add with squared coefficients):

Var(R)=42 Var(X)+32 Var(Y)=16(16)+9(9)=337\begin{aligned} \mathrm{Var}(R) &= 4^2\,\mathrm{Var}(X) + 3^2\,\mathrm{Var}(Y) \\ &= 16(16) + 9(9) \\ &= 337 \end{aligned}

So the mean revenue is $156 and the standard deviation is 337=18.357…\sqrt{337} = 18.357\ldots, which is $18.4 to 3 s.f.

(b) E(X−Y)=30−12=18E(X - Y) = 30 - 12 = 18, and

Var(X−Y)=Var(X)+Var(Y)=16+9=25\mathrm{Var}(X - Y) = \mathrm{Var}(X) + \mathrm{Var}(Y) = 16 + 9 = 25

The variances add even though the variables are subtracted.

Example 3: Six apples or six times one apple?

Section titled “Example 3: Six apples or six times one apple?”

The mass of an apple from an orchard, XX grams, has E(X)=150E(X) = 150 and Var(X)=100\mathrm{Var}(X) = 100.

  • (a) Six apples are chosen at random. Find the mean and standard deviation of their total mass TT.
  • (b) Find the mean and standard deviation of 6X6X.

Solution.

(a) T=X1+X2+⋯+X6T = X_1 + X_2 + \dots + X_6, where the XiX_i are independent and each has the same distribution as XX.

E(T)=6(150)=900 g,Var(T)=6(100)=600E(T) = 6(150) = 900 \text{ g}, \qquad \mathrm{Var}(T) = 6(100) = 600

The standard deviation is 600=24.5\sqrt{600} = 24.5 g (3 s.f.).

(b) 6X6X is one apple’s mass multiplied by 66:

E(6X)=6(150)=900 g,Var(6X)=62(100)=3600E(6X) = 6(150) = 900 \text{ g}, \qquad \mathrm{Var}(6X) = 6^2(100) = 3600

The standard deviation is 3600=60\sqrt{3600} = 60 g.

The means agree, but the total of six real apples is much less spread out (24.524.5 g compared with 6060 g), because heavier and lighter apples balance each other.

Example 4: Unbiased estimates from a frequency table

Section titled “Example 4: Unbiased estimates from a frequency table”

A random sample of 2020 hockey games recorded the number of goals scored by the home team.

Goals, xx0011223344
Frequency, ff5588442211

Find unbiased estimates of the population mean and variance.

Solution. Here n=5+8+4+2+1=20n = 5 + 8 + 4 + 2 + 1 = 20.

xˉ=0(5)+1(8)+2(4)+3(2)+4(1)20=2620=1.3\bar{x} = \frac{0(5) + 1(8) + 2(4) + 3(2) + 4(1)}{20} = \frac{26}{20} = 1.3

Now the sum of squared deviations:

∑f(x−xˉ)2=5(−1.3)2+8(−0.3)2+4(0.7)2+2(1.7)2+1(2.7)2=8.45+0.72+1.96+5.78+7.29=24.2\begin{aligned} \sum f(x - \bar{x})^2 &= 5(-1.3)^2 + 8(-0.3)^2 + 4(0.7)^2 + 2(1.7)^2 + 1(2.7)^2 \\ &= 8.45 + 0.72 + 1.96 + 5.78 + 7.29 \\ &= 24.2 \end{aligned} sn−12=24.220−1=1.27 (3 s.f.)s_{n-1}^2 = \frac{24.2}{20 - 1} = 1.27 \text{ (3 s.f.)}

The unbiased estimate of μ\mu is 1.31.3 goals and of σ2\sigma^2 is 1.271.27.

Check with the GDC: entering the table into one-variable statistics gives σx=1.1\sigma x = 1.1, so sn2=1.21s_n^2 = 1.21, and 2019(1.21)=1.2736…\dfrac{20}{19}(1.21) = 1.2736\ldots, which matches. (Sx=1.1286…Sx = 1.1286\ldots, and Sx2Sx^2 gives the same value.)

Adding standard deviations. If XX has standard deviation 33 and YY has standard deviation 44, the standard deviation of X+YX + Y (independent) is 9+16=5\sqrt{9 + 16} = 5, not 77. Always combine variances, then take the square root.

Subtracting variances. Var(X−Y)=Var(X)+Var(Y)\mathrm{Var}(X - Y) = \mathrm{Var}(X) + \mathrm{Var}(Y). If you subtract, you can even end up with a negative “variance”, which is impossible.

Forgetting to square the coefficient. Var(3X)=9 Var(X)\mathrm{Var}(3X) = 9\,\mathrm{Var}(X), not 3 Var(X)3\,\mathrm{Var}(X). And Var(X+5)=Var(X)\mathrm{Var}(X + 5) = \mathrm{Var}(X): the constant disappears.

Mixing up nX and the sum of n values. “The total mass of 44 bags” is X1+X2+X3+X4X_1 + X_2 + X_3 + X_4, with variance 4 Var(X)4\,\mathrm{Var}(X). “Four times the mass of one bag” is 4X4X, with variance 16 Var(X)16\,\mathrm{Var}(X). Ask yourself: is it one random value or several?

Using the variance rule without independence. The rule for adding variances only works for independent variables. Means always combine, but if the variables are linked (for example, the number of hot dogs and the number of buns sold), you can’t just add the variances.

Using the wrong standard deviation from the GDC. To estimate the population variance from a sample, use SxSx (sn−1s_{n-1}), not σx\sigma x (sns_n). Square it to get sn−12s_{n-1}^2.

1. (Warm-up) A random variable XX has E(X)=5E(X) = 5 and Var(X)=4\mathrm{Var}(X) = 4. Find:

  • (a) E(3X−2)E(3X - 2)
  • (b) Var(3X−2)\mathrm{Var}(3X - 2)
  • (c) Var(7−X)\mathrm{Var}(7 - X)
Solution

(a) E(3X−2)=3(5)−2=13E(3X - 2) = 3(5) - 2 = 13

(b) Var(3X−2)=32(4)=36\mathrm{Var}(3X - 2) = 3^2(4) = 36

(c) Var(7−X)=(−1)2(4)=4\mathrm{Var}(7 - X) = (-1)^2(4) = 4

2. (Warm-up) XX and YY are independent with E(X)=10E(X) = 10, Var(X)=3\mathrm{Var}(X) = 3, E(Y)=6E(Y) = 6, and Var(Y)=2\mathrm{Var}(Y) = 2. Find:

  • (a) E(X−Y)E(X - Y) and Var(X−Y)\mathrm{Var}(X - Y)
  • (b) E(2X+3Y)E(2X + 3Y) and Var(2X+3Y)\mathrm{Var}(2X + 3Y)
Solution

(a) E(X−Y)=10−6=4E(X - Y) = 10 - 6 = 4 and Var(X−Y)=3+2=5\mathrm{Var}(X - Y) = 3 + 2 = 5.

(b) E(2X+3Y)=2(10)+3(6)=38E(2X + 3Y) = 2(10) + 3(6) = 38 and

Var(2X+3Y)=4(3)+9(2)=30\mathrm{Var}(2X + 3Y) = 4(3) + 9(2) = 30

3. (Warm-up) A random sample of 1010 values has sn=2.4s_n = 2.4. Find an unbiased estimate of the population variance.

Solutionsn−12=nn−1 sn2=109(2.4)2=109(5.76)=6.4s_{n-1}^2 = \frac{n}{n - 1}\,s_n^2 = \frac{10}{9}(2.4)^2 = \frac{10}{9}(5.76) = 6.4

4. (Core) Mia walks to the bus stop and then takes the bus to school. Her walking time WW has mean 1212 minutes and standard deviation 22 minutes. Her bus time BB has mean 2525 minutes and standard deviation 44 minutes. WW and BB are independent.

  • (a) Find the mean and standard deviation of her total travel time.
  • (b) Explain why the standard deviation is not 2+4=62 + 4 = 6 minutes.
Solution

(a) E(W+B)=12+25=37E(W + B) = 12 + 25 = 37 minutes. Var(W+B)=22+42=20\mathrm{Var}(W + B) = 2^2 + 4^2 = 20, so the standard deviation is 20=4.47\sqrt{20} = 4.47 minutes (3 s.f.).

(b) Variances add for independent variables, not standard deviations. A slow walk and a fast bus ride (or the other way round) often partly cancel, so the total is less spread out than 66 minutes would suggest.

5. (Core) The mass of a bag of sugar, XX grams, has mean 10001000 g and standard deviation 55 g.

  • (a) Three bags are chosen at random. Find the mean and standard deviation of their total mass.
  • (b) Find the mean and standard deviation of 3X3X.
  • (c) Two bags are chosen at random. Find the mean and standard deviation of the difference between their masses, X1−X2X_1 - X_2.
Solution

(a) Total =X1+X2+X3= X_1 + X_2 + X_3: mean 3(1000)=30003(1000) = 3000 g, variance 3(52)=753(5^2) = 75, standard deviation 75=8.66\sqrt{75} = 8.66 g (3 s.f.).

(b) Mean 3(1000)=30003(1000) = 3000 g, variance 32(52)=2253^2(5^2) = 225, standard deviation 1515 g.

(c) E(X1−X2)=1000−1000=0E(X_1 - X_2) = 1000 - 1000 = 0 g. Var(X1−X2)=25+25=50\mathrm{Var}(X_1 - X_2) = 25 + 25 = 50, so the standard deviation is 50=7.07\sqrt{50} = 7.07 g (3 s.f.). The mean difference is 00, but the difference still varies, and the variances add.

6. (Core) In a game, the score XX has this probability distribution.

xx0011223344
P(X=x)P(X = x)0.10.10.20.20.30.30.30.30.10.1
  • (a) Use your GDC to show that E(X)=2.1E(X) = 2.1 and Var(X)=1.29\mathrm{Var}(X) = 1.29.
  • (b) A player wins $5 for each point scored but pays $8 to play, so their profit is P=5X−8P = 5X - 8 dollars. Find E(P)E(P) and Var(P)\mathrm{Var}(P).
  • (c) The player plays 1010 independent games. Find the mean and standard deviation of their total profit.
Solution

(a) Enter the values as a list and the probabilities as frequencies in one-variable statistics: xˉ=2.1\bar{x} = 2.1 and σx=1.1357…\sigma x = 1.1357\ldots, so Var(X)=σx2=1.29\mathrm{Var}(X) = \sigma x^2 = 1.29. (By hand: E(X2)=0.2+1.2+2.7+1.6=5.7E(X^2) = 0.2 + 1.2 + 2.7 + 1.6 = 5.7, and 5.7−2.12=1.295.7 - 2.1^2 = 1.29.)

(b) E(P)=5(2.1)−8=2.5E(P) = 5(2.1) - 8 = 2.5, so the mean profit is $2.50 per game. Var(P)=52(1.29)=32.25\mathrm{Var}(P) = 5^2(1.29) = 32.25.

(c) The total is P1+P2+⋯+P10P_1 + P_2 + \dots + P_{10} (ten independent games, not 10P10P). The mean is 10(2.5)=2510(2.5) = 25, so $25. The variance is 10(32.25)=322.510(32.25) = 322.5, so the standard deviation is 322.5=17.96…\sqrt{322.5} = 17.96\ldots, which is $18.0 (3 s.f.).

7. (Core) A random sample of 99 pumpkins from a farm has these masses, in kilograms: 4.8,5.3,5.1,4.6,5.0,5.4,4.9,5.2,5.54.8, 5.3, 5.1, 4.6, 5.0, 5.4, 4.9, 5.2, 5.5. Find unbiased estimates of the population mean and variance.

Solution

The sum is 45.845.8, so

xˉ=45.89=5.0888…=5.09 (3 s.f.)\bar{x} = \frac{45.8}{9} = 5.0888\ldots = 5.09 \text{ (3 s.f.)}

From the GDC, Sx=0.29344…Sx = 0.29344\ldots, so

sn−12=0.29344…2=0.0861 (3 s.f.)s_{n-1}^2 = 0.29344\ldots^2 = 0.0861 \text{ (3 s.f.)}

Check: σx2=sn2=0.076543…\sigma x^2 = s_n^2 = 0.076543\ldots, and 98(0.076543…)=0.086111…\dfrac{9}{8}(0.076543\ldots) = 0.086111\ldots, which matches.

8. (Challenge) Test scores XX have mean 5050 and standard deviation 88. A teacher rescales them with Y=aX+bY = aX + b, where a>0a \gt 0, so that the new scores have mean 7070 and standard deviation 1010. Find aa and bb, and find the new score of a student who scored 5858.

Solution

The standard deviation is multiplied by aa (since a>0a \gt 0), so 8a=108a = 10 and a=1.25a = 1.25.

The mean: 1.25(50)+b=701.25(50) + b = 70, so b=70−62.5=7.5b = 70 - 62.5 = 7.5.

The new score for 5858 is 1.25(58)+7.5=801.25(58) + 7.5 = 80. Check: 5858 was one standard deviation above the old mean, and 8080 is one standard deviation above the new mean.

9. (Challenge) X1,X2,…,XnX_1, X_2, \dots, X_n are independent, and each has mean μ\mu and variance σ2\sigma^2. The sample mean is Xˉ=X1+X2+⋯+Xnn\bar{X} = \dfrac{X_1 + X_2 + \dots + X_n}{n}.

  • (a) Show that E(Xˉ)=μE(\bar{X}) = \mu and Var(Xˉ)=σ2n\mathrm{Var}(\bar{X}) = \dfrac{\sigma^2}{n}.
  • (b) A population has σ=4\sigma = 4. How large must a sample be for the standard deviation of Xˉ\bar{X} to be at most 0.50.5?
Solution

(a) Write Xˉ=1nX1+1nX2+⋯+1nXn\bar{X} = \dfrac{1}{n}X_1 + \dfrac{1}{n}X_2 + \dots + \dfrac{1}{n}X_n. Then

E(Xˉ)=1nμ+1nμ+⋯+1nμ=n⋅μn=μE(\bar{X}) = \frac{1}{n}\mu + \frac{1}{n}\mu + \dots + \frac{1}{n}\mu = n \cdot \frac{\mu}{n} = \mu

so Xˉ\bar{X} is an unbiased estimate of μ\mu. Using independence,

Var(Xˉ)=1n2σ2+⋯+1n2σ2=n⋅σ2n2=σ2n\mathrm{Var}(\bar{X}) = \frac{1}{n^2}\sigma^2 + \dots + \frac{1}{n^2}\sigma^2 = n \cdot \frac{\sigma^2}{n^2} = \frac{\sigma^2}{n}

(b) The standard deviation of Xˉ\bar{X} is σn=4n\dfrac{\sigma}{\sqrt{n}} = \dfrac{4}{\sqrt{n}}.

4n≤0.5⇒n≥8⇒n≥64\frac{4}{\sqrt{n}} \le 0.5 \quad\Rightarrow\quad \sqrt{n} \ge 8 \quad\Rightarrow\quad n \ge 64

The sample must have at least 6464 values. Larger samples give more precise means; see the central limit theorem.