PDA

View Full Version : Dice probability question

2013-02-21, 04:53 AM
We got talking (OK, arguing) about something last session, and the question came up about the actual probability of rolling at least one 20 on 4 d20 rolls.

None of us could remember exactly how you calculated it, and it has been bugging me - I used to be good at probability in school (admittedly that was 23 years ago) and I still can't work out or remember exactly how to calculate the probability.

Anyone with a better or more recent memory remind me how this works?

GeriSch
2013-02-21, 05:12 AM
Generally you get the probability with the formula (Number of favored events) / (Number of possible events) . In this case its much easier to calculate the opposite probability (rolling no 20 in 4 rolls) and then subtracting the outcome from 1.

This would be (19/20)^4 which describes the probability NOT to roll a single 20 in 4 consecutive rolls, which amounts to 0,814 (81,4%). Then we subtract this number from 1, so we get 1-0,814=0,186 (18,6%).

gr,
Geri

Weimann
2013-02-21, 05:12 AM
Edit: Er, wait, I was hasty. :smallredface:

BenjCano
2013-02-21, 05:15 AM
You can always figure the probability of an event happening [p(x)] by

1 - p(~x)

Therefore, the probability of rolling at least one 20 on four rolls of 20 sided dice equals 1 minus the probability of rolling NO 20s.

1 - (19/20)^4 or about 18.5%

2013-02-21, 05:33 AM
Thanks for the quick replies! I feel vindicated in my 'a bit less than 20%' comment now. And my ancient memory is at least slightly refreshed.

huttj509
2013-02-21, 07:12 AM
You can also calculate it by individually calculating the chance of a single 20 [(4!/3!1!) * (19/20)^3 * (1/20)], double 20s [(4!/2!2!) * (19/20)^2 * (1/20)^2], triple 20s [(4!/1!3!) * (19/20)^1 * (1/20)^3], and a quadruple 20 [(4!/0!4!) * (19/20)^0 * (1/20)^4], add them up, which gives

4*(19/20)^3*(1/20)+6*(19/20)^2*(1/20)^2+4*(19/20)*(1/20)^3+(1/20)^4

=

What's nice is that the hard way matches the easy way, giving evidence that the easy way is, in fact, completely valid (which it is).

Any time you need to solve a "at least x successes" question, "less than x successes" might be much easier to figure out. Especially if x=1.

warty goblin
2013-02-21, 10:09 PM
This generalizes to the binomial distribution, which gives the probabilities for k 'successes' out of n trials, where n is fixed. The distribution is:

P(X = k) = (n choose k) * p^k * (1 - p)^(n - k)

where p is the probability of success for any given trial. This provides a quick and easy way to get probabilities for, say, 2 twenties out of four rolls.

The geometric distribution is also handy for deals like this. It counts the probability of the first success occurring on the Xth trial. So if you want to know how likely it is that you won't roll a twenty for the next four rolls, it also provides the answer. It's probability mass function is:

P(X = k) = p*(1 - p)^(k)

(It is also sometimes given as probability of X failures before the first success, in which case the exponent is simply k - 1. Generally I find the first version easier to think about.)

Zahhak
2013-02-21, 11:21 PM
What's nice is that the hard way matches the easy way, giving evidence that the easy way is, in fact, completely valid (which it is).

Actually, the easy way is to go to your handy dandy calculator and type in (20nCr1)x4.

Acanous
2013-02-21, 11:38 PM
I've got a bit of a followup, something that's been bugging me a while but not sure where/how to ask.
I know there's a method by which you can calculate where in a sequence a set exists (For instance, how many rolls of four D20's you'd have to make before you got a set that included a 20, and how many you'd have to make before getting nothing BUT 20's, etc.) but I can't seem to find the math on it. Maybe I'm just phrasing it wrong.

Zahhak
2013-02-22, 12:00 AM
I can't seem to find the math on it.

That's because your question is based on the gambler's fallacy.

Basically, if you flip a coin 100 times and get heads 100 times, the odds of getting heads on the next flip is still 50/50 because any one flip is completely independent of any other flip. However, if you were asking "In the set of 101 flips of a fair coin, what are the odds of 100 heads exactly?", that's something that you can find with some basic probability theory. I'd have to skim through my notes from stats, but I'm thinking it would be nCr on your calculator, and involve some division.

huttj509
2013-02-22, 01:20 AM
That's because your question is based on the gambler's fallacy.

