this post was submitted on 03 Dec 2023
418 points (100.0% liked)

196

16557 readers
1631 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] starman2112@sh.itjust.works 9 points 11 months ago* (last edited 11 months ago) (4 children)

Oops, I changed it to a more unintuitive one right after you replied! In my original comment, I said "you flip two coins, and you only know that at least one of them landed on heads. What is the probability that both landed on heads?"

And... No! Conditional probability strikes again! When you flipped those coins, the four possible outcomes were TT, TH, HT, HH

When you found out that at least one coin landed on heads, all you did was rule out TT. Now the possibilities are HT, TH, and HH. There's actually only a 1/3 chance that both are heads! If I had specified that one particular coin landed on heads, then it would be 50%

[–] Hacksaw@lemmy.ca 50 points 11 months ago* (last edited 11 months ago) (3 children)

No. It's still 50-50. Observing doesn't change probabilities (except maybe in quantum lol). This isn't like the Monty Hall where you make a choice.

The problem is that you stopped your probably tree too early. There is the chance that the first kid is a boy, the chance the second kid is a boy, AND the chance that the first kid answered the door. Here is the full tree, the gender of the first kid, the gender of the second and which child opened the door, last we see if your observation (boy at the door) excludes that scenario.

1 2 D E


B B 1 N

B G 1 N

G B 1 Y

G G 1 Y

B B 2 N

B G 2 Y

G B 2 N

G G 2 Y

You can see that of the scenarios that are not excluded there are two where the other child is a boy and two there the other child is a girl. 50-50. Observing doesn't affect probabilities of events because your have to include the odds that you observe what you observed.

[–] Zagorath@aussie.zone 10 points 11 months ago (2 children)

I was about to reply to you with a comment that started with "oh shit you're right!" But as I wrote it I started rethinking and I'm not sure now.

Because I actually don't think it matters whether we're BB1 or BB2. They're both only one generation of the four possible initial states. Which child opens the door is determined after the determination of which child is which gender. Basically, given that they have two boys, we're guaranteed to see a boy, so you shouldn't count it twice.

Still, I'm now no where near as confident in my answer as I was a moment ago. I might actually go and write the code to perform the experiment as I outlined in an earlier comment (let me know if you think that methodology is flawed/biased, and how you think it should be changed) to see what happens.

[–] Hacksaw@lemmy.ca 11 points 11 months ago (1 children)

That's a great idea let me know how it turns out. If you randomly pick the genders and randomly pick who opens the door, I think it will be 50-50. With these kinds of things they can get pretty tricky. Just because an explanation seems to make sense doesn't mean it's right so I'm curious!

[–] Zagorath@aussie.zone 16 points 11 months ago (2 children)

I put it together. Here's the code I wrote in Python.

import random

genders = ['boy', 'girl']

def run():
    other_child_girls = 0
    for i in range(10000):
        other_child = get_other_child()
        if other_child == 'girl':
            other_child_girls += 1
    print(other_child_girls)

def get_other_child():
    children = random.choices(genders, k=2)
    first_child_index = random.randint(0, 1)
    first_child = children[first_child_index]
    if first_child == 'boy':
        other_child_index = (first_child_index + 1) % 2
        return children[other_child_index]
    # Recursively repeat this call until the child at the door is a boy
    # (i.e., discard any cases where the child at the door is a girl)
    return get_other_child()

if __name__ == '__main__':
    run()

And it turns out you were right. I ran it a few times and got answers ranging from 4942 to 5087, i.e., clustered around 50%.

[–] Hacksaw@lemmy.ca 11 points 11 months ago

That's cool. Always nice to see a practical example of theory. Thanks to you I got to brush up on my Python too! I think it all makes sense. Everything is random, you exclude examples where s girl comes to the door. The odds are 50-50. Looks like you were right in the end though, this DID stir quite a bit of conversation lol!

[–] starman2112@sh.itjust.works 3 points 11 months ago* (last edited 11 months ago) (1 children)

There've been a lot of times when I simply didn't believe something in statistics until I simulated it. Like this problem:

