What is the total number of combinations such that a $6$-digit pin contains exactly $4$ distinct digits?
Solution 1:
(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$.