Interview Question
Lead Analyst Interview

AppleIf you're given a jar with a mix of fair and unfair coins, and you pull one out and flip it 3 times, and get the specific sequence heads heads tails, what are the chances that you pulled out a fair or an unfair coin?
Interview Answers
11 Answers
"If you don't know how unfair the coins are then you have to compare fair vs. not fair. A fair coin Pf = 1/2 probability of heads or tails and therefore has a 1/(2^3) = 1/8 probability of going HHT. An unfair coin has a probability P*P*(1P) = 2*(P^2)  (P^3) of going HHT. Integrating across P from 0 to 1, you also get 1/8. Therefore, whether the coin was biased or not, you had an even chance when you got HHT that the coin was fair or not fair (50%). However, if you were to know the distribution of the coins in the jar between fair and not fair, you would be able to estimate the probability the coin was fair based on that distribution." For this above comment: Isn't P*P(1P) = P^2P^3? The integral of that should be (1/3)(x^3)  (1/4)(x^4). If you integrate over 0 to 1 you would get a probability of 1/12. How are you justifying HHT to be P*P*(1P) for an unfair coin that goes HHT  could you explain? If 1/12 is correct, I assume you have 60% probability of pulling a fair coin and a 40% probability of pulling an unfair coin?
Anonymous on
An unfair coin is weighted (biased) towards one of the sides (head or tails). Since we don't know how many coins are unfair, or whether they are bias towards heads or tails, we cannot decide the probability more closely, than 50/50. Either we did, or did not pull out a fair coin.
Kevin Gøhler on
I agree with Kevin. Both and unfair and a fair coin could have the given results in only three trials. The only way to tell if that specific coin is fair or unfair is by conducting more trials. And, since we don't know how many fair or unfair coins there are in the jar, we can only say that the coin is one or the other. If this is a trick question based on wording, you could say that there's a 100% chance that the coin is either fair or unfair.
Shari on
ok i think that probability is 50/50 because to flip a coin doesn't make any difference for that true or fake coins, the fact that you picked from mixed jar gives you a probability, you don't know how the con is fake, maybe its metal is different etc so its tricky question i think, so i would say 50/50
Anonymous on
3 flips is not enough to determine fair or unfair. The number of tosses would need to be greater than or equal to 30 to be normalized for the population. You can then look at the pvalue to determine whether the coin is fair. Since you would expect a fair coin to produce a Head 50% of the time a pvalue >= 0.50 would determine it is fair and p < .5 would be biased.
Anonymous on
If we are able to identify the sequence heads heads tails then it is a fair coin. Just a tricky question
shristi on
If you don't know how unfair the coins are then you have to compare fair vs. not fair. A fair coin Pf = 1/2 probability of heads or tails and therefore has a 1/(2^3) = 1/8 probability of going HHT. An unfair coin has a probability P*P*(1P) = 2*(P^2)  (P^3) of going HHT. Integrating across P from 0 to 1, you also get 1/8. Therefore, whether the coin was biased or not, you had an even chance when you got HHT that the coin was fair or not fair (50%). However, if you were to know the distribution of the coins in the jar between fair and not fair, you would be able to estimate the probability the coin was fair based on that distribution.
Tristan Cordier on
'Fair or unfair coin'. Well then, the answer is 1. It's like asking if I flip a coin, what's the probability of getting heads or tails?
Sankrityayan on
I am sure that I have a true coin!
Aleks_Danniel on
Isn't the answer 100% that you got a fair coin? Since a coin only has 2 sides, an unfair coin would mean that it would have either both heads or both tails. The fact that when you pull a coin out and flip it 3 times and you were able to get Heads and Tails means that it is a fair coin.
Anonymous on
These types of problems are easily practiced on Khan Academy. I tried to remember how to follow the procedure I learned there.
Anonymous on