Probability – 4 random digits, 2 different ones (clarification)

combinatoricsprobability

I have been trying to solve the following problem:

What is the probability that among 4 random digits, there appear
exactly 2 different ones?

I understand that the solution can be broken down into two parts: i) there is one different digit and three similar ones, and ii) there is two different digits and each of them appears twice.

My solution to i) would be the following:

$$[10 \times 1 \times 1 \times 9 \times (4! / (1! * 3!) ) ] / 10^4 = 0.036$$

and to ii) this:

$$[10 \times 1 \times 9 \times 1 \times (4! / (2! * 2!) ) ] / 10^4 = 0.054$$

Hence, my answer to the problem would be $0.036 + 0.054 = 0.09$.

But this is not the correct answer. According to Andre Nicolas in this SO post, the numerator in ii) has to be divided by two. I assume, this is because the order does not matter there (eg.: whether we have 1122 or 2211). But if this is the case, then why we do not divide by two in i) as well (and say, eg. that 1112 and 2111 are the same)?

Best Answer

The short answer is that for case i) you have a very clear and defined way to know the difference between which number is used for which purpose. Regardless the order of the four digits, you can tell at sight which is the digit which "appears once" versus which is the digit that "appears three times." There is absolutely no ambiguity there.

Compare this to the situation where you are in case ii) where both appear twice. Which is the "first" digit that was selected to appear two times and which is the "second" digit that was selected to appear two times is ambiguous.


Rather than dividing by symmetry, I suggest instead to count the numerator for the second case in the following way:

  • Pick what the furthest left digit is: $10$ options.

  • Among the remaining three positions, exactly one will match what our left digit is. Pick which of these that is: $3$ options.

  • Pick what digit is used for the remaining two positions: $9$ options.

This gives a numerator of $10\times 3\times 9$ which you should see is equal to the same answer as given in Andre's answer before, just written differently. $\binom{10}{2}\binom{4}{2} = 10\times 3\times 9 = 10\times 9\times \binom{4}{2} / 2 = \dots$