3
$\begingroup$

I am working on a project that needs to be able to calculate the probability of rolling a given value $k$ given a set of dice, not necessarily all the same size. So for instance, what is the distribution of rolls of a D2 and a D6?

An equivalent question, if this is any easier, is how can you take the mass function of one dice and combine it with the mass function of a second dice to calculate the mass function for the sum of their rolls?

Up to this point I have been using the combinatorics function at the bottom of the probability section of Wikipedia's article on dice, however I cannot see how to generalize this to different sized dice.

  • 0
    @milcak yes, that is standard notation for dice of different sizes. Sorry if that wasn't obvious.2011-02-03

3 Answers 3

5

You can use generating functions.

I presume D2 means dice with numbers 1 and 2.

In which case the probability generating function is

$(x/2 + x^2/2)(x/6 + x^2/6 + x^3/6 + x^4/6 + x^5/6 + x^6/6) = \frac{x^2(x^2-1)(x^6 - 1)}{12(x-1)^2}$

You need to find the coefficient of $x^k$ in this to get the probability that the sum is $k$.

You can use binomial theorem to expand out $\frac{1}{(x-1)^2}$ in the form $\sum_{n=0}^{\infty} a_n x^n$

You can generalized it to any number of dice with varying sides.

I will leave the formula to you.

  • 0
    @Qiang: Sure go ahead and cancel it :-) The point is: for cases known before hand, you can just read off a formula! For unknown cases, i.e. say in a computer program, it boils down to multiplying polynomials, which can be done fast using FFT, for instance. Let me ask you this: Say there were 100, 6 sided dice. What are the chances of getting a sum of 367 when you roll them all (order matters)? See this for an answer: http://math.stackexchange.com/questions/4632/. btw, This is a general method and was provided because OP asked for it.2011-02-03
0

For D2+D6, you can only get 2 or 8 in one case each, probability 1/12. Other totals 3-7 you can attain two ways (for example 6=5+1 or 4+2), probability 2/12=1/6. A good check is the total over all the values is 1. The check is 2*(1/12)+(7-3+1)*(1/6)=1

  • 0
    @Moron: Moron has it right for that. See his answer.2011-02-03
0

Suppose we have dice $Da$ and $Db$, with $a \le b$. Then there are three cases:

  1. If $2 \le n \le a$, the probability of throwing $n$ is $\frac{n-1}{ab}$.
  2. If $a+1 \le n \le b$, the probability of throwing $n$ is $\frac{1}{b}$.
  3. If $b+1 \le n \le a+b$, the probability of throwing $n$ is $\frac{a+b+1-n}{ab}$.