Finding the doctored coin

This Riddler puzzle is about repeatedly flipping coins!

On the table in front of you are two coins. They look and feel identical, but you know one of them has been doctored. The fair coin comes up heads half the time while the doctored coin comes up heads 60 percent of the time. How many flips — you must flip both coins at once, one with each hand — would you need to give yourself a 95 percent chance of correctly identifying the doctored coin?

Extra credit: What if, instead of 60 percent, the doctored coin came up heads some P percent of the time? How does that affect the speed with which you can correctly detect it?

Here is my solution.
[Show Solution]

4 thoughts on “Finding the doctored coin”

  1. Hi Laurent,
    I am trying to understand how your curve can fall all the way to 1 when the doctored probability is 100%. In one flip, there is a 50% chance that they are both heads and I learn nothing. So there is a 1/2 chance I need a second flip, and a 1/4 chance I need a third, etc; the geometric series sums to 2. Also I found an odd “stairstep” feature where the average number of guesses jumps discontinuously at each probability p obeying p^m/(1-p)^m=19 (19 = 95% / 5% and m an integer). I put my solution at
    https://theorie.ikp.physik.tu-darmstadt.de/qcd/coin.pdf
    As an aside, a Monte-Carlo is a kind of inefficient way to find the distribution of lengths, you can solve the Fokker-Planck equation for the distribution of possible outcomes and eliminate fluctuations…
    guy

    1. Hi Laurent,
      Reading through again, I think what you computed is the number of flips n such that it is more likely than not that one knows with 95% certainty. Rather than the average number of flips needed to reach 95% certainty. Or the number of flips such that a guess after that many flips is 95% certain to be right. Curiously, these each give a different answer, though the first two appear to be close.

      1. Hi Guy,
        Thanks for the comments! I believe that what I calculated is the test statistic (the equation in the blue box that says n > …) that, when satisfied, implies you are at least 95% confident that you know which coin is the doctored one.

        My mistake was in approximating the expected value of n by substituting the true probabilities in place of the empirical ones. This turns out to be a good approximation when $p_2=0.6$, but leads to a nonsensical solution when $p_2=1$, as you pointed out.

        If I can find some free time next week, I’ll look over my solution and see if I can patch it up. I think that if I calculate expectations exactly, I will obtain what you found in the second part of your solution (“stop when you know”). In the meantime, do you have any good references that explain the Fokker-Planck approach you mentioned?

        1. I think the question is to determine before starting, how many flips are needed to give yourself a 95 percent chance of correctly identifying the doctored coin. I believe the correct answer to this question with p2=0.6, p1=0.5 is 134. This is different from the published solution which does not take into consideration 50% probability of guessing correctly for cases where there are the same number of heads up flips.

          https://twitter.com/jason_weisman/status/921369527241363456

          Regards,
          Jason

Leave a Reply

Your email address will not be published. Required fields are marked *