# How to calculate the probability of getting 2 heads wen the coins is biased?

I can't understand how I can implement the Bayes' Rule here and the probability of getting two heads when tossing twice. Could anyone give me a hint?

Suppose you have two coins. One coin has probability 0.7 of coming up heads, and the other has probability 0.4 of coming up heads. You are playing a gambling game with a friend, and you draw one of those two coins at random from a bag.

Before you start the game, your prior belief is that the probability of choosing the 0.7 coin is 0.5. This is reasonable, because both coins were equally likely to be drawn. In this game, you win if the coin comes up heads.

Suppose the game starts, you have tossed twice, and have obtained two heads. Then what is your new belief about p, the probability that you are using the 0.7 coin?

• 1. In your first sentence, do you mean "heads" where you say "coins"? 2. This reads like a textbook question. Is this a question for some class? Commented Jun 26, 2019 at 2:09
• Thank you, we have already worked it through. No, it’s just an accumulation of my misunderstanding with random numbers. Commented Jun 26, 2019 at 4:30
• Your question is still confusing in the first sentence where you have "coins" when it seems you should be saying "heads". Please edit. Commented Jun 26, 2019 at 4:50
• Good point. Have edited it accordingly. Commented Jun 26, 2019 at 4:51

I am a hardcore frequentist but we gotta know the enemy, so let's give it a try.

• Let $$A$$ be the event "we are using the 0.7 coin"
• Let $$B$$ be the event "we got two heads in a row"

According to the Bayes Theorem, $$P(A|B)=\frac{P(B|A)P(A)}{P(B)}$$

• $$P(A)=1/2$$
• $$P(B|A)=0.7^2$$
• $$P(B) = \frac{0.7^2+0.4^2}{2}$$

We can easily do the computation for $$P(A|B)$$

• I can't get how we compute P (B given A) since our prior belief is 0.5. Could you guide me throw, please? Commented Jun 25, 2019 at 10:14
• If $A$ (we are using the 0.7 coin) is true, then the probability of $B$ (getting those two heads) is $0.7^2$ Commented Jun 25, 2019 at 10:15

Let $$C_1$$ be the coin with $$0.7$$ head probability and $$C_2$$ be the other one. Priors are $$P(C_i)=0.5$$. The event occurred is $$2$$ Heads, call it $$E$$. We ask for $$P(C_1|E)$$. $$P(C_1|E)=\frac{P(E|C_1)P(C_1)}{P(E)}$$ $$P(E|C_1)=(0.7)^2$$ and we have $$P(C_1)$$. From total probability law, we can also find $$P(E)$$: $$P(E)=P(E|C_1)P(C_1)+P(E|C_2)P(C_2)=\frac{P(E|C_1)+P(E|C_2)}{2}$$ where $$P(E|C_2)=(0.4)^2$$.

• How do you get P (E given C1) to be equal to 0.7^2? Commented Jun 25, 2019 at 10:12
• $P(E|C_1)$ means the probability of two heads (i.e. HH) when know we use coin 1. Commented Jun 25, 2019 at 10:14
• Then I can't understand why do we need prior here. Commented Jun 25, 2019 at 10:15
• You need the prior when substituting $P(C_1)$ and $P(C_2)$ Commented Jun 25, 2019 at 10:15
• Then we get as for numerator: 0.7^2* 0.5, don't we? Commented Jun 25, 2019 at 10:17