7 ms·
Do you mind posting a simple walkthrough for the answer
by aeon10 13y ago
Do you mind posting a simple walkthrough for the answer
- crntaylor 13y agoSure. The slick answer is The chance of picking the biased coin is 1/1000. The chance of seeing 10 heads from a fair coin is (1/2)^10 = 1/1024. These are nearly equal, so given that you've seen 10 heads, there is a 50/50 chance of having a biased coin. So the probability the next flip shows a head is P(H) = P(biased) * P(H|biased) + P(fair) * P(H|fair) = 0.75 The long answer - Yo want to figure out P(biased | 10H). Using Bayes rule this is P(biased | 10H) = P(10H | biased) * P(biased) / P(10H) = P(10H | biased) * P(biased) / (P(10H|biased) * P(biased) + P(10H|fair) * P(fair)) = 1 * (1/1000) / (1 * 1/1000 + 1/1024 * 999/1000) ~ 0.5 and you now compute the probability of the next toss being a head as above.
- joezydeco 13y agoIsn't the gotcha of this test the fact that the history of previous coin flips has no effect on the next flip, given a fair coin? The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row. Or did I read this wrong?
- jules 13y agoYou didn't read it wrong, but you probably did fail the test ;-) There is no gotcha in the question, it's just a math problem that you either do or do not know how to solve. This isn't really about intelligence as much as it is about whether you have taken a course on probability. If you flipped 10 heads in a row the probability of the coin you have being the double heads coin increases dramatically, so you have to take that into account for the next flip. For intuitive understanding it often helps to go to extremes. Suppose you do 1 billion flips and all come up heads. What is the probability that the next flip comes up heads? Because we had 1 billion heads it is virtually certain that we are dealing with the double heads coin, so the probability that the next flip will come up heads is close to 1.
- joezydeco 13y ago"If you flipped 10 heads in a row the probability of the coin you have being the double heads coin increases dramatically..." I disagree. The coin is the coin. It didn't magically transport itself or change state after flipping it 10, 100, or a billion times. Lets change the puzzle to the simplest state: you pull a coin from the 1000-coin jar and flip it just once. What's the probability of heads? This is why roulette and baccarat tables in Vegas have those signs showing previous outcomes. It's meant to mess with your head. Previous history has no effect on future outcomes. A fair coin could come up heads a billion times in a row as well. The next flip will still be 0.5.
- jules 13y agoThe probability of heads is 0.999*0.5 + 0.001*1 = 0.5005 The important thing is that as you observe heads from the coin, you learn something about the coin. As you observe more heads it is less likely to be a fair coin and more likely to be the coin with double heads. This doesn't change anything about the coin, but it changes something about what you know about the coin. See here for the correct answer: https://news.ycombinator.com/item?id=7000523 https://news.ycombinator.com/item?id=7000523
- joezydeco 13y agoSince the question simply asked what p(heads) was on the next flip, it seems our answers match. Thanks!
- jules 13y agoOur answers to your question may match, but I very much doubt that our answers on the original question match. The crux is that your question is not equivalent to the original question. If you are interested in learning why that is I can explain it further, but it doesn't look like you are?
- joezydeco 13y ago
- 11001 13y agoThe history of coin flips has no effect on the future tosses, BUT you can use the history of flips to try to infer which coin you are dealing with.
- joezydeco 13y agoBut that's not what the OP/Interviewer wants to know. All he asked was this: "Given that you see 10 heads, what is the probability that the next toss of that coin is also a head?" He didn't ask you to identify the coin. He just wants to know if the flip is going to be heads.
- stygiansonic 13y agoThe probability of which coin you have affects the probability of the next toss coming up heads, so having this knowledge is implicit in determining the solution.
- joezydeco 13y agoThat probability was determined the moment you picked the coin out of the jar. It makes no difference what you do to it after the pick. Hold it in your hand for a day, flip it 10 times, sit on it, whatever - the end result is that p(heads) for that particular coin has not changed. p(heads) will be either 0.5 for a real coin or 1.0 for the rigged one. The probability then comes down to what coin you picked at the start of the trial. There's a 0.999 chance you have a real one, and 0.001 chance that you have the rigged one.
- jules 13y agoWhat if you picked a random coin from the jar, then you looked at it and saw that both sides are heads. Is the probability that this is the coin with both sides heads still 0.001? No, the probability that this is the coin with double heads is 100%. Now if you pick a random coin from the jar, and you randomly observe one of the sides of the coin 1 billion times and every time you see heads, is the probability that this is the coin with both sides heads still 0.001? No, the probability that this is the coin with double heads is very close to 100%. Now if you pick a random coin from the jar, and you flip the coin 1 billion times, and every time it comes up heads, is the probability that this is the coin with both sides heads still 0.001? No, the probability that this is the coin with double heads is very close to 100%. How about if you flipped it 10 times and it came up heads 10 times? Turns out the probability that it is the coin with double heads is about 51%. Probability quantifies the degree of uncertainty YOU have about the world. This can change even when the world doesn't change, namely when you observe something about the world.
- raverbashing 13y agoMore or less "The OP is only asking what the outcome of the NEXT flip is, not the probability of flipping 11 heads in a row" This is correct, however the history of flips gives us an information on the type of coin we have in our hands Would be interesting to see the probabilities if we had gotten 11 heads, 15 heads or 20 heads in a row.
- drcode 13y agoHere's my walkthrough: http://pastebin.com/e2ea9XUD http://pastebin.com/e2ea9XUD
- jules 13y agoWhen we pick the coin, we have 1 in 1000 chance of getting the double heads coin, and 999 in 1000 chance of getting a fair coin. Lets call this P(fair) = 0.001, and P(fake) = 0.999. When we have the double heads coin, the probability of getting 10 heads is 1: P(10 heads|fake) = 1. When we have a normal coin, the probability of getting 10 heads is P(10 heads|fair) = 0.5^10. The quantity we want to compute is P(heads|10 heads) = P(fair|10 heads)*0.5 + P(fake|10 heads)*1 = P(fair|10 heads)*0.5 + (1-P(fair|10 heads)) = 1 - P(fair|10 heads)*0.5. To compute P(fair|10 heads) we use Bayes' rule: P(fair|10 heads) = P(10 heads|fair) * P(fair)/P(10 heads) Here P(10 heads) = P(10 heads|fake)*P(fake) + P(10 heads|fair)*P(fair) = 1*0.001 + 0.5^10*0.999. We fill in the formula we got by Bayes' rule: P(fair|10 heads) = 0.5^10 * 0.999 / (1*0.001 + 0.5^10*0.999) Then we fill in the original formula: P(heads|10 heads) = 1 - 0.5^10 * 0.999 / (1*0.001 + 0.5^10*0.999) * 0.5 = 0.75308947108