# Odds of two dice roll

If we roll two dice, what are the odds that we roll one five OR the sum of the rolled dice equals an odd number?

The odds of rolling one five from two dice rolls is $\frac{1}{36}$. The odds of rolling an odd number from the sum of two rolls requires that we roll one even number from one die and an odd number from another die. The odds of this happening are $\frac{1}{2}$.

Therefore, the odds of either even occuring should be: $\frac{1}{36} + \frac{1}{2} = \frac{19}{36}$

However, this is incorrect. Apparently the answer is $\frac{23}{36}$. I do not understand why. I wrote a python script to evaluate my odds:

import random

def rolldice(count):
return [random.randint(1, 6) for i in range(count)]

def compute_odd(dice):
return sum(dice) % 2 == 1

def has_num_only(dice, num):
return dice.count(num) == 1

g_iEvents = 0
g_iSimulations = 8888

for i in range(g_iSimulations):
dice = rolldice(2)
if compute_odd(dice) or has_num_only(dice, 5):
g_iEvents += 1

print( float(g_iEvents) / float(g_iSimulations) )
print( g_iEvents )
print( g_iSimulations )


After several runs, I keep getting the answer of 61% - Therefore this is showing that both answers are incorrect.

• One 5 or at least one 5? – Flowers Mar 19 '14 at 5:10
• hint write a python script that enumerates all possible outcomes of rolling two dice and count the events of interest. – Brad S. Mar 19 '14 at 5:10
• One five. So you'd roll two dice, if one of the two die were five or the sum was odd. That is the event. – Jason Mar 19 '14 at 5:16

When you roll 2 dice there are 36 equally likely options, starting at double one, $(1,1)$, and going all the way to double six, $(6,6)$. Of these, there are 11 equally likely ways to roll a $5$, $(1,5), (2,5), (3,5), (4,5), (5,5), (6,5), (5,1), (5,2), (5,3),(5,4),(5,6)$, so the odds of rolling a 5 is $\frac{11}{36}$.

Similarly there are 18 equally likely ways to roll an odd number (I'll let you think about which combinations these are), so the odds of rolling an odd number are $\frac{18}{36}=\frac{1}{2}$.

At this point you may think the odds of rolling a $5$ or and odd number should be $\frac{11}{36}+\frac{18}{36}=\frac{29}{36}$, however this is not the case. Note that six of the rolls contain both a $5$ and are odd:

$(2,5), (4,5), (6,5), (5,2), (5,4),(5,6)$

If we just add the two probabilities, we'll count these situations twice, even though they're no more likely to occur than any other combination! In reality there are only $11+18-6=23$ dice rolls which contain a $5$ or are odd (see if you can list them), and so the odds of rolling either a $5$ or an odd combination is $\frac{11}{36}+\frac{18}{36}-\frac{6}{36}=\frac{23}{36}$.

This is a simple application of the "principle of inclusion and exclusion", which you may want to look up.

• +1 Thanks Tom. I missed the double counting part you mention. – Brad S. Mar 19 '14 at 5:50

We need to interpret the question.

We will be happy if we get an odd sum or if we get at least one five, or if both events happen. We want to find the probability of being happy.

In "set" notation, let $A$ be the event "odd sum" and let $B$ be the event "at least one $5$. We want $\Pr(A\cup B)$. By a formula you may be familiar with, we have $$\Pr(A\cup B)=\Pr(A)+\Pr(B)-\Pr(A\cap B).$$ We compute the three probabilities on the right.

For $\Pr(A)$, we can make a list of all the outcomes on the red and green die that yield an odd sum. Or we can use a simpler argument. We find $\Pr(A)=\frac{1}{2}$.

For $\Pr(B)$, it is easiest to find the probability of no $5$. There are $5$ ways the green die can yield something other than a $5$, and for each such way there are $5$ ways that the red can give a non-$5$. So the probability of not getting any $5$ is $\frac{25}{36}$. Thus $\Pr(B)=\frac{11}{36}$.

For $\Pr(A\cap B)$, make a list. We get an odd sum and at least one $5$ in the following ways: $(5,2),(2,5), (5,4), (4,5), (5,6), (6,5)$. Thus $\Pr(A\cap B)=\frac{6}{36}$. (One could show this faster!)

Our required probability is therefore $\frac{1}{2}+\frac{11}{36}-\frac{6}{36}$.

• I think the OP wanted exactly one five, which would mean the solution is 22/36. – Flowers Mar 19 '14 at 5:27
• Our first sentence pointed out that we were making an interpretation. We interpreted the "OR" as being inclusive, and we interpreted "one five" as at least one five. That interpretation yields a probability of $\frac{23}{36}$, which is said to be apparently the answer. That may mean it is the book answer. If that is the case, then the book answer was likely computed under the interpretation we used. Other interpretations are possible, and will almost certainly yield different answers. – André Nicolas Mar 19 '14 at 5:35
• I agree. But in his code, and when I asked him to specify, it appears that he wants exactly one 5. Just pointing out. – Flowers Mar 19 '14 at 6:36
n = 0
fives = 0
odds = 0

for i in range (1,7) :
for j in range (1,7) :
n = n + 1
if (i is 5) or (j is 5) :
fives = fives + 1
elif ( (i +j) % 2 == 1 ) :
odds = odds + 1
print fives
print odds
print  n


\$ python dice.py

11
12
36

• so, I learned a little python tonight too! – Brad S. Mar 19 '14 at 5:45
• I never thought about doing it that way, enumerating all possible rolls versus just brute forcing it with random numbers (which is what I did) – Jason Mar 19 '14 at 5:45
• after I read the answer provided by @tom , I changed the second if to elif so, I can get the right answer too! – Brad S. Mar 19 '14 at 5:49

Are you looking for probability or Odds?

The formula for finding odds is: favorable outcome/unfavourable outcome.

The probability of rolling an odd number is 18/36 but the odds would be 18/(18-36) or 18:18 which would give you 1:1 odds. If my explanation is lacking, there is a good explanation on this site:

http://stats.seandolinar.com/statistics-probability-vs-odds/