conditional probability of flipping a coin and throw a dice

I have two dices. One has 6 sides and one have 8 sides.

I select which one to roll based on a flip of a fair coin.

A dice it's selected based on whether the flip of this coin. If it's head, the 6-sided dice it's rolled, 8-sided otherwise.

What's the probability of that coin flip was heads given the roll was 5?

I'm trying to solve using bayes rule here.

I think it'll be:

P(HEADS|5) = [P(5|HEADS)*P(HEADS)] / P(5)


I'm trying with:

P(5|HEADS) = 1/6
P(5) = 2/14


Which results in: 0.58356676

But it's not the correct answer.

I think I'm confusing the value that it's supposed to be in P(5|HEADS).

• Given roll was 5 what is the meaning of this statement? – Kanwaljit Singh Jan 6 '17 at 11:01
• which of the dice do you use if you get a head? – Cato Jan 6 '17 at 11:02
• @KanwaljitSingh the entire question is: What's the probability of that coin flip was heads given the roll was 5? – Cleyton Jan 6 '17 at 11:04
• Yes if your meaning from that statement is 5 on dice. Then both dice have 5 on them so which dice? – Kanwaljit Singh Jan 6 '17 at 11:04
• @Cato Thats the beauty, I don't know. I just know the roll was 5. – Cleyton Jan 6 '17 at 11:05

P(5 and heads) = (1/2)(1/6) = 1/12

P(5) = 1/2 (1/6 + 1/8) = 7/48

(1 / 12) / (7 / 48) = 4 / 7

since you say that we don't know how a head influences the dice choice, I think it is

P(5) = 1/2 (1/6 + 1/8) = 7/48

P(HEADS AND 5) = (1/2) P(5) = 7 / 96

P(HEADS|5) = (7/96) / (7/48) = 1/2

note P(5) = P(use 8 sided) x (1/8) + P(use 6 sided) x (1/6) = (1/2) (1/8) + (1/2)(1/6) = 7 / 48

• Your answer matches, but I got confused. Why p(5) was calculated that way? P(5) as an independent is not supposed to be: P(5) = 2/14 ? – Cleyton Jan 6 '17 at 11:10
• I was assuming that if you toss a head, then you use the 6 sided die - is that correct? If we don't know what the dice toss does, then it doesn't factor in the answer – Cato Jan 6 '17 at 11:15
• I'm sorry, but the coin flip influences. I select which one to roll based on a flip of a fair coin. If heads I get the 6 sided dice, if tails the other. I'll edit. the question – Cleyton Jan 6 '17 at 11:16
• @cleyton, in that case it is the first answer - i showed how i calculated P(5) – Cato Jan 6 '17 at 11:19
• Another point. I was wondering the correct formula was: P(5|HEADS)*P(HEADS). Why did you rewrite for [P(5 AND Heads)] ? – Cleyton Jan 6 '17 at 11:23

E2 coin shows tail.

P(E1) = $\frac12$

P(E2) = $\frac12$

A : Dice shows 5.

P(A/E1) = $\frac16$

P(A/E2) = $\frac18$

By Bayes Theorem,

$P(E1/A) = \frac{\text{P(E1)P(A/E1)}}{\text{P(E1)P(A/E1) + P(E2)P(A/E2)}}$

Put values to get the answer.

It is important to know whether ${\tt H}$ chooses the 6-sided or 8-sided dice. $$\begin{cases} \Pr(5|{\tt H})=\frac{1}{6}\\ \Pr(5|{\tt T})=\frac{1}{8} \end{cases}$$ in the former case, and $$\begin{cases} \Pr(5|{\tt H})=\frac{1}{8}\\ \Pr(5|{\tt T})=\frac{1}{6} \end{cases}$$ in the latter.

From the Bayes rule:

$$\Pr({\tt H}|5)=\frac{\Pr(5|{\tt H}) \ \Pr({\tt H})}{\Pr(5)}$$ The law of total probability is used to find $\Pr(5)$: $$\Pr(5)=\Pr(5|{\tt H})\ \Pr({\tt H})+\Pr(5|{\tt T})\ \Pr({\tt T})$$ which in either case is equal to $$\left(\frac{1}{6}\right)\left(\frac{1}{2}\right)+\left(\frac{1}{8}\right)\left(\frac{1}{2}\right)=\frac{7}{48}$$ So depending on the assignment we have $$\Pr({\tt H}|5)=\begin{cases} \frac{1/6\times1/2}{7/48}\\ \frac{1/8\times1/2}{7/48} \end{cases}$$