Skip to content
Family Table Math
Auto

Variance of a Discrete Random Variable

The expected value E(X)E(X) tells you the long-run average of a random variable, but not how much the results vary. Two games can both have an expected payout of $2, one paying exactly $2 every time and the other paying $0 or $20. The variance and standard deviation measure that spread. You’ll also see how they change when every value is scaled or shifted, for example when a prize is doubled or an entry fee is subtracted.

For a discrete random variable XX with mean μ=E(X)\mu = E(X), the variance is the expected squared distance from the mean:

Var(X)=E((X−μ)2)=∑(x−μ)2 P(X=x)\text{Var}(X) = E\big((X - \mu)^2\big) = \sum (x - \mu)^2 \, P(X = x)

The standard deviation is its square root, σ=Var(X)\sigma = \sqrt{\text{Var}(X)}. It’s in the same units as XX, which makes it easier to interpret.

Expanding the square gives a formula that’s usually quicker:

Var(X)=E(X2)−[E(X)]2whereE(X2)=∑x2 P(X=x)\text{Var}(X) = E(X^2) - [E(X)]^2 \qquad \text{where} \qquad E(X^2) = \sum x^2 \, P(X = x)

In words: “the mean of the squares minus the square of the mean.” To use it, add two rows to the probability table, xP(X=x)xP(X = x) and x2P(X=x)x^2P(X = x), and add each row.

Since a variance can’t be negative, E(X2)E(X^2) is always at least [E(X)]2[E(X)]^2. If you get a negative variance, you’ve made an error.

Put the values of xx in one list and the probabilities in another, then run one-variable statistics with the probabilities as the frequency list. The mean xˉ\bar{x} is E(X)E(X), and the population standard deviation σx\sigma_x is the standard deviation of XX (don’t use sxs_x). Square σx\sigma_x for the variance.

If every value of XX is multiplied by aa and then bb is added, the new random variable is aX+baX + b. Then

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

so the standard deviation of aX+baX + b is ∣a∣σ|a|\sigma.

Why? Adding bb slides every value along by the same amount: the centre moves, but the spread doesn’t change. Multiplying by aa stretches every distance from the mean by a factor of ∣a∣|a|, so squared distances are multiplied by a2a^2.

Change to XXEffect on EEEffect on VarEffect on SD
add bbadd bbnonenone
multiply by aamultiply by aamultiply by a2a^2multiply by ∣a∣\lvert a \rvert

For any function gg, E(g(X))=∑g(x)P(X=x)E\big(g(X)\big) = \sum g(x)P(X = x). That’s how E(X2)E(X^2) is defined. Be careful: in general E(X2)≠[E(X)]2E(X^2) \ne [E(X)]^2, and their difference is exactly the variance.

Let XX be the score on a fair six-sided die. Find E(X)E(X), Var(X)\text{Var}(X) and the standard deviation.

Solution. Each value has probability 16\tfrac{1}{6}.

E(X)=1+2+3+4+5+66=216=3.5E(X) = \frac{1 + 2 + 3 + 4 + 5 + 6}{6} = \frac{21}{6} = 3.5 E(X2)=1+4+9+16+25+366=916E(X^2) = \frac{1 + 4 + 9 + 16 + 25 + 36}{6} = \frac{91}{6} Var(X)=916−3.52=916−494=182−14712=3512\text{Var}(X) = \frac{91}{6} - 3.5^2 = \frac{91}{6} - \frac{49}{4} = \frac{182 - 147}{12} = \frac{35}{12}

The variance is 3512≈2.92\dfrac{35}{12} \approx 2.92 and the standard deviation is 35/12≈1.71\sqrt{35/12} \approx 1.71 (3 s.f.).

The random variable XX has this distribution, and E(X)=1.7E(X) = 1.7.

xx00112233
P(X=x)P(X = x)0.10.1ppqq0.20.2

Find pp and qq, then find Var(X)\text{Var}(X) and the standard deviation of XX.

Solution. The probabilities add to 11: 0.1+p+q+0.2=10.1 + p + q + 0.2 = 1, so p+q=0.7p + q = 0.7.

The mean is 1.71.7: 0(0.1)+1p+2q+3(0.2)=1.70(0.1) + 1p + 2q + 3(0.2) = 1.7, so p+2q=1.1p + 2q = 1.1.

Subtracting the equations: q=0.4q = 0.4, and then p=0.3p = 0.3.

