# A simple probability problem

1. Nov 8, 2005

### Jibobo

Or what seems like it. I can't seem to figure how to apply the premutation or combination formulas to the following problem and it's driving me mad:

"There are four types of objects: A, B, C, D. Enough are mixed together in a bag so that the probability of picking any one of them out of the bag is always 1/4. If 9 total object are taken out, what's the probability of picking 4 A's, 2 B's, 2 C's and 1 D, in ANY ORDER?"

There isn't a clear-cut "success" or "failure" so I'm not sure what formula to write.

2. Nov 8, 2005

### HallsofIvy

Staff Emeritus
I'm going to assume that "Enough are mixed together in a bag so that the probability of picking any one of them out of the bag is always 1/4" means that we can treat this as "sampling with replacement"- that is, taking an object of type A out does not (noticeably) affect the number of A objects in the bag.

What is the probability of getting AAAABBCCD in THAT order?
Do you see that you are alway multiplying (1/4)s together? Do you see that if I asked "what is the probability of getting "CCDBBAAAA" you would do exactly the same arithmetic and get the same answer? Do you see that that is true for any specific order?

Finally, how many different orders are there? How many different ways can you order the letters AAAABBCCD?

3. Nov 8, 2005

### ceptimus

The question doesn't quite make sense to me. If there were only one of each type of object in the bag, then the chance of picking out any one of them would be 1/4.

But the word 'always' implies that even if (say) a type-A object has already been taken out of the bag (and not put back in), then there is still a 1/4 chance of choosing a second type-A object. The only way this could happen is for there to be an infinite number of each object in the bag (and the same infinite number for each type).

To gloss over this ambiguity, assume that there is only one object of each type, but that it replaced back into the bag after each trial.

Now if you calculate the probablitity of only picking exactly one D, two Cs and two Bs in the nine trials you have your answer (if you pick those then you have to pick As on the remaining four trials, so you don't have to calculate that).

edit to add: Oops! I crossposted with HallsofIvy, who gave a more complete answer.

4. Nov 8, 2005

### Jibobo

My main inability is in figuring out how to represent those many different orders as some sort of easy to calculate formula because the brute force method of just rearranging and counting would take forever.
I tried the brute force method to see if I could find something but nothing came to me.
If I start with AAAABBCCD and just move D around, there are 8 different combinations, and then the 1st C, there are another 6, 2nd C - 6, 1st B - 4, 2nd B - 4.
But then I have to assume what happens if I moved around 2 at once, and the numbers become way to large. If I assume my first move is AAAABBCDC, then the number of ways I can move the 1st C is 6, 2nd C - 6, 1st B - 5, 2nd B - 5.
I'm sure there's a pattern here...but I might be counting wrong as well.

5. Nov 8, 2005

### hypermorphism

Do you know permutation counting (factorials) and/or combination counting (binomial coefficients) ?

6. Nov 8, 2005

### ceptimus

You can put the D in 9 places, the first C in 8 and the second C in 7.

9 x 8 x 7 = 504

But as you're not concerned which C is which then you'll get two equivalent arrangements every time (with the two Cs swapped) so you have to halve that.

504 / 2 = 252

Then you can put the first B in 6 places and the second in 5 places, and again you have to divide by 2 to stop double counting:

252 x 6 x 5 / 2 = 3780

You don't have to worry about the As - once you've counted all the possible arrangements for the Bs, Cs and Ds - the As just fill in the blank spaces and there is only one way of doing that for each arrangement.

Last edited: Nov 8, 2005
7. Nov 8, 2005

### HallsofIvy

Staff Emeritus
There are a total of 9 letters: 4 A's, 2 B's, 2 C's, and 1 D.
Imagine first that you labeled them A1, A2, etc. so that all 9 were "distinguishable". Then there would be 9! ways of arranging them.
But some of those are identical except for the labels. That is, one might be
A1A3B1C1B2DA4CA2 while another might be A3A1B1C1B2DA4CA2- identical except that the first two A's have been switched. How many ways are there of just switching the A's around? 4! of course. Since we don't want to count those as different, we need to divide by 4!. Similarly, there are 2! ways to swap the B's and 2! ways to swap the C's. Since we don't want to count those as different, there are $\frac{9!}{4!2!2!}$ ways of ordering AAAABBCCD.
Since the probability of any one ordering is (1/4)9, the probability of getting 4 A's, 2 B's, 2 C's, and 1 D is
$$\frac{9!}{4!2!2! 4^9}$$.

8. Nov 8, 2005

### ceptimus

Another way of getting the same answer is to ask the probability of choosing an exact sequence, in order. As there are 9 choices each with a 1 in 4 probability this is 1/4 x 1/4 x 1/4 (nine times) = 1 / 4^9 = 1 / 262144

and we already worked out that there are 3780 ways of arranging one D, 2 Cs, 2 Bs and 4 As so the answer is

$$\frac{3780}{262144} = \frac{945}{65536} = \frac{3^3 \times 5 \times 7}{2^{16}}$$

Last edited: Nov 8, 2005
9. Nov 8, 2005

### Jibobo

Wow, thanks. I must've been approaching the problem totally wrong. I kept trying to figure out how to use N!/(r!*(N-r)!) but I should've been thinking about 4 outputs (A, B, C, D), not just two (Success, Failure) to get:
N!/[(N-b-c-d)! * (N-a-c-d)! * (N-a-b-d)! * (N-a-b-c)!] =
9!/[(9-2-2-1)! * (9-4-2-1)! * (9-4-2-1)! * (9-4-2-2)!] =
9!/(4! 2! 2!)

Thanks a lot. I just couldn't see it.

Also, I didn't really understand how to think of the denominator in N!/(r!(N-r)!) until you explained it.

Last edited: Nov 8, 2005