All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Urn, urn, urn (Posted on 2007-02-20)
Before you are three urns. The first two each contain 4 white and 6 black balls. The third has 3 white and 6 black.

Take one ball from the first urn and add it to the second with out looking at it. Stir it in, then take one ball from the second and add it to the third without looking at it.

If you pick a ball from the third urn, what is the probability it will be white?

What is the least number of balls you can put in the urns (at least one black and one white in each) to make the probability at the end equal to exactly 1/3?

 No Solution Yet Submitted by Jer Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 part 2: brute force | Comment 4 of 5 |

The following program computes the probability for part 1, 17/50 = 34%, and goes through all ways of distributing up to 10 extra balls beyond the 6 required (1 of each color in each of 3 urns). It does so by setting up 5 partitions between the 6 color/urn categories with digit 1 representing each extra ball before/between/after the respective partitions.

` 2000   W1=4:T1=10:W2=4:T2=10:W3=3:T3=9 2010   P1=W1//T1 2020   P2=(P1*(1+W2)+(1-P1)*W2)//(1+T2) 2030   P3=(P2*(1+W3)+(1-P2)*W3)//(1+T3) 2040   print P3,P3/1 2050   for Extra=1 to 10 2060     Lst="|||||" 2070     for I=1 to Extra:Lst=Lst+"1":next 2080     LstH=Lst 2085     repeat 2090      Luse=Lst 2092      dim Numb(6) 2093      Upto=1 2100      repeat 2110      C=left(Luse,1):Luse=mid(Luse,2,*) 2120       if C="1" then Numb(Upto)+=1 2130       if C="|" then Upto+=1 2140      until Luse="" 2150      W1=Numb(1)+1:T1=2+Numb(1)+Numb(2) 2160      W2=Numb(3)+1:T2=2+Numb(3)+Numb(4) 2170      W3=Numb(5)+1:T3=2+Numb(5)+Numb(6) 2180      erase Numb() 2190      P1=W1//T1 2200      P2=(P1*(1+W2)+(1-P1)*W2)//(1+T2) 2210      P3=(P2*(1+W3)+(1-P2)*W3)//(1+T3) 2220    ' if P3=1//3 then print Lst,P3;tab(50);P3/1 2225       if P3=1//3 then print Lst;tab(20);W1;T1-W1;W2;T2-W2;W3;T3-W3,Extra+6;tab(40); 2226       if P3=1//3 then print P1;P2;P3 2230      gosub *Permute(&Lst) 2240     until Lst=LstH 2250   next 9999   end1001010020    *Permute(&A\$)10025   local X\$,I,L\$,J10030     X\$=""10040     for I=len(A\$) to 1 step -110050      L\$=X\$10060      X\$=mid(A\$,I,1)10070      if X\$<L\$ then cancel for:goto 1010010080     next1009010100     if I=0 then10110     :for J=1 to len(A\$)\210120     :X\$=mid(A\$,J,1)10130     :mid(A\$,J,1)=mid(A\$,len(A\$)-J+1,1)10140     :mid(A\$,len(A\$)-J+1,1)=X\$10150     :next10160     :else10170     :for J=len(A\$) to I+1 step -110180     :if mid(A\$,J,1)>X\$ then cancel for:goto 10200:endif10190     :next10200     :mid(A\$,I,1)=mid(A\$,J,1)10210     :mid(A\$,J,1)=X\$10220     :for J=1 to (len(A\$)-I)\210230     :X\$=mid(A\$,I+J,1)10240     :mid(A\$,I+J,1)=mid(A\$,len(A\$)-J+1,1)10250     :mid(A\$,len(A\$)-J+1,1)=X\$10260     :next10270     :endif10280    return`

The answer for the second part is 9 balls: 1 white and 2 black in each urn, as shown in the first line of this table:

