# Formula for Calculating the Probability of Outcome - Custom Dice

I was hoping someone might be able to help me in calculating dice probability with custom dice. The desired outcome would be being able to change the values on a 6 sided die (rather than 1-6), as well as the number of dice being rolled, and solve for the probability that outcome A or outcome B, ect would occur when all dice are rolled at the same time.

For example, as I have been trying to figure this out, I have been using two custom dice. Essentially one for an "attack" roll and another one defending. The dice are both d6 but with different values on each side.

Attack Die: [0,1,1,1,2,2] Defense Die: [0,0,-1,-1,-1,-2]

The negative numbers are meant to reduce the total amount of damage the attack die would otherwise deal. This could perhaps be easier calculated using [0,0,1,1,1,2] and subtracting the outcome from the attacking die. I was able to make a chart showing the number of chances a certain outcome could occur if one of each of these was used:

enter image description here

I divided the number of chances each possible outcome had of occurring by the total number of possible outcomes and got my probability for each. The problem I have is calculating anything beyond two dice. I am pretty savvy with Excel, so I am trying to make a spreadsheet where I change the number of dice, or can tweak the faces of each die and the outcomes would adjust accordingly. Is there a simplified equation I can use that would factor in these variables and give the probability of a desired outcome?

Thank you for your time, I hope this post makes sense :)

• You can use generating functions. Let the attack outcomes be $a_1,a_2,a_3,\dots, a_k$ with corresponding probabilities $p_1,p_2,\dots,p_k$ and defense outcomes $d_1,d_2,\dots,d_j$ with corresponding probabilities $q_1,q_2,\dots,q_j$. Having rolled $n$ attack dice and $m$ defense dice, a total damage of $t$ will occur with probability equal to the coefficient of $x^t$ in the expansion of $(p_1x^{a_1}+p_2x^{a_2}+\dots+p_kx^{a_k})^n(q_1x^{d_1}+q_2x^{d_2}+\dots+q_jx^{d_j})^m$ – JMoravitz Dec 2 '17 at 19:05
• In your example with attack dice and defense dice distributions as you already gave, the probability of scoring three damage with three attack dice and two defense dice will be the coefficient of $x^3$ in the expansion of $(\frac{1}{6}+\frac{1}{2}x+\frac{1}{3}x^2)^3(\frac{1}{3}+\frac{1}{2}x^{-1}+\frac{1}{6}x^{-2})^2=\frac{1}{243}x^6+\frac{5}{162}x^5+\frac{25}{243}x^4+\color{red}{\frac{65}{324}}x^3+\dots$ – JMoravitz Dec 2 '17 at 19:09

Say you have $n$ attack dice. Then the total attack points $TA$ has possible values $0$ through $2n$. Now: to calculate the chance of the total attack points being $i$, i.e. $P(TA=i)$, note the following ways to get $i$ points:
If $i$ is even, i.e. $i=2k$, and $i \le \frac{n}{2}$, then you can either have $k$ dice with $2$, and $n-k$ dice with $0$, or $k-1$ dice with $2$, $2$ dice with $1$, and $n-k-1$ dice with $0$ or .... or $0$ dice with $2$, $i$ dice with $1$, and $n-i$ dice with $0$. So:
$$P(TA=i=2k)=\sum_{j=0}^k (\frac{1}{3})^j \cdot (\frac{1}{2})^{i-2j} \cdot (\frac{1}{6})^{n-i+j} \cdot {n \choose j} \cdot {{n-j} \choose {i-2j}}$$
You should be able to create likewise formula's for when $i > \frac{n}{2}$ (I would treat that one separately, since now you definitely need some number of dice with a $2$), and then likewise two formulas for when $i$ is odd.