E(X2)=02(0.1)+12(0.3)+22(0.4)+32(0.2)=0+0.3+1.6+1.8=3.7E(X^2) = 0^2(0.1) + 1^2(0.3) + 2^2(0.4) + 3^2(0.2) = 0 + 0.3 + 1.6 + 1.8 = 3.7 Var(X)=3.7−1.72=3.7−2.89=0.81\text{Var}(X) = 3.7 - 1.7^2 = 3.7 - 2.89 = 0.81

The standard deviation is 0.81=0.9\sqrt{0.81} = 0.9.

In a fairground game, XX is the number of targets a player hits, with the distribution from Example 2. The player pays $8 to play and wins $5 per target. Let YY be the player’s profit in dollars.

  • (a) Write YY in terms of XX.
  • (b) Find E(Y)E(Y) and the standard deviation of YY.
  • (c) Is the game fair?

Solution.

(a) Y=5X−8Y = 5X - 8.

(b) Using E(X)=1.7E(X) = 1.7 and Var(X)=0.81\text{Var}(X) = 0.81:

E(Y)=5(1.7)−8=0.5Var(Y)=52(0.81)=20.25E(Y) = 5(1.7) - 8 = 0.5 \qquad \text{Var}(Y) = 5^2(0.81) = 20.25

The standard deviation of YY is 20.25=4.5\sqrt{20.25} = 4.5. (Or directly: 5×0.9=4.55 \times 0.9 = 4.5.)

The expected profit is 50 cents per game, with a standard deviation of $4.50.

(c) A game is fair when E(Y)=0E(Y) = 0. Here E(Y)=0.5>0E(Y) = 0.5 \gt 0, so the game is not fair: it favours the player.

The probability distribution of XX is P(X=x)=kxP(X = x) = \dfrac{k}{x} for x=1,2,3x = 1, 2, 3. Find the exact values of kk, E(X)E(X) and Var(X)\text{Var}(X).

Solution. The probabilities add to 11:

k(1+12+13)=11k6=1⇒k=611k\left(1 + \frac{1}{2} + \frac{1}{3}\right) = \frac{11k}{6} = 1 \quad\Rightarrow\quad k = \frac{6}{11}

Notice that x⋅kx=kx \cdot \dfrac{k}{x} = k, so each term of E(X)E(X) is just kk:

E(X)=k+k+k=3k=1811E(X) = k + k + k = 3k = \frac{18}{11} E(X2)=∑x2⋅kx=k(1+2+3)=6k=3611E(X^2) = \sum x^2 \cdot \frac{k}{x} = k(1 + 2 + 3) = 6k = \frac{36}{11} Var(X)=3611−(1811)2=396121−324121=72121\text{Var}(X) = \frac{36}{11} - \left(\frac{18}{11}\right)^2 = \frac{396}{121} - \frac{324}{121} = \frac{72}{121}

(The standard deviation is 6211≈0.771\dfrac{6\sqrt{2}}{11} \approx 0.771.)

Squaring the mean instead of finding the mean of the squares. E(X2)E(X^2) is ∑x2P(X=x)\sum x^2P(X = x), not [E(X)]2[E(X)]^2. In Example 2, E(X2)=3.7E(X^2) = 3.7 but [E(X)]2=2.89[E(X)]^2 = 2.89.

Forgetting to subtract. E(X2)E(X^2) on its own is not the variance. Finish with −[E(X)]2- [E(X)]^2.

Writing Var(aX + b) = aVar(X) + b. Adding a constant doesn’t change the spread, and multiplying by aa multiplies the variance by a2a^2. For Y=5X−8Y = 5X - 8, Var(Y)=25 Var(X)\text{Var}(Y) = 25\,\text{Var}(X), not 5 Var(X)−85\,\text{Var}(X) - 8.

A negative variance or standard deviation. Var(−2X)=4 Var(X)\text{Var}(-2X) = 4\,\text{Var}(X), which is positive, and the standard deviation is 2σ2\sigma, not −2σ-2\sigma. Square aa for the variance; use ∣a∣|a| for the standard deviation.

Mixing up variance and standard deviation. Read which one the question asks for. If you’re given σ=3\sigma = 3, then Var(X)=9\text{Var}(X) = 9.

Using the sample standard deviation on a GDC. For a probability distribution, use σx\sigma_x, not sxs_x.

1. (Warm-up) Find E(X)E(X), Var(X)\text{Var}(X) and the standard deviation of XX.

