Expected Value, Variance, and SD - Extra Practice

Grab a pencil and some paper: every question here is meant to be worked out by hand. The numbers are chosen to come out clean, so if you find yourself with a horrible decimal, double-check your arithmetic.

Quick refresher

For a random variable \(X\) with pmf \(P(X = x)\):

  • Expected value: \(E(anything)\) is the probability-weighted average of that thing.
    • Notationally, \(E(X) = \sum_x x \times P(X = x)\)
  • Variance:
    • Variance is \(E(\)squared distance from the mean\()\) or \(E((X - \mu)^2)\), where \(\mu = E(X)\).
      • …which means you need to compute \(E(X)\) first.
    • When you expand the math above, it works out to a shortcut formula that is usually easier to compute:
      • \(Var(X) = E(X^2) - \mu^2\), where \(E(X^2) = \sum_x x^2 \times P(X = x)\).
  • Standard deviation:
    • …is the square root of variance.
    • This gives a more intuive measure of spread. It’s roughly the “give or take” when you say something like “It’ll take about 20 minutes to drive there, give or take 5 minutes.”
    • Formulaically: \(SD(X) = \sqrt{Var(X)}\). So you need to compute \(Var(X)\) first (which itself requires computing \(E(X)\) first).

Shift and scale: for constants \(a\) and \(b\),

You could derive these yourself with a bit of effort, but it’s easier to just remember them:

  • \(E(aX + b) = a \times E(X) + b\)
    • This is a linear property of the expected value.
  • \(Var(aX + b) = a^2 \times Var(X)\)
    • Adding a constant \(b\) doesn’t change the spread (all numbers shift the same amount - no new variability!)
    • But multiplying by \(a\) does. This is intuitive when you remember that computing \(Var(something)\) requires computing \(E(something^2)\).
  • \(SD(aX + b) = |a| \times SD(X)\)
    • This undoes the squaring in the variance formula, so you get the (positive version of) \(a\).

Sums and averages:

  • \(E(X + Y) = E(X) + E(Y)\), always.
  • If \(X\) and \(Y\) are independent, \(Var(X + Y) = Var(X) + Var(Y)\), and \(Var(X - Y) = Var(X) + Var(Y)\) too.
    • Another way to see why X - Y still increases variance, using the rules above:
    • \(Var(X - Y) = Var(X + (-1) \times Y) = Var(X) + Var((-1) \times Y)\)
    • \(= Var(X) + (-1)^2 \times Var(Y) = Var(X) + Var(Y)\)
  • For \(n\) independent draws \(X_1, \ldots, X_n\) from the same box, with sum \(S_n\) and average \(\overline{X} = S_n / n\):
    • \(E(S_n) = n \times E(X_1)\) and \(SE(S_n) = \sqrt{n} \times SD(X_1)\)
    • \(E(\overline{X}) = E(X_1)\) and \(SE(\overline{X}) = SD(X_1) / \sqrt{n}\)

Expected value, variance, and SD

Question 1

A random variable \(X\) has this pmf:

\(x\) 0 1 2 3
\(P(X = x)\) 0.1 0.3 0.4 0.2

1. Find \(E(X)\).

Show answer

Answer: \(E(X) = 1.7\). Multiply each value by its probability, then add:

\(E(X) = 0 \times 0.1 + 1 \times 0.3 + 2 \times 0.4 + 3 \times 0.2 = 0 + 0.3 + 0.8 + 0.6 = 1.7\)

2. Find \(Var(X)\).

Show answer

Answer: \(Var(X) = 0.81\). Using the shortcut formula, first find \(E(X^2)\) by squaring each value before weighting it:

\(E(X^2) = 0^2 \times 0.1 + 1^2 \times 0.3 + 2^2 \times 0.4 + 3^2 \times 0.2 = 0 + 0.3 + 1.6 + 1.8 = 3.7\)

From part 1, \(E(X) = 1.7\), so…

\(Var(X) = E(X^2) - E(X)^2 = 3.7 - 1.7^2 = 3.7 - 2.89 = 0.81\)

It can help to lay this out as a table, adding columns as you go:

