Here's another way of looking at it: By your logic, if I announce that one of the children is a girl, then the other child only has a 1/3 chance of also being a girl. Likewise, if I announce that one of the children is a boy, then the other child only has a 1/3 chance of being a boy. Therefore, by your logic, the act of my arbitrarily announcing the gender of one of the children increases the probability that the other child is of the opposite gender from 1/2 (what it was before I spoke) to 2/3, regardless of whether I said it was a girl or boy. Hopefully you can see why this is not correct.
Nor is that what I said. :)
Assuming you meant "chance of being a boy" where you said "chance of being a girl", I agree that announcing the gender of one of the two children increases the probability of the other child being the opposite gender from 1/2 to 2/3.
The reason this is so is that some of the original probability was sunk in a case you've now eliminated: the case where there were two of the gender you didn't announce.
[Edit: Jeff already wrote some code, and while I haven't bothered to review it, I assume the lack of outcry about it indicates its correctness. Care to share where he got that wrong?]
If Jeff wrote code that yielded 2/3, then he was implementing my "algorithm 1" (which has selection), not the second algorithm (which does not do any selection).
I just updated my post with an explanation that may clear things up for you.
import random
jeff_stats = { 'boy_and_girl': 0, 'two_girls': 0 }
paul_stats = { 'boy_and_girl': 0, 'other': 0 }
for i in xrange(100000):
children = [random.randint(0, 1), random.randint(0, 1)]
# Jeff's algorithm
if children[0] or children[1]:
print 'I have a girl'
if children[0] and children[1]:
jeff_stats['two_girls'] += 1
else:
jeff_stats['boy_and_girl'] += 1
else:
print "Oops, I'm a liar - I have no girls, so don't count me"
# Paul's algorithm
print 'I have a ' + ('girl' if children[0] else 'boy')
if children[0] != children[1]:
paul_stats['boy_and_girl'] += 1
else:
paul_stats['other'] += 1
print "Jeff stats: " + str(jeff_stats)
print "Paul stats: " + str(paul_stats)
Output (ignoring the actual printouts for each person): Jeff stats: {'boy_and_girl': 50027, 'two_girls': 24949}
Paul stats: {'boy_and_girl': 50027, 'other': 49973}
I liked tromino's explanation best: it's really an ambiguity in the English language. Under your 2nd algorithm, 1/4 of parents can't truthfully announce "I have a girl" - but in ordinary conversation, this doesn't matter, because they'd just truthfully say "I have a boy" and we don't make a distinction. It's only when we explicitly filter out parents who don't have a boy that we change the probabilities.It can still be the case that the chances of there being a boy and a girl are 1/2, while the chances of there being a boy after you find out about a girl are 1/3, purely because you don't know whether you found out about an older or younger girl. Probability is just a function of our ignorance (at least in this case; I'm not qualified to have an opinion about whether it always is).
[Edit: Hm. Looking again, it seems Jeff Atwood's code is for a different problem he was also discussing, so nevermind. After considering your update, I think you might be right.]
[Further edit follows:]
Here's some python that essentially shows you're correct, unless I flubbed it:
firstpickwasboy = {'boy':0, 'girl':0}
firstpickwasgirl = {'boy':0, 'girl':0}
choices = ['boy', 'girl']
for i in range(100000):
children = [random.choice(choices), random.choice(choices)]
whichchild = random.randint(0, 1)
otherchild = 1
if(whichchild): otherchild = 0
if(children[whichchild]=='boy'):
firstpickwasboy[children[otherchild]] += 1
else:
firstpickwasgirl[children[otherchild]] += 1
>>> firstpickwasboy
{'boy': 25132, 'girl': 25116}
>>> firstpickwasgirl
{'boy': 24679, 'girl': 25073}My point is that there is nothing wrong with Jeff's question, and I believed that you made a distinction with the Monty Hall version. But your second algorithm isn't the same as Jeff's question, my mistake.
It is very clear that my argument specifically adresses the question the way Jeff has formulated it, so you can even forget the part about "your second formulation", what I meant was the question of Jeff and why there is nothing wrong with it.
In statistics, it is commonly accepted that we don't know what we don't state (for an obvious practical purpose). Therefore, when we say : "One of them is a girl", it is implied that we don't know wich one because we didn't specify it.
Therefore there is nothing wrong with Jeff's question (and the probability is 2/3), at least for anyone familiar with basic statistics and probabilities conventions (and I suspect you are), anything else is just quibble. I assumed your argument wasn't about nitpicking this kind of convention, but it turns out I was wrong. I guess nobody wins this one :)
As mentioned in another thread started by Eliezer, it's the difference between "What is the sex of one of your children?" and "Is (at least) one of your children a girl?". For the second question, the results skew to 1/3 and 2/3 because we're discarding the cases where the answer is 'no'.
The light went on for me when Paul pointed out in his update that getting a random answer for "What is the sex of one of your children?" eliminates (an unknown) one of BG and GB.
In the world of mathematical conventions you learn in school, the question is understood and you're right. In the "normal" world where you can quibble with language because there is no specific agreement, Paul is right and the question should be more precise. In both cases the conclusion remains the same : what a waste of time.
You mean, if you only specify that at least one child is a girl, then it's 1/3.
Actually you're still underspecified, because you haven't said what you do if the parent has no girls.