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

Home > Probability
All the colors in (Posted on 2010-04-26) Difficulty: 3 of 5
Seven sportsmen (named A,B,C,D,E,F and G) buy 7 hats choosing randomly out of 4 available colors (say G,R,W and Y).
What is the probability that all the colors were chosen?

See The Solution Submitted by Ady TZIDON    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution | Comment 3 of 22 |

Using "&" to represent "and", and "|" to represent "or":

The inclusion/exclusion principle gives us:

p(g & r & w & y) = p(g)+p(r)+p(w)+p(y)
                  - p(g|r) - p(g|w) - p(g|y)
                  - p(r|w) - p(r|y) - p(w|y)
                  + p(g|r|w) + p(g|r|y) + p(g|w|y) + p(r|w|y)
                  - p(g|r|w|y)


                 
Now p(g), or any of the single color probabilities (that is the probability that a given color shows up among the sportsmen, not necessarily exclusively), is 1 - (3/4)^7.

The probability that a given pair of colors will have at least one representation among the sportsmen, such as p(g|r), is 1 - (1/2)^7.

And the probability of one of the triples is 1 - (1/4)^7.

And of course p(g|r|w|y) = 1, as one of these colors must be represented at least once among the sportsmen.

So the probability that all four colors will be represented is:

4 * (1 - (3/4)^7) - 6 * (1 - (1/2)^7) + 4 * (1 - (1/4)^7) - 1

which is equal to 525/1024, or about 0.5126953125.

Simulation verification:

FOR tr = 1 TO 1000000
 REDIM used(3)
 FOR spm = 1 TO 7
   choice = INT(RND(1) * 4)
   used(choice) = 1
 NEXT
 good = 1
 FOR i = 0 TO 3
   IF used(i) = 0 THEN good = 0
 NEXT
 IF good THEN hits = hits + 1
 PRINT tr, hits / tr, 1024 * hits / tr
NEXT

finds as its last line:

1000000       .512473       524.7723

meaning that after a million trials, the fraction of successes is .512473, or, relative to a denominator of 1024: 524.7723/1024.


  Posted by Charlie on 2010-04-26 13:50:11
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
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