\(x\) \(P(X = x)\) \(x \times P(X = x)\) \(x^2\) \(x^2 \times P(X = x)\)
0 0.1 0 0 0
1 0.3 0.3 1 0.3
2 0.4 0.8 4 1.6
3 0.2 0.6 9 1.8
Sum 1 1.7 3.7

3. Find \(SD(X)\).

Show answer

Answer: \(SD(X) = 0.9\)

\(SD(X) = \sqrt{Var(X)} = \sqrt{0.81} = 0.9\)

Question 2

Every time you eat lunch on the pier, Gerald the seagull swoops in and steals some of your fries. Years of painful experience have taught you his habits:

  • On 30% of days, you guard your fries well and Gerald gets none.
  • On 20% of days, he snatches 1 fry.
  • On 40% of days, he snatches 2 fries.
  • On the rest of the days, he goes big and makes off with 4 fries.

Gerald never steals exactly 3. Nobody knows why.

Let \(X\) be the number of fries Gerald steals on a given day.

1. Write out the pmf of \(X\) as a table.

Show answer

The possible values are 0, 1, 2, and 4. The probabilities must add up to 1, so the chance of 4 fries is \(1 - (0.3 + 0.2 + 0.4) = 0.1\).

\(x\) 0 1 2 4
\(P(X = x)\) 0.3 0.2 0.4 0.1

2. Find \(E(X)\), the expected number of stolen fries.

Show answer

Answer: \(E(X) = 1.4\) fries.

\(E(X) = 0 \times 0.3 + 1 \times 0.2 + 2 \times 0.4 + 4 \times 0.1 = 0 + 0.2 + 0.8 + 0.4 = 1.4\)

Gerald never steals exactly 1.4 fries, of course. The expected value is a long-run average, not a value \(X\) has to be able to take.

3. Find \(Var(X)\) and \(SD(X)\).

Show answer

Answer: \(Var(X) = 1.44\) and \(SD(X) = 1.2\) fries.

\(E(X^2) = 0 \times 0.3 + 1 \times 0.2 + 4 \times 0.4 + 16 \times 0.1 = 0 + 0.2 + 1.6 + 1.6 = 3.4\)

From earlier, \(E(X) = 1.4\), so…

\(Var(X) = E(X^2) - E(X)^2 = 3.4 - 1.4^2 = 3.4 - 1.96 = 1.44\)

\(SD(X) = \sqrt{Var(X)} = \sqrt{1.44} = 1.2\).

So on a typical day, Gerald steals about 1.4 fries, give or take about 1.2 fries.

Question 3

At the county fair, the Duck Pond game has 10 rubber ducks floating in a tub. You pick one duck at random and win the prize written on its bottom:

  • 7 ducks say $0 (“Better luck next time!”)
  • 2 ducks say $5
  • 1 duck says $20 (“Lucky duck!”)

Let \(X\) be your prize, in dollars, from one pick.

1. Write out the pmf of \(X\) as a table.

Show answer

Each duck is equally likely to be picked, so each prize’s probability is the fraction of ducks with that prize:

\(x\) 0 5 20
\(P(X = x)\) 0.7 0.2 0.1

2. Find \(E(X)\).

Show answer

Answer: \(E(X) = \$3\).

\(E(X) = 0 \times 0.7 + 5 \times 0.2 + 20 \times 0.1 = 0 + 1 + 2 = 3\)

This is also just the average of the 10 ducks: \((0 \times 7 + 5 \times 2 + 20 \times 1) / 10 = 30 / 10 = 3\).

3. Find \(Var(X)\) and \(SD(X)\).

Show answer

Answer: \(Var(X) = 36\) and \(SD(X) = \$6\).

\(E(X^2) = 0^2 \times 0.7 + 5^2 \times 0.2 + 20^2 \times 0.1 = 0 + 5 + 40 = 45\)

From part 2, \(E(X) = 3\), so…

\(Var(X) = E(X^2) - E(X)^2 = 45 - 3^2 = 45 - 9 = 36\)

\(SD(X) = \sqrt{Var(X)} = \sqrt{36} = 6\)

The SD is bigger than the mean here. That one $20 duck pulls the spread way out.

Question 4

Every morning, Biscuit the cat sits on the kitchen table next to your coffee mug, makes eye contact with you, and decides whether to knock it onto the floor. She does it on 20% of mornings.

