# Multiple dice rolls (D&D Skill challenge)

In Dungeons and Dragons there is something called a skill challenge, which involves rolling some dice (no surprise there).

An example of a skill challenge: Skill challenge DC 25 thievery. Roll a d20* and add your thievery bonus (let's say 11) and check if the result matches or goes over 25 take note and roll again (next turn).

As soon as you have five rolls under 25 you fail. As soon as you have 2 rolls over or equal to 25 you succeed in the skill challenge.

How do I calculate the odds of being successful in a skill challenge?

With the numbers I provided I need at least a 14 to match the DC 25. That means that I have $7/20$ odds of matching (or going over) the DC (and $13/20$ for the opposite).

If I only had to match the DC once the math would be easy:
$(13/20)^5$ is the probability of failing, so $1-(13/20)^5$ is the probability of succeeding.

* d20 = 20 sided die, numbered 1-20.

-
So in 5 rolls, you need at least 2 rolls (not necessarily consecutive) to be over 25 with the bonus? – Jacob Jan 23 '13 at 19:20
@Jacob I can have at most 5 rolls under 25 (with the bonus). And need 2 rolls over 25. Meaning that I will roll at least 2 times and at most 6 times. – João Portela Jan 24 '13 at 17:40

An equivalent way of phrasing this is that you roll 6d20 (because $6=5+2-1$ is the number of rolls after which you'll definitely have either succeeded or failed, and can't have done both), and succeed if at least two of those are higher than the threshold number. So your overall failure probability is $$p^6 +6 p^5(1-p) \, ,$$ where $p=13/20$ is the probability of failing on any given roll (the first term counts the probability of failing 6 times, the second the probability of failing 5 times and succeeding once).

So, in your specific example, the probability of success is $$1-(13/20)^6-6(13/20)^5(7/20) \approx 0.6809 \, .$$

-
Thank you for your answer. I feel a bit embarrassed for being so close and still not seeing it. Is it hard to generalize this method for any number of failures and successes? – João Portela Jan 24 '13 at 17:35
I tried to generalize your answer but I'm not sure I did everything right (it's been a long time since statistics classes) maybe you can have a look? – João Portela Jan 24 '13 at 18:55

If we define:

• $m$ - maximum number of misses (originally $5$)
• $n$ - required number of successes (originally $2$)
• $p$ - probability of failing any given roll (originally $13/20$)
• $x = m + n - 1$ - number of rolls after which we'll have either succeeded or failed (originally $6$)

The overall failure probability can calculated using this:

$$\sum_{i=0}^{n-1} \binom{x}{x-i} \times p^\left(x-i\right) \times \left(1-p\right)^i$$

$s$ is the odds of success.

Example 1

Given $m = 5$, $n = 1$ and $p = 13/20$

we get $$x=5 \\ s = 1 - \left( 1 \times \left( 13/20 \right)^5 \times \left (1 - \left( 13/20 \right) \right)^0 \right)$$

Example 2

Given $m = 5$, $n = 2$ and $p = 13/20$

we get $$x=6 \\ s = 1 - \left( 1 \times \left( 13/20 \right)^6 \times \left (1 - \left( 13/20 \right) \right)^0 + 6 \times \left( 13/20 \right)^5 \times \left (1 - \left( 13/20 \right) \right)^1 \right)$$

Example 3

Given $m = 5$, $n = 3$ and $p = 13/20$

we get $$x=7 \\ s = 1 - \\ \left( \\ 1 \times \left( 13/20 \right)^7 \times \left (1 - \left( 13/20 \right) \right)^0 + \\ 7 \times \left( 13/20 \right)^6 \times \left (1 - \left( 13/20 \right) \right)^1 + \\ 21 \times \left( 13/20 \right)^5 \times \left (1 - \left( 13/20 \right) \right)^2 \right)$$

-
This looks almost right to me, except that a lot of your $m$s should be $x$s (since that's the number of rolls you're making). Basically, you want to take the binomial expansion for $\left(p+(1-p)\right)^x$ and truncate it after $n$ terms. – Micah Jan 24 '13 at 19:11
The thing you need to be careful about when generalizing is the "you'll definitely have either succeeded or failed, and can't have done both" condition. It's possible to have some very similar-sounding rules to these ones where there's no such number -- then you have to worry a lot more about order. For example, if you decided that a natural 20 counted as 2 successes and a natural 1 counted as 2 failures, then rolling 6d20 and coming up with 5 20s and a 1 could be either an overall success or failure, depending on the order you rolled them in. – Micah Jan 24 '13 at 19:14
Okay, now I believe you. :) – Micah Jan 25 '13 at 1:32
@Micah Now you got me curious of how to solve for that case, maybe I'll create a new question for that. I have also taken the liberty of adding some example values. – João Portela Jan 25 '13 at 12:02