Probability – 4-Digit Password with Exactly 2 Digits in Common

combinatoricsprobability

Question: A system generates a 4 unique digits password. Extracting 2 passwords created independently and randomly, what is the probability that they have exactly 2 digits in common?

My attempt:
There are $\frac{10!}{(10-4)!} = 5040 $ different passwords in the sample space. If we take one them, say $2647$, there are ${4 \choose 2} = 6$ cases of coincidence: $\{2,6\},\{2,4\},\{2,7\},\{6,4\},\{6,7\},\{4,7\}$. So, if we consider the first case, there are 30 passwords that have a 2 and a 6 and also don't have a 4 and a 7. If we shuffle the digits, we still get valid passwords, so in the first case there are $30 \times 4! = 720$ passwords. The reasoning for the other cases is identical, so we must have $720 \times 6$ passwords in total that match the given password in exatcly 2 digits. So the probability asked is $\frac{720 \times 6}{5040} = \frac{6}{7}$

the supposed answer is $\frac{3}{7}$

What did I miss? Thanks in advance.

Best Answer

You are counting, for example, permutations of $\{2,6,3,8\}$ and permutations of $\{2,6,8,3\}$

Having found $\binom{4}{2}$ ways to choose two common digits, you should have found $\binom{6}{2}$ ways to choose other distinct digits. Since you don't care about the order of the digits, you should divide by $\binom{10}{4}$ to arrive at the given answer.

$$\frac{\binom{4}{2}\binom{6}{2}}{\binom{10}{4}}=\frac{3}{7}$$