Let \(X = 1\) if Biscuit knocks the mug off on a given morning, and \(X = 0\) if she spares it.

1. Write out the pmf of \(X\), and find \(E(X)\).

Show answer
\(x\) 0 1
\(P(X = x)\) 0.8 0.2

Answer: \(E(X) = 0.2\).

\(X\) is a 0/1 (Bernoulli) random variable with \(p = 0.2\), and for any Bernoulli, the expected value is just the chance of a 1:

\(E(X) = p = 0.2\)

Or, the long way: \(E(X) = 0 \times 0.8 + 1 \times 0.2 = 0.2\).

2. Find \(Var(X)\) and \(SD(X)\).

Show answer

Answer: \(Var(X) = 0.16\) and \(SD(X) = 0.4\).

Using the Bernoulli shortcut:

\(Var(X) = p(1 - p) = 0.2 \times 0.8 = 0.16\)

\(SD(X) = \sqrt{Var(X)} = \sqrt{0.16} = 0.4\)

Or, the long way: since \(0^2 = 0\) and \(1^2 = 1\), \(E(X^2) = 0 \times 0.8 + 1 \times 0.2 = 0.2\). From part 1, \(E(X) = 0.2\), so…

\(Var(X) = E(X^2) - E(X)^2 = 0.2 - 0.2^2 = 0.2 - 0.04 = 0.16\)

Shift and scale

Question 5

Back to the Duck Pond from Question 3, where your prize \(X\) has \(E(X) = \$3\) and \(SD(X) = \$6\).

1. It costs $5 to play. Let \(W = X - 5\) be your net winnings from one play. Find \(E(W)\) and \(SD(W)\).

Show answer

Answer: \(E(W) = -\$2\) and \(SD(W) = \$6\).

\(E(W) = E(X - 5) = E(X) - 5 = 3 - 5 = -2\)

On average, you lose $2 every time you play.

\(SD(W) = SD(X) = 6\)

Paying $5 shifts every outcome down by the same amount, so the spread doesn’t change at all.

2. How much would the fair have to charge so that your expected net winnings are exactly $0?

Show answer

$3. If it costs \(c\) dollars, then \(E(X - c) = 3 - c\), which is 0 when \(c = 3\). (Don’t hold your breath.)

3. On “Double Prize Saturday,” every prize is doubled, but it still costs $5 to play. Your net winnings are now \(D = 2X - 5\). Find \(E(D)\), \(Var(D)\), and \(SD(D)\).

Show answer

Answer: \(E(D) = \$1\), \(Var(D) = 144\), and \(SD(D) = \$12\).

\(E(D) = E(2X - 5) = 2 \times E(X) - 5 = 2 \times 3 - 5 = 1\)

Finally, a game worth playing (on average).

From Question 3, \(Var(X) = 36\), so…

\(Var(D) = (Var 2X - 5) = Var(2X) =2^2 \times Var(X) = 4 \times 36 = 144\)

The \(-5\) doesn’t affect the variance - the results are spread out the same amount, just shifted.

\(SD(D) = \sqrt{Var(D)} = \sqrt{144} = 12\)

Or, using the scale rule directly: \(SD(D) = SD(2X - 5) = SD(2X) = |2| \times SD(X) = 2 \times 6 = 12\).

Doubling the prizes doubles the SD but quadruples the variance.

Question 6

Cinderbeard the dragon keeps a thermometer in his lair, because a dragon has to keep his gold at just the right temperature. Over a year, the temperature \(C\) in degrees Celsius has \(E(C) = 50\) and \(SD(C) = 5\).

His dragon cousin, Smokey, is visiting from America insists on Fahrenheit. The conversion is \(F = 1.8\,C + 32\).

1. Find \(E(F)\).

Show answer

Answer: \(E(F) = 122\) degrees Fahrenheit

\(E(F) = E(1.8 \times C + 32) = 1.8 \times E(C) + 32 = 1.8 \times 50 + 32 = 90 + 32 = 122\)

2. Find \(SD(F)\) and \(Var(F)\).

Show answer

Answer: \(SD(F) = 9\) and \(Var(F) = 81\).

This time we’ll do SD first, using our rules.

