# the probability of picking certain amount of items from a sack.

I need a help on calculating the probability. Here is the task that I can "translate" it into a probability task.

Let's assume we have a sack with 12 items. There are 1 X item and 2 Y items and other staff. Every time we pick an item from the sack and throw it back into the sack. So what is the smallest n such that if we perform the experiment n times, the probability of having picked 2X and 3Y items at least once is no more than m?

-
"what is the smallest n such that if we perform the experiment n times, the probability… is no more than m?": If m<0, then there is no such n, else the smallest such n is 0. Did you mean to say the probability is at least something? –  ShreevatsaR Jun 22 '12 at 10:05
m should be >= 0. let me formulate the question this way. what is the probability that after performing the experiment let's say 100 times we will have at least one 2X +3Y combination. does it make sense now ? –  Ruzanna Jun 22 '12 at 11:11
Now the other question: by "having picked 2X and 3Y items at least once" (or by "at least one 2X+3Y combination") do you mean "picked at least 2 X and at least 3 Y", or do you mean "picked 2X and 3Y consecutively in some consecutive five pickings"? –  ShreevatsaR Jun 22 '12 at 11:16
not there is no need of consecutiveness of picking that items. let me clarify it by an example. for example there were 30 attempts and the picked items were as follows : a, x, b, y, c, d, a, x, d, y, c, a, y, b, c, a, x, b, y, c, d, a, x, d, y, c, a, y, b, c that means, there were 2 combinations of 2X + 3Y –  Ruzanna Jun 22 '12 at 11:29
If you pick x,x,x,x,y,y,x,x,x,y,a,b,c that also counts as "at least one 2X+3Y", right? (What you want is actually "at least two X and at least three Y", right?) –  ShreevatsaR Jun 22 '12 at 12:23

Ok then. Your sack of $12$ items has $1$ item of type 'X', $2$ items of type 'Y', and $9$ other items. Suppose you draw an item from the sack $n$ times.

To not have at least $2$ X and at least $3$ Y, you must have picked either:

• $0$ X and any number of $Y$ (ways: $11^n$),
• $1$ X and any number of $Y$ (ways: ${n \choose 1}11^{n-1}$),
• $0$ Y and any number of $X$ (the case of $0$ or $1$ X is already counted, so ways: $10^n - 9^n - {n \choose 1}9^{n-1}$),
• $1$ Y and any number of $X$ (the case of $0$ or $1$ X is already counted, so ways: ${n \choose 1}10^{n-1} - {n \choose 1}9^{n-1} - {n \vphantom{-1} \choose 1}{n-1 \choose 1}9^{n-2}$), or
• $2$ Y and any number of $X$ (the case of $0$ or $1$ X is already counted, so ways: ${n \choose 2}2^210^{n-2} - {n \choose 2}2^29^{n-2} - {n\vphantom{-2}\choose 2}{n-2\choose 1}2^29^{n-3}$).

So putting all these together, the probability of getting at least two X and at least three Y is:

$$1 - (11^n + n11^{n-1} + (10^n - 9^n -n9^{n-1}) + (n10^{n-1} - n9^{n-1} -n(n-1)9^{n-2}) + (\frac{n(n-1)}{2}2^210^{n-2} - \frac{n(n-1)}{2}2^n9^{n-2} - \frac{n(n-1)(n-2)}{2}2^29^{n-3}))/{12^n}$$

To understand the behaviour of this number for large $n$ (of course it gets very close to $1$, since the probability of picking so few X or so few Y is close to $0$), you may want to collect exponential terms with the same base together:

$$\frac{12^n - 11^n(1 + \frac{n}{11}) - 10^n(1 + \frac{n}{10} + \frac{n(n-1)}{50}) + 9^n(1 + \frac{2n}{9} + \frac{3n(n-1)}{81} + \frac{2n(n-1)(n-2)}{729})}{12^n}$$

In particular, for $n = 100$, the probability that you will have at least two X and at least three Y is about $0.998318$.

-