Unit 4, lesson 29

Expected Value

What the expected value of a discrete random variable is, how it differs from the mode, how to find a conditional mean and an expected net gain, and when the expectation is infinite or undefined.

  • Video 29
  • Expected Value

A service request might need 00, 22 or 55 hours of work, and staffing has to be planned before the request arrives. The most likely workload is one possible summary, but it ignores how large the other possibilities are. Expected value combines every possible value with its probability into a single weighted average. This lesson defines it, separates it from the mode and from any single outcome, and shows that a valid distribution with infinitely many values need not have a finite mean.

Key terms

Expected value

Definition Let XX be a discrete random variable with support SS and PMF pXp_X. When SS is finite, the expected value of XX is the probability-weighted average of its support values,

E[X]=∑x∈Sx pX(x).E[X] = \sum_{x \in S} x \, p_X(x).

Each value appears once, weighted by its own probability. When SS is countably infinite, the same series defines E[X]E[X] as a finite number provided ∑x∈S∣x∣ pX(x)<∞\sum_{x \in S} \lvert x \rvert \, p_X(x) < \infty, as explained under absolute integrability below. The expected value is also called the mean and is often written μ\mu. It carries the units of XX, and for finite support it lies between the smallest and the largest support value.

In plain words Multiply each possible value by its probability and add the products. Values with more probability get more weight. An ordinary average of the listed values gives each of them equal weight, which is the right weighting for a uniform distribution on those values but not in general.

Example In a constructed model, the number of hours XX needed by one service request is 00, 22 or 55, with probabilities 0.50.5, 0.30.3 and 0.20.2.

Hours xx002255
Probability pX(x)p_X(x)0.50.50.30.30.20.2
Contribution x pX(x)x \, p_X(x)000.60.61.01.0

Adding the contributions gives E[X]=1.6E[X] = 1.6 hours. The same number appears if ten equally likely slots hold five zeros, three twos and two fives, since their ordinary average is 16/1016/10. The unweighted average (0+2+5)/3=7/3≈2.33(0 + 2 + 5)/3 = 7/3 \approx 2.33 answers a different question, because the three values are not equally likely. No single request takes 1.61.6 hours in this model, so the mean describes the distribution as a whole, not the workload of any individual request.

Mode

Definition A mode of a discrete random variable XX is a value mm with the largest probability mass, that is, pX(m)≥pX(x)p_X(m) \ge p_X(x) for every real number xx. A distribution can have more than one mode. The mode and the mean are different summaries and need not agree.

In plain words The mode is the most likely value, or one of the most likely values when there is a tie. It ignores how far the other values lie from it, while the mean weighs both their sizes and their probabilities.

Example For the service request, the value 00 has the largest probability, 0.50.5, so 00 hours is the only mode, while the mean is 1.61.6 hours. The two-hour and five-hour requests do not change the mode, but they pull the mean above 00. If two values shared the largest probability, both would be modes.

Conditional mean

Definition Let AA be an event with P(A)>0P(A) > 0. The conditional PMF of XX given AA is pX∣A(x)=P(X=x∣A)=P({X=x}∩A)/P(A)p_{X \mid A}(x) = P(X = x \mid A) = P(\{X = x\} \cap A) / P(A), and the conditional mean of XX given AA is

E[X∣A]=∑xx pX∣A(x),E[X \mid A] = \sum_{x} x \, p_{X \mid A}(x),

with the sum over the support of XX, provided ∑x∣x∣ pX∣A(x)<∞\sum_x \lvert x \rvert \, p_{X \mid A}(x) < \infty, which always holds when the support is finite. When AA is the event {X∈C}\{X \in C\} for a set CC of values, the conditional masses are pX(x)/P(X∈C)p_X(x) / P(X \in C) for xx in CC and 00 for every other xx.

In plain words When the new information is a statement about XX itself, it can rule out some values. Keep the values that are still possible, divide their masses by the probability that remains so that they add to 11 again, and average with these new weights.

Example Suppose we learn that the request needs some work, the event X>0X > 0, which has probability 0.3+0.2=0.50.3 + 0.2 = 0.5. The conditional masses are 0.3/0.5=0.60.3/0.5 = 0.6 at 22 hours and 0.2/0.5=0.40.2/0.5 = 0.4 at 55 hours. The contributions are 2⋅0.6=1.22 \cdot 0.6 = 1.2 and 5⋅0.4=25 \cdot 0.4 = 2, so

