   A real mind bender
  On our biology final test, we were asked the final question for extra credit:There are three pancakes in a hat. One pancake is golden on both sides, one is brown on both sides, and the last is gold on one side and brown on the other. You draw one pancake from the hat and the side you see is brown. What's the probability the other side of the pancake you drew is brown?Most people in my class (including me) figgured it was 1/2 but the teacher told is it was 2/3. I decided to write a program testing this by randomly setting up the pancake sides and checking the other side of the "drawn" one. However, It's showing the probibility as being ~50% (determined by dividing the number of pancakes with brown on the other side by the total number of pancakes checked.)Here's some of the results it's been giving me (p1s1 stands for pancake 1 side 1 and p1s1 will always be 2 representing the brown side I drew. Program checks pancake 1 side 2 to see what color it is).1 = gold, 2 = brown p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 2Total Golds: 1Probability: 2-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 3Total Golds: 1Probability: 1.5-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 3Total Golds: 2Probability: 1-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 4Total Golds: 2Probability: 1-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 4Total Golds: 3Probability: 0.8-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 4Total Golds: 4Probability: 0.666667-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 5Total Golds: 4Probability: 0.714286-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 6Total Golds: 4Probability: 0.75-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 6Total Golds: 5Probability: 0.666667-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 7Total Golds: 5Probability: 0.7-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 7Total Golds: 6Probability: 0.636364-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 7Total Golds: 7Probability: 0.583333-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 8Total Golds: 7Probability: 0.615385-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 9Total Golds: 7Probability: 0.642857-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 9Total Golds: 8Probability: 0.6-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 10Total Golds: 8Probability: 0.625-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 10Total Golds: 9Probability: 0.588235-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 10Total Golds: 10Probability: 0.555556-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 11Total Golds: 10Probability: 0.578947-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 12Total Golds: 10Probability: 0.6-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 12Total Golds: 11Probability: 0.571429-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 13Total Golds: 11Probability: 0.590909-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 13Total Golds: 12Probability: 0.565217-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 13Total Golds: 13Probability: 0.541667-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 14Total Golds: 13Probability: 0.56-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 15Total Golds: 13Probability: 0.576923-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 15Total Golds: 14Probability: 0.555556-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 16Total Golds: 14Probability: 0.571429-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 16Total Golds: 15Probability: 0.551724-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 16Total Golds: 16Probability: 0.533333-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 17Total Golds: 16Probability: 0.548387-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 18Total Golds: 16Probability: 0.5625-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 18Total Golds: 17Probability: 0.545455-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 19Total Golds: 17Probability: 0.558824-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 19Total Golds: 18Probability: 0.542857-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 19Total Golds: 19Probability: 0.527778-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 20Total Golds: 19Probability: 0.540541-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 21Total Golds: 19Probability: 0.552632-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 21Total Golds: 20Probability: 0.538462-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 22Total Golds: 20Probability: 0.55-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 22Total Golds: 21Probability: 0.536585-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 22Total Golds: 22Probability: 0.52381-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 23Total Golds: 22Probability: 0.534884-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 24Total Golds: 22Probability: 0.545455-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 24Total Golds: 23Probability: 0.533333-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 25Total Golds: 23Probability: 0.543478-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 25Total Golds: 24Probability: 0.531915-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 25Total Golds: 25Probability: 0.520833-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 26Total Golds: 25Probability: 0.530612-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 27Total Golds: 25Probability: 0.54-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 27Total Golds: 26Probability: 0.529412-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 28Total Golds: 26Probability: 0.538462-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 28Total Golds: 27Probability: 0.528302-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 28Total Golds: 28Probability: 0.518519-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 29Total Golds: 28Probability: 0.527273-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 30Total Golds: 28Probability: 0.535714-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 30Total Golds: 29Probability: 0.526316-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 31Total Golds: 29Probability: 0.534483-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 31Total Golds: 30Probability: 0.525424-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 31Total Golds: 31Probability: 0.516667-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 32Total Golds: 31Probability: 0.52459-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 33Total Golds: 31Probability: 0.532258-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 33Total Golds: 32Probability: 0.52381-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 34Total Golds: 32Probability: 0.53125-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 34Total Golds: 33Probability: 0.523077-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 34Total Golds: 34Probability: 0.515152-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 35Total Golds: 34Probability: 0.522388-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 36Total Golds: 34Probability: 0.529412-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 36Total Golds: 35Probability: 0.521739-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 37Total Golds: 35Probability: 0.528571-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 37Total Golds: 36Probability: 0.521127-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 37Total Golds: 37Probability: 0.513889-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 38Total Golds: 37Probability: 0.520548-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 39Total Golds: 37Probability: 0.527027-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 39Total Golds: 38Probability: 0.52-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 40Total Golds: 38Probability: 0.526316-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 40Total Golds: 39Probability: 0.519481-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 40Total Golds: 40Probability: 0.512821-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 41Total Golds: 40Probability: 0.518987-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 42Total Golds: 40Probability: 0.525-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 42Total Golds: 41Probability: 0.518519-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 43Total Golds: 41Probability: 0.52439-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 43Total Golds: 42Probability: 0.518072-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 43Total Golds: 43Probability: 0.511905-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 44Total Golds: 43Probability: 0.517647-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 45Total Golds: 43Probability: 0.523256-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 2 p3s1: 1 p3s2: 1Total Browns: 45Total Golds: 44Probability: 0.517241-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 2 p3s1: 2 p3s2: 1Total Browns: 46Total Golds: 44Probability: 0.522727-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 2 p2s2: 1 p3s1: 2 p3s2: 2Total Browns: 46Total Golds: 45Probability: 0.516854-------------------------------------------------------p1s1: 2 p1s2: ->1<- p2s1: 1 p2s2: 2 p3s1: 1 p3s2: 2Total Browns: 46Total Golds: 46Probability: 0.511111-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 1 p2s2: 1 p3s1: 2 p3s2: 1Total Browns: 47Total Golds: 46Probability: 0.516484-------------------------------------------------------p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2Total Browns: 48Total Golds: 46Probability: 0.521739-------------------------------------------Am I just doing something wrong here or is my progrm showing something otherwise?At first, it's showing some results that look closer to 2/3 but later on it levels out at around .51 or so...Here's the source if anybody's interested[edited by - Xtremehobo on February 4, 2004 8:06:57 PM]
  ahthe trick here is that you are picking sides of a pancake, not a whole pancake.  so if you''ve picked a brown side, there are 3 respective sides that can be on the other side, one gold and 2 browns.  so there is 2/3 a chance for brown being on the other side....make sense?-me ;  It''s 1/2.  Your teacher is wrong. ;  The fact that you are picknig side''s, and not whole pancakes, is irrelevant.  It''s pretty apparent to me that a pancake would have to have two sides.  You are looking at the other side of the pancake you drew. ;  Palidine''s got it - you''re probably counting whole gold pancakes that you got out of the hat.Since you already know that the pancake you have has at least one brown side, you know you are holding one of only three possible pancakes - and in that set, two will have the other side brown, one will have it golden, hence, a 2/3 probability of the other side also being brown.;  Now I''m getting a bit confused :\The count of gold pancakes taken out of the hat shouldn''t be realivent to the predicted probability.However, I''m beginning to think there''s something wrong with my random number generator. If you search the string "p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2" in the results, you''ll see it comes up every three result-sample-thinggies. Maybe I should only seed the random number generator once in the program? ;  The way a problem is structured is very determining of how it should be solved.The correct answer is of course 1/2, no matter what everyone tells you.You teacher is just trying to make herself look smarter by pulling some basic Math trick.When you get the test back can you post the *exact* phrasing of the question? That is very important. If it was as you said in your original post, then I stand by my answer.The result 2/3 falls outside of the Universe of the result:"What is the probability that the OTHER side is also brown".That sentence defines our Universe as:U = {Brown-Brown; Brown-Gold}The Gold-Gold pancake doesnt even make it into the problem, because it fails to pass the universe analisis test, a basic step in probability solving your math teacher should know about.   [Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD]    [Yann  L.][Enginuity]  [Penny Arcade]  [MSDN][VS  RoadMap][Humus][BSPs][UGP][NeHe]"I say we take off and nuke the entire site from orbit. It''s the only way to be sure." ;quote:Original post by Palidine  the trick here is that you are picking sides of a pancake, not a whole pancake.  so if you''ve picked a brown side, there are 3 respective sides that can be on the other side, one gold and 2 browns.  so there is 2/3 a chance for brown being on the other side....make sense?That doesn''t make sense to me.  If you''ve picked a pancake with a brown side up, then there are only 2 possibilities that fit (brown on both sides or brown on only the side you see).  The 3rd is impossible since it can''t be gold on both sides and have a brown side up at the same time.quote:Original post by alexmoura  Palidine''s got it - you''re probably counting whole gold pancakes that you got out of the hat.Since you already know that the pancake you have has at least one brown side, you know you are holding one of only three possible pancakes - and in that set, two will have the other side brown, one will have it golden, hence, a 2/3 probability of the other side also being brown.   If you already no one side is brown, how can two in that set have the other side brown?  That would mean there are two pancakes that are brown on both sides.I think 50% sounds right.  Given that you are holding a pancake with one side brown, what are the odds that the other side is brown too?  There are only 2 pancakes that you can hold that have brown on one side.  And of those only 1 is brown on both sides so 1/2.   Tadd- WarbleWare ;quote:Original post by Xtremehobo  However, I''m beginning to think there''s something wrong with my random number generator. If you search the string "p1s1: 2 p1s2: ->2<- p2s1: 2 p2s2: 1 p3s1: 1 p3s2: 2" in the results, you''ll see it comes up every three result-sample-thinggies. Maybe I should only seed the random number generator once in the program?   that''s correct, you should only seed the random numbers once in the program ;  If you call the pancakes bb, bg, and gg, the theory behind 50/50 odds is that bb and bg will be chosen with equal probability, so half the time the opposite side is brown, and half the time its golden... The problem with this reasoning is that half the time you choose bg, the side you see is gold so you don''t even bother checking the other side (it doesn''t count toward your result).  But EVERY time you select bb, it counts toward your results.  So bb constitutes twice as many entries in your result set as bg, so the answer is 2/3. 