PDA

View Full Version : Maths Problem



nolispe
2010-09-16, 05:25 AM
If I have X dice, how do I work out the probibiity of rolling one or more double? That is, one or more of the numbers being the same?

Brother Oni
2010-09-16, 06:27 AM
Shouldn't that be X+1 dice as you can't roll a double on a single die?

Do all the dice must have the same number, or do only at least 2 of them require to be the same?

Thajocoth
2010-09-16, 06:36 AM
I learned this in a statistics class long ago... It's either nCr or nPr or something.

For two dice, 1dX and 1dY, with X <= Y, the answer is 1/Y. With more dice, it's more complex than that, and can't recall the easy answer right now.

The long way is to count all the possible ways you can get what you're looking for, put that in the numerator, and count all the possible ways the dice can land for the denominator. (Simply multiply their side quantities for the denominator. 5d8 & 1d4 would be 8*8*8*8*8*4 for the denominator here.)

For the first example I gave, that gives you X/(X*Y), which simplifies to 1/Y.

kamikasei
2010-09-16, 06:51 AM
I assume the dice are of the same size. Let's say they're d6s.

The probability that you will roll one or more double is 1 - (the probability that none of the numbers will be the same).

You will roll something on the first die. Probability: 1.

You have a 5/6 chance of rolling a different number on the second.

You have a 4/6 chance of rolling a different number to either you already have on the third.

...

So if you have XdY, the probability of getting no numbers the same is ((Y-1)*(Y-2)*...*(Y-(X-1)))/Y^X.

Subtract that from 1 and you get the probability of having at least one pair.

If you want to know probabilites of triples or more, it gets more complicated.

Capt Spanner
2010-09-16, 07:32 AM
Let us suppose you roll NdM.

The odds are P(N,M) = N(N - 1) / 2M

Here's why:

The probability of getting the number m (where 1 <= m <= M) is 1/M.

Let [i]N[i/i] = 2. The first dice rolls a number, and we define that number to be m, so the probability of two dice rolling the same number (i.e. a double) is 1/M.

Now suppose that N > 2.

The odds of any pair of dice rolling a double are independent, and all equal to 1/M.

So:

Odds of a rolling a double on NdM = [Number of dice pairings] / M.

Number of dice pairings can be shown to be N(N - 1) / 2.

Hence, odds of rolling a double are:

P(N,M) = N(N - 1) / 2M


EDIT:

What is the probability of rolling n of the same number on NdM?

The general formula is:

P(n,N,M) = P(N = n) x nCN. (Where C is the combination operator.)

P(N = n) = M^(1-n).

nCN = N! / (n! (N - n)!)
(Where ! is the factorial A! = 1 x 2 x ... x (A - 1) x A.)

So the probability of rolling n identical results on NdM is:

P(n,N,M) = N! / (M^(n-1) n! (N - n)!)

Cyrion
2010-09-16, 09:22 AM
Add to the above quality answers that if you have more dice than you have sides, you are guaranteed to roll at least one double.

nolispe
2010-09-16, 03:28 PM
Thank you, everybody. That works.

Erloas
2010-09-16, 04:16 PM
For general math stuff wolframalpha.com is pretty good at giving answers by searching for what you want.

For example this is the results for searching for 4d6 (http://www40.wolframalpha.com/input/?i=4d6) It gives expected value, std deviation, distribution, changes of doubles, triples, 4 of a kind, or all different.