xx112233
P(X=x)P(X = x)0.20.20.50.50.30.3
SolutionE(X)=0.2+1.0+0.9=2.1E(X2)=0.2+2.0+2.7=4.9E(X) = 0.2 + 1.0 + 0.9 = 2.1 \qquad E(X^2) = 0.2 + 2.0 + 2.7 = 4.9Var(X)=4.9−2.12=4.9−4.41=0.49\text{Var}(X) = 4.9 - 2.1^2 = 4.9 - 4.41 = 0.49

The standard deviation is 0.49=0.7\sqrt{0.49} = 0.7.

2. (Warm-up) E(X)=4E(X) = 4 and Var(X)=9\text{Var}(X) = 9. Find:

  • (a) E(3X−2)E(3X - 2) and Var(3X−2)\text{Var}(3X - 2);
  • (b) E(5−X)E(5 - X) and Var(5−X)\text{Var}(5 - X).
Solution

(a) E(3X−2)=3(4)−2=10E(3X - 2) = 3(4) - 2 = 10. Var(3X−2)=32(9)=81\text{Var}(3X - 2) = 3^2(9) = 81.

(b) 5−X=−X+55 - X = -X + 5, so a=−1a = -1, b=5b = 5. E(5−X)=−4+5=1E(5 - X) = -4 + 5 = 1. Var(5−X)=(−1)2(9)=9\text{Var}(5 - X) = (-1)^2(9) = 9.

3. (Core) P(X=x)=k(x+1)P(X = x) = k(x + 1) for x=0,1,2,3x = 0, 1, 2, 3. Find kk, E(X)E(X) and Var(X)\text{Var}(X).

Solution

k(1+2+3+4)=10k=1k(1 + 2 + 3 + 4) = 10k = 1, so k=0.1k = 0.1. The probabilities are 0.1,0.2,0.3,0.40.1, 0.2, 0.3, 0.4.

E(X)=0+0.2+0.6+1.2=2E(X2)=0+0.2+1.2+3.6=5E(X) = 0 + 0.2 + 0.6 + 1.2 = 2 \qquad E(X^2) = 0 + 0.2 + 1.2 + 3.6 = 5Var(X)=5−22=1\text{Var}(X) = 5 - 2^2 = 1

4. (Core) A fair coin is tossed three times, and XX is the number of heads. Write down the probability distribution of XX, and find E(X)E(X) and Var(X)\text{Var}(X).

Solution
xx00112233
P(X=x)P(X = x)18\tfrac{1}{8}38\tfrac{3}{8}38\tfrac{3}{8}18\tfrac{1}{8}
E(X)=0+3+6+38=128=1.5E(X2)=0+3+12+98=248=3E(X) = \frac{0 + 3 + 6 + 3}{8} = \frac{12}{8} = 1.5 \qquad E(X^2) = \frac{0 + 3 + 12 + 9}{8} = \frac{24}{8} = 3Var(X)=3−1.52=0.75\text{Var}(X) = 3 - 1.5^2 = 0.75

Check: X∼B(3,0.5)X \sim B(3, 0.5), and the binomial formulas give np=1.5np = 1.5 and np(1−p)=0.75np(1 - p) = 0.75. ✓

5. (Core) A game costs $8 to play. You roll a fair die and win twice the score in dollars. Let WW be your profit in dollars.

  • (a) Write WW in terms of the score XX, and find E(W)E(W) and the standard deviation of WW.
  • (b) What should the game cost for it to be fair?
Solution

(a) W=2X−8W = 2X - 8. From Example 1, E(X)=3.5E(X) = 3.5 and Var(X)=3512\text{Var}(X) = \dfrac{35}{12}.

E(W)=2(3.5)−8=−1SD(W)=23512=3.42 (3 s.f.)E(W) = 2(3.5) - 8 = -1 \qquad \text{SD}(W) = 2\sqrt{\frac{35}{12}} = 3.42 \text{ (3 s.f.)}

On average you lose $1 per game.

(b) With a cost of cc dollars, E(2X−c)=7−cE(2X - c) = 7 - c. This is 00 when c=7c = 7, so the game is fair if it costs $7.

6. (Core) The random variable XX has E(X)=0.5E(X) = 0.5 and this distribution.

xx−1-1002255
P(X=x)P(X = x)0.30.3ppqq0.10.1

Find pp and qq, and the standard deviation of XX.

Solution

Mean: −0.3+0+2q+0.5=0.5-0.3 + 0 + 2q + 0.5 = 0.5, so 2q=0.32q = 0.3 and q=0.15q = 0.15. Total: 0.3+p+0.15+0.1=10.3 + p + 0.15 + 0.1 = 1, so p=0.45p = 0.45.

