Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question
    
Is $D2$ a two sided "dice", i.e a coin and $D6$ a regular dice? –  milcak Feb 3 '11 at 5:32
    
Related, but not exactly dupe: math.stackexchange.com/questions/4632/… –  Aryabhata Feb 3 '11 at 5:43
    
@milcak yes, that is standard notation for dice of different sizes. Sorry if that wasn't obvious. –  dimo414 Feb 3 '11 at 5:51
add comment

3 Answers

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.

share|improve this answer
    
Could you please elaborate on how you get from the probabilities of the different dice to the expression on the right? I cannot follow that reasoning. –  dimo414 Feb 3 '11 at 6:07
    
@dimo: It is adding up terms in geometric progression. –  Aryabhata Feb 3 '11 at 6:09
    
Sorry, I'm afraid this is all a bit over head. I'll have to look into this all further. static.funnyjunk.com/pictures/twelve_plane_of_torment0.jpg –  dimo414 Feb 3 '11 at 7:30
    
@Moron: what will it do to expand out $\frac{1}{(x-1)^2}$ in this case? For $x\gt8$ in this case, the probability is 0 anyway... –  Qiang Li Feb 3 '11 at 18:26
    
@QIang: You mean $k \gt 8$? YOu don't have to expand out the whole thing, just upto $x^k$. –  Aryabhata Feb 3 '11 at 18:44
show 2 more comments

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

share|improve this answer
    
Sorry, maybe I wasn't clear. I'm trying to figure out a general function that works on different sided dice in the same way F(s,n) in the Wikipedia article works. –  dimo414 Feb 3 '11 at 5:40
    
@Moron: Moron has it right for that. See his answer. –  Ross Millikan Feb 3 '11 at 5:46
add comment

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}$.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.