Tuesday Boy Problem Solved by Simulation
The other day, I came across a logic/math problem I hadn't heard before, The Tuesday Birthday Problem. It goes like this:
I have two children, one of whom is a son born on a Tuesday. What is the probability that I have two boys?
This puzzle was apparently first presented at a convention for mathematicians, magicians and puzzle enthusiasts (yeah, that's a pretty specialized convention) by Gary Foshee. Immediately after giving the puzzle, he followed up with this.
The first thing you think is 'What has Tuesday got to do with it?' Well, it has everything to do with it.
I know my first inclination was to dismiss that extra fact. How could it have any effect on the probability of the sex of the other child. I first read this puzzle late at night when I was tired, so I didn't feel like putting too much thought into it. Instead, I just read the explanations of how that extra bit of information alters the odds. But I still wasn't ready to buy those explanations just yet. But rather than try to think through the explanation that night, I decided to tackle it from a different angle. Instead of trying to figure out the odds, I'd just program a simulation and see how it played out.
In fact, this is a very simple simulation. I didn't program it in the most efficient manner, but it got the job done. Here's what I did. I created a 4 x 10,000 element array. That is, 10,000 sets of kids, with four pieces of information to designate sex and birth day of the week for each kid (sex 1, day 1, sex 2, day 2). Then, I randomly assigned sex and birth day to each of the kids. Next, I created a couple variables that would be filled in in the next stage. First was a variable keeping track of the number of sets where at least one was a boy born on a Tuesday - that is, the number of sets where the father would have given his first statement. The other variable was the number of sets with a boy born on a Tuesday and another son - the sets fulfilling the second statement. With the array and variables in place, I went back and did some if statements to simulate the father's conditions, increasing the totals of those variables as appropriate. When that was done, I simple divided the number of sets with kids with a boy born on a Tuesday and another son by the number of sets with at least one boy born on a Tuesday.
After running this program a few times, I found a small problem. 10,000 sets wasn't enough. The fraction was varying by several percentage points each time I ran it. So, I added one more feature to allow the program to keep a running average every time it ran.
Oh, and just to be sure I was doing things properly, I added a similar set of calculations to calculate the probability for a simpler puzzle:
I have two children, one of whom is a son. What is the probability that I have two boys?
This is much easier to understand, so it was my control to make sure the algorithm was working properly.
Warning: Don't read on if you want to solve the problem on your own, first.
Well, guess what I found out. After running the simulation on 100,000,000 sets of kids, I got a probability of 0.4813391 for the Tuesday boy problem, and 0.3333046 for the simpler boy problem. Those are very close to the actual odds of 13/27 (0.481481481...) and 1/3 (0.33333333...). It's pretty counterintuitive, but I guess those eggheads know what they're talking about, after all.
Image Source: Wikimedia Commons
Anyone interested in checking this out for themselves can download my program below:
Comments
I haven't read exactly what your simulation does, but I don’t need to. I know what it does from the answer it got. Let me make a suggestion for a slightly different one.
Rather than "eliminating" two-child families that don't meet certain criteria, keep track of fourteen different types: those where a parent tells you about a boy born on a Sunday, a boy born on a Monday, ..., a boy born on a Saturday, a girl born on a Sunday, ..., and a girl born on a Saturday. Each parent tells you only one thing, but is truthful. Calculate the probability of two children with the same gender separately for each category.
You will find that one of the following two facts is true: either the answer is vastly different based on what the parent tells you, or the answer is exactly 1/2 for each category.
What you are overlooking is that the parent of a boy born on a Tuesday, and a child that doesn't fit that description, is equally likely to tell you about either child. (Unless, of course, you require the parent to be biased toward Tuesday Boys. That's what makes the probabilities vastly different, based on that bias.)
The intuitive query "What has Tuesday got to do with it?" is valid, and can be explained much better without the "Tuesday" complication. Say a parent tells you "I have two children." The probability this person has two children of the same gender is 50%: there are four possible gender combinations - BB, BG, GB, and GG - and in half of them the children share a gender.
But suppose the parent adds "... and one has the gender I've written in this sealed envelope." One of the combinations we originally counted contradicts whatever is written there, so it may seem that one case is "eliminated," even if you don’t know which. Of the three remaining, only one includes two of the same gender. So even though you learned nothing relevant to the probability question, it seems the answer changed from 1/2 to 1/3.
The fallacy in this logic is that the parent of a boy and a girl had to decide what to write in the envelope, and could have chosen either "boy" or "girl." So you need to "eliminate" not only the parents who *couldn't* write "boy," but also those who *would* write something else even though they have a boy.
This apparent paradox was first created, in a form that differs only in the numbers of cases, in 1889 by a French mathematician named Joseph Bertrand. He used it to warn future generations that you need to more than just a fact, you need to know how it was obtained. Too many modern mathematicians fail to heed that warning.
Posted by: JeffJo | May 26, 2013 12:42 PM
I'm not trying to be difficult, but could you please tell me exactly how you would model the Tuesday Birthday problem without worrying about other cases? It's not that I couldn't do it, it's just a fair amount of work for a blog entry when I don't think it will make much difference. Just to repeat what I did:
1. Generate random two child combinations.
2. Search for all sets that satisfy the first statement.
3. Search for all subsets of 2 that satisfy the second statement.
4. Divide the two totals to get the probability.
I don't see that what you're suggesting is actually much different, other than that I'd be repeating steps 2 through 4 for all the different combinations of birth day and gender. So, the Tuesday boy case should come out exactly the same as my original program, and I don't see why it would be any different for any other gender/day combination. What am I missing?
Posted by: Jeff | June 7, 2013 1:20 PM
I thought I did describe it. I was brief, but it's there. But...
1) Initialize Count(1:14) to 0. Initialize Match(1:14) to zero.
2) For i=1:LotsAndLots
3) Generate a random two-child family.
4) Generate a true statement of the form "One is a [boy/girl] born on a [Sun/Mon/Tues/Wednes/Thurs/Fri/Satur]day." Determine which j in 1:14 corresponds to this statement.
5) Increment Count(j).
6) If both children have the same gender, increment Match(j)
7) next i
8) For j=1:14
9) Print out Match(j)/Count(j)
10) next j
The only thing I left to you is how to generate the statement in step 4). If you do it randomly, all of the numbers you print out will be 1/2, +/- the accuracy of your simulation. If you look for the lowest j whose statement is true, you will print out different numbers for each.
The point is that your simulation does not represent a real-world situation. It reflects a world where every parent of two is asked "Is one of your children a boy who was born on Tuesday?" Those who answer "yes" are counted, while those who answer "no" are not.
Mine represents a world where every parent is free to describe whatever they like. It counts those who say "I have a boy who was born on a Tuesday." It does not count, in the same category, those with a Tuesday Boy who would tell you about a Thursday Girl. Which is what the problem statement suggests.
The difference is that you count all of the parents of a Tuesday Boy and a Thursday Girl in the "Tuesday Boy" category, and none of them in the "Thursday Girl" category. I split them.
Posted by: JeffJo | June 10, 2013 4:17 PM
buy generic atorvastatin over the counter lipitor 20mg sale buy lipitor 20mg online
Posted by: Dhyjdo | March 12, 2024 1:10 PM
ciprofloxacin 500mg for sale - baycip cost buy augmentin no prescription
Posted by: Kjzkuf | March 13, 2024 3:16 PM
cipro pill - bactrim 480mg ca amoxiclav order
Posted by: Cdmauz | March 14, 2024 5:38 AM
ciprofloxacin 500mg brand - order trimox
order erythromycin 500mg for sale
Posted by: Qdqjfz | March 16, 2024 4:11 PM
buy metronidazole paypal - buy oxytetracycline for sale buy zithromax pills for sale
Posted by: Bxhmav | March 17, 2024 1:29 AM
india ivermectin - buy ciplox generic buy sumycin 500mg for sale
Posted by: Gokbam | March 18, 2024 3:59 PM
stromectol tablets uk - cost sumycin purchase sumycin without prescription
Posted by: Yvhkmc | March 18, 2024 7:57 PM
valacyclovir cost - diltiazem generic acyclovir online
Posted by: Ravild | March 19, 2024 6:21 AM
order ampicillin generic cheap generic amoxil buy generic amoxicillin online
Posted by: Cumwqs | March 21, 2024 3:32 AM
purchase metronidazole generic - buy terramycin online zithromax 500mg us
Posted by: Gamkmb | March 21, 2024 8:52 AM
order lasix 100mg online - prograf 1mg pill buy captopril 25 mg generic
Posted by: Izmmuy | March 22, 2024 11:22 PM
buy glycomet 500mg generic - purchase epivir sale order lincocin 500mg generic
Posted by: Sqqmvv | March 24, 2024 4:57 PM
order zidovudine without prescription - glycomet 1000mg us buy zyloprim generic
Posted by: Mrjjha | March 26, 2024 5:17 AM
clozapine for sale online - order tritace generic famotidine order
Posted by: Idhnet | March 26, 2024 6:18 PM
order quetiapine generic - buy zoloft 50mg generic order eskalith
Posted by: Ihttoz | March 29, 2024 5:47 AM
anafranil online buy - buy celexa 20mg without prescription doxepin 75mg generic
Posted by: Oyxeih | March 29, 2024 4:16 PM
buy hydroxyzine 25mg pills - purchase lexapro for sale endep uk
Posted by: Glzgfu | March 31, 2024 5:13 AM
buy augmentin 625mg online - cipro for sale ciprofloxacin 1000mg price
Posted by: Wjvzeo | April 2, 2024 6:09 PM
amoxil order online - buy generic cephalexin online where to buy ciprofloxacin without a prescription
Posted by: Mzvldk | April 3, 2024 7:55 PM
azithromycin 250mg pill - buy floxin 200mg for sale buy ciprofloxacin without a prescription
Posted by: Laokgf | April 8, 2024 4:39 PM
order cleocin 300mg without prescription - order cleocin chloramphenicol pills
Posted by: Vacyca | April 9, 2024 4:57 AM
ivermectin 12mg without a doctor prescription - cost levofloxacin buy generic cefaclor for sale
Posted by: Fkydea | April 11, 2024 9:15 AM
purchase ventolin generic - order advair diskus online cheap brand theophylline
Posted by: Hczpov | April 12, 2024 8:01 PM
methylprednisolone 16 mg online - order astelin 10ml for sale order astelin 10ml without prescription
Posted by: Bfgjou | April 14, 2024 8:51 AM
clarinex pills - clarinex 5mg for sale albuterol without prescription
Posted by: Gyrviw | April 15, 2024 5:23 AM
glycomet drug - purchase hyzaar for sale cost acarbose
Posted by: Bdpjcl | April 16, 2024 7:19 PM
micronase 2.5mg pills - buy micronase cheap order dapagliflozin 10mg sale
Posted by: Aoboil | April 17, 2024 5:19 AM
prandin us - order empagliflozin online purchase empagliflozin generic
Posted by: Gbrfee | April 19, 2024 5:52 AM
purchase semaglutide generic - buy semaglutide generic buy desmopressin paypal
Posted by: Ofmmam | April 21, 2024 11:12 AM
terbinafine 250mg us - fluconazole 200mg without prescription griseofulvin tablet
Posted by: Jdxhkz | April 21, 2024 10:57 PM
buy ketoconazole for sale - sporanox 100mg for sale buy itraconazole generic
Posted by: Rtnebr | April 24, 2024 2:37 AM
famvir brand - buy famciclovir 500mg for sale purchase valcivir for sale
Posted by: Cdgtdc | April 24, 2024 1:02 PM
lanoxin 250 mg generic - buy verapamil tablets furosemide 40mg sale
Posted by: Zvgahm | April 26, 2024 3:47 AM
cheap metoprolol 100mg - telmisartan 80mg without prescription buy adalat without prescription
Posted by: Qkiryv | April 27, 2024 4:38 PM
order microzide pills - lisinopril 5mg tablet bisoprolol usa
Posted by: Jfizqj | April 28, 2024 6:00 AM
nitroglycerin cheap - where can i buy combipres buy diovan cheap
Posted by: Uwypej | April 30, 2024 5:58 AM
zocor grant - lipitor difficulty atorvastatin dreadful
Posted by: Zwjapq | May 1, 2024 9:17 AM
rosuvastatin pills across - pravastatin replace caduet buy position
Posted by: Nxtghq | May 2, 2024 9:38 PM
inhalers for asthma passionate - asthma medication utmost inhalers for asthma blank
Posted by: Adubpk | May 19, 2024 9:59 AM
acne treatment beach - acne medication curtain acne medication hut
Posted by: Qkxlaj | May 19, 2024 6:09 PM
pills for treat prostatitis pad - prostatitis pills weigh prostatitis pills wrinkle
Posted by: Rarecj | May 21, 2024 6:39 AM
treatment for uti recall - treatment for uti necessary uti treatment swell
Posted by: Lwceym | May 21, 2024 2:25 PM
claritin pills humble - claritin pills dignity loratadine rage
Posted by: Nundjp | May 23, 2024 5:23 AM