Expected Value of the Difference of Two Dice

451 Views Asked by At

Problem: If a six-sided die is fair, what is the expected value of the difference between two die rolls?

Attempted solution: The expected value can be thought of as the midpoint of the outcomes. If the die is rolled twice, the difference of the two sides could be $$0,0,0,0,0,0,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5$$ The midpoint is then $1$. Here, I have assumed that two rolls with sides $4,5$ is the same as $5,4$.

Is there a more sensible way to answer this problem?

7

There are 7 best solutions below

0
On BEST ANSWER

There is some ambiguities in your OP regarding the definition of "difference", and we discuss them separately. Let $X$ be the outcome of the first die, $Y$ be the outcome of the second die, and $D$ is the "difference".

Case.(1) If the "difference" includes those negative outcomes, namely $D=X-Y$. (For example, when $X=1, Y=4$, we get $D=-3$.) Under this definition of $D$, we get

$$\boxed{\mathbb E(D)=\mathbb E(X-Y)=\mathbb E(X)-\mathbb E(Y)=3.5-3.5=0}$$

Case.(2) If the "difference" means the absolute distance, namely $D=|X-Y|$, then we have

$$\mathbb E(D)=\mathbb E(|X-Y|)$$

When we compute $\mathbb E(|X-Y|)$, there are three subcases,

(i) if $X=Y$, then $\mathbb E(|X-Y|)=\mathbb E(0)=0$

(ii) if $X>Y$, then $\mathbb E(|X-Y|)=\mathbb E(X-Y)$

(iii) if $X<Y$, then $\mathbb E(|X-Y|)=\mathbb E(Y-X)$

Due to symmetry, case (ii) and (iii) are equal, hence we get

$$\mathbb E(D)=\mathbb E(|X-Y|)=0+2\cdot\mathbb E(X-Y),~~~\text{where}~~X>Y\tag{1}$$

Next, we compute the probability for each outcome,

$$\begin{align}X-Y&=1\Leftrightarrow (X,Y)=(2,1), (3,2), (4,3), (5,4), (6,5)\Leftrightarrow P(X-Y=1)=\frac5{36}\\ \\ X-Y&=2\Leftrightarrow (X,Y)=(3,1), (4,2), (5,3), (6,4)\Leftrightarrow P(X-Y=2)=\frac4{36}\\ \\ X-Y&=3\Leftrightarrow (X,Y)=(4,1), (5,2), (6,3)\Leftrightarrow P(X-Y=3)=\frac3{36}\\ \\ X-Y&=4\Leftrightarrow (X,Y)=(5,1), (6,2)\Leftrightarrow P(X-Y=4)=\frac2{36}\\ \\ X-Y&=5\Leftrightarrow (X,Y)=(6,1)\Leftrightarrow P(X-Y=5)=\frac1{36}\\ \end{align}$$

therefore,

$$\mathbb E(X-Y)=1\cdot\frac5{36}+2\cdot\frac4{36}+\cdots+5\cdot\frac1{36}=\frac{35}{36},~~~\text{where}~~X>Y$$

Finally, use eq.(1), we get

$$\boxed{\mathbb E(D)=2\cdot\frac{35}{36}=\frac{35}{18}}$$

2
On

I would read the difference to be the absolute difference, so negative values do not exist. The expected value is not the median (which you call the midpoint) but the mean of the differences. In my reading all the non-$0$ values should be counted twice as $5$ can come from $1,6$ or $6,1$. There are $36$ possible results from rolling two dice which are equally probable.

4
On

How many ways are there to make 0? We can make 0 only if both dice roll the same number, and there are 6 ways to do this. So as there are 36 (6 $\times$ 6) ways to roll the two dice, the probability of 0 is 6/36 = 1/6. For 1, we can do this with the pairs (6, 5), (5, 4), (4, 3), (3, 2), (2, 1) which we can get twice, the the probability of getting 1 is 10/36 For 2, we can do this with the pairs (6, 4), (5, 3), (4, 2), (3, 1) and we can again get these two ways, so the probability of getting 2 is 8/36 For 3, working similarly we get a probability of 6/36, for 4 we get a probability of 4/36 and finally for 5 we get a probability of 2/36. You can check that the probabilities add to 36.

Now, to find the expected value we use the formula $\sum x \mathbb{P}(X = x)$ where $X$ is our random variable $|Y-Z|$ where $Y$ and $Z$ represent the two dice. Plugging in the values above gives a value of $$\mathbb{E}(X) = 70/36.$$

0
On

If the event of rolling 2 dices is independent then the PMF is given by convolution of each identical PMF:

$$ Z = X - Y \implies {f}_{z} \left( z \right) = \left( {f}_{x} \ast {f}_{y} \right) \left( z \right), \; z \in \left\{ -5, -4, \ldots, 0, \ldots, 4, 5 \right\} $$

