# Same Colour Balls From a Bag

1. Dec 18, 2011

### Abanishki

A bag contains a total of 50 balls (10 red, 10 blue, 10 green, 10 black, 10 white). If I draw x balls from the bag, what is the probability that the largest number of balls that are the same color is y?

For example, if I draw 7 balls, and I get 4 Blue, 2 Green, 1 Red, y=4

It'd be nice if you could derive the formula.

Last edited: Dec 18, 2011
2. Dec 18, 2011

### Fredrik

Staff Emeritus
Welcome to Physics Forums.

The forum policy on textbook-style questions is to only give hints, not complete solutions. If you show your own attempt, we can tell you if we see something wrong. If you have some of it figured out but is stuck on a detail, you should always post your work up to the point where you're stuck, and point out the detail that's causing you trouble.

I don't have time to help you myself. I'm going to bed now and won't be here tomorrow. I will ask the moderators to move this to the homework section, where it's likely to be read by more people. (The homework forum is always the right place for a textbook-style question at the undergraduate level, even if it's not homework).

3. Dec 18, 2011

### Abanishki

well i figured it needs hypergeometric distribution :S

not too sure how to deal with the fact that the same colored balls can be any of the 5 colors...

4. Dec 18, 2011

### Simon Bridge

Welcome to PF.
I figure you've been studying permutations and combinations? Binomial and hypergeometric distributions?

When you start out with these things, it is often helpful to have a play with the situation by trying out come numbers. eg.

Imagine instead of all the balls in one bag, you have five bags, each with one color only, and you take a ball from a random bag - x times. Number the bags. y(i) could be the number of times you've dipped into the ith bag - and the largest y(i) will be y. The possible solutions will be s=(y(1), y(2), ... y(5)).

The probability of a particular y will depend on the number of ways y can be produced by a combination of y(i).

We need to deal with what happens when x > 10, since there is a possibility of running out of balls in one bag. When this happens - we just select from another bag.
This should be equivalent to your problem - y(1) is the number of reds and so on.

For x > 45, p(y=10)=1.

For x=45 you have
(9,9,9,9,9): y=9 - one possibility.
(10,8,9,9,9): y=10 - there's four of these with the 8 in different positions, times 5 for the 10 in different positions, which would be 5x4=20 ways.
Total possible combinations is, therefore, 21
p(y=9)=1/21 and p(y=10)=20/21

At the other end of the scale.

If x=3, then y can be 1 or 2 or 3.
for y=1, you need the number of ways you select 3 out of 5 bags without duplication.
That would be 5x4x3=60 ways.
Caution: Have I overcounted?
Does it matter which order I select the bags in?

for y = 2, this means we dipped into one bag twice and one of the other bags once.
so there are 5 bags to dip twice and 4 to dip once for 5x4=20 ways. (caution: not if I overcounted!).

and there are 5 ways to get three from one bag. (well that checks out)

total # possibilities are 5+20+60=85.
P(y=1)=60/85, p(y=2)=20/85, p(y=3)=5/85
(you'll have to revise this for the overcounting - if any)

See how you can get a feel for the distribution.

What if you think of getting a black ball is a "win", and you want to know the probability of getting y wins from x samples - without replacement?

What kind of distribution would this be?

But that is not good enough - you want the situation where you get y black balls, and Y≤y balls of each of the other colors.

How do you express this in terms of probability?

What happens to that probability when you don't care which color is the "winning" color?

Last edited: Dec 18, 2011
5. Dec 18, 2011

### Abanishki

P(Y=y)=(((9)C(y-1)×(40)C(x-y))/(49)C(x-1))

Does this formula not suffice? I used hypergeometric d, but ignored the first draw. The maximum number of balls that are of the same color is 10 :/

6. Dec 18, 2011

### Simon Bridge

That gives you the probability that one color is drawn y times out of x draws... from 59 balls, of which only 9 of them are that color.

Does that describe the situation?

Say x was 30
The first ball drawn was red.

put y = 3

So you want 2 red balls to win?

The formula you got counts the situation when there are 27 balls of another color - because there are still two red ones.

7. Dec 18, 2011

### Simon Bridge

if Yi=y is the event that there are y balls of color i, then:

P(Yi=y) ~ H(N,m,n,k)

where:
N = # marbles = 50
m = # of color i = 10
N-m = # not color i = 40
n = # trials = x
k = # wins = y

This is the same for each color.

So the probability that red will come up with 5 and blue will come up with 6 will be P(Y1=5)P(Y2=6) right?

The probability that red will be anything other than 5 will be 1-P(Y1=5) and the probability that red will come up at least 5 times in 7 trials is: P(Y1=5)+P(Y1=6)+P(Y1=7)=P(Y1>4).

You want the situation where you get y black balls, and Y≤y balls of each of the other colors.

8. Dec 18, 2011

### Abanishki

so, you are saying that my initial formula only calculates the probability that balls of the same color as the first ball picked can win?

9. Dec 18, 2011

### Simon Bridge

No - I'm saying that ignoring the first draw has confused things. Why did you do that?

Your formula has 9 winning balls and 40 non-winning balls.
It works out the probability of getting y winning balls without taking account of the number of non-winning balls drawn.

(your text book will use the word "success" but "win" is quicker to type.)

Your problem needs you to only count the y wins if none of the other colors get more than y.

10. Dec 18, 2011

### VirtuallyReal

I too am having a similar dilemma, and cannot determine how to manipulate the hypergeometric formula to accommodate the fact that the number of balls of the other colours must be less than y.

Also, in the situation, there are 50 balls, 10 of each colour, with a maximum of 5 balls allowed to be chosen.

Can you please demonstrate how the hypergeometric formula must be manipulated, I have been attempting this for several hours now.

Last edited: Dec 18, 2011
11. Dec 18, 2011

### Simon Bridge

Hello VirtuallyReal - welcome to PF.

If you only have to pick 5 balls, then it is easy.
Look at post #4 and just count them.

eg. if y=5, then that means you picked 5 ofone color and none of the others - there are only 5 ways to do that.

if y = 4, then you have a combination of 2 things from 5
...
if y = 1, then you picked 1 from each color, there's only one way to do that.

Add up all the different ways.
The probability of y is the number of ways to get y divided by the total number of ways.
No manipulation of hard formulas to do.

12. Dec 18, 2011

### Abanishki

ohh, I believe I get it now :D
thanks a lot Simon, VirtuallyReal!!

13. Dec 18, 2011

### Simon Bridge

Cool! Go carefully and show me your reasoning.
If VirtuallyReal still has a problem, you can test your understanding by helping him :)