E[X∣X>0]=1.2+2=3.2 hours.\begin{aligned} E[X \mid X > 0] &= 1.2 + 2 \\[0.4em] &= 3.2 \text{ hours}. \end{aligned}

It is twice the unconditional mean 1.61.6, which is no contradiction, since it averages over a different group of requests. As a check, half of the probability sits on requests with conditional mean 3.23.2 hours and the other half on requests needing 00 hours, and 0.5⋅3.2+0.5⋅0=1.60.5 \cdot 3.2 + 0.5 \cdot 0 = 1.6.

Net gain

Definition When a payoff GG is received and a fixed cost cc is paid in every outcome, the net gain is the random variable N=G−cN = G - c, in the same units as GG. If E[G]E[G] is finite, then

E[N]=E[G]−c,E[N] = E[G] - c,

because subtracting cc from every value lowers the weighted sum by cc times the total weight, which is 11.

In plain words Decide what is being averaged before averaging. A gross prize and the result after paying to play are different random variables, and only the second says whether you end up ahead. An expected net gain can be negative, zero or positive.

Example A constructed training game awards 88 tokens with probability 0.20.2 and nothing otherwise, and entry costs 11 token. The net gain is 77 tokens with probability 0.20.2 and −1-1 token with probability 0.80.8, so

E[N]=7⋅0.2−1⋅0.8=0.6 tokens.\begin{aligned} E[N] &= 7 \cdot 0.2 - 1 \cdot 0.8 \\[0.4em] &= 0.6 \text{ tokens}. \end{aligned}

The expected gross award is 8⋅0.2=1.68 \cdot 0.2 = 1.6 tokens, and 1.6−1=0.61.6 - 1 = 0.6 agrees. Averaging the award alone would report 1.61.6 and forget the fee. The expected net gain is positive, yet the most likely result, with probability 0.80.8, is a loss of 11 token.

Infinite expectation

Definition Let XX be a discrete random variable whose support contains no negative values. Every term of ∑xx pX(x)\sum_x x \, p_X(x) is nonnegative, so the series either converges to a finite number or diverges to +∞+\infty. In the second case we write E[X]=+∞E[X] = +\infty and say that XX has infinite expectation. This can happen only when the support is infinite.

In plain words A valid probability distribution need not have a finite mean. If large values keep enough probability, the contributions x pX(x)x \, p_X(x) add up without bound, even though every single value is a finite number.

Example Let XX take the values n=1,2,3,…n = 1, 2, 3, \dots with

P(X=n)=1n(n+1).P(X = n) = \frac{1}{n(n+1)}.

Since 1n(n+1)=1n−1n+1\frac{1}{n(n+1)} = \frac{1}{n} - \frac{1}{n+1}, the first mm masses add to 1−1m+11 - \frac{1}{m+1}, which tends to 11, so this is a valid PMF. Its expectation is

E[X]=∑n=1∞n⋅1n(n+1)=∑n=1∞1n+1=+∞,\begin{aligned} E[X] &= \sum_{n=1}^{\infty} n \cdot \frac{1}{n(n+1)} \\[0.4em] &= \sum_{n=1}^{\infty} \frac{1}{n+1} = +\infty, \end{aligned}

the harmonic series without its first term. The tail probabilities P(X≥n)=1/nP(X \ge n) = 1/n shrink, but too slowly for a finite mean.

Absolute integrability

Definition A discrete random variable XX is absolutely integrable if

E[∣X∣]=∑x∣x∣ pX(x)<∞.E\bigl[\lvert X \rvert\bigr] = \sum_{x} \lvert x \rvert \, p_X(x) < \infty.

Then the series for E[X]E[X] converges absolutely, every ordering of its terms gives the same sum, and E[X]E[X] is a finite number equal to E[X+]−E[X−]E[X^{+}] - E[X^{-}], where X+=max⁡(X,0)X^{+} = \max(X, 0) and X−=max⁡(−X,0)X^{-} = \max(-X, 0). If exactly one of E[X+]E[X^{+}] and E[X−]E[X^{-}] is infinite, then E[X]E[X] is +∞+\infty when E[X+]E[X^{+}] is the infinite one and −∞-\infty when E[X−]E[X^{-}] is. If both are infinite, E[X]E[X] is undefined. Every variable with finite support is absolutely integrable.

In plain words Before adding signed contributions, check that their sizes alone add to a finite total. When they do, gains and losses can be added in any order. When the positive and the negative contributions both add to infinity, pairing them off to get a number is not legitimate, since different orders or groupings of the terms give different answers.

