Answer to the puzzler

So there seems to be a couple different answers to this question

Three coins, a nickel, a dime, and a quarter, are flipped. It is revealed to you that one coin is heads. What is the probability that the nickel is heads?

It seems to depend on how people interpreted the question. The most popular is

Three coins, a nickel, a dime, and a quarter, are flipped. It is revealed to you that at least one coin is heads. What is the probability that the nickel is heads?

At which point the popular answer is 4/7. There are 8 possible outcomes to flipping three coins. One of those 8 is all tails, which is ruled out by saying “at least one”, and thus, there are only 7 possibilities. Out of that, 4 outcomes have the nickel as heads.

Another popular interpretation is

Three coins, a nickel, a dime, and a quarter, are flipped. It is revealed to you that only one coin is heads. What is the probability that the nickel is heads?

At which point, there are only 3 possible outcomes and nickel being heads is one of them, and thus, the probability is 1/3.

The popular way this question is read by software engineers is as follows.

Three coins, a nickel, a dime, and a quarter, are flipped.
It is revealed to you that one coin is heads.
What is the probability that the nickel is heads?

In this interpretation, the only pertinent information is what is actually in the question, “What is the probability that the nickel is heads?” At which point, the answer is 1/2. If the question was worded like this,

If three coins, a nickel, a dime, and a quarter, are flipped and it is revealed that [at least one | only one] of them is heads, then what is the probability that the nickel is heads?

then it would have been either 4/7 or 1/3.

But then just to throw a wrench into the whole thing, someone with a Math PhD says the answer is 2/3. And here is the proof.

(N=H) =
P(N=H | coin revealed was a Q) P(coin revealed was Q)
+ P(N=H |coin revealed was a D) P(coin revealed was D)
+ P(N=H | coin revealed was N) P(coin revealed was N)

= (1/2 + 1/2 + 1)*(1/3).

Thoughts?

Advertisements

7 responses to this post.

  1. Real Programmers write code. Simulation says Math PhD is wrong.

    % perl coins.pl 100000
    P(N=H | at least one H) = 57.10%
    P(N=H | exactly one H) = 33.25%
    4 / 7 = 57.14%
    1 / 3 = 33.33%

    % cat coins.pl
    #!/usr/bin/perl
    $count = shift || 1000;
    $leastOne = $leastOneAndN = $exactlyOne = $exactlyOneAndN = 0;
    while ($count–) {
    $q = int(rand(2)); $d = int(rand(2)); $n = int(rand(2));
    if ($q+$d+$n == 1) { $exactlyOne++; $exactlyOneAndN++ if ($n); }
    if ($q+$d+$n >= 1) { $leastOne++; $leastOneAndN++ if ($n); }
    }
    printf “P(N=H | at least one H) = %.2f%%\n”, $leastOneAndN * 100.0 / $leastOne;
    printf “P(N=H | exactly one H) = %.2f%%\n”, $exactlyOneAndN * 100.0 / $exactlyOne;
    printf “4 / 7 = %.2f%%\n”, 4 * 100.0 / 7; printf “1 / 3 = %.2f%%\n”, 1 * 100.0 / 3;

    Reply

  2. I think Math PhD is answering a question with four random variables: three coin flips, and a game-show style “open a random door” that reveals the state of exactly one coin. But the question as given only has three random variables; there is no random selection of a coin to reveal. There’s no new independent random variable in the statement “at least one is heads”.

    With the open-a-door reveal, you get more information than merely “at least one is heads”. Sometimes, you know precisely that the nickel is heads, because that was the door that was opened for you. That’s why the probability is 2/3 for the game show scenario, higher than the question as given.

    Reply

  3. I endorse g’s response. No coins are ever revealed, so each of the Math PhD’s conditional probabilities == zero. The perl script by g formulates the problem(s) correctly, assuming the rand() function is uniform. (The simulation results suggest that rand() is indeed uniform.)

    Reply

  4. “In this interpretation, the only pertinent information is what is actually in the question, “What is the probability that the nickel is heads?” At which point, the answer is 1/2.”

    All the question is asking for is what the likelihood that the nickel coin is heads. All the rest is irrelevant. I still go with 1/2. You can’t change the wording after you ask the question to change the responses. =P

    Reply

  5. My engineer’s interpretation of the question was, “If I wait a few days then K will probably post the answer.” :-)

    Reply

  6. Posted by Daniel Delwood on February 17, 2010 at 5:35 pm

    “Three coins, a nickel, a dime, and a quarter, are flipped. It is revealed to you that one coin is heads. What is the probability that the nickel is heads?”

    Actually, my first comment would be that **there are six coins total**. You used a comma, not an em-dash for an aside like such:
    “Three coins—a nickel, a dime, and a quarter—are flipped. It is revealed to you that one coin is heads. What is the probability that the nickel is heads?”

    Assuming that there are a total of three coins, my analysis goes like the following:
    • Since the wording was “one coin is heads” (as opposed to “only one coin is heads” or “one of the three coins is heads”, the other two will be considered as in unknown states.
    • As the revealing did not tell the identity of the coin, it is assumed that it cannot be known whether or not the ‘heads’ coin spoken of was indeed the nickel.

    If the coin spoken of was the nickel (1/3 chance), then it’s heads (1/1).
    If the coin spoken of was the dime (1/3 chance), then it could be heads (1/2)
    If the coin spoken of was the quarter (1/3 chance), then it could be heads (1/2)

    Thus, 1/3 + 1/6 + 1/6 = 2/3 chance.

    Checking the answer, imagine I hand my sister three coins like that and tell her to flip ’em where I can’t see. I’ll assume my nickel has a nice 1/2 chance of being heads. But when I ask her to tell me what side one of them is and she says “heads”, it’s going to skew that probability more towards 1.0 . Thus, I’d say your 1/3 answer is right out, 1/2 is low (for the express reason that the coin mentioned *could* be the nickel; if it couldn’t, 1/2 it is since they’re independent variables as stated), and I’ll stick by my answer of: 2/3.

    Reply

  7. Posted by Chris on February 17, 2010 at 9:58 pm

    Of your two questions, “at least one” is the only sensible way to interpret the question.

    But friends and I have decided on two possible interpretations, nonetheless. I will spell these out in detail, though Daniel’s interpretation is right on.

    The three coins are flipped. Neither you nor me see the results. I choose a coin at random and look at the result and inform you the coin I looked at was heads without informing you which coin I looked at. Now I ask you the probability that the nickel is heads.

    The answer to this question is 2/3.

    Different scenario.

    The three coins are flipped. I look at all the results and inform you at least one is heads. Now I ask you the probability the nickel is heads.

    I suspect the answer to this question may be 4/7.

    This is very important to know because suppose we wanted to bet money on the outcome and wanted nobody to be cheated. If you wager $4 that the nickel is heads and are correct, does the house owe you $6 or $7. On the flipside, if you wager $3 that the nickel is tails and are correct, does the house owe you $9 or $7.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: