# Three tosses of the same coin: Conditional probability that the coin picked is unfair

There are two coins: one fair and one unfair. P(head | fair)=½ and P(head | unfair)=⅓ These two coins look identical.

You picked up a coin from these two, throw it 3 times and observed 1 head.

What is the probability that the coin you picked is the unfair coin?

The part that is throwing me off is three tosses with one resulting in a head. Below I calculated if a heads is observed, what would be the probability that it's an Unfair coin. But if I consider three tosses, I consider three possibilities that outcome space could be {HTT, THT,TTH} and to me, all three possibilities seem to require the same calculation, so using a tree, I calculated P(U|HTT) = P(U∩H∩T∩T)/P(H∩T∩T) as

Am I making a mistake in calculating below part? The result makes me feel weird for some reason and if I consider the three outcome possibilities in numerator and denominator, they cancel out so final result should be same as below but that implies that number of tosses has no affect - this is the part that is throwing me off so need help with 1) Verify the calculation 2) Does number of tosses have an effect? or is there another way to interpret repeated tosses without replacement?

I looked at this post that is very close to my question but the first and second tosses have a pre-defined outcome. Thanks again for your help.

P(U)P(H|U)P(T|U)P(T|U)/(P(U∩H∩T∩T)+P(F∩H∩T∩T))

P(U|HTT) = 1/2 * 1/3 * 2/3 * 2/3 /(1/2*1/3*2/3*2/3 + 1/2*1/2*1/2*1/2)
= 4/27 / (4/27 + 1/8)
= 32/59


This comes out to

Here is the simple one toss calculation:

P(F) = probability the coin is fair
P(U) = probability the coin is UNfair
P(H|F) = 1/2
P(H|U) = 1/3

To calculate Probability the coin is Unfair given a heads is observed, I can use bayes theorum as:

P(U|H) = P(U)*P(H|U)/ (P(U)*P(H|U) + P(F)*P(H|F)
= 1/2 * 1/3 / (1/2*1/3 + 1/2*1/2)
= 4/10
= 2/5


## Update:

I realized the mistake I was making in assuming that number of tosses doesn't matter. It's the order that doesn't matter in the calculation, not the number of tosses - even if there were 2 or 4 or any number of tosses with one Heads, there would be 2 or 4 or n possible combinations respectively, so counting them in numerator or denominator cancels out, so order doesn't matter. However, number of tosses do matter, if there were 4 tosses, the P(HTTT|U) would have additional factor of 2/3 to indicate additional Tails, so the numerator as well as denominator would change.

The part I am still not able to think intuitively about is how to explain that order doesn't matter. Algebraically, it cancels out from Num and Denom but can't think of an intuition behind it. Thanks for the long read.

P(H|U) = 1/3
P(H|F) = 1/2

Let A be the event where we observe 3 tosses with one head

P(U|A) =  P(A,U)   =  p(U) * P(A|U)
--------   ---------------
P(A)         P(A)

= 1/2 *[P(HTT|U)+P(THT|U)+P(TTH|U)]
------------------------------------
P(A, U) + P(A, F)

=        1/2 * [(1/3*2/3*2/3)*3]
------------------------------------
[1/2*(1/3*2/3*2/3)*3] + [1/2*(1/2*1/2*1/2)*3]

=     4/27
------------
(4/27 + 1/8)

=      4/27
-----------------
(32 + 27)/(27*8)

= 32
--
59


Let's define a few random variables. Let $$U \sim \operatorname{Bernoulli}(\pi = 1/2)$$ represent the prior probability of selecting the unfair coin, where $$U = 1$$ means the coin is unfair, and $$U = 0$$ means the coin is fair. So $$\Pr[U = 1] = \Pr[U = 0] = 1/2$$. Next, define $$X \mid U \sim \operatorname{Binomial}(n = 3, p),$$ representing the number of heads obtained in three coin tosses. The probability of heads $$p$$ is a function of $$U$$: if $$U = 0$$, then $$p = 1/2$$, whereas if $$U = 1$$, then $$p = 1/3$$. So we can write this as $$p = \frac{1}{2} - \frac{1}{6}U = \frac{3-U}{6}.$$ Therefore, $$\Pr[X = 1 \mid U = u] = \binom{3}{1} \left( \frac{3-u}{6} \right)^1 \left( 1 - \frac{3-u}{6} \right)^2 = \frac{(3-u)(3+u)^2}{72},$$ and in particular, $$\Pr[X = 1 \mid U = 1] = \frac{4}{9}, \\ \Pr[X = 1 \mid U = 0] = \frac{3}{8}.$$ It follows from the law of total probability, $$\Pr[X = 1] = \Pr[X = 1 \mid U = 0]\Pr[U = 0] + \Pr[X = 1 \mid U = 1]\Pr[U = 1] = \frac{4}{9}\cdot \frac{1}{2} + \frac{3}{8} \cdot \frac{1}{2} = \frac{59}{144}.$$ Therefore, $$\Pr[U = 1 \mid X = 1] = \frac{\Pr[X = 1 \mid U = 1] \Pr[U = 1]}{\Pr[X = 1]} = \frac{2/9}{59/144} = \frac{32}{59}.$$