# If I have two unfair coins how can I calculate the probability of either coin producing a particular sequence of heads and tails?

Suppose I have two unfair coins A and B. The probability of A landing on heads is 0.6 and the probability of B landing on heads is 0.5. Suppose now that one coin is picked at random (with a 0.5 probability) and flipped 10 times, giving the result HHHHTHHHHH. What is the probability that coin A was used?

I am most interested in the reasoning behind how to get to the answer.

• Why is B not called a fair coin? Commented Jan 11, 2017 at 14:01
• Yeah it is, just left it that way for conciseness, maybe should have made that clear Commented Jan 14, 2017 at 10:49

You can solve this by the application of Bayes' theorem.

You are given the probability of choosing coins $A$ and $B$:

$$P(A) = P(B) = \frac{1}{2}$$

You are also given the probability of getting a head, given that you have chosen coin $A$ or $B$:

$$P(H|A) = \frac{6}{10} \quad P(H|B) = \frac{1}{2}$$

Therefore you can compute the probability of getting 10 heads with either coin.

$$P(10 H|A) = \left(\frac{6}{10}\right)^{10} \quad P(10 H|B) = \left(\frac{1}{2}\right)^{10}$$

You are interested in the probability that coin A was used, given that 10 heads were observed, i.e. $P(A|10H)$. Using Bayes' theorem:

$$P(A|10H) = \frac{P(10H|A)P(A)}{P(10H)}$$

The marginal probability $P(10H)$ is the weighted sum of probabilies of getting 10 Heads across the two coins: $$P(10H)=P(10H|A)P(A)+P(10H|B)P(B)$$

Therefore:

$$\frac{P(10H|A)P(A)}{P(10H|A)P(A)+P(10H|B)P(B)}$$

And since in this example $P(A) = P(B)$

$$P(A|10H)=\frac{P(10H|A)}{P(10H|A)+P(10H|B)}= \frac{\left(\frac{6}{10}\right)^{10}}{\left(\frac{6}{10}\right)^{10} + \left(\frac{1}{2}\right)^{10}} \approx 0.861$$

• Perfect, the question was actually for 1T and 9H (I wrote it a bit confusingly I think) but your answer is general enough to answer any case, thank you very much Commented Jan 11, 2017 at 10:19
• Yes to get $P(9H,1T)$ just substitute this where you see $P(10H)$ i.e. $P(10H|A)$ becomes $P(9H,1T|A)$ Commented Jan 11, 2017 at 10:51
• @Dippynark This may be redundant, but do note that there is only one way of flipping heads ten out of ten flips (HHHHHHHHHH), but that the other possible sequences e.g. flipping tails once, are more frequent: flipping tails once and heads nine times can occur in ten possible sequences. In short, take note of this when substituting the $P(10H|A)$ for $P(9H,1T|A)$
– IWS
Commented Jan 11, 2017 at 12:08
• Cheers, yeah I just multiplied by the choose function C(10,1) Commented Jan 14, 2017 at 10:46