I have two children. One is a boy born on a Tuesday. What is the probability I have two boys?

I wanted to simulate that because the answer seems absurd. 13/27? Where does that even come from? I'm scared of snakes, so I use Baby's First Programming Language: Tasker.

  1. Variable randomize %sex Min:1 Max:2

  2. Variable randomize %day Min:1 Max:7

  3. Variable set %child1 "%sex%day"

  4. Variable randomize %sex Min:1 Max:2

  5. Variable randomize %day Min:1 Max:7

  6. Variable set %child2 "%sex%day"

  7. Goto 1 IF %child1 != 11 AND %child2 != 11

Now I've generated two random children, at least one of which is 11–a specific sex born on a specific day.

  1. Variable add %BoyGirl IF %child1 = 2* OR %child2 = 2*

  2. Variable add %BoyBoy IF %child1 = 1* AND %child2 = 1*

If either child is a girl, it adds one to the BG bucket. If neither one is a girl, it adds one to the BB bucket.

  1. Variable add %Counter

  2. Goto 1 IF %Counter > 1,000

Hit play and yep, about 48% of families were BB. But remove the Tuesday part and just simulate the question "I have two children, and at least one of them is a boy," and it drops down to 33% again. I don't understand it, but apparently the math maths.

[–] Zagorath@aussie.zone 5 points 11 months ago (1 children)

the math maths

Ha. As someone from the "mathematics is shortened to maths" part of the world, this sounds weird to me. I'd probably say "the maths mathses". I just thought you might enjoy that.

Anyway, I Googled the problem you presented, and came across this excellent answer:

There are even trickier aspects to this question. For example, what is the strategy of the guy telling you about his family? If he always mentions a boy first and not a daughter, we get one probability; if he talks about the sex of the first born child, we get a different probability. Your calculation makes a choice in this issue - you choose the version of "if the father has a boy and a girl, he'll mention the boy".

What I'm aiming to is this: the question is not well-defined mathematically. It has several possible interpretations, and as such the "problem" here is indeed of the language; or more correctly, the fact that a simple statement in English does not convey enough information to specify the precise model for the problem.

The whole answer is worth reading, but that part there is the crux of it. It goes back to one of my earliest comments on this topic in this thread. The problem isn't that maths is weird, it's that language's ability to describe mathematical problems is lacking. There are so many different ways to translate the described problem into mathematical formulae and they necessarily carry assumptions. Even far more subtle assumptions than I at first thought.

[–] nilloc@discuss.tchncs.de 3 points 11 months ago (1 children)

I know this wasn’t the main point of your comment, but to be grammatically correct, it would be “the maths math.”

Plural verbs go with their plural noun subject and don’t need the s:

  • This book belongs on the shelf.
  • These books belong on the shelf.

And like you said, maths being short for mathematics means it’s plural.

[–] Zagorath@aussie.zone 4 points 11 months ago

Since using "maths" as a verb is very much nonstandard, I would argue against trying to apply any rigorous rules to it. It's about the vibes of the thing.

[–] Smoked_Brie@lemmy.blahaj.zone 4 points 11 months ago

And this interaction is why lemmy (and others) is superior. No “fuck you, you’re wrong” just “well I think it’s this” followed by “okay, let me try that” 10/10

[–] starman2112@sh.itjust.works 3 points 11 months ago

Yes! They responded to my comment before the edit, where I gave the coin example: "I flipped two coins, at least one of them was heads. What is the probability that both of them are heads?"

Before I read their reply, I edited it to the more confusing and infuriating two kids example. It's annoying because it seems like it should be the same as saying "I have two children, and at least one is a boy. What is the probability that I have two boys?" In both the coin case and this one, the answer is 1/3, but when one child answers the door, it's like sliding one quarter out from behind my hand. Now you know a particular (child, coin)'s (sex, face), and the answer is 50% again.

[–] calcopiritus@lemmy.world 5 points 11 months ago (1 children)

You assume that the probability of TH = HT = HH

