# Probability of totals of random variables, decided by rolling 4 dice then making another success roll on successful rolls

You roll 4 dice. The results determine the next set of rolls you can make and what the target values for those rolls are in order to add a value to your possible totals. How do we calculate the probabilities of each possible total - assuming we choose the 2nd roll to get the best possible value.

An example:

+------------+-------------+-------+
| First Roll | Second Roll | Value |
+------------+-------------+-------+
| 2+         | 3+          |     1 |
| 3+         | 4+          |     2 |
+------------+-------------+-------+


For the first roll we roll: [1, 1, 3, 3]

For the 2nd roll we can roll for each 3 to try and get a 4+ to add the value 2 to our total.

So the probabilities of the totals we want are:

• 0: 25%
• 2: 50%
• 4: 25%

This is a simple example but as you can see if our first roll was [1,2,3,3] then we would have different probabilities with different values to consider when calculating the totals and their probabilities.

Ultimately we would like to iterate through all possible combinations of the first 4 dice to get the overall probability of each total.

• I still do not fully understand the rules. Lets say, I roll $1,2,3,4$ in the first try. What happens then ? – Peter Oct 4 '17 at 21:59
• Thanks for looking Peter. For each of your rolls you would try for the highest value you are allowed to by the first column. So for 1 you can't make a second roll. For the 2 you can't try for the value 2 because you haven't rolled a 3+. But you can for the 3 and 4. So for the 2 you would try to get 1 by rolling a 3+ and for the 3 and 4 you would try to get 2 by rolling a 4+. The maximum you could get is 5. – uoa7 Oct 4 '17 at 22:25

Since each of the dice are completely independent under these rules, including their final value, we can start by simply considering the combinations of rolls of a single die. Since there aren't very many possible combinations, drawing a tree of the possibilities with their probabilities makes sense here.

• rolled 1 (1/6)
• value 0 (total probability 1/6 = 6/36)
• rolled 2 (1/6)
• reroll too low (2/6) -> value 0 (total probability 1*2/36)
• reroll high (4/6) -> value 1 (total probability 1*4/36)
• rolled 3-6 (4/6)
• reroll too low (3/6) -> value 0 (total probability 4*3/36)
• reroll high (3/6) -> value 2 (total probability 4*3/36)

For validation we make sure the probabilities add up to 1; (6 + 2 + 4 + 12 + 12) / 36 = 1, so this distribution looks right.

Merging same-value results to simplify the next step, each die has a 20/36 chance of scoring 0, 4/36 chance of scoring 1, and 12/36 chance of scoring 2.

Now for n dice, the probability of a given total value can be found by finding every permutation that can lead to that value, and summing the probability of each of those permutations. The probability of one permutation is the multiplication of the probability of the required result for each of the dice. Since there are only 4 dice it's not hard to do this manually without generalizing for n (which is significantly less intuitive).  P(0) = (20/36)*(20/36)*(20/36)*(20/36) P(1) = (20/36)*(20/36)*(20/36)*(4/36) * 4 (AAAB, AABA, ABAA, BAAA) P(2) = (20/36)*(20/36)*(20/36)*(12/36) * 4 + (20/36)*(20/36)*(4/36)*(4/36) * 6 (AABB, ABAB, ABBA, BAAB, BABA, BBAA) P(3) = (20/36)*(4/36)*(4/36)*(4/36) * 4 + (20/36)*(20/36)*(4/36)*(12/36) * 12 (like P(2)'s permutations, but one set with the first B replaced with C, and another with the second) ... etc. (it doesn't get more complicated) P(8) = (12/36)*(12/36)*(12/36)*(12/36)