`distr of             urn1  urn2  urn3   totextra balls          w  b  w  b  w  b   balls p1     p2   p3|1||1||1             1  2  1  2  1  2    9   1//3  1//3  1//31||1|||11            2  1  2  1  1  3    10  2//3  2//3  1//31|||11||1            2  1  1  3  1  2    10  2//3  1//3  1//3|1|11|||11           1  2  3  1  1  3    11  1//3  2//3  1//31|111||1||1          2  4  1  2  1  2    12  1//3  1//3  1//3|1|1|111||1          1  2  2  4  1  2    12  1//3  1//3  1//3|1||1|1|111          1  2  1  2  2  4    12  1//3  1//3  1//3111|1|1|||11         4  2  2  1  1  3    13  2//3  2//3  1//3111|1||11||1         4  2  1  3  1  2    13  2//3  1//3  1//31||111|1||11         2  1  4  2  1  3    13  2//3  2//3  1//31||1|1111||1         2  1  2  5  1  2    13  2//3  1//3  1//31||1||1|1111         2  1  2  1  2  5    13  2//3  2//3  1//31|||11|1|111         2  1  1  3  2  4    13  2//3  1//3  1//31|111|11|||11        2  4  3  1  1  3    14  1//3  2//3  1//3|1|1111|1||11        1  2  5  2  1  3    14  1//3  2//3  1//3|1|11||1|1111        1  2  3  1  2  5    14  1//3  2//3  1//311|11111||1||1       3  6  1  2  1  2    15  1//3  1//3  1//31|111|1|111||1       2  4  2  4  1  2    15  1//3  1//3  1//31|111||1|1|111       2  4  1  2  2  4    15  1//3  1//3  1//3|1|11|11111||1       1  2  3  6  1  2    15  1//3  1//3  1//3|1|1|111|1|111       1  2  2  4  2  4    15  1//3  1//3  1//3|1||1|11|11111       1  2  1  2  3  6    15  1//3  1//3  1//311111|11|1|||11      6  3  2  1  1  3    16  2//3  2//3  1//311111|11||11||1      6  3  1  3  1  2    16  2//3  1//3  1//3111|1|111|1||11      4  2  4  2  1  3    16  2//3  2//3  1//3111|1|1|1111||1      4  2  2  5  1  2    16  2//3  1//3  1//3111|1|1||1|1111      4  2  2  1  2  5    16  2//3  2//3  1//3111|1||11|1|111      4  2  1  3  2  4    16  2//3  1//3  1//31||11111|11||11      2  1  6  3  1  3    16  2//3  2//3  1//31||111|1|1|1111      2  1  4  2  2  5    16  2//3  2//3  1//31||11|111111||1      2  1  3  7  1  2    16  2//3  1//3  1//31||1|1111|1|111      2  1  2  5  2  4    16  2//3  1//3  1//31||1||11|111111      2  1  2  1  3  7    16  2//3  2//3  1//31|||11|11|11111      2  1  1  3  3  6    16  2//3  1//3  1//3`

Where p1 is the probability of choosing a white ball from urn 1 to place in urn 2; p2 is the probability of choosing a white ball from urn 2 to place in urn 3; p3 is the probability of choosing a white ball from urn 3.  Note that UBASIC places two slashes in its representation of rational numbers.

For curiosity, if you want to use the same 11 white and 18 black balls you started out with, any of these will work to produce a final probablity of 1/3:

`                             urn1 urn2   urn3                             w  b  w  b  w   b        p1    p2    p3111111|1111111111111|11|||11 7  14  3  1  1  3   29  1//3  2//3  1//311111|11111111111|11||1|1111 6  12  3  1  2  5   29  1//3  2//3  1//31111|111111111|11||11|111111 5  10  3  1  3  7   29  1//3  2//3  1//3111|1111111|11||111|11111111 4  8  3  1  4  9    29  1//3  2//3  1//311|11111|11||1111|1111111111 3  6  3  1  5  11   29  1//3  2//3  1//31|111|11||11111|111111111111 2  4  3  1  6  13   29  1//3  2//3  1//3|1|11||111111|11111111111111 1  2  3  1  7  15   29  1//3  2//3  1//3`

 Posted by Charlie on 2007-02-20 17:03:26

 Search: Search body:
Forums (0)