When In fact, the probabilities are as follows:

P(HT)+P(TH) = 50% P(HH) = 50%

For all the probabilities being equal, you'd have to consider 4 cases:

HT, TH, HH (1) and HH (2).

The difference between HH (1) and HH (2) is which one you were told that was heads.

Then P(HH) = P(HH (1)) + P(HH (2)) = 2/4 = 50%

[–] starman2112@sh.itjust.works 2 points 11 months ago (2 children)

The issue is that you weren't told a particular one was heads, only that at least one was heads. If I flipped a nickel and a dime, then the four possibilities are NtDt, NtDh, NhDt, and NhDh. If I say that at least one of them is heads but don't tell you which one, then there are three possibilities: I flipped NhDt, NtDh, or NhDh. It's only when I tell you that the nickel landed on heads that it collapses to NhDt and NhDh.

Sorry if the acronyms are hard to read, they're much faster than typing something like "Heads (nickel) tails (dime)"

[–] calcopiritus@lemmy.world 1 points 11 months ago (1 children)

Again, you are assuming that every occurrence has the same chance. When in fact, they have not. There are 3 random events happening here:

  1. Flip of one coin (50% chance each)
  2. Flip of the other coin (50% chance each)
  3. The coin that you told me (let's say it's 50% nickel 50% dime for simplicity's sake)

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%

[–] starman2112@sh.itjust.works 1 points 11 months ago* (last edited 11 months ago) (2 children)

This is very easily simulated. I use Tasker, you can use Python or something. Assume 1 is heads and 2 is tails

  1. Randomize variable %dime to 1 or 2

  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.

  1. Goto 1 IF %dime != 1 AND %nickel != 1

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.

  1. Add 1 to variable %HeadsTails IF %dime = 2 OR %nickel = 2

  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

  1. Add 1 to variable %Counter

  2. 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.

[–] calcopiritus@lemmy.world 1 points 11 months ago (1 children)

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@sh.itjust.works 1 points 11 months ago (1 children)

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 2 points 11 months 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.

[–] GhostsAreShitty@lemmy.world 3 points 11 months ago (2 children)

You’ve also ruled out TH by knowing one is heads. So the only possibilities are HT and HH. Is that not 50/50?

[–] PotatoesFall@discuss.tchncs.de 3 points 11 months ago

it depends on how you know this information. did you look at one of the coins? then it's 50/50. did you ask a friend to look and yell you whether at least one of them is heads? then it's 2/3.

[–] starman2112@sh.itjust.works 3 points 11 months ago (1 children)

At least one is heads, but unless you know which one it is, you haven't ruled out HT or TH

[–] Glide@lemmy.ca 7 points 11 months ago* (last edited 11 months ago)

But you do know which one it is, because you said "other child". As soon as you ask the question, you assign a specific outcome to a specific child eliminating HH and HT (or in the new example, BB and BG). "What are the odds they have a female child" and "what are the odds the other child is female" are not the same question.

[–] Floey@lemm.ee 1 points 8 months ago* (last edited 8 months ago)

This is a ridiculous argument when taken to the extreme. Say you have three bags. Bag A contains 100 blue marbles. Bag B contains 99 blue marbles and 1 red marble. Bag C contains 100 red marbles. You reach into a random bag and draw a red marble. You've only eliminated bag A. Would you say it is a 50-50 whether you are left with a bag now containing 99 blue marbles or 99 red marbles? No, the fact that you drew a red marble tells you something about the composition of the bag you drew from. The odds that you drew out of bag B is 1/101, the total number of red marbles in bag B divided by the total number of red marbles across all bags. The odds that you are dealing with bag C is 100x that.

Now let's say you have 4 bags. BB, BR, BR, and RR. You draw an R. There is a 50% chance you are dealing with bag 2 or 3 because together they contain 2 out of 4 R. There is also a 50% chance you are dealing with bag 4. So it is equally likely that you draw either color of marble if you take the remaining marble out of the bag you randomly selected despite there being twice as many BR bags as RR bags.