# Dice probability with limited reroll

What is the probability of getting 2 successes when 3 dice are rolled once, and then one die is optionally rerolled?

$$n = \text{Number of dice} = 3$$ $$p_s = \text{Single die success probability (when the face is 3 or more)} = \frac{1}{2}$$ $$k = \text{Number of successful die} \in 0, 1, 2, 3$$ $$P(n, k, p) = \binom{n}{k}p^k(1-p)^{n-k}$$

The probability of getting 2 success $(k=2)$ if each die is rolled only once $(p = p_s = \frac{1}{2})$ is $$P\left(3,\ 2,\ \frac{1}{2}\right) = \binom{3}{2}\left(\frac{1}{2}\right)^2\left(1-\frac{1}{2}\right)^{3-2} = \frac{3}{8} = 0.375$$

If we have the option to reroll any failed die once, then $$p = p_s + (1-p_s)p_s = \frac{3}{4}\\$$ and $$P\left(3,\ 2,\ \frac{3}{4}\right) = \binom{3}{2}\left(\frac{3}{4}\right)^2\left(1-\frac{3}{4}\right)^{3-2} = \frac{27}{64} = 0.421875$$

Following the principles from this answer: Fair and Unfair coin Probability

Out of the 3 dice, 2 $(n_{1,2} = 2)$ are rolled once $(p_{1,2} = p_s = \frac{1}{2})$ and 1 die $(n_3 = 1)$ is rolled twice $(p_3 = p_s + (1 - p_s)p_s = \frac{3}{4})$

The probability of rolling 2 successes when all three dice are rolled and then one is rerolled is: $$P(\text{Rolling 2 successes on the 1-roll dice})\times P(\text{Rolling 0 successes on the 2-roll die})$$ $$+\ P(\text{Rolling 1 success on the 1-roll dice})\times P(\text{Rolling 1 success on the 2-roll die})$$ $$= P\left(2,\ 2,\ \frac{1}{2}\right)\cdot P\left(1,\ 0,\ \frac{3}{4}\right) + P\left(2,\ 1,\ \frac{1}{2}\right)\cdot P\left(1,\ 1,\ \frac{3}{4}\right)$$ $$= \binom{2}{2}\left(\frac{1}{2}\right)^2\left(1 - \frac{1}{2}\right)^{2 - 2}\cdot\binom{1}{0}\left(\frac{3}{4}\right)^0\left(1 - \frac{3}{4}\right)^{1 - 0}$$ $$+ \binom{2}{1}\left(\frac{1}{2}\right)^1\left(1 - \frac{1}{2}\right)^{2 - 1}\cdot\binom{1}{1}\left(\frac{3}{4}\right)^1\left(1 - \frac{3}{4}\right)^{1 - 1}$$ $$= \frac{7}{16} = 0.4375$$

However this seems wrong because it's greater than if I were to roll 3 dice with rerolling $P\left(3,\ 2,\ \frac{3}{4}\right) = \frac{27}{64} = 0.421875$

What am I missing?

• @joriki - Although this question is similar to my other ones, it's different enough to stand on its own as it's tackling the issue at a different angle. After some research, I've added more information and linked this question to another more similar question. However I still can't account for the discrepancy at the end. – Daniel Mar 23 '16 at 17:16
• Two things are not quite clear to me from the question: Does "and then one die is optionally rerolled" mean that there is one particular die that can optionally be rerolled, or can any failed die be optionally rerolled? And does it get rerolled whenever its own first roll failed, or only if the first roll didn't yield a total of $2$ successes? – joriki Mar 25 '16 at 8:42
• @joriki Any failed die can be optionally rerolled (but only one). Only failed dice can be rerolled regardless of the result of the first roll. – Daniel Mar 25 '16 at 8:52
• But do you stop if the first roll yields two successes, or do you then reroll the failed die anyway (spoiling the result of two successes if the reroll succeds)? – joriki Mar 25 '16 at 9:34

It seems to me now that there was a misunderstanding regarding your first question. In that question, you didn't state that you stop if you get the desired number of successes on the first attempt ("What is the probability of having exactly $k$ successes from $n$ coins if all $n$ coins are flipped and there are $x$ successes, then $n - x$ coins are re-flipped to give the additional $k - x$ successes?") This (and the fact that you were expecting the success probabilities to add up to $1$) led me to think that you always reflip the failed coins, independent of the result of the first flip. Now I see from the fact that you had $P(2)=f(2)+\cdots$ instead of $P(2)=f(2)f(0)+\cdots$ and $P(1)=f(1)+\cdots$ instead of $P(1)=f(1)f(0)+\cdots$, and from the way you're now trying to apply my answer, that apparently you meant all along that you stop if the first flip gives you the $k$ successes.
In that case, my answer to that other question is wrong, and that also explains what's going wrong here: Your result $\frac{27}{64}$ is the probability to get exactly $2$ successes if all failed coins are reflipped, even if the first flip yielded exactly $2$ successes. This is less than the probability you actually want.
• Thanks for your answer joriki! Your right, my first question was badly written and I apologise for this. You're saying that the probability for the dice which can be rerolled: $p = \frac{1}{2} + (1 - \frac{1}{2})\frac{1}{2} = \frac{3}{4}$ is wrong because it's not accounting for when the first flip yields 2 results right? But using $p = 1 - (1 - \frac{1}{2})^2 = \frac{3}{4}$ will yield the same result $\frac{27}{64}$ won't it? – Daniel Mar 25 '16 at 8:03
• @DanielK: Yes. You can't solve this with a single probability $p$ plugged into the binomial distribution, because the binomial distribution assumes $n$ independent events that occur with identical independent probability $p$. Because the reflipping depends on what other coins do, this doesn't apply. I got around this in my answer to your first question only because I thought that all failed coins would be reflipped, so even though their reflipping depended on something, it only depended on what the coin itself did, so I was able to aggregate it into a single $p$ independent of other coins. – joriki Mar 25 '16 at 8:35