# Generalize from Binomial to Multinomial

Trying to find a generic formula for the probability of N players out of P players picking the same value from a dice with D sides.

i.e. If we have 3 players with 3 sided dice, you have 3/27 probability of them getting the same number (1, 1, 1), (2, 2, 2), (3, 3, 3). You also have 18/27 probability of 2 of them getting the same number.

I was able to generalize for a 2 sided-dice (coin-flip).

Variables Summary:

1. Dice faces: D
2. Players: P
3. Needed number of players with same side: N

$$(D)*({P\choose N}/(D)^{P})$$

When I tried to apply the above formula for more than 2 sides, it didn't give the correct value.

If I have 5 people who roll (1, 1, 2, 3, 3), this is considered as 1 sample with 2 matches.

Any pointers?

Edit: Fixed wrong variable

$$Pr(N) = {P\choose N}q^N (1-q)^{(P-N)}$$
For your case, $$q=1/D$$, yielding
$${P\choose N}(\frac{1}{D})^N (1-\frac{1}{D})^{(P-N)}$$
$$D{P\choose N}(\frac{1}{D})^N (1-\frac{1}{D})^{(P-N)}$$