Combining Random Variables

Combining random variables means finding the mean and standard deviation of a sum or difference like X + Y or X − Y. The mean of a sum or difference is the sum or difference of the means. For independent random variables, the variances add, for sums and for differences. Then take the square root to get the standard deviation.

Before this lesson: Expected Value, Transforming Data and Independent Events

Why the variances add

Suppose a commute has two parts: a walk to the bus and a bus ride. Each part varies from day to day. On some days both parts run long, and on others both run short. So the total time varies more than either part alone.

The same thing happens with a difference. If you subtract one random amount from another, the extra randomness never cancels out. That is why the variances add even for X − Y.

The standard deviations do not add, though. Variances add, so standard deviations combine like the sides of a right triangle, as in the Pythagorean theorem.

A right triangle with legs labeled sigma X equals 6 and sigma Y equals 8, and hypotenuse labeled sigma of X minus Y equals 10. A note says 6 squared plus 8 squared equals 10 squared, so 36 plus 64 equals 100. The hypotenuse, 10, is shorter than 6 plus 8, which is 14.
Variances add (36 + 64 = 100), so the standard deviation of the difference is 10, not 6 + 8 = 14.

Rules for combining random variables

Linear transformation. If Y = a + bX, adding a constant shifts the mean but not the spread. Multiplying by b scales both:

\mu_Y = a + b\mu_X
\sigma_Y = |b|\,\sigma_X

Sums and differences. For any random variables X and Y, the means combine directly:

\mu_{X + Y} = \mu_X + \mu_Y \qquad \mu_{X - Y} = \mu_X - \mu_Y

If X and Y are independent, which means knowing one tells you nothing about the other, the variances add:

\sigma^2_{X \pm Y} = \sigma^2_X + \sigma^2_Y
\sigma_{X \pm Y} = \sqrt{\sigma^2_X + \sigma^2_Y}

If X and Y are not independent, the mean rules still hold, but the variance rule does not.

Combining random variables examples

Example 1: A linear transformation

A tutor’s number of sessions per week, X, has mean 12 and standard deviation 3 (example data). She earns $25 per session and pays a $40 weekly app fee. Her weekly profit is Y = 25X - 40. Find the mean and the standard deviation of Y.

\mu_Y = 25\mu_X - 40

Use the mean rule with b = 25 and a = −40.

\mu_Y = 25(12) - 40

Substitute the mean.

= 300 - 40

Multiply.

= 260

Subtract.

\sigma_Y = |25|\sigma_X

The fee shifts every value by the same amount, so it does not change the spread (see absolute value).

\sigma_Y = 25(3)

Substitute.

= 75

Multiply.

Answer: \mu_Y = \$260 and \sigma_Y = \$75. The $40 fee lowers the mean but leaves the standard deviation alone.

Example 2: Mean and standard deviation of a sum

The walk to a bus stop, X, has mean 8 minutes and standard deviation 2 minutes. The bus ride, Y, has mean 20 minutes and standard deviation 4 minutes. The two times are independent. Find the mean and standard deviation of the total time T = X + Y.

\mu_T = 8 + 20

Add the means.

= 28

Add.

\sigma^2_T = 2^2 + 4^2

The times are independent, so add the variances.

= 4 + 16

Square each standard deviation (see exponents).

= 20

Add.

\sigma_T = \sqrt{20}

Take the square root (see square roots).

\sigma_T \approx 4.47

Round to the nearest hundredth.

Answer: the total time has mean 28 minutes and standard deviation about 4.47 minutes. Note that 4.47 is less than 2 + 4 = 6.

Example 3: Mean and standard deviation of a difference

Ava’s test scores, A, have mean 85 and standard deviation 6. Ben’s scores, B, have mean 80 and standard deviation 8. Their scores on a test are independent. Let D = A - B. Find the mean and standard deviation of D.

\mu_D = 85 - 80

Subtract the means.

= 5

Subtract.

\sigma^2_D = 6^2 + 8^2

Variances add, even for a difference.

= 36 + 64

Square.

= 100

Add.

\sigma_D = \sqrt{100}

Take the square root.

= 10

Simplify.

Answer: \mu_D = 5 points and \sigma_D = 10 points. On average Ava scores 5 points higher, but the gap varies a lot from test to test. The diagram above shows these numbers.

Example 4: Check the rule with a small distribution

Flip a coin: X = 1 for heads and X = 0 for tails. Separately, flip a second coin: Y = 2 for heads and Y = 0 for tails. Build the distribution of S = X + Y, then check that its mean and variance match the rules.

