I have a complicated probability question. I want to know how to calculate the probability of reaching a target number (or greater) on a variable number of dice with each die having a variable number of sides. For example, the chance of rolling a 10 or higher on 2d6 and 1d4. I can calculate the answer by just writing down all the possibilities for any given set of dice but I need a formula that can work this out on its own if given the inputs. I want to use this formula as part of a google spreadsheet, (similar to Microsoft Excel). If it helps, I wont ever need more than 10 dice at a time and the dice can only have 4, 6, 8, 10, or 12 sides.
Thanks.
One way is to use generating functions.
If you have $n$ dice, with sides $a_1,\dots,a_n$, then the coefficient on $x^k$ of the polynomial $$ \prod_{i=1}^n \left( \frac{1}{a_i} \sum_{j=1}^{a_i} x^i \right) $$ yields the probability of a sum of $k$ with these dice.
Summing the appropriate values will give you the probability of a sum above a given value.
For example, if you have a three-sided, a four-sided, and a six-sided die, then we want to look at $$ \left(\frac{1}{3}\sum_{i=1}^3 x^i\right)\left(\frac{1}{4}\sum_{i=1}^4 x^i\right)\left(\frac{1}{6}\sum_{i=1}^6 x^i\right)=\frac{1}{72} x^{13} + \frac{1}{24} x^{12} + \frac{1}{12} x^{11} + \frac{1}{8} x^{10} + \frac{11}{72} x^9 + \frac{1}{6} x^8 + \frac{11}{72} x^7 + \frac{1}{8} x^6 + \frac{1}{12} x^5 + \frac{1}{24} x^4 + \frac{1}{72} x^3. $$ Then, for example, the probability that the sum is greater than $10$ is $\frac{1}{12}+\frac{1}{24}+\frac{1}{72}=\frac{5}{36}$.
Another example. For the probability of throwing 9 or greater with two six-sided dice, we look at $$ \left(\frac{1}{6}\sum_{i=1}^6 x^i\right)\left(\frac{1}{6}\sum_{i=1}^6 x^i\right)=\frac{1}{36} x^{12} + \frac{1}{18} x^{11} + \frac{1}{12} x^{10} + \frac{1}{9} x^9 + \frac{5}{36} x^8 + \frac{1}{6} x^7 + \frac{5}{36} x^6 + \frac{1}{9} x^5 + \frac{1}{12} x^4 + \frac{1}{18} x^3 + \frac{1}{36} x^2 $$ Summing the coefficients on $x^9$, $x^{10}$, $x^{11}$, and $x^{12}$, we find the probability of throwing $9$ or higher is $\frac{5}{18}$.