# PDF of open ended double dice rolls

1. Sep 15, 2015

### S. Moger

In many games a pair of standard six sided dice is used. I denote this 2d6.

In this particular game, if a die is rolled the result is registered. If it returned a 6, it is re-rolled while a 5 is recorded. So it's basically a 2d5+1 open ended roll, which in theory could end up with very large numbers.

Anyway, the expected value of one such roll is 4, which if written out as a series, can be calculated like this $\sum_{n=1}^{\infty} \frac{5\cdot3+5}{6^n} = 20/5 = 4$. It can be generalized to show that introducing the open endedness (i.e. dn+1) adds 1/2 to the average of dn.

For two dice in 2d5+1 arrangement the average is 8 compared to the 7 of 2d6.

That is all great, but now I want a function that returns the probability of 2d5+1 beating a roll of 2d5+1 plus an arbitrary integer c, i.e.

$f(c) = P([\mathit{2d5+1}]_1 > [\mathit{2d5+1}]_2 + c)$

To get an impression of the problem I tried drawing some approximate graphs by enumerating the sums of the "display values" of a 2d5+1 dice roll and pairing them with the probabilities of them containing at least one 6 and thus computing the average "return values" using the known average computed before. From 2-6 the display values equal the actual values. From 7 to 10 one six can be present. At 11, one six is present, and at 12, both are. With this simplified approach 18 is the highest return value though.

And a sketch of the PDF:

This PDF (roughly) shows the return values of 2-6 and values that included a six as display value + the average of the next roll (apart from the bar for 7 which I added in manually). The real values would have to include some more data from non-six contributions. In any case, it would seem that some return values are drained in favor of increasing the span to the right. However, it would be interesting to populate the graphs above and to make them exact, incl. obtaining an expression for

$f(c) = P([\mathit{2d5+1}]_1 > [\mathit{2d5+1}]_2 + c)$

2. Sep 15, 2015

### andrewkirk

I'm afraid your description of the game lacks too much detail to be understood. You need to set out the rules step by step, as you would if writing instructions for a board game.

For example it's not even clear whether the two dice are rolled simultaneously, and what is done if the two dice give a 6 and a non-6. The meaning of '2d5+1 open ended roll' is indecipherable.

3. Sep 16, 2015

### S. Moger

Ok, you throw a pair of dice and sum the result. In many cases it ends there. However, if a dice shows a 6 it's rerolled after adding a five (not a six) to the sum. The new value of the new roll is added to that sum.

So for example:

Roll 1:
Dice show 2, 3.
Result is 2+3 = 5.

Roll 2:
Dice show 2, 6.
Result is 2+5 = 7 plus Roll 2.1 of the 6-die: 3:
7+3 = 10.

Roll 3:

Dice show 6, 6.
Result is 5+5 = 10 plus Roll 3.1 of both dice 6, 3:
10+5+3 = 18 plus Roll 3.2 of the 6-die: 2:
18+2 = 20

It's open-ended because it can be re-rolled ad infinitum (in theory).

The dice may show one thing, i.e. the "display value", but with the rules above the "display value" is not always the "return value" (for example in the case with a 6 roll).

The display value (of the initial 2-roll) has the PDF of a dual dice roll (2d6).

But from sum 7 and up there's a chance of at least one die displaying a 6. I think that "distribution" is

7 - 1/3
8 - 2/5
9 - 1/2
10 - 2/3
11 - 1
12 - 2 (should probably be 1, but got to note that both have to be rerolled here).

To get the "return value", the above would have to be superimposed on the PDF of a 2d6, while also taking into account the reduction of outcomes that result in for example 7 as a result of rerolls. The PDF in my original post is a bad sketch of how it approximately might look, but as can be seen the cutoff at 18 is made too early (it's still significant). Some kind of recursive super-imposition would have to be made to expand into higher values. It would be easy to write a computer program for it, but it would be more interesting to find a mathematical way (I would imagine a sum of sums).

Last edited: Sep 16, 2015
4. Sep 16, 2015

### andrewkirk

The first thing to notice is that the two dice can be considered independently, as they do not interact.

Let $X_1, X_2,X_3,X_4$ be four independent random variables, each with the distribution of the total from rolling a single die according to the rules you have outlined. Then the value $f(c)$ you are wondering about is

$$Pr\left((X_1+X_2)-(X_3+X_4)\right)>c$$

That will equal a quadruple sum of the product of the pdfs of the four random variables, where the limits for three of the variables are 1 to $\infty$ and for the fourth is 1 to a finite number based on the values of the other three. Can you work out what that upper limit for the fourth sum is?

The pdf of each $X_i$ is $f_{X_i}(x)=6^{-(\lfloor \frac{x-1}{5}\rfloor +1)}$ where $\lfloor x \rfloor$ indicates the rounding down of $x$ to an integer.

I expect that the sum may be able to be simplified, removing the need to compute it by brute force.

5. Sep 18, 2015

### gill1109

So when you have just one die, you throw it till you don't get a six, and then your score = number of sixes you threw x 5 + (non-6) result of last throw. This is the sum of a geometrically distributed random variable (times 5) plus an independent uniform number chosen from {1, 2, 3, 4, 5}. Now you want the probability distribution of the sum of two such independent random variables, minus an independent copy of the same thing.

I would use a computer algebra program to get the probability generating function and then expand it in a power series to get the probabilities: https://en.wikipedia.org/wiki/Probability-generating_function

6. Sep 19, 2015

### andrewkirk

I did a calc on this for scores of up to 30 from each of the four dice. Here's the cdf and pdf of the difference between the scores of two players, each with two dice: $X_1+X_2-X_3-X_4$. As one would expect, the pdf is symmetric and centred on zero. It looks roughly normal but I didn't do any tests of normality.

7. Sep 19, 2015

### S. Moger

Thanks for your input, I will get back to this as soon as I can !