Followers 0

## 35 posts in this topic

Posted · Report post

Where in the puzzle does it say anything about the girl being born first, there is no reason to assume it and this is the main reason as to why people get this wrong. There is a case for the answer being 0.5 but this is based on the method used for selecting the family which is unclear.

0

##### Share on other sites

Posted · Report post

But this is assuming the question is implying the girl does not need to have been born first.

Yes, I am assuming order doesn't matter because the question states both kids are already born. The fact that one is a girl just means that out of the two, one is a girl.

0

##### Share on other sites

Posted · Report post

My last post(#15) was awkward and ill-worded. Here's a better one:

Suppose many two-child households each filled out a questionnaire truthfully.

The questionnaire contained two questions: "Do you have a daughter?" and

"Do you have a son?". If you take all of the questionnaires with a yes

answer to "Do you have a daughter?", what portion of these would have a

no answer to "Do you have a son?" (this is the same as saying that

both are daughters)?

To simulate this, just use two tosses of a fair fair coin to decide the

genders of the two children. Use this to fill out each questionnaire.

If you then take those with a yes answer to "Do you have a daughter?",

you will find that 1/3 of those have a no answer to "Do you have a son?".

Try it!

I just did it quickly for 12 questionnaires and I got 10 with a yes to

"Do you have a daughter?". Of these 10, 4 (that's 4/10 = .4) had a no

answer to"Do you have a son?". The more questionnaires you do, the closer

this gets to 1/3.

0

##### Share on other sites

Posted · Report post

My last post(#15) was awkward and ill-worded. Here's a better one:

Suppose many two-child households each filled out a questionnaire truthfully.

The questionnaire contained two questions: "Do you have a daughter?" and

"Do you have a son?". If you take all of the questionnaires with a yes

answer to "Do you have a daughter?", what portion of these would have a

no answer to "Do you have a son?" (this is the same as saying that

both are daughters)?

To simulate this, just use two tosses of a fair fair coin to decide the

genders of the two children. Use this to fill out each questionnaire.

If you then take those with a yes answer to "Do you have a daughter?",

you will find that 1/3 of those have a no answer to "Do you have a son?".

Try it!

I just did it quickly for 12 questionnaires and I got 10 with a yes to

"Do you have a daughter?". Of these 10, 4 (that's 4/10 = .4) had a no

answer to"Do you have a son?". The more questionnaires you do, the closer

this gets to 1/3.

Hmmm I'm gonna write a quick java program and test this quick, but yeah, when you think about it that way, does seem to be a third

BUT I STILL LIKE 1/2 AS AN ANSWER!!! FOOK YOU ALLLLL

0

##### Share on other sites

Posted · Report post

yaya, you people who say 1/3 are right. I hate you alllllllll!

0

##### Share on other sites

Posted · Report post

i seem to be getting 1/2.

```
import random

count1 = 0

count2 = 0

for i in range(0,100000):

value1 = random.randint(0,1)

if value1 == 1: #if they answer yes to "do you have a daughter" (if they answer no to this then we dont consider it.)

count1 += 1

value2 = random.randint(0,1)

if value2 == 0: #if they answer no to "do you have a son"

count2 += 1

print(count2/count1)

```
gives me .4996. it's all in how you interpret it. of course, if i wrote the program...
```
for i in range(0,100000):

value1 = random.randint(0,1)

value2 = random.randint(0,1)

if value1 == 1:

count1 += 1

if value2 == 0:

count2 += 1

```

then it would be 1/3.

0

##### Share on other sites

Posted · Report post

i seem to be getting 1/2.

```
import random
count1 = 0
count2 = 0
for i in range(0,100000):
value1 = random.randint(0,1)
if value1 == 1: #if they answer yes to "do you have a daughter" (if they answer no to this then we dont consider it.)
count1 += 1
value2 = random.randint(0,1)
if value2 == 0: #if they answer no to "do you have a son"
count2 += 1
print(count2/count1)
[/code]

gives me .4996.

it's all in how you interpret it.

of course, if i wrote the program...

[code]
for i in range(0,100000):
value1 = random.randint(0,1)
value2 = random.randint(0,1)
if value1 == 1:
count1 += 1
if value2 == 0:
count2 += 1
```

then it would be 1/3.

No, you don't flip the coins to answer the questions -- you flip them to decide

the genders of both children. Then, and only then, do you fill out the

questionnaires. In reality, the children would already exist before you got

the questionnaire, so you have to decide about both children first in order

to accurately simulate the situation.

0

##### Share on other sites

Posted (edited) · Report post

but again, if i do...

```
import random

total1girl = 0

total2girl = 0

child = [-1]*2

for i in range(0,100000):

for j in range(0,2):

child[j] = random.randint(0,1)

if child[0] == 1 or child[1] == 1: #if either the first or second child is a girl

total1girl += 1

if child[0] == 1 and child[1] == 1: #if both childern are girls

total2girl += 1

print(total2girl/total1girl)

```
then i of course will get 1/3. if however i do...
```
for i in range(0,100000):

for j in range(0,2):

child[j] = random.randint(0,1)

if child[0] == 1: #if the first child is a girl.

total1girl += 1

if child[1] == 0: #if the second child is a girl.

total2girl += 1

```

then its 50/50.

Edited by phillip1882
0

##### Share on other sites

Posted · Report post

but again, if i do...

```
import random
total1girl = 0
total2girl = 0
child = [-1]*2
for i in range(0,100000):
for j in range(0,2):
child[j] = random.randint(0,1)
if child[0] == 1 or child[1] == 1: #if either the first or second child is a girl
total1girl += 1
if child[0] == 1 and child[1] == 1: #if both childern are girls
total2girl += 1
print(total2girl/total1girl)
[/code]

then i of course will get 1/3.

if however i do...

[code]
for i in range(0,100000):
for j in range(0,2):
child[j] = random.randint(0,1)
if child[0] == 1: #if the first child is a girl.
total1girl += 1
if child[1] == 0: #if the second child is a girl.
total2girl += 1
```

then its 50/50.

You're still cutting corners. Simulations should carry out every step of

the process as closely as possible. In this case, flip the coins to make 2

kids, then answer the two questions "Do you have a daughter?" and "Do you

have a son?" and make a large bunch of questionnaires this way. Then, take

the questionnaires that have a "yes" answer to "Do you have a daughter?" and

count the proportion of them with a "no" answer to "Do you have a son?".

That second program seems to make distinctions (first child -- second child)

which the questionnaire doesn't address at all. To be REALLY convincing,

a simulation must carry out every step of what it is trying to simulate.

Every programming shortcut must be avoided. So, I don't think even the first

program qualifies as a good simulation of the questionnaire scenario.

0

##### Share on other sites

Posted · Report post

My 2 cents worth:

I wrote these in AutoHotKey to try and give my 2 teenage children (both girls!) an idea of how a computer program works. To prove a point I included a breakdown of no. of boys from the same sample.

The first is easier to read and understand (I hope), the second is about 25% faster. I apologise if the ;comments are a bit obvious/patronising

```
#NoEnv

SendMode Input

;set counters to 0

atleastonegirl = 0, botharegirls = 0, atleastoneboy = 0, bothareboys = 0

loop 10000000

{

random, child1, 0, 1               	;  randomly assign 1 (girl) or 0 (boy) to child1

random, child2, 0, 1               	;  likewise child2

if (child1 or child2 )             	;  if either are girls

{

atleastonegirl ++                  ;  add one to counter

if (child1 and child2)         	;  if both are girls

botharegirls ++             	;  add one to counter

}

if (!child1 or !child2)                ;  if either are boys

{

atleastoneboy ++               	;  add one to counter

if (!child1 and !child2)       	;  if both are boys

bothareboys ++                  ;  add one to counter

}

}

girlpercent := botharegirls / atleastonegirl * 100

boypercent := bothareboys / atleastoneboy * 100

;  Write to file

FILEAPPEND, 10000000 - sample of 2 children families`n %atleastonegirl% - no. who have at least one girl. `n %botharegirls% - no. who have both girls`n`n %girlpercent% percent  `n`n`n%A_SPACE%, %A_MYDOCUMENTS%\famsample.txt

;

FILEAPPEND, %atleastoneboy% - no. who have at least one boy. `n %bothareboys% - no. who have both boys`n`n %boypercent% percent `n, %A_MYDOCUMENTS%\famsample.txt

msgbox Done

```
result: 10000000 - sample of 2 children families 7500583 - no. who have at least one girl. 2501412 - no. who have both girls 33.349568 percent 7498588 - no. who have at least one boy. 2499417 - no. who have both boys 33.331835 percent
```
#NoEnv

SendMode Input

;set counters to 0

atleastonegirl = 0, botharegirls = 0, atleastoneboy = 0, bothareboys = 0

loop 10000000

{

random, child1, 0, 1               	;  randomly assign 1 (girl) or 0 (boy) to child1

random, child2, 0, 1               	;  likewise child2

if (child1 or child2)                  ;  if either are girls

{

atleastonegirl ++                  ;  add one to counter

if (child1 and child2)         	;  if both are girls

botharegirls ++             	;  add one to counter

else

atleastoneboy ++                ;  if one is a girl but not both, then one is a boy

}

else

{

bothareboys ++                 	; if neither are girls, both are boys

atleastoneboy ++               	; and at least one is, too!

}

}

girlpercent := botharegirls / atleastonegirl * 100

boypercent := bothareboys / atleastoneboy * 100

;  Write to file

FILEAPPEND, 10000000 - sample of 2 children families`n %atleastonegirl% - no. who have at least one girl. `n %botharegirls% - no. who have both girls`n`n %girlpercent% percent  `n`n`n%A_SPACE%, %A_MYDOCUMENTS%\famsample.txt

;

FILEAPPEND, %atleastoneboy% - no. who have at least one boy. `n %bothareboys% - no. who have both boys`n`n %boypercent% percent `n, %A_MYDOCUMENTS%\famsample.txt

msgbox Done

```

result:

10000000 - sample of 2 children families

7500527 - no. who have at least one girl.

2500002 - no. who have both girls

33.331018 percent

7499998 - no. who have at least one boy.

2499473 - no. who have both boys

33.326316 percent

0

## Create an account

Register a new account