Example Let XX take the values nn and −n-n, each with probability 12n(n+1)\frac{1}{2n(n+1)}, for n=1,2,3,…n = 1, 2, 3, \dots. The masses add to 11 and the distribution is symmetric about 00. Yet

E[X+]=∑n=1∞12(n+1)=+∞,\begin{aligned} E[X^{+}] &= \sum_{n=1}^{\infty} \frac{1}{2(n+1)} \\[0.4em] &= +\infty, \end{aligned}

and E[X−]=+∞E[X^{-}] = +\infty for the same reason, so E[X]E[X] is undefined. Symmetry alone does not give a mean of 00. Adding the terms of ∑xx pX(x)\sum_x x \, p_X(x) with the values taken in the order 1,−1,2,−2,…1, -1, 2, -2, \dots gives partial sums that tend to 00, while taking two positive terms for each negative one gives partial sums that tend to 12ln⁡2≈0.347\tfrac12 \ln 2 \approx 0.347.

Check yourself

  1. A constructed task lasts 11, 33 or 77 hours with probabilities 0.250.25, 0.50.5 and 0.250.25. Find its expected duration and its mode. Can a single task last exactly the expected duration?
Show the answer

The contributions are 1⋅0.25=0.251 \cdot 0.25 = 0.25, 3⋅0.5=1.53 \cdot 0.5 = 1.5 and 7⋅0.25=1.757 \cdot 0.25 = 1.75, so the expected duration is 3.53.5 hours. As a check, it lies between 11 and 77. The mode is 33 hours, the value with the largest probability.

In this model every task lasts 11, 33 or 77 hours, so no single task lasts 3.53.5 hours. The mean describes the distribution, not an individual task.

  1. For the same task, a student computes the mean duration of tasks longer than 11 hour as 3⋅0.5+7⋅0.25=3.253 \cdot 0.5 + 7 \cdot 0.25 = 3.25 hours. What went wrong, and what is the correct conditional mean?
Show the answer

The event X>1X > 1 has probability 0.5+0.25=0.750.5 + 0.25 = 0.75, and the student used the original masses without dividing by it. Those masses add to 0.750.75, not 11, so they are not a distribution. The conditional masses are 0.5/0.75=230.5/0.75 = \tfrac23 at 33 hours and 0.25/0.75=130.25/0.75 = \tfrac13 at 77 hours. The contributions are 3⋅23=23 \cdot \tfrac23 = 2 and 7⋅13=737 \cdot \tfrac13 = \tfrac73, so

E[X∣X>1]=2+73=133≈4.33 hours.\begin{aligned} E[X \mid X > 1] &= 2 + \tfrac73 \\[0.4em] &= \tfrac{13}{3} \\[0.4em] &\approx 4.33 \text{ hours}. \end{aligned}

It is larger than the unconditional mean 3.53.5 because the shortest duration has been ruled out.

  1. Let KK take the values 1,2,3,…1, 2, 3, \dots with P(K=k)=2−kP(K = k) = 2^{-k}, and let W=(−2)KW = (-2)^{K}. Someone groups the terms of ∑ww pW(w)\sum_w w \, p_W(w) in pairs and concludes that E[W]=0E[W] = 0. Is that right?
Show the answer

No. The PMF of KK is valid, since ∑k≥12−k=1\sum_{k \ge 1} 2^{-k} = 1, and the value (−2)k(-2)^k of WW has probability 2−k2^{-k}. The terms of the series are therefore (−2)k 2−k=(−1)k(-2)^k \, 2^{-k} = (-1)^k, that is, −1,1,−1,1,…-1, 1, -1, 1, \dots. Grouping them as (−1+1)+(−1+1)+⋯(-1 + 1) + (-1 + 1) + \cdots gives 00, but grouping them as −1+(1−1)+(1−1)+⋯-1 + (1 - 1) + (1 - 1) + \cdots gives −1-1, and the partial sums themselves alternate between −1-1 and 00 without settling.

Each positive value 2k2^k, for even kk, contributes 2k⋅2−k=12^k \cdot 2^{-k} = 1 to E[W+]E[W^{+}], so E[W+]=+∞E[W^{+}] = +\infty. In the same way each negative value −2k-2^k, for odd kk, contributes 11 to E[W−]E[W^{-}], so E[W−]=+∞E[W^{-}] = +\infty. Both parts are infinite, so WW is not absolutely integrable and E[W]E[W] is undefined.

How this lesson connects