# How does re-rolling $n$ of $m$ dice affect the probability distribution of the set of dice?

I'm trying to wrap my head around some dice maths with re-rolls.

Say I have $$m$$ six sided dice and roll them. I then check each die individually, and if the it is showing a face less than some threshold $$t$$ then I can re-roll up to $$n$$ of these "failed" dice. How will this change the probability distribution of each face for the set of dice?

Example:

To start with, say I just roll $$2$$ dice. The probability of each face appearing on either die is $$\frac{1}{6}$$.

Then say I can re-roll both of these dice if the result of the die is less than 2. So if I rolled $$\{1, 4\}$$ then I would re-roll the $$1$$, if I rolled a $$\{1, 1\}$$ I would re-roll both dice, and if I rolled a $$\{2, 3\}$$ then I would re-roll neither.

My understanding is that the probability of a face appearing on each face is:

$$\mathbb{P}(1) = \frac{1}{36}$$

$$\mathbb{P}(\{2\dots6\}) = \frac{7}{36}$$

However I get completely lost when I can only re-roll up to $$1$$ die, so in the example above where I rolled a $$\{2, 3\}$$ I would only be able to re-roll one of the dice.

Ideally I would be able to expand this to a formula where I can roll a larger number of dice $$m$$, and re-roll up to $$n$$ of them where the result is less than $$t$$.

• You need to specify the procedure a little more. Suppose you can re-roll a $1$ or a $2$, but only one die. If the roll is $1$-$2$, which die do you re-roll? – saulspatz Dec 6 '19 at 16:13
• That's a good point. I'm trying to run stats on a board game so in reality it could be either, as it would still be considered re-rolling $1$ of $2$ failed dice. I assume if we re-rolled the minimum available it would generally produce the best result. – Andy Heard Dec 6 '19 at 16:17
• If you just want stats, I'd advise running simulations. This is a messy calculation, as Ross noted, so even if I did it theoretically, I'd want to run a simulation to confirm my computations. – saulspatz Dec 6 '19 at 16:20
• I'm tempted to, this would end up in code anyway so may run some simulations to get a decent level of accuracy. – Andy Heard Dec 6 '19 at 16:21

Your two die, reroll 1 example is correct. If there is no limit on the number of dice you reroll, each die is independent and you can use that technique for each of the. If the number of dice you are allowed to reroll is less than the number of dice it becomes much more complicated.

Taking three dice where you can reroll $$2$$ or less but only two of them, we initially ignore the restriction on rerolling only two. Each die has $$\frac 1{18}$$ chance to come up $$1$$ or $$2$$ because you have to get $$1$$ or $$2$$ at the start, then the specific number for the second roll. The other numbers then have chance $$\frac 29$$ to come up.

When we consider the restriction you have $$\frac 1{216}$$ chance of rolling all $$1$$s and leaving you stuck with one of them. This would add $$\frac 1{216} \cdot \frac 56$$ chance of getting a $$1$$ where the $$\frac 56$$ is because we already counted the chance you get three $$1$$s, reroll, and this die comes up $$1$$ again. You lose $$\frac 1{216} \frac 16$$ chance of getting a $$2$$ because you can't reroll the third die and get $$2$$. The chance of each number above $$2$$ is decreased by $$\frac 1{6^4}$$ just like $$2$$.

You have $$\frac 7{216}$$ of rolling all numbers $$2$$ or below including at least one $$2$$, which sticks you with this $$2$$. This adds $$\frac 7{216}\cdot \frac 56$$ to the chance you get a $$2$$ and subtracts $$\frac 7{216}\cdot \frac 16$$ from the chance of each other number.

With more dice it is even more of a mess.