I'm trying to figure out a handy formula for calculating the probability of getting a set of w amount of the same face up number, which is equal to or larger than h, on n amount of x-sided dice. So, with "x=4, n=10, w=3, h=2", I would be looking for the probability of rolling a 4-sided die ten times and getting three twos, threes or fours.

I'm three years out of secondary school and haven't done any math more complicated than simple trigonometry since then, so I'm a bit out of my element here. I tried reading through my old math textbooks, but could not find an answer to the problem so I figured I'd post this here in the advanced section. I apologize if it's too simple for this section.

Now, as far as I remember, finding the probability of getting w amount of any one face value is relatively simple using binomial probability:

w = amount of same value ("width" of the set)
n = amount of dice (dice pool)
x = the amount of sides on the dice
p = probability of getting a certain value = 1/x
q = the complement of p

$\displaystyle P=\left(\begin{array}{cc}n\\w\end{array}\right)p^w (q)^{(n-w)}$

Now that's all well and good, but that only gives the probability of getting, for example, w amount of ones. Expanding this to cover all the different face values seems rather complicated, though. As far as I can see, it would be quite simple if I was flipping a coin.

P(heads) = P(A)
P(tails) = P(B)

$\displaystyle A=B=\left(\begin{array}{cc}n\\w\end{array}\right)p ^w(q)^{(n-w)}$

$\displaystyle P(A{\cup}B)=P(A)+P(B)-P(A{\cap}B)$

But I'm quite stumped on how this works when there are more than two possible outcomes? Using a four sided die, for example:

P(w times 1) = A
P(w times 2) = B
P(w times 3) = C
P(w times 4) = D

$\displaystyle =\left(\begin{array}{cc}n\\w\end{array}\right)p^w( q)^{(n-w)}$

$\displaystyle P(A{\cup}B{\cup}C{\cup}D)=?$