Jump to content


Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

Of course, you can also enjoy our collection of amazing optical illusions and cool math games.

If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top.
If you have a website, we would appreciate a little link to BrainDen.

Thanks and enjoy the Den :-)
Guest Message by DevFuse
 

Photo
- - - - -

One Girl - One Boy


Best Answer Riddari , 13 July 2007 - 07:38 PM

Spoiler for solution
Go to the full post


  • Please log in to reply
348 replies to this topic

#321 fabpig

fabpig

    Prominent Member

  • Members
  • PipPipPipPip
  • 2423 posts
  • Gender:Male
  • Location:Cumbria, England

Posted 10 July 2012 - 10:44 AM

This teaser is about 4 years old now. It was resurrected about a year ago as: http://brainden.com/...8--/' . On the last couple of pages, you'll see there are programs which come to the same conclusion as benjer3's. (including a rare excursion into programming by one Mr F.Pig :P )


***************Sorry, the above link seems to have got corrupted between copying and pasting. Try http://brainden.com/.../topic/14158--/
  • 0

You must not think me necessarily foolish because I am facetious,  nor will I consider you necessarily wise because you are grave.  Sydney Smith.


#322 bhramarraj

bhramarraj

    Advanced Member

  • Members
  • PipPipPip
  • 254 posts

Posted 10 July 2012 - 01:20 PM

OP states: "They have two kids, one of them is a girl, what is the probability that the other kid is also a girl.
Spoiler for ALSO

Edited by bhramarraj, 10 July 2012 - 01:22 PM.

  • 0

#323 syonidv

syonidv

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 10 July 2012 - 08:51 PM

Wow, I was a doubter, but I have to say I'm impressed. The question I will ask all of you, before all of your bickering and mathematics, is have you tried it out? I wrote a simple program to chuck out the numbers, and the results are pretty astounding.


Your simulation is flawed, specifically at the point where you query
if( family.Child1 || family.Child2 )

The 'or' condition encapsulates the condition that the family has at least one girl, but it does not encapsulate the restriction that once a girl has been observed, we need to definitively assign this girl as "sibling #1" or "sibling #2".

