tag:blogger.com,1999:blog-5246987755651065286.post5915869513387622340..comments2024-08-11T04:34:48.463-07:00Comments on cbloom rants: 02-16-09 - Amusing Word Problemcbloomhttp://www.blogger.com/profile/10714564834899413045noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-5246987755651065286.post-76335738511184950192009-02-18T11:30:00.000-08:002009-02-18T11:30:00.000-08:00It's a trick question because you left out sex-sel...It's a trick question because you left out sex-selective abortion and infanticide. <BR/><BR/>I prefer to do it experimentally: http://www.msnbc.msn.com/id/5953508<BR/><BR/>54.5% boys.Aaronhttps://www.blogger.com/profile/13300224857283384872noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-79435750759767091722009-02-17T21:24:00.000-08:002009-02-17T21:24:00.000-08:00There's another way you can prove it, by induction...There's another way you can prove it, by induction.<BR/><BR/>The couple has one child. The distribution is obviously equal at that point.<BR/><BR/>Now if the couple has had N children and the distribution of boys and girls is even, then if they have 1 more, they are adding 1 boy or 1 girl to the set with equal probability, thus the distribution must stay even.<BR/><BR/>At 1 child it's even<BR/>If it's even at N children it's even at N+1<BR/>Therefore it's always even<BR/><BR/>You can see this :<BR/><BR/>B (1/2)<BR/>G (1/2)<BR/><BR/>B (1/2)<BR/>GB (1/4)<BR/>GG (1/4)<BR/><BR/>B=1/2 + 1/4 = 3/4<BR/>G=1/4 + 2/4 = 3/4<BR/><BR/>B (1/2)<BR/>GB (1/4)<BR/>GGB (1/8)<BR/>GGG (1/8)<BR/><BR/>B = 1/2+1/4+1/8 = 7/8<BR/>G = 1/4+2/8+3/8 = 7/8<BR/><BR/>etccbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-88819219068158333612009-02-17T21:19:00.000-08:002009-02-17T21:19:00.000-08:00Rats, nobody fell for my trap.There are a number o...Rats, nobody fell for my trap.<BR/><BR/>There are a number of ways you can reason about this and get it wrong and I find them all amusing. The flaw in my first post is that it's summing percentages which of course doesn't give you the overall expected percentage.<BR/><BR/>Jim, I really like that expectation value way.<BR/><BR/>The simplest way I found was to count the number of girls, or count the number of kids total. (you know the average number of boys is 1)<BR/><BR/>The number of kids is<BR/><BR/>1/2 + 2*1/4 + 3*1/8 + 4*1/16 ...<BR/><BR/>= Sum n * (1/2)^n<BR/><BR/>which can be solved by differentiating the geometric sum by d/dr<BR/><BR/>and the answer is = 2 kids average, so it must be 50/50cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-52117984233658368002009-02-17T17:59:00.000-08:002009-02-17T17:59:00.000-08:00"Yes and no. I find it's pretty easy to do the cal..."Yes and no. I find it's pretty easy to do the calculations wrong for these kind of things if you don't work on the right variables. When your calculation tells you something strange it's useful to have an idea of the answer intuitively."<BR/>Except it also works the other way round, where you end up tweaking your calculations until it agrees with your intuition, and intuition is usually a pretty bad guide on anything involving probabilities. This problem being a prime example. It's pretty straightforward to transform the problem description into some code that simulates it (as klon did), but it's tremendously easy to go wrong when you try to calculate the answer directly.<BR/><BR/>That program converges towards a rate of 50% boys (or at least it did here). You can derive the same directly: Every family obviously has exactly 1 boy, so the question is how many girls. The expectation works out to sum(n=1;inf) (n-1)*2^(-n) = 1 (50% chance for no girls, 25% for 1 girl, 12.5% for 2 girls etc.). In other words the average family in that setting has one boy and one girl, and since expectations are linear, the same goes for the whole population.<BR/><BR/>Your formula first computes the expectation of the ratio, which obviously doesn't agree with the ratio of the expectations in this case (or in general, for that matter); only the ratio of expectations has a plausible interpretation (namely, an urn with E[boys] blue balls and E[girls] red balls from which we draw random balls and check which color they are), while I don't see any such thing for the expectation of ratios. I'm quite certain that my interpretation is both plausible and correct :), but it would still help immensely to have a model of what's going on in the other interpretation to be able to point our where it's going wrong.ryghttps://www.blogger.com/profile/03031635656201499907noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-34094207964921673052009-02-17T17:11:00.000-08:002009-02-17T17:11:00.000-08:00Here is a simple calculation: Let X = # of tries u...Here is a simple calculation:<BR/> <BR/>Let X = # of tries until boy<BR/>Let Y = sex of first child<BR/> <BR/>Then E[X] = E[X|Y=male]Pr[Y=male] + E[X|Y=female]Pr[Y=female]<BR/> <BR/>Now, E[X|Y=female] = 1 + E[X]<BR/> <BR/>Plugging into above, E[X] = 1*1/2 + (1+E[X])*1/2.<BR/> <BR/>Solving, we get E[X] = 2. So the answer is 50%Anonymoushttps://www.blogger.com/profile/10636026531236911095noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-45075284178855838462009-02-17T14:40:00.000-08:002009-02-17T14:40:00.000-08:00This comment has been removed by the author.Sylvain Vhttps://www.blogger.com/profile/15419843346005251134noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-28270514669424164432009-02-17T14:33:00.000-08:002009-02-17T14:33:00.000-08:00I always do a Monte Carlo simulation to be sure:in...I always do a Monte Carlo simulation to be sure:<BR/><BR/>int boys = 0;<BR/>int girls = 0;<BR/>Random rnd = new Random();<BR/><BR/>for (int i = 0; i < 10000000; i++) { <BR/> while (true) {<BR/> if (rnd.nextBoolean()) {<BR/> boys++;<BR/> break;<BR/> }<BR/> girls++; <BR/> }<BR/>}<BR/>System.out.println("boys/girls = " + (float)boys / girls);Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-57916755706609861132009-02-17T14:32:00.000-08:002009-02-17T14:32:00.000-08:00Sly, there's a little error in your maths.It shoul...Sly, there's a little error in your maths.<BR/><BR/>It should be :<BR/><BR/>fraction of boys = sum of 0.5^n * (1/n) for n=1 to infinity<BR/><BR/>There are these possibilities :<BR/><BR/>B<BR/>GB<BR/>GGB<BR/>GGGB<BR/><BR/>first one happens 50% of the time, next 25% of the time, next (0.5)^3 , etc.<BR/><BR/>In first case its 1/1 boys, second case is 1/2 boys.<BR/><BR/>This sum can be done exactly, it's a series expansion of ln(2) = 0.69315<BR/><BR/>69.3% boyscbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-12808010570007789162009-02-17T14:28:00.000-08:002009-02-17T14:28:00.000-08:00This comment has been removed by the author.Sylvain Vhttps://www.blogger.com/profile/15419843346005251134noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-24998526570996456392009-02-17T14:27:00.000-08:002009-02-17T14:27:00.000-08:00" and, same as with the monty hall problem, the..." and, same as with the monty hall problem, the "birthday paradox" and other counterintuitive stochastical phenomena, the best way to not make a fool of yourself is to just Shut Up And Calculate(tm) first, then figure out the "why" later :)"<BR/><BR/>Yes and no. I find it's pretty easy to do the calculations wrong for these kind of things if you don't work on the right variables. When your calculation tells you something strange it's useful to have an idea of the answer intuitively.cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-9929582046866820962009-02-17T14:05:00.000-08:002009-02-17T14:05:00.000-08:00and, same as with the monty hall problem, the "bir...and, same as with the monty hall problem, the "birthday paradox" and other counterintuitive stochastical phenomena, the best way to not make a fool of yourself is to just Shut Up And Calculate(tm) first, then figure out the "why" later :)ryghttps://www.blogger.com/profile/03031635656201499907noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-9986207073094984482009-02-17T13:53:00.000-08:002009-02-17T13:53:00.000-08:00if the chance for girl:boy is 50:50, then you'll h...if the chance for girl:boy is 50:50, then you'll have exactly 50% girls in the resulting population (with an average family having 2 kids).<BR/><BR/>(as long as you don't start killing girls, it doesn't make a difference how many kids each family gets and for what reason - every time they decide to have a child, it's a 50:50 chance, and that's all that matters for the resulting population).ryghttps://www.blogger.com/profile/03031635656201499907noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-72601462257635175662009-02-17T11:51:00.000-08:002009-02-17T11:51:00.000-08:00percentage of girls = sum of 0.5^n for n=1 to infi...percentage of girls = sum of 0.5^n for n=1 to infinity.<BR/><BR/>Also known as 1: there won't be any number between 1 and the binary number 0.1111111111111111... So proportion of man = almost 0.<BR/><BR/>Also known as man paradise country :)Sylvain Vhttps://www.blogger.com/profile/15419843346005251134noreply@blogger.com