I ask people at random if they have two children and also if one is a boy born on a Tuesday. After a long search I finally find someone who answers yes. What is the probability that this person has two boys? Assume an equal chance of giving birth to either sex and an equal chance to giving birth on any day.
clearvars
ctAll=0; bothBoys=0;
for s1='bg'
for d1='smtwhfa'
for s2='bg'
for d2='smtwhfa'
if isequal([s1 d1], 'bt') || ...
isequal([s2 d2], 'bt')
disp([s1 d1 ' ' s2 d2])
ctAll=ctAll+1;
if isequal([s1 s2],'bb')
bothBoys=bothBoys+1;
end
end
end
end
end
end
ctAll
bothBoys
finds all the possibilities for first and second child's being boy or girl and on any day of the week:
All the cases where at least one was a boy born on a Tuesday:
bs bt
bm bt
bt bs
bt bm
bt bt
bt bw
bt bh
bt bf
bt ba
bt gs
bt gm
bt gt
bt gw
bt gh
bt gf
bt ga
bw bt
bh bt
bf bt
ba bt
gs bt
gm bt
gt bt
gw bt
gh bt
gf bt
ga bt
ctAll =
27
bothBoys =
13
Both were boys in 13 of the 27 cases where at least one was a boy born on a Tuesday.
It's not exactly half and not 2/3 either. The disparity from half likely results from the "other" boy being allowed to be born any day of the week.
|
Posted by Charlie
on 2024-06-12 10:29:33 |