5.04a, 5.04b - Combining random variables

5.04a, 5.04b - Combining random variables

Combine means and variances without confusing a sum of separate observations with a multiple of one observation. In 5.04a you will calculate the expectation and variance of linear combinations; in 5.04b you will use exact normal distributions to find probabilities for totals, differences and comparisons.

The expectation of a combination

Three independent positioning errors each have distribution N(0,22)\mathrm{N}(0, 2^2), with errors measured in millimetres. Is adding the three errors just as risky as tripling one of them? Both answers have mean zero, but one is much more spread out. By the end of this lesson you will calculate the probability that each exceeds 6 mm6\,\mathrm{mm}.

Start with what happens to the average. If two random costs have means 1212 and 77 pounds, buying twice the first and three times the second, then adding a fixed charge of 55 pounds, gives mean cost 2(12)+3(7)+5=502(12) + 3(7) + 5 = 50 pounds. You can calculate that mean even if the two costs tend to rise together.

You already know

E(X)\mathrm{E}(X) is the expectation, or population mean, of XX. The variance is Var(X)=E((X−E(X))2)\mathrm{Var}(X) = \mathrm{E}\big((X - \mathrm{E}(X))^2\big), and the standard deviation is its positive square root. These definitions apply to both discrete and continuous variables.

The variable describing the total is built by multiplying variables by constants and adding them.

Linear combination

A linear combination of random variables XX and YY, with a possible fixed offset, has the form aX+bY+caX + bY + c, where aa, bb and cc are real constants. For example, 2X−3Y+52X - 3Y + 5 is a linear combination. Neither XYXY nor X/YX/Y is a linear combination.

Expectation respects the additions and constant multiples in that expression. In a discrete model, multiplying every possible value by aa multiplies its weighted average by aa. Adding the weighted averages of two variables gives the weighted average of their sum, even when their values are connected. The corresponding integral argument works for continuous variables.

Expectation of a linear combination

For random variables with finite expectations and real constants aa, bb and cc,

E(aX+bY+c)=aE(X)+bE(Y)+c\mathrm{E}(aX + bY + c) = a\mathrm{E}(X) + b\mathrm{E}(Y) + c

Independence is not required. This includes sums and differences, and the special case E(aX+c)=aE(X)+c\mathrm{E}(aX + c) = a\mathrm{E}(X) + c.

In the formula booklet.

Keep the signs of the coefficients: subtracting a variable subtracts its expectation.

Worked example 1: a total with a fixed charge

Question. The random variables XX and YY have expectations 1212 and 77. Find E(2X+3Y+5)\mathrm{E}(2X + 3Y + 5).

Plan. Replace each variable by its expectation, keeping the coefficients and the fixed charge.

E(2X+3Y+5)=2E(X)+3E(Y)+5linearity=2(12)+3(7)+5substitute means=50add\begin{aligned} \mathrm{E}(2X + 3Y + 5) &= 2\mathrm{E}(X) + 3\mathrm{E}(Y) + 5 && \text{linearity} \\ &= 2(12) + 3(7) + 5 && \text{substitute means} \\ &= 50 && \text{add} \end{aligned}

Why this step? The fixed charge is paid every time, so its whole value belongs in the mean.

Answer. E(2X+3Y+5)=50\mathrm{E}(2X + 3Y + 5) = 50.

Check. The variable part has mean 24+21=4524 + 21 = 45; the fixed charge raises it to 5050.

Worked example 2 changes only the sign of the coefficient of YY. The same expectation rule handles the resulting difference.

Worked example 2: subtracting a random cost

Question. The random variables XX and YY still have expectations 1212 and 77. Find E(2X−3Y+5)\mathrm{E}(2X - 3Y + 5).

Plan. Apply the expectation rule with coefficient −3-3 for YY.

E(2X−3Y+5)=2E(X)−3E(Y)+5keep the minus sign=24−21+5substitute means=8simplify\begin{aligned} \mathrm{E}(2X - 3Y + 5) &= 2\mathrm{E}(X) - 3\mathrm{E}(Y) + 5 && \text{keep the minus sign} \\ &= 24 - 21 + 5 && \text{substitute means} \\ &= 8 && \text{simplify} \end{aligned}