Basically, if you flip a coin 100 times and get heads 100 times, the odds of getting heads on the next flip is still 50/50 because any one flip is completely independent of any other flip. However, if you were asking "In the set of 101 flips of a fair coin, what are the odds of 100 heads exactly?", that's something that you can find with some basic probability theory. I'd have to skim through my notes from stats, but I'm thinking it would be nCr on your calculator, and involve some division.

You know, I never knew about the nCr function on various Ti calculators. My stats teacher in high school had us download the Statkit program, which was an awesome go to for general calculations.

warty goblin
2013-02-22, 01:25 AM
I've got a bit of a followup, something that's been bugging me a while but not sure where/how to ask.
I know there's a method by which you can calculate where in a sequence a set exists (For instance, how many rolls of four D20's you'd have to make before you got a set that included a 20, and how many you'd have to make before getting nothing BUT 20's, etc.) but I can't seem to find the math on it. Maybe I'm just phrasing it wrong.

As phrased yes, you do have it wrong. There is no finite point at which you have to have rolled four twenties, and the probability of rolling a twenty is one only in the limit - over any finite sequence of rolls there is always a non-zero chance of not rolling a twenty.

Now it happens that the probability of rolling at least one twenty over 4d20 is pretty good: P(at least 1 20) = 1 - P(no twenties) = 1 - (19/20)^4 = .1854, as previous posters have calculated.

The probability of rolling four twenties is also fairly straightforward, it's just (1/20)^4 = .00000625.

Now if you want to know the probability of rolling either of those results after k rolls not achieving it, plug into the geometric formula with p the probability calculated above and k whatever you want it to be. If you want to know on average how many times you will have to roll 4d20 before obtaining your desired result, you want the expected value of the geometric. For the version I listed this is just 1/p.

(Note that the geometric is generally skewed right, so the mean is generally much higher than the median. Better than half the time you'll roll your desired value in under the 'expected' number of rolls.)

Zahhak
2013-02-22, 11:09 AM
You know, I never knew about the nCr function on various Ti calculators. My stats teacher in high school had us download the Statkit program, which was an awesome go to for general calculations.

College stats must be different then.

warty goblin
2013-02-22, 01:08 PM
College stats must be different then.

I used R in college. Still use R in grad school. It's fairly useful once you get used to it.

Zahhak
2013-02-22, 02:52 PM
It was an intro course

huttj509
2013-02-22, 03:09 PM
College stats must be different then.

*shrug*, I never had any issue computing factorials manually. For AP stats Statkit was mainly useful for built in things like X^2 tables, bonomial probability calculations, etc. The sort of thing where you'd generally look up on a table what % was y standard deviations above the mean, or what have you. I knew the formulas and notation, just never knew about the built-in function.

Razanir
2013-02-22, 03:30 PM
I've got a bit of a followup, something that's been bugging me a while but not sure where/how to ask.
I know there's a method by which you can calculate where in a sequence a set exists (For instance, how many rolls of four D20's you'd have to make before you got a set that included a 20, and how many you'd have to make before getting nothing BUT 20's, etc.) but I can't seem to find the math on it. Maybe I'm just phrasing it wrong.

I won't bother helping with the binomial probability; it's been beaten to death. What you have in this question is a geometric probability, where you keep rolling sets of 4 until you get a 20 in one. The geometric distribution is a bit weird where what the English language would call a success, it calls a failure. So the probability of "success" (that is, that you keep trying) is p=(19/20)^4. The expected value which is 1/p or (20/19)^4 or about 1.23. So you'd need to roll 4d20 1.23 times on average before getting a 20.

Jay R
2013-02-23, 11:15 AM
College stats must be different then.

Of course it's taught differently. When I took my first stat course, the only computer on campus was the basement of the math building.

These days when I teach it, I show them how to use Excel to calculate, mean, variance, standard deviation, etc., and they follow along on their laptops.

They can also use the NORM.S.DIST function instead of a Standard Normal table, if they like.

scurv
2013-02-23, 11:41 AM
Keep in mind, And I have this conversation with engineers at least twice a year, Field results can and quite often will be different in subtle ways from your calculated results. (As was gone in to in another thread here)

All of the above does not take into account imperfections in the manufacturing process of the dice, or any were and tear the dice may of had sense its manufacture. So keep in mind the above is a good guide for what should happen in an ideal perfect world,