# Probability of getting a certain number: rolling a die with x number of sides, with advantage

In D&D when you have advantage or disadvantage you roll your die twice (ex 3&7), and pick the higher number($7$). When you have disadvantage you pick the lower($3$). I want to know how to calculate the probability of getting a certain number with a $s$ sided die with advantage and disadvantage (getting 1 with 20 sided die with advantage is 1/400(.25%) because it would require both dice to be 1; getting 2 is 1/100(1%) because the only possibilities are: 1,1;1,2;2,1;2,2)

What would the formula look like?

What if instead of the same die rolled twice: there were two different sided die? (Ex 20 sided and 10 sided)

• Basically you want max(or min) of two dice = a certain number? Nov 24 '15 at 15:48
• @math_noob Yes. Nov 24 '15 at 15:48
• Let's say for a fair dice, you want the probability that max of two throws is 4. So the favourable outcomes are $(1, 4), (2, 4), (3, 4), (4, 4), (4, 1), (4, 2), (4, 3)$. Required probability = $7/36$ Nov 24 '15 at 15:59
• With 6 sided dice, that would be true. Nov 24 '15 at 16:00

You can translate the problem as a count of sequences. By example you have a sequence $(a_1,a_2,...,a_n)$ where each term represent a dice, then you want to count the number of sequences that hold some conditions.

By example Im searching the sequences where the maximum value $M\in A$ and the minimum value $m\in B$. When a dice hold some condition I symbolize it as $M$, $m$ or $X$ for a different value.

If I have 4 dice the sequences $(M,M,M,m)$ or $(X,M,X,m)$ hold the conditions for a maximum value and a minimum.

Some example: I want to know the number of throws where the maximum value is $M\ge 10$ and the minimum is $m\le 3$, and my throw is composed by 2 dice of 20 side (2D20) a dice of 10 side (1D10) and a dice of 6 side (1D6), and for simplicity the values of the sides for each dice go from 1 to it number of sides, and all side have the same probability to be (i.e. they are fair dice).

I order my sequence putting in the 2 first place the 2D20, after the 1D10 and last the 1D6, i.e. $(D20,D20,D10,D6)$. Now I want to know the number of sequences of the kind $(a_1,a_2,a_3,a_4)$ where $a_i\in\{X,M,m\}$.

Each $a_i$ can hold or not some condition, by example $a_4$ cant hold $M$ condition because it maximum value is $6$ so $a_4\in\{X,m\}$ so the total number of sequences will be anything with at least one $M$ and one $m$.

Each symbolic sequence have associated a number of sequences, by example $XMMm=6*11*1*3$. When the dice are different it is hard to search a closed formula for it, but for equal dice we can simplify it a lot.

Sometimes it easier to count the sequences that dont hold some condition. In the anterior example we can count all the sequences with $\forall a_i \in\{X,M\}$ and the sequences $\forall a_i \in\{X,m\}$, add them and subtract at the total number of possible sequences to get the probability that we want.

Another approach can be encode the information that we want on some kind of algebraic property, using some knowledge of theory of numbers. With some exponential scale we can make sums that encode qualitative information.

I will think in a way to encode all of this in a generating function. Anyway this is not a perfect answer because it doesnt means that exist a closed formula for every case that you want.

The probability of getting $n$ on $d$-sided dice with advantage is the probability either of getting $n$ on both dice, $\left(\frac1d\right)^2=\frac1{d^2}$, or $n$ on one die and from $1$ to $n-1$ on the other, $2\frac{n-1}d\frac1d=\frac{2n-2}{d^2}$. Thus, the probability is $$\frac{2n-1}{d^2}$$ Another way of thinking of this is that the probability of getting at most $n$ on two $d$-sided dice is $\left(\frac nd\right)^2=\frac{n^2}{d^2}$. Thus, the probability of getting exactly $n$ is the probability of getting at most $n$ but not getting at most $n-1$, that is $\frac{n^2}{d^2}-\frac{(n-1)^2}{d^2}$, which is $$\frac{2n-1}{d^2}$$ as above.

Rolling with disadvantage is the same as rolling with advantage, but subtracting the roll of each die from $d+1$. That is, getting $n$ on two $d$-sided dice with disadvantage is the same as getting $d-n+1$ with advantage: $$\frac{2(d-n+1)-1}{d^2}=\frac{2d-2n+1}{d^2}$$

• Using what you have I got the following function: z is # of dice d is sides on the dice and n is the value to find the % of. 1/(d^z) + [z-1]SUMMATION[i=1](1/(d^(z-i))*zCi*((n^i)-1)/(d^i)) Sorry I don't know how to format math on SE. Nov 24 '15 at 19:25
• @GrantDavis: Is this the correct formatting of your fomula? $$\frac1{d^z} +\sum_{i=1}^{z-1} \frac1{d^{z-i}}\binom{z}{i}\frac{n^i-1}{d^i}$$
– robjohn
Nov 24 '15 at 19:30
• Not quite drive.google.com/file/d/0B1p-c4afh5jFSmpEWTB0aGRUMGc/… is what I came up with Nov 24 '15 at 19:33
• The zCi is combination formula which is equal to: z! / (z-i)!*i! Nov 24 '15 at 19:38
• In any case, your formula above is equal to $$\frac{(n+1)^z-n^z-2^z+2}{d^z}$$ If you replace $n^i-1$ by $(n-1)^i$ then you get $$\frac{n^z-(n-1)^z}{d^z}$$ which looks right
– robjohn
Nov 24 '15 at 20:06

Let $i,j$ denote the two outcomes of the rolling of the two dice. If $i\not =j$ then there are two realizations: $(i,j)$ and $(j,i)$. For $(i,i)$ there is only one realization.

Having said that consider an $s$ sided die and the advantage case and the number $k$. We have the following possibilities:

$$(1,k),(2,k),...(k,k)$$

out of which $k-1$ have two possible realizations and one, $(k,k)$ has only one possible realization. So the probability of getting $k$ in this case is

$$2\frac{k-1}{s^2}+\frac1{s^2}=\frac{2k-1}{s^2}.$$

$$(k,k),(k,k+1),...,(k,s)$$
out of which $s-k$ have $2$ possible realizations and $1$, $(k,k)$ again, has only one realization. So, the probability of getting $k$ with disadvantage is
$$2\frac{s-k}{s^2}+\frac1{s^2}=\frac{2s-2k+1}{s^2}.$$