Why this step? Expectation is an average signed value. A deduction reduces that average; it is not a measure of spread.

Answer. E(2X−3Y+5)=8\mathrm{E}(2X - 3Y + 5) = 8.

Check. Changing +3Y+3Y to −3Y-3Y subtracts 6Y6Y, so the mean falls by 6(7)=426(7) = 42: 50−42=850 - 42 = 8.

A mean describes the centre. The next part will show why the calculation for spread treats that minus sign differently.

Watch out

Wrong: “The means can be added only if the variables are independent.” Right: E(X+Y)=E(X)+E(Y)\mathrm{E}(X + Y) = \mathrm{E}(X) + \mathrm{E}(Y) whenever the expectations exist. Independence will matter for the variance rule, not for this expectation rule.

Try a different combination and state whether its mean needs an independence assumption.

The variance of a combination

The independent variance rule extends one-variable coding to combinations of two distinct random variables.

You already know

For a single variable with finite variance, Var(aX+c)=a2Var(X)\mathrm{Var}(aX + c) = a^2\mathrm{Var}(X): a scale factor multiplies squared deviations by a2a^2, and a shift changes no deviations. Its standard deviation is multiplied by ∣a∣|a|. These one-variable coding results are included in the booklet's expectation algebra.

For independent variables, the scaled variance contributions add. To see where independence enters, consider the deviation of aX+bYaX + bY from its mean:

a(X−E(X))+b(Y−E(Y))a(X - \mathrm{E}(X)) + b(Y - \mathrm{E}(Y))

Squaring produces the two individual squared deviations and a mixed product. Independence makes the expectation of that mixed product zero, because each individual deviation has expectation zero. Without independence the mixed product need not disappear, and you cannot use the following rule without further information.

Variance of an independent combination

If XX and YY are independent, with finite variances, then for real constants aa, bb and cc,

Var(aX+bY+c)=a2Var(X)+b2Var(Y)\mathrm{Var}(aX + bY + c) = a^2\mathrm{Var}(X) + b^2\mathrm{Var}(Y)

In particular,

Var(aX+c)=a2Var(X)Var(X+Y)=Var(X)+Var(Y)Var(X−Y)=Var(X)+Var(Y)\begin{aligned} \mathrm{Var}(aX + c) &= a^2\mathrm{Var}(X) \\ \mathrm{Var}(X + Y) &= \mathrm{Var}(X) + \mathrm{Var}(Y) \\ \mathrm{Var}(X - Y) &= \mathrm{Var}(X) + \mathrm{Var}(Y) \end{aligned}

The one-variable result needs no independence assumption. A constant has variance zero.

In the formula booklet.

Square each coefficient before multiplying by its variance. Keep the mean calculation on a separate line if the question asks for both.

Worked example 3: scaling before adding variances

Question. Independent random variables XX and YY have variances 44 and 99. Find Var(2X+3Y+5)\mathrm{Var}(2X + 3Y + 5).

Plan. Square the two coefficients, add the independent variance contributions, and omit the fixed offset.

Var(2X+3Y+5)=22Var(X)+32Var(Y)independence=4(4)+9(9)square coefficients=97add contributions\begin{aligned} \mathrm{Var}(2X + 3Y + 5) &= 2^2\mathrm{Var}(X) + 3^2\mathrm{Var}(Y) && \text{independence} \\ &= 4(4) + 9(9) && \text{square coefficients} \\ &= 97 && \text{add contributions} \end{aligned}

Why this step? The offset 55 shifts the whole distribution; it creates no additional variation.

Answer. Var(2X+3Y+5)=97\mathrm{Var}(2X + 3Y + 5) = 97.

Check. The standard deviations of 2X2X and 3Y3Y are 44 and 99. Their squared values add to 16+81=9716 + 81 = 97; their standard deviations do not add.

Worked example 4 changes only +3Y+3Y to −3Y-3Y. This changes the mean, but leaves the variance unchanged because (−3)2=32(-3)^2 = 3^2.

Worked example 4: the spread of a difference

