SA5 - Functions of random variables

SA5 - Functions of random variables

A fixed change to every outcome changes the whole probability distribution. SA5 uses expectation and variance rules for linear changes, then calculates moments of nonlinear functions, including inverse powers. You will see why transforming an average is usually different from averaging transformed outcomes.

Linear changes to mean and variance

If XX is equally likely to be −2-2 or 22, why does X2X^2 have no spread even though XX does? To distinguish linear and nonlinear changes, start with a change that preserves the shape of the distribution.

Suppose Y=2X+5Y=2X+5. Each possible value is doubled, then shifted by 5; its probability stays attached to it. Doubling stretches distances from the mean by 2, while adding 5 moves the outcomes and their mean together, leaving those distances unchanged.

Linear transformation

For real constants a,ba,b and a random variable XX with finite mean and variance,

E(aX+b)=aE(X)+bVar⁡(aX+b)=a2Var⁡(X)SD⁡(aX+b)=∣a∣SD⁡(X)\begin{aligned} E(aX+b)&=aE(X)+b\\ \operatorname{Var}(aX+b)&=a^2\operatorname{Var}(X)\\ \operatorname{SD}(aX+b)&=|a|\operatorname{SD}(X) \end{aligned}

These general transformation formulae are required knowledge and are not printed in the formula booklet. They apply for negative and zero aa too.

Why does the first rule hold? In the weighted sum, ∑(axi+b)pi=a∑xipi+b∑pi=aE(X)+b\sum(ax_i+b)p_i=a\sum x_ip_i+b\sum p_i=aE(X)+b, since the probabilities total 1. For the variance, let μ=E(X)\mu=E(X). Subtracting the transformed mean gives

(aX+b)−(aμ+b)=a(X−μ)(aX+b)-(a\mu+b)=a(X-\mu)

Squaring this deviation introduces a2a^2, proving the variance rule. A negative aa reverses order but still gives nonnegative squared distances. When a=0a=0, every outcome is bb, with mean bb, variance 0 and standard deviation 0.

Worked example 1: stretch and shift

Question. E(X)=3E(X)=3 and Var⁡(X)=2\operatorname{Var}(X)=2. For Y=2X+5Y=2X+5, find its mean, variance and standard deviation.

Plan. Apply the linear rules, keeping the mean multiplier separate from the squared variance multiplier.

E(Y)=2(3)+5=11Var⁡(Y)=22(2)=8SD⁡(Y)=8=22\begin{aligned} E(Y)&=2(3)+5=11\\ \operatorname{Var}(Y)&=2^2(2)=8\\ \operatorname{SD}(Y)&=\sqrt8=2\sqrt2 \end{aligned}

Answer. Mean 11, variance 8, standard deviation 222\sqrt2.

Check. One distribution with the stated moments has values 1,3,51,3,5 and probabilities 1/4,1/2,1/41/4,1/2,1/4. Its transformed values are 7,11,157,11,15, with mean 11 and mean squared deviation 16/4+0+16/4=816/4+0+16/4=8.

Change only the sign of the multiplier. The mean changes, but the variance does not.

Worked example 2: reversing the outcomes

Question. E(X)=3E(X)=3 and Var⁡(X)=2\operatorname{Var}(X)=2. For Y=−2X+5Y=-2X+5, find its mean, variance and standard deviation.

Plan. Use the signed multiplier in the mean and its square in the variance.

E(Y)=−2(3)+5=−1Var⁡(Y)=(−2)2(2)=8SD⁡(Y)=∣−2∣2=22\begin{aligned} E(Y)&=-2(3)+5=-1\\ \operatorname{Var}(Y)&=(-2)^2(2)=8\\ \operatorname{SD}(Y)&=|-2|\sqrt2=2\sqrt2 \end{aligned}

Answer. Mean −1-1, variance 8, standard deviation 222\sqrt2.

Check. The distribution used for the previous check now gives values 3,−1,−53,-1,-5. Their deviations from −1-1 are 4,0,−44,0,-4, whose squared weighted average is still 8.

If a problem gives standard deviation rather than variance, square it before using the variance rule.

Watch out

Wrong: Var⁡(−2X+5)=−2Var⁡(X)+5\operatorname{Var}(-2X+5)=-2\operatorname{Var}(X)+5. A shift adds no spread, and the multiplier must be squared. Standard deviation uses ∣a∣|a|, never a negative multiplier.

Use these rules with a different multiplier and given standard deviation.

Expectation of a function

A nonlinear change may alter the gaps between outcomes or send several values to the same result. You can still average those results using the original probabilities.

Average the transformed values

For a function gg defined at every possible value with positive probability,

E(g(X))=∑ig(xi)piE(g(X))=\sum_i g(x_i)p_i

For infinite support the expectation must exist; finite support and finite function values are sufficient. This formula is required knowledge and is not printed in the booklet. In general, E(g(X))≠g(E(X))E(g(X))\ne g(E(X)).

You need not construct a new distribution first. If two original values give the same transformed value, both weighted contributions belong in the sum. To construct the new distribution instead, add their probabilities before recording that value once.

Worked example 3: square before averaging

Question. XX has values −1,0,2-1,0,2 with probabilities 1/4,1/2,1/41/4,1/2,1/4. Find E(X2)E(X^2).

Plan. Apply g(x)=x2g(x)=x^2 to each value and use its original probability.

E(X2)=(−1)2(14)+02(12)+22(14)=14+0+1=54\begin{aligned} E(X^2)&=(-1)^2\left(\frac14\right)+0^2\left(\frac12\right)+2^2\left(\frac14\right)\\ &=\frac14+0+1=\frac54 \end{aligned}

Answer. 5/45/4.

Check. X2X^2 takes values 0,1,40,1,4 with probabilities 1/2,1/4,1/41/2,1/4,1/4; averaging this new table also gives 5/45/4.

Keep the distribution and square, then add 3 to the function. This lets the general sum and the linear shift rule check one another.

Worked example 4: shift a nonlinear outcome

Question. For the same XX, find E(X2+3)E(X^2+3).

Plan. Transform every original value using g(x)=x2+3g(x)=x^2+3, then weight.

g(−1)=4,g(0)=3,g(2)=7E(g(X))=4(14)+3(12)+7(14)=174\begin{aligned} g(-1)&=4,\quad g(0)=3,\quad g(2)=7\\ E(g(X))&=4\left(\frac14\right)+3\left(\frac12\right)+7\left(\frac14\right)=\frac{17}{4} \end{aligned}

Answer. 17/417/4.

Check. Treat Z=X2Z=X^2 as the random variable in the linear shift rule: E(Z+3)=E(Z)+3=5/4+3=17/4E(Z+3)=E(Z)+3=5/4+3=17/4.

Here E(X)=1/4E(X)=1/4, so (E(X))2=1/16(E(X))^2=1/16, far from E(X2)=5/4E(X^2)=5/4. Squaring one average loses the separate outcomes that the weighted sum needs.

Watch out

Apply gg to each value, not to each probability. If transformed values coincide, combine their masses rather than deleting a repeated contribution.

Average a new function of new values.

Continue this lesson.

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

Create free account