Sub topic 4
Expected Value as a Weighted Average
This chapter assumes you can work with fractions, decimals, and percents, and that you know the mean of a data set. It also assumes you know what a random variable and a probability distribution are, from the earlier chapters. Here you will learn to compute the expected value of a discrete random variable, interpret it correctly, and avoid the errors that GRE questions are built to catch.
What expected value means
The expected value of a random variable X, written E(X) or μ, is the long-run average of X. If you could repeat the random process many times, the average of all the results would settle near E(X).
The expected value is a weighted average. Each possible value counts in proportion to its probability.
The formula for a discrete random variable is:
E(X) = x₁·p₁ + x₂·p₂ + ... + xₙ·pₙ
Here each xᵢ is a possible value and pᵢ is its probability. The probabilities must add to 1. Check this first, because a distribution whose probabilities do not sum to 1 is incomplete or mistyped.
Connection to the ordinary mean
You already know how to find the mean of a list. For the list 2, 2, 5, you add them and divide by 3, which gives 3. You can also write this as a weighted average. The value 2 appears 2 out of 3 times, and the value 5 appears 1 out of 3 times:
2·(2/3) + 5·(1/3) = 4/3 + 5/3 = 3
Expected value uses the same idea. The "frequencies" are now probabilities.
A worked example
Suppose X takes the values 1, 2, 3, and 4 with probabilities 0.1, 0.2, 0.3, and 0.4.
- Check that the probabilities sum to 1: 0.1 + 0.2 + 0.3 + 0.4 = 1.
- Multiply each value by its probability: 0.1, 0.4, 0.9, 1.6.
- Add the products: 0.1 + 0.4 + 0.9 + 1.6 = 3.
So E(X) = 3.
Notice that the simple average of 1, 2, 3, 4 is 2.5. The expected value is 3 because the larger values are more likely. The weights pull the mean toward them.
This code carries out the same calculation. It uses exact fractions so there is no rounding error.
from fractions import Fraction
values = [1, 2, 3, 4]
probs = [Fraction(1, 10), Fraction(2, 10), Fraction(3, 10), Fraction(4, 10)]
assert sum(probs) == 1
mean = sum(v * p for v, p in zip(values, probs))
variance = sum((v - mean) ** 2 * p for v, p in zip(values, probs))
print(mean, variance) # 3 1The variance line is covered in the next chapter. For now, focus on the mean line. It is the formula above, written in code.
Interpreting the result
Expected value need not be a possible outcome
A fair six-sided die has outcomes 1 through 6, each with probability 1/6.
E(X) = (1 + 2 + 3 + 4 + 5 + 6)/6 = 21/6 = 3.5
You can never roll a 3.5. The expected value describes the long-run average, not a single result. A GRE question may ask for the expected value of a quantity that can only be a whole number, and a decimal answer is perfectly fine.
Expected value as a balance point
Picture the distribution as weights on a number line, where each weight is proportional to its probability. The expected value is the point where the line would balance. This picture helps you estimate. If most of the weight sits on the right side, the expected value must be on the right side too.
Expected value of a game or a bet
Many GRE problems use payoffs. A payoff can be negative, which stands for a loss.
Suppose you pay $2 to play a game. You win $10 with probability 0.1 and win nothing otherwise. Your net result X is:
- +$8 with probability 0.1 (the $10 prize minus the $2 cost)
- −$2 with probability 0.9
E(X) = 8(0.1) + (−2)(0.9) = 0.8 − 1.8 = −1
On average you lose $1 per play. A negative expected value means the game is unfavorable to the player.
You can get the same answer another way. The expected prize is 10(0.1) = $1, and the cost is $2, so the expected net is 1 − 2 = −1. This works because expected value is linear: you can find the expected value of each part and combine them.
Expected value when probabilities come from counts
Sometimes a problem gives a table of frequencies instead of probabilities. Turn each count into a probability by dividing by the total.
| Number of pets | Households |
|---|---|
| 0 | 20 |
| 1 | 50 |
| 2 | 30 |
The total is 100 households, so the probabilities are 0.20, 0.50, and 0.30.
E(X) = 0(0.20) + 1(0.50) + 2(0.30) = 1.1
You can also skip the division. Compute the sum of value times count, then divide once by the total: (0·20 + 1·50 + 2·30)/100 = 110/100 = 1.1. This is the same weighted average you use for grouped data.
Expected value of a scaled or shifted variable
You do not need to start over when a quantity is changed in a simple way. If Y = aX + b, then:
E(Y) = a·E(X) + b
For example, if E(X) = 50 and Y = 2X + 10, then E(Y) = 2(50) + 10 = 110. A later chapter covers this rule in full, including what happens to the standard deviation.
mean_x = 50
sd_x = 8
# Y = 2X + 10
mean_y = 2 * mean_x + 10
sd_y = abs(2) * sd_x
print(mean_y, sd_y) # 110 16Expected values also add. For any two random variables X and Y, E(X + Y) = E(X) + E(Y). This holds even when X and Y are not independent. So the expected total of 10 rolls of a fair die is 10 × 3.5 = 35, found without listing any outcomes.
Edge cases and common errors
- Probabilities that do not sum to 1. If a problem leaves one probability unknown, find it by subtracting the others from 1 before you compute anything.
- Forgetting the weights. Averaging the values alone gives the unweighted mean. This is only correct when all outcomes are equally likely.
- Dropping the sign of a loss. In a bet, a loss must enter the sum as a negative value. Decide whether the payoff includes the cost of playing, and be consistent.
- Dividing by the number of outcomes. When you use probabilities as weights, you do not divide by the number of values. The probabilities already sum to 1, so the weighted sum is the average.
- Reading E(X) as a guarantee. The expected value says what happens on average over many trials. One trial can land far from it.
- Expecting the mean to be the most likely value. The expected value (3 in the main example) and the most likely value (4 in that example) are different things.
Why this matters for the normal distribution
Everything above applies to discrete variables, where you can list the values. The normal distribution is continuous, so there is no list to sum. The idea stays the same, though. The mean of a normal distribution is its balance point, and it is the center of the bell curve. Treat the mean μ as the expected value, and the rest of this tutorial will measure distances from it.
The next chapter measures how far values typically fall from this center. That measure is the variance and its square root, the standard deviation.
Exercise
A random variable X has the values 0, 1, and 5. P(X = 0) = 0.5 and P(X = 5) = 0.1. What is P(X = 1), and what is E(X)?
Show answer
The probabilities must sum to 1, so P(X = 1) = 1 − 0.5 − 0.1 = 0.4. Then E(X) = 0(0.5) + 1(0.4) + 5(0.1) = 0 + 0.4 + 0.5 = 0.9.
Exercise
A raffle ticket costs $5. One ticket in 200 wins a $600 prize, and every other ticket wins nothing. What is the expected net gain per ticket?
Show answer
The net gain is $595 with probability 1/200 and −$5 with probability 199/200. E = 595(1/200) − 5(199/200) = 2.975 − 4.975 = −2. The expected net gain is −$2 per ticket. Check: the expected prize is 600/200 = $3, and 3 − 5 = −2.
Exercise
A fair die is rolled 20 times. What is the expected sum of the rolls?
Show answer
Each roll has expected value 3.5, and expected values add, so the expected sum is 20 × 3.5 = 70.