E(X2)=1(0.3)+0+4(0.15)+25(0.1)=0.3+0.6+2.5=3.4E(X^2) = 1(0.3) + 0 + 4(0.15) + 25(0.1) = 0.3 + 0.6 + 2.5 = 3.4Var(X)=3.4−0.52=3.15σ=3.15=1.77 (3 s.f.)\text{Var}(X) = 3.4 - 0.5^2 = 3.15 \qquad \sigma = \sqrt{3.15} = 1.77 \text{ (3 s.f.)}

7. (Core) The daily maximum temperature CC (∘C^\circ\text{C}) in a city in July has mean 2222 and standard deviation 44. The temperature in degrees Fahrenheit is F=1.8C+32F = 1.8C + 32. Find the mean, standard deviation and variance of FF.

SolutionE(F)=1.8(22)+32=71.6SD(F)=1.8(4)=7.2Var(F)=7.22=51.84E(F) = 1.8(22) + 32 = 71.6 \qquad \text{SD}(F) = 1.8(4) = 7.2 \qquad \text{Var}(F) = 7.2^2 = 51.84

(Adding 3232 changes the mean but not the spread.)

8. (Challenge) E(X)=2E(X) = 2 and Var(X)=3\text{Var}(X) = 3.

  • (a) Find E(X2)E(X^2) and E((2X+1)2)E\big((2X + 1)^2\big).
  • (b) Find constants a>0a \gt 0 and bb so that Y=aX+bY = aX + b has E(Y)=0E(Y) = 0 and Var(Y)=1\text{Var}(Y) = 1.
Solution

(a) Var(X)=E(X2)−[E(X)]2\text{Var}(X) = E(X^2) - [E(X)]^2, so E(X2)=3+4=7E(X^2) = 3 + 4 = 7.

E((2X+1)2)=E(4X2+4X+1)=4(7)+4(2)+1=37E\big((2X + 1)^2\big) = E(4X^2 + 4X + 1) = 4(7) + 4(2) + 1 = 37

(b) Var(Y)=a2(3)=1\text{Var}(Y) = a^2(3) = 1, so a=13a = \dfrac{1}{\sqrt{3}} (taking a>0a \gt 0). E(Y)=23+b=0E(Y) = \dfrac{2}{\sqrt{3}} + b = 0, so b=−23b = -\dfrac{2}{\sqrt{3}}.

So Y=X−23Y = \dfrac{X - 2}{\sqrt{3}}: subtract the mean and divide by the standard deviation. That’s standardizing, just like a z-score.

9. (Challenge) XX takes only the values 00 and aa, where a>0a \gt 0, with P(X=a)=pP(X = a) = p. Given that E(X)=2E(X) = 2 and Var(X)=6\text{Var}(X) = 6, find aa and pp.

Solution

E(X)=ap=2E(X) = ap = 2 and E(X2)=a2pE(X^2) = a^2p, so

Var(X)=a2p−(ap)2=a2p(1−p)=6\text{Var}(X) = a^2p - (ap)^2 = a^2p(1 - p) = 6

Write a2p(1−p)=a(ap)(1−p)=2a(1−p)=6a^2p(1 - p) = a(ap)(1 - p) = 2a(1 - p) = 6, so a(1−p)=3a(1 - p) = 3, which means a−ap=3a - ap = 3. Since ap=2ap = 2, a=5a = 5, and then p=25=0.4p = \dfrac{2}{5} = 0.4.

Check: E(X)=5(0.4)=2E(X) = 5(0.4) = 2 and Var(X)=25(0.4)(0.6)=6\text{Var}(X) = 25(0.4)(0.6) = 6. ✓

Try these independently after the practice questions. Show your setup and explain your reasoning. Use exact answers where possible, and check that your answers fit the question. Homework solutions are not provided on the published site.

Give decimal answers to 3 significant figures unless the question says otherwise.

H1. (Foundations) Find E(X)E(X), E(X2)E(X^2), Var(X)\text{Var}(X) and the standard deviation of XX.

xx00112244
P(X=x)P(X = x)0.40.40.30.30.20.20.10.1

H2. (Foundations) A random variable XX has E(X)=6E(X) = 6 and Var(X)=4\text{Var}(X) = 4. Without a calculator, find:

  • (a) E(2X+3)E(2X + 3), Var(2X+3)\text{Var}(2X + 3) and the standard deviation of 2X+32X + 3;
  • (b) E(10−3X)E(10 - 3X), Var(10−3X)\text{Var}(10 - 3X) and the standard deviation of 10−3X10 - 3X;
  • (c) E(X2)E(X^2).

