420
Glitch in the matrix
(ani.social)
Be sure to follow the rule before you head out.
Rule: You must post before you leave.
Again, you are assuming that every occurrence has the same chance. When in fact, they have not. There are 3 random events happening here:
Also, I am assuming that these 3 events are completely unrelated. That is, the result of a coin flip won't determine whether you tell me the nickel or dime. A complete list of events is as follows:
T T N
T T D
H T N
H T D
T H N
T H D
H H N
H H D
After telling me that one of them is heads, the list is as follows:
H T D
T H N
H H D
H H N
H H is 50% chance, and the sum of HT + TH is the other 50%
This is very easily simulated. I use Tasker, you can use Python or something. Assume 1 is heads and 2 is tails
Randomize variable %dime to 1 or 2
Randomize variable %nickel to 1 or 2
This flips two coins. At this point there's a 25% chance of each TT, TH, HT, and HH occurring.
This is the point where I tell you that at least one of them is heads, but not which. It flips the coins again only if they landed TT, which means there are three possible sets of coins now: TH, HT, or HH.
Add 1 to variable %HeadsTails IF %dime = 2 OR %nickel = 2
Add 1 to variable %HeadsHeads IF %dime = 1 AND %nickel = 1
This keeps track of what sets made it past line 3. If either is tails, it adds one to %HeadsTails. If neither is tails, then it adds one to %HeadsHeads
Add 1 to variable %Counter
Goto 1 IF %Counter <1000
You can set your counter as high as you like. Python would probably handle 10,000 flips faster than Tasker can handle 1,000, but I'm on my phone and also python illiterate.
Press play, and I get 357 sets with two heads, and 643 sets that have a tails. The longer it runs, the closer to a ratio of 1:2 it'll get.
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".
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.
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.