Consider the corrected code, which honours the constraint that the observed child must be either child 1 or child 2 (I wrote it in javascript, and you can run it by simply pasting it into a site such as this one:

(function() {
    var BOY = 0, GIRL = 1;
    var FIRST = 0, SECOND = 1;

    var second_girls = 0, second_boys = 0;

    for( var i = 0; i < 100000; i++ ) {
        var family = {
            child1: Math.random() < 0.5 ? BOY : GIRL,
            child2: Math.random() < 0.5 ? BOY : GIRL
        };

        var child_we_happen_to_see = Math.random() < 0.5 ? FIRST : SECOND;
        var gender_of_child_we_see = (child_we_happen_to_see == FIRST) ? family.child1 : family.child2;

        if( gender_of_child_we_see == BOY )
            continue; /* this is our conditioning; omit any trial where a boy is observed */

        var gender_of_other_child = (child_we_happen_to_see == FIRST) ? family.child2 : family.child1;
        if( gender_of_other_child == BOY )
            second_boys++;
        else second_girls++;
    }

    alert( "Number of boys is " + second_boys + ".\n" +
        "Number of girls is " + second_girls + ". This is " +
        (new Number( 100*second_girls/(second_girls + second_boys))).toFixed( 2 ) + '%.' );
})();

In my run, I get "Number of boys is 25020. Number of girls is 24799. This is 49.78%."

This makes intuitive sense. The number of included trials is approx. 50,000--all those cases where we happened upon a family and happened to observe a girl child with them. And of those families, approximately half have a boy as the second child.

I believe somebody mentioned this earlier, but an excellent analog that helps make sense of "why you need to constrain the observed child to either child 1 or child 2" is called the "Gambler's Ruin" problem.

Consider I have two boxes, A and B. I tell you that there is some non-zero amount of money in the boxes, and that one box contains exactly twice the amount of money as the other one. But I don't tell you which one is which.

Suppose you pick box A. It has some unknown amount of money, X, in it. But then you think: wait a minute, there's a 50% chance that box B has twice as much money, or 2X, and a 50% chance that it has half as much money, or X/2. So if we calculate the expected value for the amount of money in box B we get

E(B) = 0.5*(2X) + 0.5*(X/2) = 1.25X

Or, roughly 25% more money than in box A. So we decide to swap. But now we let our (slightly larger) amount of money be X and the same logic applies to swapping back to box A.

Hence, by simply swapping A with B again and again, we can make our amount of money grow to infinity! We're rich! :D

Of course, we can disprove this fallacy by honouring the "our box must be only one of either A or B" constraint. That is, the calculation

E(B) = 0.5*(2X) + 0.5*(X/2)

assumes that the box we're holding is in a fuzzy state of simultaneously being both the greater AND the lesser money box (X/2 is only valid if the former is true, and 2X is only valid if the latter is true).

In the same way, "if( family.Child1 || family.Child2 )" assumes the child we've observed is in a fuzzy state of simultaneously being both the first AND second child. But it has to be one or the other.
  • 1

#324 benjer3

benjer3

    Advanced Member

  • Validating
  • PipPipPip
  • 298 posts

Posted 10 July 2012 - 10:52 PM

Did you get to the end of my post? I came to a very important conclusion, I think. Your program assumes that the parents randomly told us the gender of one of their children, which is perfectly logical. On the other had, mine assumes that if a girl is present, the parents would mention that, as that is what we're testing for. I believe that that is the whole teaser in a nutshell. It all depends on how you test it. The problem is, the 1/3-ists can't prove the 1/2-ists wrong as any 1/3-ist proof doesn't apply to the 1/2-ists, and vice versa.

Let's do a little mind experiment. Say we went to test this out for real. You go around asking parents with two children what the gender of one of their children are, while go around asking if one of their children are a girl. You then (if they say a girl) ask the gender of the other child, while I (if they respond yes) do the same. Our results will be obvious: about 1/2 of your second children will be girls, while about 1/3 of mine will be girls. Did we do something wrong? Well yes and no. Yes because we tested for two completely different things. I can't say to you, nor you to me, "You should have gotten my results," because we each tested for something different. However, there is nothing wrong with either of our methods of testing.

The big question now is which is right? I propose that they are both right. It just depends on how you read the question. So if anyone ever points a gun at your head and asks you, "I have two children. One of them is a girl. What's the gender of the other one?" you should first ask him, "If you had a boy and a girl, would you tell me one was a girl, or would you pick arbitrarily between them?"... and that would probably leave him stumped enough for you to get away. :P
  • 1

#325 syonidv

syonidv

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 11 July 2012 - 12:10 AM

I see where you're coming from, Ben, but let me play the contrarian.

The specific "condition" statement offered by the problem is: "They have two kids, one of them is a girl."

The question to be answered (Q2BA) is: "What is the probability that the other kid is also a girl?"

I agree with your assessment on the difference between the 1/3-ist question and the 1/2-ist question, but the Q2BA makes it clear that the 1/3-ist question is not well-defined in all contexts.

Suppose I ask the 1/3-ist question: "Do you have at least one girl?" and the parents reply "Yes." We'll call this a "yes" family.

Then I ask: "What is the gender of the other child?"

This question is well-defined if the parents have one boy and one girl, but for the approx. 1/3 of the time that the "Yes" families have two girls, they'll ask what 'other' child you're talking about. You didn't specify a 'first' child such that there can be an 'other' child in this case.

Or to make the point clearer, suppose the second question is: "What is the gender and age of the other child?"

If you asked this question, the parents' response would appropriately be "Uh... actually.. we have two daughters. Which one do you mean?", which is ostensibly them telling you "there is no 'other' child; you didn't specify one to begin with".

The 1/2-ist perspective doesn't suffer this drawback. For the 1/2-ist question: "Think of which of your kids did <totally random action>. Is this kid a girl?" (e.g. "Think of which of your kids you saw chewing bubblegum last. It is a girl?", or "Which kid do you have with you? Is it a girl?", etc.) and they answer 'yes'.

Now you have a well-defined 'other' in all contexts, as well as the condition statement being satisfied.

And since families with two girls will be "Yes" families twice as often than 1-boy 1-girl families (per Bayes' rule) under this scheme, our 1/2-ist philosophy comes by its name rightfully. ;)

My $0.02, at any rate. :)

Edited by syonidv, 11 July 2012 - 12:13 AM.

  • 0

#326 fabpig

fabpig

    Prominent Member

  • Members
  • PipPipPipPip
  • 2423 posts
  • Gender:Male
  • Location:Cumbria, England

Posted 11 July 2012 - 12:56 AM

.

Suppose I ask the 1/3-ist question: "Do you have at least one girl?" and the parents reply "Yes." We'll call this a "yes" family.

Then I ask: "What is the gender of the other child?"

This question is well-defined if the parents have one boy and one girl, but for the approx. 1/3 of the time that the "Yes" families have two girls, they'll ask what 'other' child you're talking about. You didn't specify a 'first' child such that there can be an 'other' child in this case.

Or to make the point clearer, suppose the second question is: "What is the gender and age of the other child?"

If you asked this question, the parents' response would appropriately be "Uh... actually.. we have two daughters. Which one do you mean?", which is ostensibly them telling you "there is no 'other' child; you didn't specify one to begin with".

The 1/2-ist perspective doesn't suffer this drawback. For the 1/2-ist question: "Think of which of your kids did <totally random action>. Is this kid a girl?" (e.g. "Think of which of your kids you saw chewing bubblegum last. It is a girl?", or "Which kid do you have with you? Is it a girl?", etc.) and they answer 'yes'.

Now you have a well-defined 'other' in all contexts, as well as the condition statement being satisfied.

And since families with two girls will be "Yes" families twice as often than 1-boy 1-girl families (per Bayes' rule) under this scheme, our 1/2-ist philosophy comes by its name rightfully. ;)

My $0.02, at any rate. :)



If you have 2 children, both girls, and 1 of them is a girl, then the 'other' child is also a girl. I really don't see your point.

I have 2 daughters. If someone says to me "Do you have at least 1 daughter?", I say "Yes". If they then ask what the gender of my 'other' child is, I don't say "what other child?"
  • 0

You must not think me necessarily foolish because I am facetious,  nor will I consider you necessarily wise because you are grave.  Sydney Smith.


#327 benjer3

benjer3

    Advanced Member

  • Validating
  • PipPipPip
  • 298 posts

Posted 11 July 2012 - 01:14 AM

Hmm, you do have a point. And I'm beginning to think that this question cannot be answered by experimentation. The reason I say that is surveying about the genders of people's children is very different from them just coming out and telling you. If you ask people about their children, you have no prior knowledge and thus have to remove those cases where you do not get the results you want. However, if a bunch of people come up and tell you the same condition (that they have two children and one girl), every case has to be considered; no case is just thrown out, meaning there's no dropping of combinations. So now the question I'm pondering is, if a thousand people come up to you and say said condition, how many of the unmentioned children are girls?
Spoiler for The Answer?

  • 0

#328 fabpig

fabpig

    Prominent Member

  • Members
  • PipPipPipPip
  • 2423 posts
  • Gender:Male
  • Location:Cumbria, England

Posted 11 July 2012 - 01:34 AM

Oh good grief.
  • 0

You must not think me necessarily foolish because I am facetious,  nor will I consider you necessarily wise because you are grave.  Sydney Smith.


#329 benjer3

benjer3

    Advanced Member

  • Validating
  • PipPipPip
  • 298 posts

Posted 11 July 2012 - 02:02 AM

Oh good grief.

Sorry, I'm always doubting myself. :P
  • 0

#330 fabpig

fabpig

    Prominent Member

  • Members
  • PipPipPipPip
  • 2423 posts
  • Gender:Male
  • Location:Cumbria, England

Posted 11 July 2012 - 02:28 AM

This is getting ridiculously obtuse. benjer - you were right. Now extend your program to show the percentage of 2 child families who had 2 boys. and you'll find .... well see what you find.
  • 0

You must not think me necessarily foolish because I am facetious,  nor will I consider you necessarily wise because you are grave.  Sydney Smith.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users