# Distinguish between two unfair coins

#### tal goldberg

##### New Member
Say I have two unfair coins, I ask someone to toss coin A 100 times and coin B 50 times and tell me the results (for example: coin A was head 20 times and tails 80 times while B was head 40 times and tails 10 times)

Now someone picks evenly coin A or B, tosses it as well and tells the result. How do I calculate the probability that coin A was tossed vs the probability that B was tossed?

#### obh

##### Active Member
Hi Tal,
Please try to use the conditional probability P(A|B)=P(A and B)/P(B).
If you are not sure, please show me how you try to solve

#### staassis

##### Active Member
These are two separate problems. The choice of the method for one problem is separate from the choice of the method for the other problem.

1. Parameters p_a = Prob(Heads in 1 toss if the coin is A) and p_b = Prob(Heads in 1 toss if the coin is B) can be estimated using the first round of tosses. This is done via either

___ 1.1. the method of maximum likelihood

or

___ 1.2. Bayesian analysis where p_a and p_b have uniform prior on [0, 1].

2. Once (p_a, p_b) have been estimated, the identity of the coin in the second round can be calculated using formulas for conditional probability.

#### tal goldberg

##### New Member
@obh - Is simple conditional probability good enough? I don't think the answer would be the same if we change coin A numbers to be "1 head out of 5 tosses" instead of the original "20 heads out of 100 tosses". Seems as the number of tosses (especially when numbers are small) should have major impact on the probability that coin A or B was tossed.

@staassis - how should I apply method of maximum likelihood to this specific case, is there a formula / code sample that takes these 4 numbers and calculates the probability that A or B was tossed given the result of a single coin toss?

#### staassis

##### Active Member
I gave you the link. Why are you asking before reading it carefully? Are you sure that you would not see the solution after spending your time on studying the referenced material?

#### tal goldberg

##### New Member
You are right. I will try and read through it.Thank you!

#### Dason

These are two separate problems. The choice of the method for one problem is separate from the choice of the method for the other problem.
I'm not convinced of that. The uncertainty in the original estimation needs to be accounted for in the second part when calculating the probability that the observed coin is A or B.

I would personally use a Bayesian approach for the entire problem

#### tal goldberg

##### New Member
I'm not convinced of that. The uncertainty in the original estimation needs to be accounted for in the second part when calculating the probability that the observed coin is A or B.

I would personally use a Bayesian approach for the entire problem
Thank you Dason.

How would you estimate if/when the uncertainty should be taken into account. If we toss coin A 100 times and get 20 heads, then assuming p_a = 0.2 seems reasonable, However, if we toss 5 times and get 1 head, it does not. Is there a rule of thumb to use here (i.e. if we. tossed the coin at least X time, we can assume using p_a = heads/tosses is good enough).