# Probability for a ball choosing game from infinite amount

1. Jun 3, 2013

### bear_lord

1. The problem statement, all variables and given/known data

There is a large\infinite amount of balls in a basket to pick from.

Each ball in the basket is with the same probability (33.33...%) either black, white or gray. No other colors exist.

You first pick 4 balls out of the basket.

Then you pick 2 more balls out of the basket.

Question: What is the probability that the last 2 picked balls are fully 'contained' in the 4 balls?

Notes: BOTH balls have to be of a same color of one of balls in the 4, and they both have to be unique. Thus: One black ball in the 4 counts only for one black ball in the last 2, etc...

2. Relevant equations

Simpler case: only one ball is drawn after the first four. Then the probability is:

-- P(1 ball is contained in the 4) =$1 - 2/3*2/3*2/3*2/3 = 1-(2/3)^4$ == CORRECT

The analytical solution for the full original 4+2 balls case is: $399/729$. I have written and tested a computer program to find all the solutions for this, so it should be correct.

3. The attempt at a solution

-- P(1 ball is contained in the 4) AND P(1 ball is contained in the 4) =$(1-(2/3)^4) ^2$ == WRONG

I have no idea how to continue from here or why this is wrong.

2. Jun 3, 2013

### tiny-tim

welcome to pf!

hi bear_lord! welcome to pf!
ah, but you haven't taken the "Note" into account!

3. Jun 3, 2013

### rcgldr

I'm not clear on how you handled all the possible outcomes:

For the first part where you pick 4 balls:

You pick 4 balls and they are all the same color.
You pick 4 balls and they are some combination of just two colors.
You pick 4 balls and they are some combination of all three colors.

4. Jun 3, 2013

### Ray Vickson

Why do you say that the correct answer is 399/729? The basis of this claim is not clear from what you wrote.

5. Jun 4, 2013

### haruspex

However, I get that answer too.

6. Jun 4, 2013

### tiny-tim

because bear_lord has counted them, using a computer program!

7. Jun 4, 2013

### Ray Vickson

Ahhh, yes, but how do we know his computer program is correct? And, of course, if he can do it using a computer program, why can't he do it directly without a computer program? (I do agree with the claimed answer, I was just asking the OP to clarify.)

8. Jun 4, 2013

### Ray Vickson

The reason your method is OK for one ball but not for two (or more) is that with two balls, the probability of a "match" depends on the composition of the first four. If the first four are wwww, you need 2w on the second round, and the probability of that is 1/3^2 = 1/9. If the first four are wwwb (in any order) you need either {2w} or {1w and 1b in any order} on the second round; furthermore, P(2w) = 1/9 but P(1w,1b) =/= 1/9 because you can have first 'w then b' or 'first b then w', giving P(1w,1b) = 2/9, etc.

9. Jun 4, 2013

### bear_lord

Thanks for everybody participating in my (very first) thread on physicsforums.

This question rose from a computer programming exercise. I wrote the code for the software first, and was intrigued about the analytical solution afterwards. (Also, bonus points were given for providing math.)

The reason I was able to do the computer program was because I simply manually listed every single combination and through some hardship and testing was able to figure out how to count and print only the 'winning' combinations. This number came out to be the very 399/729.

I think I can solve this now for myself but I need to go through every one of the possibilities, as Ray Vickson listed.

Last edited: Jun 4, 2013
10. Jun 4, 2013

### rcgldr

I don't think this was explained yet. Pick 6 balls, each of which can be one of 3 colors, so the total number of outcomes is:

36 = 729

Then the program tests to see how many of these 729 outcomes meets the stated requirement. Assuming the program is correct, it determined that 399 of those outcomes met the requirement.

11. Jun 4, 2013

### haruspex

I broke it into two cases, according to whether the last two balls are the same or different. E.g. if different, black and white say, we want the prob that the first four include at least one of each. We can use inclusion-exclusion here: 1 - P[no blacks] - P[no whites] + P[no blacks and no whites]