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

 White vs red (Posted on 2012-10-17)
There are m white and n red marbles in a closed box.
Two players take turns on drawing randomly a marble, without returning it back.
The 1st player drawing a white marble wins.

Evaluate the probability that the first player wins.

Check your formula for (m,n)= (2,3) and (2,4).

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution with 2 formulae: Sigma Pi and recursive Comment 1 of 1

m/(m+n) + (n/(m+n))*((n-1)/(m+n-1))*(m/(m+n-2)) + (n/(m+n))*((n-1)/(m+n-1))*((n-2)/(m+n-2))*((n-3)/(m+n-3))*(m/(m+n-4)) + ...

or in Sigma and Pi notation (Sum and Product):

Sum{i=0 to floor[n/2]} (m/(m+n-2*i)) * Prod{j=0 to 2*i-1}(n-j)/(m+n-j)

assuming that Prod will evaluate to 1 if 2*i-1 < 0, otherwise we'd have to take the first term of the original formula separately and start i off at 1 instead of zero. The Wikipedia article on Multiplication, in the section on Capital Pi notation states that for Pi{m to n}, "If m > n, the product is the empty product, with the value 1."

An alternative formulation is recursive:

p(a,0)=1

p(m,n) = m/(m+n) + (n/(m+n))*(1 - p(m,n-1)) when n>0,

as the first player can win on the first try, or, with the reciprocal probability, after the second player is given a shot but ultimately fails to win.

Both are implemented in:

DECLARE FUNCTION p2# (m#, n#)
DECLARE FUNCTION p1# (m#, n#)
CLEAR , , 25000
DEFDBL A-Z
CLS
FOR n = 0 TO 33
PRINT n; p1(2, n), p2(2, n)
NEXT

FUNCTION p1 (m, n)
tot = 0
FOR i = 0 TO INT(n / 2)
prod = m / (m + n - 2 * i)
FOR j = 0 TO 2 * i - 1
prod = prod * (n - j) / (m + n - j)
NEXT j
tot = tot + prod
NEXT i
p1 = tot
END FUNCTION

FUNCTION p2 (m, n)
IF n = 0 THEN
p = 1
ELSE
p = m / (m + n) + (n / (m + n)) * (1 - p2(m, n - 1))
END IF
p2 = p
END FUNCTION

All with m=2:

` n    Sigma Pi                 recursive 0  1                        1 1  .6666666666666666        .6666666666666666 2  .6666666666666666        .6666666666666667 3  .6                       .6 4  .6                       .6 5  .5714285714285714        .5714285714285714 6  .5714285714285715        .5714285714285714 7  .5555555555555555        .5555555555555556 8  .5555555555555556        .5555555555555556 9  .5454545454545454        .5454545454545454 10  .5454545454545454       .5454545454545455 11  .5384615384615384       .5384615384615384 12  .5384615384615383       .5384615384615384 13  .5333333333333333       .5333333333333333 14  .5333333333333333       .5333333333333333 15  .5294117647058824       .5294117647058824 16  .5294117647058824       .5294117647058824 17  .5263157894736842       .5263157894736842 18  .5263157894736842       .5263157894736843 19  .5238095238095238       .5238095238095237 20  .5238095238095238       .5238095238095238 21  .5217391304347825       .5217391304347826 22  .5217391304347827       .5217391304347826 23  .52                     .52 24  .52                     .52 25  .5185185185185185       .5185185185185185 26  .5185185185185185       .5185185185185186 27  .5172413793103449       .5172413793103448 28  .5172413793103449       .5172413793103449 29  .5161290322580645       .5161290322580645 30  .5161290322580647       .5161290322580645 31  .515151515151515        .5151515151515151 32  .5151515151515152       .5151515151515151 33  .5142857142857142       .5142857142857143 `

As given above, p(2,3) = p(2,4) = .6

 Posted by Charlie on 2012-10-17 12:43:07
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 (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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