\mu_X = 0.5, \quad \sigma^2_X = 0.25

X is 0 or 1, each with probability 0.5 (see expected value).

\mu_Y = 1, \quad \sigma^2_Y = 1

Y is 0 or 2, each with probability 0.5.

S = 0, 1, 2, 3

The four outcomes TT, HT, TH, HH give these sums.

P(S = s) = \dfrac{1}{4} \text{ for each}

The coins are independent, so each outcome has probability 0.5 · 0.5.

\mu_S = \dfrac{0 + 1 + 2 + 3}{4} = 1.5

Find the mean of S directly.

0.5 + 1 = 1.5

The mean rule gives the same value.

\sigma^2_S = \dfrac{(-1.5)^2 + (-0.5)^2 + 0.5^2 + 1.5^2}{4}

Find the variance of S directly.

= \dfrac{2.25 + 0.25 + 0.25 + 2.25}{4}

Square each deviation.

= \dfrac{5}{4} = 1.25

Add and divide.

0.25 + 1 = 1.25

The variance rule gives the same value.

Answer: S has mean 1.5 and variance 1.25, which match \mu_X + \mu_Y and \sigma^2_X + \sigma^2_Y.

Example 5: Four boxes versus one box times four (word problem)

Boxes at a warehouse have weights with mean 12 pounds and standard deviation 1.5 pounds, and the weights of different boxes are independent. (a) Find the mean and standard deviation of the total weight of 4 boxes. (b) Compare with 4 times the weight of one box.

\mu_T = 12 + 12 + 12 + 12 = 48

(a) Add the four means.

\sigma^2_T = 4(1.5^2)

Add four equal variances.

= 4(2.25)

Square.

= 9

Multiply.

\sigma_T = \sqrt{9} = 3

Take the square root.

\mu_{4X} = 4(12) = 48

(b) Use the transformation rule with b = 4.

\sigma_{4X} = 4(1.5) = 6

Multiply the standard deviation by 4.

Answer: (a) mean 48 pounds and standard deviation 3 pounds. (b) mean 48 pounds and standard deviation 6 pounds. Four different boxes vary less in total than one box counted four times, because a heavy box and a light box can balance each other.

Common mistakes

MistakeExample of the errorFix
Adding standard deviationsσ for X + Y = 2 + 4 = 6Add the variances: √(4 + 16) ≈ 4.47.
Subtracting variances for a differenceVar(A − B) = 64 − 36 = 28Variances always add: 36 + 64 = 100.
Letting a constant change the spreadσ of 25X − 40 is 25(3) − 40 = 35Adding or subtracting a constant never changes σ, so σ = 75.
Using the variance rule without independenceAdding variances for a person’s height and weightCheck that the variables are independent first.
Treating X₁ + X₂ as 2Xσ of two boxes’ total = 2(1.5) = 3Two different boxes: √(2.25 + 2.25) ≈ 2.12.
Forgetting to square before addingσ = √(2 + 4)Square each σ first: √(2² + 4²).

Related methods

Transforming a data set

The linear transformation rules are the same rules you used for data in transforming data. Adding a constant shifts the center, and multiplying scales both the center and the spread.

Finding probabilities for a sum

These rules give the center and spread of a sum, not its shape. When X and Y are both normal and independent, X + Y is also normal, so you can find probabilities with z-scores, as in percentiles and z-scores. The normal distribution comes in Unit 6. The next lesson, the Binomial Distribution, adds up many independent success-or-failure trials.

Practice problems

  1. X has mean 10 and standard deviation 2. Find the mean and standard deviation of Y = 3X + 5.
  2. X has mean 1.5 and standard deviation 0.5. Find the mean and standard deviation of Y = 2 − 4X.
  3. X and Y are independent, with means 40 and 25 and standard deviations 3 and 4. Find the mean and standard deviation of X + Y.
  4. Use the variables in Problem 3. Find the mean and standard deviation of X − Y.
  5. A city’s daily high temperature C (in °C) has mean 20 and standard deviation 5. Find the mean and standard deviation in °F, using F = 1.8C + 32.
  6. A fair die has mean 3.5 and variance 35/12. Find the mean and standard deviation of the sum of 3 independent rolls.
  7. In the carnival game from Expected Value, the net gain has mean −1 and variance 11. Find the mean and standard deviation of the total net gain for 2 independent games.
  8. A bag of chips holds X grams of chips (mean 283, standard deviation 2). The empty bag weighs Y grams (mean 15, standard deviation 1). X and Y are independent. Find the mean and standard deviation of the total weight.
  9. Is it true that σ for X + Y equals σ for X plus σ for Y? Test it with σ = 3 and 4 for independent X and Y.
  10. An insurance policy’s profit has mean $63 and variance 27,051. Find the mean and standard deviation of the total profit on 2 independent policies.
Show answers

1.

\mu_Y = 3(10) + 5

Use the mean rule.

= 30 + 5

Multiply.

= 35

Add.

\sigma_Y = 3(2) = 6

Multiply the standard deviation by 3; the + 5 does not change it.

Answer: mean 35, standard deviation 6

2.

\mu_Y = 2 - 4(1.5)

Use the mean rule with b = −4.

= 2 - 6

Multiply.

= -4

Subtract.

\sigma_Y = |-4|(0.5)

Use the absolute value of b.

= 4(0.5) = 2

Multiply.

Answer: mean −4, standard deviation 2

3.

\mu = 40 + 25 = 65

Add the means.

\sigma^2 = 3^2 + 4^2 = 9 + 16

Add the variances.

= 25

Add.

\sigma = \sqrt{25} = 5

Take the square root.

Answer: mean 65, standard deviation 5

4.

\mu = 40 - 25 = 15

Subtract the means.

\sigma^2 = 9 + 16 = 25

Variances still add.

\sigma = \sqrt{25} = 5

Take the square root.

Answer: mean 15, standard deviation 5

5.

\mu_F = 1.8(20) + 32

Use the mean rule.

= 36 + 32

Multiply.

= 68

Add.

\sigma_F = 1.8(5) = 9

Multiply the standard deviation by 1.8.

Answer: mean 68 °F, standard deviation 9 °F

6.

\mu = 3.5 + 3.5 + 3.5 = 10.5

Add the three means.

\sigma^2 = 3 \cdot \dfrac{35}{12} = \dfrac{35}{4}

Add three equal variances.

\dfrac{35}{4} = 8.75

Divide.

\sigma = \sqrt{8.75} \approx 2.96

Take the square root.

Answer: mean 10.5, standard deviation about 2.96

7.

\mu = -1 + (-1) = -2

Add the means.

\sigma^2 = 11 + 11 = 22

Add the variances.

\sigma = \sqrt{22} \approx 4.69

Take the square root.

Answer: mean −$2, standard deviation about $4.69

8.

\mu = 283 + 15 = 298

Add the means.

\sigma^2 = 2^2 + 1^2 = 4 + 1

Square and add the variances.

= 5

Add.

\sigma = \sqrt{5} \approx 2.24

Take the square root.

Answer: mean 298 g, standard deviation about 2.24 g

9.

3 + 4 = 7

The sum of the standard deviations.

\sqrt{3^2 + 4^2} = \sqrt{25} = 5

The correct standard deviation of X + Y.

Answer: no; the correct value is 5, not 7

10.

\mu = 63 + 63 = 126

Add the means.

\sigma^2 = 27051 + 27051 = 54102

Add the variances.

\sigma = \sqrt{54102} \approx 232.60

Take the square root.

Answer: mean $126, standard deviation about $232.60

Combining random variables FAQ

Why do you add variances when you subtract random variables?

Subtracting a random amount adds its uncertainty instead of removing it. The difference can be far off in either direction, so its spread grows, and the variances add.

Can you add standard deviations?

No. Add the variances, then take the square root. The result is always less than the sum of the standard deviations when both are positive.

Do random variables have to be independent to add the means?

No. The means add for any random variables. Only the variance rule needs independence.

What is the difference between 2X and X + X?

2X doubles one outcome, so its standard deviation is 2σ. The sum of two independent copies, X₁ + X₂, has standard deviation √2 · σ, which is smaller.

Summary

  • For Y = a + bX: \mu_Y = a + b\mu_X and \sigma_Y = |b|\sigma_X.
  • Means always add or subtract: \mu_{X \pm Y} = \mu_X \pm \mu_Y.
  • For independent X and Y, variances add for sums and differences: \sigma^2_{X \pm Y} = \sigma^2_X + \sigma^2_Y.
  • Never add standard deviations; add variances, then take the square root.
  • The sum of several independent values varies less than one value times a constant.

Previous lesson: Expected Value

Next lesson: Binomial Distribution

Back to the Statistics Index