Which is given by:

$$ {f}_{z} \left( z \right) = \begin{cases} \frac{1}{36} & \text{ if } \left| z \right| = 5 \\ \frac{2}{36} & \text{ if } \left| z \right| = 4 \\ \frac{1}{36} & \text{ if } \left| z \right| = 3 \\ \vdots \\ \frac{6 - i}{36} & \text{ if } \left| z \right| = i \end{cases} $$

Now the expected value is just summing over the values.

For the absolute value it would be:

$$ 0 \cdot \frac{6}{36} + 1 \cdot \frac{2 \cdot 5}{36} + 2 \cdot \frac{2 \cdot 4}{36} + 3 \cdot \frac{2 \cdot 3}{36} + 4 \cdot \frac{2 \cdot 2}{36} + 5 \cdot \frac{2 \cdot 1}{36} = \frac{70}{36} $$

A simple MATLAB code to verify:

numRelaizations = 100000;

mA = randi(6, numRelaizations, 2);

vA = abs(mA(:, 1) - mA(:, 2));
mean(vA) 
0
On

$X$ and $Y$ are two independent random variables following a uniform distribution on $\{1, \ldots, 6\}$ (your two dices). Using conditional expectation you have $$ \mathbb{E} \left[ \left\lvert X - Y \right\rvert \right] = \sum_{k = 1}^6 \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = k \right] \mathbb{P} \left( Y = k \right). $$ From the law of $Y$, you know that $\mathbb{P} \left( Y = k \right) = \frac{1}{6}$ for all $k$. Moreover, you can check that \begin{align*} \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = 1 \right] = \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = 6 \right] &= \frac{15}{6}, \\ \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = 2 \right] = \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = 5 \right] &= \frac{11}{6}, \\ \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = 3 \right] = \mathbb{E} \left[ \left\lvert X - Y \right\rvert \mid Y = 4 \right] &= \frac{9}{6}. \end{align*} Therefore you finally have $$ \mathbb{E} \left[ \left\lvert X - Y \right\rvert \right] = 2 \times \frac{15 + 11 + 9}{6} \times \frac{1}{6} = \frac{70}{36}. $$

0
On

Here is a generating function approach. We encode the result of a die roll by \begin{align*} x^1+x^2+x^3+x^4+x^5+x^6 \end{align*} Since the dice are not distinguishible we consider the absolute difference between two die rolls. We obtain by increasing outcome of the second die roll the absolute differences encoded as \begin{align*} \begin{array}{ll|l} \mathrm{encoded\ absolute\ difference}&&\mathrm{second\ die}\\ \hline \phantom{+}1+x+x^2+x^3+x^4+x^5&&x\\ +1+x+x^2+x^3+x^4&+x&x^2\\ +1+x+x^2+x^3&+x+x^2&x^3\\ +1+x+x^2&+x+x^2+x^3&x^4\\ +1+x&+x+x^2+x^3+x^4&x^5\\ +1&+x+x^2+x^3+x^4+x^5&x^6\\ \hline 6+10x+8x^2+6x^3+4x^4+2x^5 \end{array} \end{align*} The polynomial in the last line encodes all absolute differences between two die rolls. The coefficient of each term gives the number of occurrences of the absolute difference which is indicated by the exponent of $x$ of the term. Since there is a total of $36$ outcomes when rolling two six-sided die the generating function is \begin{align*} A(x)=\frac{1}{36}\left(6+10x+8x^2+6x^3+4x^4+2x^5\right) \end{align*} It follows the expected value is \begin{align*} \color{blue}{\left.\left(\frac{d}{dx}A(x)\right)\right|_{x=1}} &=\left.\frac{1}{36}\left(10+16x+18x^2+16x^3+10x^4\right)\right|_{x=1}\\ &=\frac{1}{36}\left(10+16+18+16+10\right)\\ &=\frac{70}{36}\\ &\,\,\color{blue}{=\frac{35}{18}} \end{align*}

0
On

There are $36$ possible rolls, $30$ in which the difference is non-zero and $6$ in which the difference is zero.

Non-Zero Difference

Let $d_{l}$ be the lower number and $d_{u}$ be the higher number. Define the followings:

$$ \begin{aligned} x_{1} &= d_{l} - 0 \\ x_{2} &= d_{u} - d_{l} \\ x_{3} &= 7 - d_{u} \\ \end{aligned} $$

Then we have $x_{1}+x_{2}+x_{3}=7$. Using symmetry, we have $E\left[d_{u}-d_{l}\right]=E\left[x_{2}\right]=\frac{7}{3}$

Putting it all together

The expected value of the difference is then given by the following:

$$ \begin{aligned} E &= \frac{30\cdot\frac{7}{3}+6\cdot 0}{30+6} \\ &= \frac{35}{18} \end{aligned} $$