# Throw dice twice picking the best result.

There are some tabletops with this dice trick and I have not been able to find or translate this to math.

For example in DnD there is Advantage that means throwing a 20 sided dice choosing the best (higher) result.

In CoD some dice tricks allow you to for example throw 10, 10 sided dice with any number matching 8 or above being considered a success. Normally I can expect 3 successes. If I throw the same number of dice twice choosing the best result. How many successes can I expect to have? What probability distributions should I use? I think have not been able to apply them correctly in this case.

• To clarify, you roll all 10 dice and count successes, then roll all 10 again, count successes again, and finally take the greater of the two outcomes, right? – amd Sep 12 at 0:00

With this mass reroll, you’re starting to get into what are called order statistics: given the random variables $$X_1,\dots,X_n$$, the random variable denoted by $$X_{(k)}$$, called the $$k$$th order statistic, is the result of sorting the $$n$$ values in increasing order and taking the $$k$$th one. Two of the most common order statistics are the minimum $$X_{(1)}$$ and maximum $$X_{(n)}$$. Here, we’ve got two i.i.d. variables $$X_1,X_2 \sim \operatorname{Binom}\left(10,\frac3{10}\right)$$. It’s pretty easy to come up with a formula for the PMF of the order statistic $$X_{(2)}$$: we want both values to be at most $$k$$, but not have both be less than $$k$$.

So, let $$f(x)$$ be the PMF of the distribution and $$F(x)$$ the CDF. Then, \begin{align} \Pr(X_{(2)}=k) &= \Pr(X_1\le k,X_2\le k) - \Pr(X_1\lt k, X_2\lt k) \\ &= F(k)^2 - F(k-1)^2 \\ &= F(k)^2 - (F(k)-f(k))^2. \end{align} This is not a particularly nice expression to calculate by hand, and computing the expected value gets even uglier. Perhaps someone more clever than I can come up with a way to use linearity of expectation or LOTUS to derive a nicer formula for the expectation than the obvious weighted sum.† With the help of Mathematica, I get $$\mathbb E[X_{(2)}] \approx 3.803$$, a slight improvement over the expected value of $$3$$ without the reroll. That the improvement is small makes some intuitive sense: with ten dice, most of the distribution’s mass is going to be near the expected value, so rolling a second time isn’t likely to shift this mass by much. It’s also interesting in this context to examine the probability $$\Pr(X_2\gt X_1 \mid X_1=k) = \Pr(X_2\gt k) = 1-F(k)$$ of the second roll improving on $$k$$ hits.

You can also use an online tool such as AnyDice to explore this. Here, for instance, are the graphs of the probabilities to get at least $$k$$ hits both with and without the reroll: The AnyDice code to generate this plot is

output [count {8..10} in 10d10] named "10d10"

output [highest of [count {8..10} in 10d10] and [count {8..10} in 10d10]] named "higher of 2 x 10d10"

The expected value of $$3.80$$ reported by AnyDice agrees with my Mathematica calculations.

† I also tried to attack this with generating functions, but the squared terms correspond to Hadamard products of the related sequences, which don’t have particularly nice expressions as transformations of the individual o.g.f.s. One other possible line of attack is to express the CDF of the binomial distribution in terms of the regularized beta function, but I didn’t get very far with that, either.

Edit: As amd points out, this answer may have misinterpreted what the OP has in mind. I'll leave it posted as is for now. end edit

If you roll a $$10$$-sided die twice, the probability of "failure" on both rolls is $$(7/10)^2=0.49$$, so the probability of "success" for that die is $$0.51$$. The expected number of successes when rolling ten dice twice each is thus $$10\times0.51=5.1$$.

Another way to arrive at the answer is to imagine rolling all $$10$$ dice, then rerolling only the ones that aren't successes. On average you'll have $$10\times(3/10)=3$$ successes with the first set, leaving, on average, $$7$$ dice to be rerolled, which will, on average, produce $$7\times(3/10)=2.1$$ successes, for a total average of $$3+2.1=5.1$$ successes.

• I don’t think that this is what the OP was asking about. Here you’re rolling each die twice and taking the best result of each pair of rolls. The OP is asking about rolling all ten, counting successes and then rolling all ten again and counting those successes, finally taking the higher of the two results. – amd Sep 11 at 23:59
• @amd, thanks, you may well be right. – Barry Cipra Sep 12 at 0:44