# Dice Probability

**URL:** <https://boards.straightdope.com/t/dice-probability/126779>\
**Category:** Factual Questions\
**Created:** [September 3, 2002, 10:31am UTC](https://boards.straightdope.com/t/dice-probability/126779 "2002-09-03T10:31:11Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricksummon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ricksummon/32/3333_2.png) [@ricksummon](https://boards.straightdope.com/u/ricksummon)\
**Post date:** [September 3, 2002, 10:31am UTC](https://boards.straightdope.com/t/dice-probability/126779/1 "2002-09-03T10:31:11Z")

</div>

If you have x dice with y sides each, the total of the dice roll can be anywhere from x to x\*y. My question is, how do you calculate the probability of rolling a specific number?

---

<div class="post-metadata">

**Author:** ![sirjamesp](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@sirjamesp](https://boards.straightdope.com/u/sirjamesp)\
**Post date:** [September 3, 2002, 10:46am UTC](https://boards.straightdope.com/t/dice-probability/126779/2 "2002-09-03T10:46:53Z")

</div>

I’m no maths guru, but I’d just work out the probability of _not_ getting a specific number, and subtract this from 1.

So - on one die with y sides, the probability of not getting your particular number is:

p = [y-1]/y

(i.e. 5/6 for a 6 sided die)

The probability of not getting your number when throwing two dice (or one die twice) is thus

p = [y-1]/y \* [y-1]/y = ( [y-1]/y] )^2

(i.e. 25/36 for teo 6 sided dice)

And thus for x dice:

p = ( [y-1]/y )^x

So, the probability of _getting_ a specific number must be:

p = 1 - ( [y-1]/y )^x

(i.e. around 2/3 chance of throwing a single 6 when rolling six 6-sided dice)

…I think.

---

<div class="post-metadata">

**Author:** ![ricksummon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ricksummon/32/3333_2.png) [@ricksummon](https://boards.straightdope.com/u/ricksummon)\
**Post date:** [September 3, 2002, 11:41am UTC](https://boards.straightdope.com/t/dice-probability/126779/3 "2002-09-03T11:41:57Z")

</div>

No, that’s not quite what I’m talking about.

Say you roll 2d6. The total of this dice roll can be anything from 2 to 12. The following permutations are available:

11 = 2  
12 21 = 3  
13 22 31 = 4  
14 23 32 41 = 5  
15 24 33 42 51 = 6  
16 25 34 43 52 61 = 7  
26 35 44 53 62 = 8  
36 45 54 63 = 9  
46 55 64 = 10  
56 65 = 11  
66 = 12

So, the probability of rolling a 2 on 2d6 is 1/36, while the probability of rolling a 7 is 6/36. What I want to know is a formula that can be used to generalize this result for any number of dice with any number of sides.

---

<div class="post-metadata">

**Author:** ![SpaceDog](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/spacedog/32/9932_2.png) [@SpaceDog](https://boards.straightdope.com/u/SpaceDog)\
**Post date:** [September 3, 2002, 11:53am UTC](https://boards.straightdope.com/t/dice-probability/126779/4 "2002-09-03T11:53:22Z")

</div>

Well you’ve got x dice with y sides each. That x \* y possible combinations.

So if you work out the number of ways to get your number (remembering the ordering is important) and call this C.

Then the probability of getting the number C is C/(x\*y).

I think. I’ll see if I can think of a fast way to find the C part.

SD

---

<div class="post-metadata">

**Author:** ![Diceman](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@Diceman](https://boards.straightdope.com/u/Diceman)\
**Post date:** [September 3, 2002, 11:55am UTC](https://boards.straightdope.com/t/dice-probability/126779/5 "2002-09-03T11:55:41Z")

</div>

Dice Probablility? Is s/he related to me somehow?

(sorry, couldn’t reseist :D)

---

<div class="post-metadata">

**Author:** ![SpaceDog](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/spacedog/32/9932_2.png) [@SpaceDog](https://boards.straightdope.com/u/SpaceDog)\
**Post date:** [September 3, 2002, 11:56am UTC](https://boards.straightdope.com/t/dice-probability/126779/6 "2002-09-03T11:56:01Z")

</div>

> [@](#):
>
> \*Originally posted by SpaceDog \*  
> **Well you’ve got x dice with y sides each. That x \* y possible combinations.**

Which is, of course, nonsense. There’s y ^ x combinations.

---

<div class="post-metadata">

**Author:** ![sirjamesp](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@sirjamesp](https://boards.straightdope.com/u/sirjamesp)\
**Post date:** [September 3, 2002, 11:58am UTC](https://boards.straightdope.com/t/dice-probability/126779/7 "2002-09-03T11:58:38Z")

</div>

Ah, I misunderstood. That’s a bit embarrassing…

Still, SpaceDog has the method, but I don’t know off hand what the general formula for working out what the “C” is. Hopefully some smart Doper can come on and tell us, saving anyone the hassle of working it out from scratch.

---

<div class="post-metadata">

**Author:** ![Jabba](https://avatars.discourse-cdn.com/v4/letter/j/b5e925/32.png) [@Jabba](https://boards.straightdope.com/u/Jabba)\
**Post date:** [September 3, 2002, 11:58am UTC](https://boards.straightdope.com/t/dice-probability/126779/8 "2002-09-03T11:58:59Z")

</div>

**sirjamesp** has answered the question: what is the probability that at least one die shows the number n, where 1 [symbol]£[/symbol] n [symbol]£[/symbol] y. But this is not how I interpreted your question. I shall attempt to answer the question: What is the probability that the sum of the scores on the dice is m, where x [symbol]£[/symbol] m [symbol]£[/symbol] xy.  
Let the score on the ith die be X[sub]i[/sub]. Then the total score is  
X = X[sub]i[/sub]+ … + X[sub]x[/sub]  
The probability generating function ( pgf) for X[sub]i[/sub] is  
G(t) = ( t + t[sup]2[/sup] + … + t[sup]y[/sup])/y  
= t( 1 - t[sup]y[/sup])/y( 1 - t)  
Since the X[sub]i[/sub] are independent, the pgf of X is the product of these, namely  
t[sup]x[/sup]( 1 - t[sup]y[/sup])[sup]x[/sup]/y[sup]x[/sup]( 1 - t)[sup]x[/sup]

The rquired probability is the coefficient of t[sup]m[/sup] in this expression, namely the coefficient of t[sup]m-x[/sup] in  
( 1 - t[sup]y[/sup])[sup]x[/sup]/y[sup]x[/sup]( 1 - t)[sup]x[/sup]

We need to expand the expressions in the numerator and denominator of this fraction. Let C(n,r) denote the binomial coefficient. Then  
( 1 - t[sup]y[/sup])[sup]x[/sup] = 1 - C(x,1)t[sup]y[/sup] + C(x,2)t[sup]2y[/sup] - … + (-1)[sup]x[/sup]t[sup]xy[/sup]  
and  
( 1 - t)[sup]-x[/sup] = 1 + C(x,1)t + C(x+1,2)t[sup]2[/sup] + …

To get a term t[sup]m-x[/sup] we need a term t[sup]ky[/sup] from the first expression and a term t[sup]m-x-ky[/sup] from the second. The coefficient of this product is (-1)[sup]k[/sup]C(x,k)C(m-ky-1,m-x-ky). The required probability is thus  
{C(m-1,m-x) - C(x,1)C(m-y-1,m-x-y) + C(x,2)C(m-2y-1,m-x-2y) - …}/y[sup]x[/sup]  
where the sum continues as long as all the binomial coefficients are defined.

Well, you asked.

---

<div class="post-metadata">

**Author:** ![zut](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zut/32/2875_2.png) [@zut](https://boards.straightdope.com/u/zut)\
**Post date:** [September 3, 2002, 3:13pm UTC](https://boards.straightdope.com/t/dice-probability/126779/9 "2002-09-03T15:13:55Z")

</div>

Dunno if this helps, but [here](http://mathworld.wolfram.com/Dice.html) is MathWorld’s answer to the question. If’n you just want to calculate a probability number, and not necessarily know the formula behind it, try this [Java applet](http://we.got.net/~emclan/js/xdy.html) I stumbled across.

---

<div class="post-metadata">

**Author:** ![CurtC](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@CurtC](https://boards.straightdope.com/u/CurtC)\
**Post date:** [September 3, 2002, 4:11pm UTC](https://boards.straightdope.com/t/dice-probability/126779/10 "2002-09-03T16:11:34Z")

</div>

Of course, you could do it manually for four-sided, six-sided, eight-sided, twelve-sided, and twenty-sided dice. Any others couldn’t have equal probabilities for all the sides.

---

<div class="post-metadata">

**Author:** ![CurtC](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@CurtC](https://boards.straightdope.com/u/CurtC)\
**Post date:** [September 3, 2002, 4:29pm UTC](https://boards.straightdope.com/t/dice-probability/126779/11 "2002-09-03T16:29:23Z")

</div>

Please forget I said that. Other shapes of dice can be fair.

---

<div class="post-metadata">

**Author:** ![xash](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xash](https://boards.straightdope.com/u/xash)\
**Post date:** [September 3, 2002, 9:23pm UTC](https://boards.straightdope.com/t/dice-probability/126779/12 "2002-09-03T21:23:30Z")

</div>

here’s some additional explanation:

[http://boards.straightdope.com/sdmb/showthread.php?s=&threadid=132737](http://boards.straightdope.com/sdmb/showthread.php?s=&threadid=132737)

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [September 3, 2002, 10:43pm UTC](https://boards.straightdope.com/t/dice-probability/126779/13 "2002-09-03T22:43:55Z")

</div>

If you have enough dice, you can approximate this very well by a Gaussian distribution. For n dice, each with k sides (numbered 1 to k), the mean will be n\*(k+1)/2, and the standard deviation will be sqrt(n)_[symbol]s/symbol, where [symbol]s/symbol is the standard deviation for a single k-sided die ([symbol]s/symbol = 1.7078251, and [symbol]s/symbol ~= .28867_k for k large).
