Re: Insoluble marbles-in-urn problem?
- To: mathgroup at smc.vnet.net
- Subject: [mg119988] Re: Insoluble marbles-in-urn problem?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Mon, 4 Jul 2011 06:44:24 -0400 (EDT)
On 7/3/11 at 4:11 AM, johnfeth at gmail.com (John Feth) wrote: >There is a huge urn full of marbles, each marked with a single >digit: 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. The marked marble >quantities are uniformly distributed between all of the digits and >the marbles are thoroughly mixed. You look away, choose 10 marbles, >and put them in a black velvet bag. >When you have some time, you look away, open the bag, and remove one >marble. You close the bag, look at the digit on the marble, open a >beer perhaps, and calculate the probability that there is at least >one more marble in the bag with the same digit. >The answer is brute forced below is there a formal way to obtain the >answer? Yes. I will assume in your urn the number of marbles marked with each digit is exactly the same. Assume there are n sets of marbles marked with the digits 0 through 9 in the urn. Draw out 1 marble. Then you problem becomes 1 minus the probability of not drawing another marble marked the same in 9 additional draws. In the second draw, there are 10 n -1 marbles in the urn and 9 n marbles marked differently than the first. Hence the probability of getting a differently marked marble is 9n/(10n-1). On the third draw there are 10n-2 marbles in the urn and 9n-1 marbles different than the first marble drawn assuming the second marble is different than the first. So, the probability of the not matching the first marble in two additional draws is 9n/(10n -1) (9n-2)/(10n-2). Continuing in this manner it is clear the probability of not drawing another marble like the first in 9 additional draws is Product[(9 n - k)/(10 n - 1 - k),{k,0,8}] Hence the probability of at getting at least one more marble like the first in 9 additional draws is 1 - Product[(9 n - k)/(10 n - 1 - k),{k,0,8}] Note, to create a simulation of this problem you do not want to simulate your urn of marbles with RandomInteger[{0,9},10 n}] since this will not ensure there are exactly the same number of marbles marked with each digit. Nor do you need your simulated urn to have a random order. It is sufficient to make a random choice regardless of whether the array representing the urn is ordered or not. So, for 5 sets In[13]:= pDiff = Product[(9 n - k)/(10 n - k - 1), {k, 0, 8}]; In[14]:= N[pDiff /. n -> 5] Out[14]= 0.431337 That is there is a 57% chance of getting at least one marble like the first in the next 9. Simulate an urn with 50 marbles by: In[15]:= urn = Flatten@Table[Range[0, 9], {5}]; Repeat the simulation 1000 times In[16]:= Total@ Table[Boole[ MemberQ[Rest@#, First@#] &[RandomSample[urn, 10]]], {1000}] Out[16]= 581 That works out to 58.1% which is reasonably close to the expected value of 57%. Note if I make urn In[18]:= urn = RandomInteger[{0, 9}, 50]; In[19]:= Tally[urn] Out[19]= {{9, 5}, {6, 6}, {1, 5}, {2, 7}, {8, 6}, {0, 5}, {3, 5}, {5, 4}, {4, 4}, {7, 3}} There is not exactly 5 of each digit. So, the simulated probability will vary according to how the first marble drawn is marked.
- Follow-Ups:
- Re: Insoluble marbles-in-urn problem?
- From: DrMajorBob <btreat1@austin.rr.com>
- Re: Insoluble marbles-in-urn problem?