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

Home > Probability
Pick two (Posted on 2023-06-08) Difficulty: 2 of 5
Two marbles are to be picked from an urn with B>0 blue and R>0 red marbles without replacement.

The probability both picked marbles are the same color is exactly 1/2. What is can be said about B and R?

Suppose, in addition to the blue and red marbles there is also a single green marble.

The probability both picked marbles are the same color is exactly 1/2. What is can be said about B and R?

No Solution Yet Submitted by Jer    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Analytic and computer solutions | Comment 1 of 2
Just in case the title is a "Three Stooges" reference:  Hey Moe!

b(b-1)/(b+r)(b+r-1) = 1/2
2*(b(b-1) + r(r-1)) = (b+r)(b+r-1)
2b^2 - 2b + 2r^2 - 2r = b^2 + r^2 + 2br - b - r
b^2 + r^2 - (b+r) = 2br

b^2 - (2r+1)b + r^2 - r = 0
b = ( (2r+1) ± sqrt( 4r^2 + 4r  + 1  - 4r^2 + 4r))/2
b = ( (2r+1) ± sqrt( 8r  + 1))/2

Solution to Part 1:  R and B are adjacent triangular numbers
-----------
part 2
2*(b(b-1) + r(r-1)) = (b+r+1)(b+r)
2b^2 - 2b + 2r^2 - 2r = b^2 + r^2 + 2br + b + r
b^2 + r^2 - 3(b+r) = 2br
b^2 - (2r+3)b + r^2 - 3r = 0
b = ( (2r+3) ± sqrt( 4r^2 + 12r  + 9  - 4r^2 + 12r))/2
b = ( (2r+3) ± sqrt( 24r + 9))/2

part one
0 1 0
1 3 0.5
3 6 0.5
6 10 0.5
10 15 0.5
15 21 0.5
21 28 0.5
28 36 0.5
36 45 0.5
45 55 0.5
55 66 0.5
66 78 0.5
78 91 0.5
91 105 0.5
105 120 0.5
120 136 0.5
136 153 0.5
153 171 0.5
171 190 0.5
190 210 0.5

 part two
0 3 0.5
3 9 0.5
9 18 0.5
18 30 0.5
30 45 0.5
45 63 0.5
63 84 0.5
84 108 0.5
108 135 0.5
135 165 0.5
165 198 0.5
198 234 0.5

Solution to Part 2:  R and B are adjacent members of the sequence
3n(n+1)/2

"""

def b(r):
    ans = ( (2*r+1) + ( 8*r  + 1)**.5 )/2
    if ans%1 == 0:
        ans = int(ans)
    return ans

def g(r):
    ans = ( (2*r+3) + ( 24*r  + 9)**.5 )/2
    if ans%1 == 0:
        ans = int(ans)
    return ans

def prob(r,b,g):
    """ if there are r,g,b marbles, what are the odds of picking 
    2 s.t. both are the same color   """
    marbles = 'R'*r + 'B'*b + 'G'*g
    from itertools import combinations
    same = 0
    diff = 0
    for comb in combinations(marbles,2):
        if comb[0] == comb[1]:
            same += 1
        else:
            diff += 1
    try:
        ratio = same/(same+diff)
    except ZeroDivisionError:
        return 0
            
    return  ratio

print('part one')
for r in range(200):
    if b(r)%1 == 0:
        print(r, b(r), prob(r,int(b(r)),0))
print('\n','part two')
for r in range(200):
    if g(r)%1 == 0:
        print(r, g(r), prob(r,int(g(r)),1))

  Posted by Larry on 2023-06-08 08:19:14
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 (7)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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