# Roll two dice, find the pmf of X if X is the difference between largest and smallest number

I have another problem very much like the one I recently asked about in the thread Problem: Roll two dice and find the pmf of X . I'm trying to solve it using similar techniques but with no luck.

"Roll two dice and find the pmf of X if X is the difference between the largest and the smallest numbers."

I introduce the random variables $X_1=\{1,2,...,6\}$ and $X_2=\{1,2,...,6\}$ and I am trying to find

$P(\max(X_1,X_2)-\min(X_1,X_2) = k)$ for $k=\{0,1,...,5\}$.

(This is how i interpret the question. It would make sense to talk about the absoulte value between the two numbers, but since they explicity state in the problem the largest minus the smallest i figured this was the way to go.)

I note that $$P(\max(X_1,X_2)-\min(X_1,X_2) = k) = \\=P(\max(X_1,X_2)-\min(X_1,X_2) \leqq k) - P(\max(X_1,X_2)-\min(X_1,X_2) < k) =\\= P(\max(X_1,X_2)-\min(X_1,X_2) \leqq k) - P(\max(X_1,X_2)-\min(X_1,X_2) \leqq k-1)$$

So now I try to evaluate the expression $P(\max(X_1,X_2)-\min(X_1,X_2) \leqq k)$.

By rearranging I get that $P(\max(X_1,X_2)-\min(X_1,X_2) \leqq k) = P(\max(X_1,X_2) \leqq k+\min(X_1,X_2))$

and since $\{\max(X_1,X_2) \leqq k\}$ = $\{X_1\leqq k\} \cap \{ X_2 \leqq k\}$

the expression above equals $$P(\max(X_1,X_2) \leqq k+\min(X_1,X_2)) = P[(X_1\leqq k + \min(X_1,X_2)) \cap (X_2 \leqq k + \min(X_1,X_2))] = P(X_1\leqq k + \min(X_1,X_2))P(X_2\leqq k + \min(X_1,X_2)) = [P(X_1\leqq k + \min(X_1,X_2))]^2$$

Now evaluating $P(X_1\leqq k + \min(X_1,X_2)) = P(\min(X_1,X_2)\geqq X_1 -k)$ which is, by the same reasoning as above, $P[(X_1\geqq X_1-k) \cap (X_2\geqq X_1-k)] = P[(k\geqq 0) \cap (X_2\geqq X_1-k)] = P(X_2 \geqq X_1-k) = P(X_1 -X_2 \leqq k)$.

Here I can now try with a few values on $k$ and hope that a pattern emerges.

$$k=0: P(X_1 -X_2 \leqq 0) = \frac{6}{36}$$

$$k=1: P(X_1 -X_2 \leqq 1) = \frac{12}{36}$$

$$k=2: P(X_1 -X_2 \leqq 2) = \frac{16}{36}$$

and so on. I cant seem to find a pattern however, and it makes med doubt that the method I used is the right one. There is probably some even more simpler solution to this problem, but even if that is the case I wonder if my method is right and if so how to proceed from here?

Thanks!

• Couldn't find pattern because of some counting errors? – BruceET Apr 4 '18 at 3:04

I think in this case it is best simply to go case by case. Let $D=\max(X_1,X_2)-\min(X_1,X_2)$.For example $$P(D=0)=P(X_1=X_2)=\frac{6}{36}$$ while $$P(D=1)=P(\{(1,2),(2,1),(2,3),(3,2),(3,4),(4,3),(4,5),(5,4), (5,6),(6,5)\}=\frac{10}{36}$$ while $$P(D=2)=P(\{ (1,3),(3,1),(2,4),(4,2),(3,5),(5,3),(4,6),(6,4) \})=\frac{8}{36}$$ while $$P(D=3)=P(\{ (1,4),(4,1),(2,5),(5,2),(3,6),(6,3) \})=\frac{6}{36}$$ while $$P(D=4)=P(\{ (1,5),(5,1),(2,6),(6,2) \})=\frac{4}{36}$$ and finally $$P(D=5)=P(\{ (1,6),(6,1) \})=\frac{2}{36}.$$

• Thanks! This solution makes perfect sense. However, I still wonder whether my first attempt at solution is obviously wrong somewhere in my steps. Even though the problem is easily solved using your method, I still think that my first attempt also can solve the problem. Maybe i did some obvious mistake that you can identify? – tarkovsky123 Apr 4 '18 at 11:40

Table of absolute differences. Red die rows, Green die columns.

 Red \ Green   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


So $P(D = 0) = 6/36,\, P(D = 1) = 10/36,\, \dots, P(D = 5) = 2/36.$

Simulation in R:

 set.seed(4318);  m = 10^6;  faces = 1:6
d = replicate( m, abs(diff(sample(faces, 2, repl=T))) )
round(36*table(d)/m)
d
0  1  2  3  4  5
6 10  8  6  4  2


Histogram of simulated probabilities (blue bars) and exact probabilities (red dots): 