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? 

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$.
