The total number of combinations such that a $6$-digit pin contains exactly $4$ distinct digits

combinatoricspermutations

Including $0$ as the leading digit e.g. $011232$

The solution is $$C(10, 4) \cdot \left[C(4, 2) \cdot \frac{6!}{(2!)^2} + C(4, 1) \cdot \frac{6!}{3!}\right]$$ I understand what it represents; taking into account the outcome where $1$ digit repeats thrice and the outcome where $2$ digits repeat twice.

However, I don't understand how it represents these outcomes where $2$ digits are repeated twice. Why do we multiply $C(4, 2)$ by $6!/(2!)^2$?

E.g. the outcome were $1$ digit is repeated thrice makes sense to me; if the digits are thought of _ _ _ _ _ _ then $6!/3!$ just represents the number of ways I can fill the non-repeating digits in the placeholders. Nothing else matters here since the other placeholders are filled by the same number so you can't form more permutations.

I'm looking for a similar explanation for the the other scenario.

Best Answer

(C/P from comments at the suggestion of N.F. Taussig)

Choose the four digits in $\binom{10}{4}$ ways. Then choose the two digits (say $a$ and $b$) that get repeated in $\binom{4}{2}$ ways. So we have our collection of six digits. There are $6!$ ways to order six digits. But we have to divide by $2!$ because the two digits $a$ are indistinguishable. Similarly divide by $2!$ again for the two digits $b$. This explains the factor of $(6!)/(2!)^2$.