Basics of dice probabilities

26 May, 2009 at 7:32 pm (game design, linkedin, mathematics) (, , )

I’ll write a post or a few about probabilities that involve rolling dice. Those who know mathematics might be more interested in probability theory.

I will assume that all probability distributions are discrete and integer-valued. Trying to apply what I say here to continuous distributions will cause problems or require thinking.

Probability

Probability measures, or indicates, how certain it is that some event will happen (or has happened, in case of imperfect knowledge). Probability of 1 means that something is certain, while 0 means impossibility. Probability 1/2, or $\frac{1}{2}$, or 50%, or 0.5 or in Finnish notation 0,5 means that something happens half the time (if the event is repeated).

I very much prefer working with fractions as they are exact and, in my opinion, more intuitive, but many people like percents. To convert a fraction into percents simply multiply it by hundred and add the %-sign.

An important axiom of probability is that something always happens. The sum of probabilities of all the specific outcomes is 1. By this I mean that if, say, a die is rolled than it gives one and exactly one result. It doesn’t land sideways. It is not hit by a meteor or eaten by a dog.

Symmetry

Especially when playing around with dice symmetry plays an important role. Symmetric events have the same probability.

I will assume that all dice are fair; in practice they are not and it doesn’t matter. An n-sided die has n symmetric results. All of them hence have the same probability. Something must always happen, so the sum of the probabilities is 1. It follows that for an n-sided die the probability of getting any result from the set $\{ 1 , 2 , \ldots , n-1 , n \}$ is 1/n, while the probability of getting any other integer is zero.

Notation

Since writing probability all the time gets boring, I’ll use a shorthand: $P( \text{event} ) = p$, which means the probability that event happens is p. For example: $P(\text{d}8=7 ) = 1/8$ and $P(\text{d}8=-4 ) = 0$.

or, and, not

Some rules for performing calculations with probabilities are in order. First, a definition: Events are independent when knowing something about one of them gives no knowledge about the others. Dice rolls are, as far as this post is concerned, independent: I roll a d12 and get a 1. This tells me nothing about what the next result will be when I roll that d12.

Take two independent events A and B. Now $P(A \text{ and } B ) = P(A)P(B)$. For example: The probability of rolling 1, 2, 3, 4 or 5 (that is: not 6) with a six-sider is 5/6. If we roll two d6s, what is probability of both of them giving a result less than six? Since separate rolls are independent events, this probability is 5/6 times 5/6, which equals 25/36. This rule applies to any finite number of rolls. As long as they are independent, and means multiplication. The independence is not there for show only: Suppose I roll a singe d4. What is the probability of that die giving result of both 1 and 4 at the same time? Obviously, since a given die only gives one result per roll, the event is impossible and hence has probability zero. Careless use of the “and is multiplication”-rule would give 1/4 times 1/4 equals 1/16, which would be wrong.

Multiplying fractions, in case it is not clear: Supposing a, b, c and d are real numbers, b and d are not zero, then $\frac{a}{b}\text{ times } \frac{c}{d} = \frac{ac}{bd}$.

Take any event. Now $P( \text{not event} ) = 1 - P( \text{event} )$. This is a direct consequence of something always happening. Example: The probability of rolling 6 with a d6 is 1/6, from which it follows that the probability of not rolling a 6, which is the probability of rolling something else than 6, is $1 - 1/6 = 5/6$. Now we have the tools for solving one problems with some history: Roll 4d6. Should you bet on rolling at least one 6? The goal here is to determine $P( \text{at least one is 6})$. Using the law of not this problem is the same as determining the probability of none of the dice showing 6, which is same as all of them giving a result from the set $\{ 1 , 2 , 3, 4, 5 \}$. We already know this probability for a single die: It is 5/6. Since separate rolls are made, the events are independent, and hence by the law of and we can simply multiply 5/6 four times, which means raising it to the fourth power: $(5/6)^4 = (5^4)/(6^4) = 625/1296$, which is slightly less than half. By the principle of not we get that the probability of getting at least one 6 is slightly more than half and should be betted on. By symbols the calculation goes as follows: $P(\text{at least one die gives a six}) = 1-P(\text{none of the dice give a six} =$ $1-P(\text{first die is not six and } \dots \text{ and fourth die is not a six}) =$ $1- (P(\text{first die is not a six}) \times \dots \times P(\text{fourth die is not a six}))$ $= 1 - 625/1296 = 1296/1296 - 625/1296 = (1296-625)/ 1296 =$ $671/1296$, which is greater than 648/1296 = 1/2.

Take two events A and B. The probability of at least one of them happening, by which I mean P(A or B), equals the sum of their probabilities minus the probability of A and B both happening; otherwise  the “and” would be counted twice. So, for any events A and B, $P(A \text{ or } B) = P(A) + P(B) - P(A \text{ and } B)$. An important special case: A single d12 is rolled. What is $P(\text{d}12=7 \text{ or } 9 )$?. Since rolling 7 and 9 are clearly distinct events, the probability of both happening with single die roll is 0 (since they never happen at the same time). Hence $P(\text{d}12=7 \text{ or } 9 ) = P(\text{d}12=7) + P(\text{d}12=9) - 0 = 1/6.$ Another useful application: Roll 2d6. What is the probability that at least one of them shows a 6? This can be formulated in another way: What is the probability of first die showing a 6 or the second die showing a 6? Here the events are independent since two dice are cast. Hence, $P(\text{at least one 6}) = P(\text{first d}6=6 \text{ or second d}6=6) =$ $P(\text{first d}6=6) + P(\text{second d}6=6) - P(\text{first and second d}6=6) =$ $1/6 + 1/6 - P(\text{d}6=6)P(\text{d}6=6) = 2/6 - 1/36 = 11/36$.

More to come?

If someone finds this useful, please say so. I do not know how good I am at expository text like this and I really don’t know the skill level of my audience, if any. A topic I might handle in the future, if anyone is interested, is how to calculate the distribution of a sum of two arbitrary distributions.

I managed to land a quite demanding job, so frequent updates are somewhat unlikely, at least for some time. I’ll need to do some adjusting.

1. njharmansaid,

I got your dice probabilities right here buddy :)

http://trollandflame.blogspot.com/2009/05/i-present-dice-o-matic.html

2. noismssaid,

I find it interesting.

3. Tommisaid,

njharman;
That looks less than practical, I think.

noisms;
Thanks. I’ll see if inspiration strikes again.

4. d7said,

That was interesting. It’s been too long since I studied combinatorics, but I still enjoy the math.