H3. (Core) The random variable XX has this distribution, and E(X)=2.6E(X) = 2.6.

xx11223344
P(X=x)P(X = x)aa0.30.3bb0.20.2
  • (a) Find aa and bb.
  • (b) Find Var(X)\text{Var}(X) and the standard deviation of XX.

H4. (Core) (IB style) Without a calculator. The probability distribution of XX is P(X=x)=kx2P(X = x) = kx^2 for x=1,2,3x = 1, 2, 3.

  • (a) Find the exact value of kk.
  • (b) Find E(X)E(X) and show that E(X2)=7E(X^2) = 7.
  • (c) Find the exact values of Var(X)\text{Var}(X) and the standard deviation of XX.

H5. (Core) A bakery in Corner Brook takes orders for custom cakes. The number of custom cakes XX ordered on a weekday has this distribution (hypothetical data).

xx00112233
P(X=x)P(X = x)0.150.150.350.350.30.30.20.2

Each cake brings in $45 of profit, but the bakery pays a decorator $30 every weekday whether or not any cakes are ordered. Let YY be the bakery’s daily profit from custom cakes, in dollars.

  • (a) Find E(X)E(X) and Var(X)\text{Var}(X).
  • (b) Write YY in terms of XX.
  • (c) Use your answers to (a) and (b) to find E(Y)E(Y) and the standard deviation of YY. You may use your GDC.

H6. (Core) A raw quiz score XX (the score of a randomly chosen student) has mean 3232 and standard deviation 88. The teacher rescales every score using Y=aX+bY = aX + b so that the new scores have mean 7070 and standard deviation 1010.

  • (a) Find aa and bb, given that a>0a \gt 0.
  • (b) There is a second pair of values of aa and bb that also gives mean 7070 and standard deviation 1010. Find it, and explain why the teacher wouldn’t use it.
  • (c) Using your answer to (a), what rescaled score does a raw score of 4040 become?

H7. (Challenge) XX takes the values 11 and 33, each with probability 12\tfrac{1}{2}. Sam says: ”2X2X is just X+XX + X, so Var(2X)=Var(X)+Var(X)=2 Var(X)\text{Var}(2X) = \text{Var}(X) + \text{Var}(X) = 2\,\text{Var}(X).”

  • (a) Find Var(X)\text{Var}(X).
  • (b) Write down the distribution of 2X2X and find Var(2X)\text{Var}(2X) directly from it.
  • (c) Explain what is wrong with Sam’s reasoning, and state the correct rule.
  • (d) How does the standard deviation of 2X2X compare with the standard deviation of XX?

H8. (Challenge) Two carnival games each cost the same to play. The tables show a player’s profit in dollars per game.

Game A:

Profit (AA)−1-11133
Probability0.40.40.30.30.30.3

Game B:

Profit (BB)−2-21212
Probability0.80.80.20.2
  • (a) Show that both games have the same expected profit.
  • (b) Find the standard deviation of the profit for each game.
  • (c) Which game is riskier? Use your answers to explain what “riskier” means here.
  • (d) A friend says, “Game B is the better deal because its top prize is bigger.” Comment on this claim.
  • (e) The operator of Game B triples every prize and every loss. Find the new expected profit and standard deviation.

H9. (Challenge) XX takes the values 11, 22 and 33, with P(X=1)=P(X=3)=pP(X = 1) = P(X = 3) = p.

  • (a) Write P(X=2)P(X = 2) in terms of pp, and state the possible values of pp.
  • (b) Show that E(X)=2E(X) = 2 for every allowed value of pp.
  • (c) Show that Var(X)=2p\text{Var}(X) = 2p.
  • (d) Find pp if Var(X)=0.5\text{Var}(X) = 0.5.
  • (e) Could Var(X)\text{Var}(X) equal 1.21.2? Explain.

H10. (Challenge) E(X)=3E(X) = 3 and Var(X)=2\text{Var}(X) = 2. The random variable Y=aX+bY = aX + b has E(Y)=1E(Y) = 1 and E(Y2)=19E(Y^2) = 19.

  • (a) Find Var(Y)\text{Var}(Y).
  • (b) Find all possible pairs of values of aa and bb.
  • (c) Find E(X2)E(X^2), and use it to check one of your pairs by expanding E((aX+b)2)E\big((aX + b)^2\big).