# Probability of getting an equal number of ones and twos from 10 dice rolls

If a die is rolled 10 times, how do you calculate the probability that an equal number of ones and twos occur?

Let A be the number of ones, B the number of twos

I first thought it might be equal to

$\ (P(A=1) \times P(B=1)) + (P(A=2) \times P(B=2)) + ... + (P(A=10) \times P(B=10))$

but this can't work because $\ P(A=6) \times P(B=6)$ onwards is impossible.

I know I could just stop after 5 each but I don't think that's the way to do it.

The probability of getting $A=i$ ones and $B=i$ twos is a multinomial with three categories (one, two, other) $$P(A=i,B=i)=\frac{10!}{i!\ i!\ (10-2i)!}(\tfrac{1}{6})^i(\tfrac{1}{6})^i(\tfrac{4}{6})^{(10-2i)}.$$ The total chance of observing the same number of ones and twos is then $$P(A=B)=\sum_{i=0}^{5}P(A=i,B=i).$$ Computing the sum yields $P(A=B)\approx 22\%$
After this, having the fact that we have x ones and twos the probability that we have an equal amount of them is $\binom{x}{x/2}\cdot (1/2)^x$
So the total probability is $\sum_{z=0}^5P(X=2z)\cdot P(\text{$z$ones,$z$twos})$ where $P(X=2z)=\binom{10}{2z}(1/3)^{2z}(2/3)^{10-2z}$