\(SD(F) = SD(1.8 \times C + 32) = |1.8| \times SD(C) = 1.8 \times 5 = 9\)

The \(+32\) shifts every temperature by the same amount, so it doesn’t affect the spread.

\(Var(F) = SD(F)^2 = 9^2 = 81\)

Question 7

Back on the pier with Gerald the seagull from Question 2, who steals \(X\) fries per day, with \(E(X) = 1.4\) and \(SD(X) = 1.2\).

1. Your order always comes with 12 fries. Let \(L = 12 - X\) be the number of fries left for you. Find \(E(L)\) and \(SD(L)\).

Show answer

Answer: \(E(L) = 10.6\) fries and \(SD(L) = 1.2\) fries.

$E(L) = E(12 - X) = 12 - E(X) = 12 - 1.4 = 10.6

\(SD(L) = SD(12 - X) = SD(-X) = |-1| \times SD(X) = 1 \times 1.2 = 1.2\)

Flipping the sign mirrors the distribution, but doesn’t make it any more or less spread out. (SD and Var can never be negative!)

2. Gerald starts bringing two friends in a coordinated raid. For every fry Gerald steals, each friend steals one too, so you lose \(3X\) fries. Now you’re left with \(L = 12 - 3X\) fries. Find \(E(L)\), \(SD(L)\), and \(Var(L)\).

Show answer

Answer: \(E(L) = 7.8\) fries, \(SD(L) = 3.6\) fries, and \(Var(L) = 12.96\).

$E(L) = E(12 - 3X) = 12 - 3 E(X) = 12 - 3 * 1.4 = 7.8

\(SD(L) = SD(12 - 3X) = SD(-3X) = |-3| \times SD(X) = 3 \times 1.2 = 3.6\)

We could just square this to get variance, but let’s calculate for practice.

From Question 2, \(Var(X) = 1.44\), so…

\(Var(L) = Var(12 - 3X) = Var(-3X) = (-3)^2 \times Var(X) = 9 \times 1.44 = 12.96\)

(Check: \(SD(L)^2 = 3.6^2 = 12.96\).)

Sums and averages

Question 8

Kresh the ogre eats turnips and cabbages for lunch, and he’s not too picky about how many. On a given day, the number of turnips \(X\) has \(E(X) = 6\) and \(SD(X) = 3\). The number of cabbages \(Y\) has \(E(Y) = 4\) and \(SD(Y) = 4\). Assume \(X\) and \(Y\) are independent.

1. Let \(T = X + Y\) be the total number of vegetables Kresh eats. Find \(E(T)\), \(Var(T)\), and \(SD(T)\).

Show answer

Answer: \(E(T) = 10\), \(Var(T) = 25\), and \(SD(T) = 5\).

\(E(T) = E(X + Y) =E(X) + E(Y) = 6 + 4 = 10\)

Since \(X\) and \(Y\) are independent, their variances add:

\(Var(T) = Var(X + Y) = Var(X) + Var(Y) = 3^2 + 4^2 = 9 + 16 = 25\)

\(SD(T) = \sqrt{Var(T)} = \sqrt{25} = 5\)

Notice this is not \(3 + 4 = 7\). SDs don’t add; variances do.

2. Let \(M = X - Y\) be how many more turnips than cabbages Kresh eats. Find \(E(M)\) and \(SD(M)\).

Show answer

Answer: \(E(M) = 2\) and \(SD(M) = 5\).

\(E(M) = E(X - Y) = E(X) - E(Y) = 6 - 4 = 2\)

\(Var(M) = Var(X - Y) =Var(X) + Var(Y) = 9 + 16 = 25\)

\(SD(M) = \sqrt{Var(M)} = \sqrt{25} = 5\)

The variances still add, even though we’re subtracting! \(X - Y\) is \(X + (-1)Y\), and \(Var(-Y) = (-1)^2 \, Var(Y) = Var(Y)\). Subtracting a random quantity adds uncertainty, just like adding one does.

Question 9

Undeterred by Question 5, you play the Duck Pond (at the regular $5 price) 100 times. Each play is independent, and your net winnings \(W\) on a single play have \(E(W) = -\$2\) and \(SD(W) = \$6\).

