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

Home > Probability
Urn, urn, urn (Posted on 2007-02-20) Difficulty: 3 of 5
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.)
Solution 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   end
10010
10020    *Permute(&A$)
10025   local X$,I,L$,J
10030     X$=""
10040     for I=len(A$) to 1 step -1
10050      L$=X$
10060      X$=mid(A$,I,1)
10070      if X$<L$ then cancel for:goto 10100
10080     next
10090
10100     if I=0 then
10110     :for J=1 to len(A$)\2
10120     :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     :next
10160     :else
10170     :for J=len(A$) to I+1 step -1
10180     :if mid(A$,J,1)>X$ then cancel for:goto 10200:endif
10190     :next
10200     :mid(A$,I,1)=mid(A$,J,1)
10210     :mid(A$,J,1)=X$
10220     :for J=1 to (len(A$)-I)\2
10230     :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     :next
10270     :endif
10280    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   tot
extra 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//3
1||1|||11            2  1  2  1  1  3    10  2//3  2//3  1//3
1|||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//3
1|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//3
111|1|1|||11         4  2  2  1  1  3    13  2//3  2//3  1//3
111|1||11||1         4  2  1  3  1  2    13  2//3  1//3  1//3
1||111|1||11         2  1  4  2  1  3    13  2//3  2//3  1//3
1||1|1111||1         2  1  2  5  1  2    13  2//3  1//3  1//3
1||1||1|1111         2  1  2  1  2  5    13  2//3  2//3  1//3
1|||11|1|111         2  1  1  3  2  4    13  2//3  1//3  1//3
1|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//3
11|11111||1||1       3  6  1  2  1  2    15  1//3  1//3  1//3
1|111|1|111||1       2  4  2  4  1  2    15  1//3  1//3  1//3
1|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//3
11111|11|1|||11      6  3  2  1  1  3    16  2//3  2//3  1//3
11111|11||11||1      6  3  1  3  1  2    16  2//3  1//3  1//3
111|1|111|1||11      4  2  4  2  1  3    16  2//3  2//3  1//3
111|1|1|1111||1      4  2  2  5  1  2    16  2//3  1//3  1//3
111|1|1||1|1111      4  2  2  1  2  5    16  2//3  2//3  1//3
111|1||11|1|111      4  2  1  3  2  4    16  2//3  1//3  1//3
1||11111|11||11      2  1  6  3  1  3    16  2//3  2//3  1//3
1||111|1|1|1111      2  1  4  2  2  5    16  2//3  2//3  1//3
1||11|111111||1      2  1  3  7  1  2    16  2//3  1//3  1//3
1||1|1111|1|111      2  1  2  5  2  4    16  2//3  1//3  1//3
1||1||11|111111      2  1  2  1  3  7    16  2//3  2//3  1//3
1|||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 p3
111111|1111111111111|11|||11 7  14  3  1  1  3   29  1//3  2//3  1//3
11111|11111111111|11||1|1111 6  12  3  1  2  5   29  1//3  2//3  1//3
1111|111111111|11||11|111111 5  10  3  1  3  7   29  1//3  2//3  1//3
111|1111111|11||111|11111111 4  8  3  1  4  9    29  1//3  2//3  1//3
11|11111|11||1111|1111111111 3  6  3  1  5  11   29  1//3  2//3  1//3
1|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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (9)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information