[Math] conditional probability of flipping a coin and throw a dice

probability

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(HEADS) = 1/2
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).

Best Answer

P(HEADS|5) = [P(5 AND Heads)] / P(5)

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(HEADS|5) = [P(5 AND Heads)] / P(5)

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