1. Let \(S_{100}\) be your total net winnings over all 100 plays. Find \(E(S_{100})\) and \(SE(S_{100})\).

Show answer

Answer: \(E(S_{100}) = -\$200\) and \(SE(S_{100}) = \$60\).

\(E(S_{100}) = n \times E(W) = 100 \times (-2) = -200\)

\(SE(S_{100}) = \sqrt{n} \times SD(W) = \sqrt{100} \times 6 = 10 \times 6 = 60\)

So you should expect to be down about $200, give or take about $60.

2. Let \(\overline{W}\) be your average net winnings per play over the 100 plays. Find \(E(\overline{W})\) and \(SE(\overline{W})\).

Show answer

Answer: \(E(\overline{W}) = -\$2\) and \(SE(\overline{W}) = \$0.60\).

\(E(\overline{W}) = E(W) = -2\)

That’s the same as for a single play.

\(SE(\overline{W}) = \dfrac{SD(W)}{\sqrt{n}} = \dfrac{6}{\sqrt{100}} = \dfrac{6}{10} = 0.6\)

Question 10

Back to Biscuit the cat from Question 4, who knocks your mug off the table on 20% of mornings. Each morning is independent. Over the next 100 mornings:

1. Let \(S_{100}\) be the number of mornings your mug hits the floor. Find \(E(S_{100})\) and \(SE(S_{100})\).

Show answer

Answer: \(E(S_{100}) = 20\) mornings and \(SE(S_{100}) = 4\) mornings.

\(S_{100}\) is the sum of 100 independent 0/1 draws, each with \(E(X) = 0.2\) and \(SD(X) = 0.4\) (from Question 4), so…

\(E(S_{100}) = n \times E(X) = 100 \times 0.2 = 20\)

\(SE(S_{100}) = \sqrt{n} \times SD(X) = \sqrt{100} \times 0.4 = 10 \times 0.4 = 4\)

This is also \(Bin(100, 0.2)\), so you can check with the binomial formulas: \(E(Bin(n, p)) = np = 100 \times 0.2 = 20\), and \(Var(Bin(n, p)) = np(1 - p) = 100 \times 0.2 \times 0.8 = 16\), whose square root is 4.

2. Now let \(\overline{X}\) be the proportion of the 100 mornings that Biscuit strikes. Find \(E(\overline{X})\) and \(SE(\overline{X})\).

Show answer

\(E(\overline{X}) = 0.2\) and \(SE(\overline{X}) = 0.04\).

\(E(\overline{X}) = E(X) = 0.2\)

\(SE(\overline{X}) = \dfrac{SD(X)}{\sqrt{n}} = \dfrac{0.4}{\sqrt{100}} = \dfrac{0.4}{10} = 0.04\)

So expect Biscuit to strike on about 20% of mornings, give or take about 4 percentage points.

Question 11

A garden gnome named Pemberton goes out foraging every night. The number of mushrooms he finds on a given night has an average of 4 and a standard deviation of 2. Each night is independent of the others.

Fill in this table, where \(S_n\) is the total number of mushrooms Pemberton finds over \(n\) nights, and \(\overline{X}\) is his average per night.

Nights (\(n\)) \(E(S_n)\) \(SE(S_n)\) \(E(\overline{X})\) \(SE(\overline{X})\)
1
4
16
100
Show answer
Nights (\(n\)) \(E(S_n)\) \(SE(S_n)\) \(E(\overline{X})\) \(SE(\overline{X})\)
1 4 2 4 2
4 16 4 4 1
16 64 8 4 0.5
100 400 20 4 0.2
  • \(E(S_n) = n \times E(S) = n \times 4 = 4n\): the expected total grows in step with \(n\).
  • \(SE(S_n) = SE(S) \times \sqrt{n} = 2 \times \sqrt{n}\): the SE of the total grows too, but only like \(\sqrt{n}\). Sixteen times as many nights only makes it four times as big.
  • \(E(\overline{X}) = 4\) no matter how many nights.
  • \(SE(\overline{X}) = SE(X) / \sqrt{n} = 2 / \sqrt{n}\): the SE of the average shrinks as \(n\) grows. The more nights Pemberton goes out, the more likely his average harvest is close to 4.