• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    If you simulate it like that, it leads to a contradiction.

    According to the problem, 2 coins are flipped, and we all agree that it leads to an event pool of {TT,TH,HT,HH}, where all 4 events are equally as likely.

    In the simulation, however, you just ignore the “TT” situation, which leads to a total event pool of {HT,TH,HH}. Where all events are equally likely.

    The way the problem was phrased was “2 coin flips happen, and I have a machine that tells me either if both are Tails or not, this time it turns out that there is at least 1 heads”. But the way you simulated it is “I will make coinflips until I have at least 1 heads”.

    • starman2112
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      The way the problem was phrased was “2 coin flips happen, and I have a machine that tells me either if both are Tails or not, this time it turns out that there is at least 1 heads”.

      That is exactly what my program simulates. We’re only interested in the times when this time, it turns out that there is at least one heads. If they both land tails, then we don’t record anything about the flip, because the question is “if they aren’t both tails, what is the probability that they are both heads?”

      Think of it this way: generate n pairs of flipped coins, and put them in Bucket 0. Take every pair of coins that has at least one heads, and put it in Bucket 1. You’ll be leaving 25% of the pairs in Bucket 0–specifically, the TT pairs. The TH, HT, and HH pairs are all in Bucket1. Now, 33% of the pairs in Bucket 1 are HH.

      When I tell you that I’ve flipped a pair of coins, there’s a 25% chance that they landed HH. But when I tell you that at least one is heads, it’s like pulling a random pair out of Bucket 1. We don’t know whether that pair was in Bucket 1 because of the nickel, dime, or both.

      • calcopiritus@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        I tried to answer but idk why Lemmy failed to post it, so I’ll make a tldr instead.

        TLDR:

        Instead of reasoning I used actual statistics equations and you are correct: the chance in the coins case is 1/3.

        However, I was misguided assuming that both the “girl and boy” problem and “coins” problem are the same, when in fact they are not.

        In the “coins” case, the statement “at least one of them is heads” has a probability of 3/4. In the “girl and boy” case, the statement “the child that opened the door was a boy” has a probability of 1/2.