Question. Independent random variables XX and YY still have variances 44 and 99. Find Var(2X−3Y+5)\mathrm{Var}(2X - 3Y + 5).

Plan. Use the same independent variance rule, this time with coefficient −3-3.

Var(2X−3Y+5)=22Var(X)+(−3)2Var(Y)independence=16+81(−3)2=9=97add\begin{aligned} \mathrm{Var}(2X - 3Y + 5) &= 2^2\mathrm{Var}(X) + (-3)^2\mathrm{Var}(Y) && \text{independence} \\ &= 16 + 81 && (-3)^2 = 9 \\ &= 97 && \text{add} \end{aligned}

Why this step? Subtracting YY reverses the direction of its fluctuations. It does not remove them.

Answer. Var(2X−3Y+5)=97\mathrm{Var}(2X - 3Y + 5) = 97.

Check. Both 3Y3Y and −3Y-3Y have standard deviation 99, so they contribute the same variance.

There is a striking consequence. For two independent fair dice, each with variance 35/1235/12, the sum and the difference both have variance 35/635/6, although their means are 77 and 00. Moving the centre and changing the spread are different jobs.

Watch out

Wrong: Var(X−Y)=Var(X)−Var(Y)\mathrm{Var}(X - Y) = \mathrm{Var}(X) - \mathrm{Var}(Y) for independent variables. Right: the coefficient of YY is −1-1, whose square is 11, so the variances add. Also check independence: X−X=0X - X = 0 has variance zero, so treating the two appearances of the same non-constant variable as independent would give a false answer.

In the next check, the supplied quantities are standard deviations. Convert them to variances before combining them.

Separate observations or one multiple

Writing X1+X2+X3X_1 + X_2 + X_3 means adding three observations; writing 3X3X means taking one observation and tripling it. Equal means do not make those variables interchangeable.

Suppose R1R_1, R2R_2 and R3R_3 are the scores on three independent fair dice, each with mean 7/27/2 and variance 35/1235/12. Their total has mean 21/221/2 and variance

Var(R1+R2+R3)=3(3512)=354\mathrm{Var}(R_1 + R_2 + R_3) = 3\left(\frac{35}{12}\right) = \frac{35}{4}

By contrast, rolling one fair die RR and tripling its score gives mean 21/221/2 but variance

Var(3R)=32(3512)=1054\mathrm{Var}(3R) = 3^2\left(\frac{35}{12}\right) = \frac{105}{4}

In the first experiment a high score can be balanced by a low score on another die. In the second, all three copies of the score rise and fall together. The possible outcomes even reveal the difference: three dice can total 44, whereas three times one die cannot.

Independent observations

Independent observations X1,…,XnX_1, \ldots, X_n from the same distribution are separate random variables with that common distribution, whose outcomes are mutually independent. Reusing one observed value several times does not create independent observations.

Repeated use of the two-variable rules gives a compact way to keep the experiments apart.

Totals of independent observations

If X1,…,XnX_1, \ldots, X_n are independent observations, each with mean μ\mu and variance σ2\sigma^2, then

E(X1+⋯+Xn)=nμVar(X1+⋯+Xn)=nσ2\begin{aligned} \mathrm{E}(X_1 + \cdots + X_n) &= n\mu \\ \mathrm{Var}(X_1 + \cdots + X_n) &= n\sigma^2 \end{aligned}

For a single variable XX with those parameters,

E(nX)=nμ,Var(nX)=n2σ2\mathrm{E}(nX) = n\mu, \qquad \mathrm{Var}(nX) = n^2\sigma^2

These are consequences of expectation algebra; the general total formula is not printed separately.

Not in the formula booklet: learn it.

If a total contains several types of observation, add one variance contribution for each independent observation. For example, four independent observations with variance 99 and two further independent observations with variance 1616 give total variance 4(9)+2(16)=684(9) + 2(16) = 68, provided all six observations are independent.

Key idea

Count independent observations once each. Square a coefficient only when it scales the same variable or the same already-defined total.

This distinction is often hidden in the words of a problem. Decide what experiment the words describe before touching the calculator.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account