Expected values for a single discrete variable
For a single discrete variable \(X\) with probability function \(p(x)\), we defined the expected value of any function of \(X\), \(g(X)\), to be
\[ E[g(X)] \;=\; \sum_{\text{all }x} {g(x) \times p(x)} \]This involves all possible values of \(g(x)\) and weights each by the probability of it being observed — the higher its probability \(p(x)\), the greater the contribution that it makes to the expected value. In particular, the distribution's mean and variance were defined to be
\[ \mu \;=\; E[X] \;=\; \sum_{\text{all }x} {x \times p(x)} \spaced{and} \Var(X) \;=\; E\left[(X-\mu)^2\right] \]Expected values for two discrete variables
We define expected values for the joint distribution of two discrete random variables in a similar way.
Definition
If \(X\) and \(Y\) are discrete random variables with joint probability function \(p(x,y)\), then the expected value of a function of the variables, \(g(X,Y)\), is defined to be
\[ E[g(X,Y)] \;=\; \sum_{\text{all }x,y} {g(x,y) \times p(x,y)} \]This can be expressed as a double-summation,
\[ E[g(X,Y)] \;=\; \sum_{\text{all }x} {\sum_{\text{all }y}{g(x,y) \times p(x,y)}} \]Example: Maximum – minimum for three dice
Earlier, we gave the joint probability function of the maximum and minimum values in rolls of three fair dice.
\[ p(x,y) \;\;=\;\; \begin{cases} {\frac 1 {6^3}} & \quad\text{if }x = y \;\;\text{ and }\;\; 1 \le x,y \le 6 \\[0.4em] {\frac {x-y}{6^2}} & \quad\text{if } 1 \le y \lt x \le 6 \\[0.4em] 0 & \quad\text{otherwise} \end{cases} \]What is the expected value of the difference between the maximum and minimum?
We initially find the expected value by listing the probabilities for all possible values of \(X\) and \(Y\).
Maximum, x | ||||||
---|---|---|---|---|---|---|
Minimum, y | 1 | 2 | 3 | 4 | 5 | 6 |
1 | \(\small\diagfrac 1{6^3}\) | \(\small\diagfrac 1{6^2}\) | \(\small\diagfrac 2{6^2}\) | \(\small\diagfrac 3{6^2}\) | \(\small\diagfrac 4{6^2}\) | \(\small\diagfrac 5{6^2}\) |
2 | 0 | \(\small\diagfrac 1{6^3}\) | \(\small\diagfrac 1{6^2}\) | \(\small\diagfrac 2{6^2}\) | \(\small\diagfrac 3{6^2}\) | \(\small\diagfrac 4{6^2}\) |
3 | 0 | 0 | \(\small\diagfrac 1{6^3}\) | \(\small\diagfrac 1{6^2}\) | \(\small\diagfrac 2{6^2}\) | \(\small\diagfrac 3{6^2}\) |
4 | 0 | 0 | 0 | \(\small\diagfrac 1{6^3}\) | \(\small\diagfrac 1{6^2}\) | \(\small\diagfrac 2{6^2}\) |
5 | 0 | 0 | 0 | 0 | \(\small\diagfrac 1{6^3}\) | \(\small\diagfrac 1{6^2}\) |
6 | 0 | 0 | 0 | 0 | 0 | \(\small\diagfrac 1{6^3}\) |
Here are the corresponding values of \((x-y)\).
Maximum, x | ||||||
---|---|---|---|---|---|---|
Minimum, y | 1 | 2 | 3 | 4 | 5 | 6 |
1 | 0 | 1 | 2 | 3 | 4 | 5 |
2 | -1 | 0 | 1 | 2 | 3 | 4 |
3 | -2 | -1 | 0 | 1 | 2 | 3 |
4 | -3 | -2 | -1 | 0 | 1 | 2 |
5 | -4 | -3 | -2 | -1 | 0 | 1 |
6 | -5 | -4 | -3 | -2 | -1 | 0 |
The expected value is the sum of the product of the values in the two tables, and this evaluates to
\[ E[X-Y] \;=\; 2.917 \]Alternatively, we can find the expected value more algebraically.
\[ \begin{align} E[X-Y] \;=\; \sum_{\text{all }x,y}{(x-y) \times p(x,y)} \;&=\; \sum_{1 \le y \lt x \le 6} {(x-y)\frac{x-y}{6^2}} \\ &=\; \sum_{1 \le y \lt x \le 6} {\frac{(x-y)^2}{6^2}} \end{align} \]We now note that there are only five non-zero possible differences, \((x-y)\) = {1, 2, 3, 4 or 5}. These arise in the summation {5, 4, 3, 2 and 1} times, respectively. Therefore
\[ \begin{align} E[X-Y] \;&=\; 5 \times \frac {1^2}{6^2} + 4 \times \frac {2^2}{6^2} + 3 \times \frac {3^2}{6^2} + 2 \times \frac {4^2}{6^2} + 1 \times \frac {5^2}{6^2} \\ &=\; 2.917 \end{align} \]