Expectation of a function
Theorem taught in Random variables and distributions, part of Probability
Expectation of a function
| Type | Theorem |
| Taught in | Random variables and distributions |
| Part | Probability |
| Worked examples | 2 |
If g is a real function and X is discrete with mass function f, then \mathbb{E} g(X)=\sum_x g(x)\,f(x). If X is continuous with density f, then \mathbb{E} g(X)=\int_{-\infty}^{\infty} g(x)\,f(x)\,\,\mathrm{d} x, whenever the sum or integral converges absolutely.
In the discrete case, group the outcomes on which g takes the value y. The mass at y is \sum_{x:g(x)=y}f(x), so \mathbb{E} g(X)=\sum_y y\sum_{x:g(x)=y}f(x)=\sum_x g(x)\,f(x).
Examples
A game on the smaller face
Question page: A game on the smaller face
Two fair dice are thrown and Z is the smaller face.
Give the probability mass function of Z.
Calculate \mathbb{E}(1/Z).
A player is paid Z and pays 3 to play. Find the expected profit from 100 independent plays.
- \mathbb{P}(Z\ge z) is the probability that both faces are at least z, which is ((7-z)/6)^2. So
\mathbb{P}(Z=z)=\frac{(7-z)^2-(6-z)^2}{36}=\frac{13-2z}{36},\qquad z=1,\ldots,6,
that is 11/36, 9/36, 7/36, 5/36, 3/36 and 1/36.
\mathbb{E}(1/Z)=\sum_{z=1}^6\frac{13-2z}{36z}=\frac{11}{36}+\frac9{72}+\frac7{108}+\frac5{144}+\frac3{180}+\frac1{216}=\frac{397}{720}=0.551.
- \mathbb{E} Z=\sum z(13-2z)/36=91/36=2.53. The expected profit per play is 91/36-3=-17/36, so over 100 plays the player expects to lose about 47.2.
Paying the square of the number of heads
Question page: Paying the square of the number of heads
Ten fair coins are tossed, and the payout is the square of the number of heads. What stake makes the game fair, in the sense that the expected profit is zero?
Let X\sim\operatorname{Bin}(10,1/2). The payout is X^2, and
\mathbb{E} X^2=\operatorname{Var}(X)+(\mathbb{E} X)^2=10\cdot\tfrac12\cdot\tfrac12+5^2=2.5+25=27.5.
A stake of 27.5 makes the expected profit zero. Any smaller stake has positive expected profit for the player.
Used in
- Taught in Random variables and distributions, where the derivation and examples are.
- All 27 questions on Random variables and distributions
See also
Discrete distribution · Random variable · Cumulative distribution function · Continuous distribution · Expectation · Variance · Probability generating function · Moment generating function