How many six-digit numbers can be formed using the digits $0$ to $9$, where exactly one digit is repeated only once

combinatorics

How many six-digit numbers can be formed using the digits $0$ to $9$, where exactly one digit is repeated only once?

For example, some of those numbers can be:
123451
123453
156786
205470

In these $4$ numbers, I have only given the possible numbers that have the repeated digit in the last place. But the repeated digit can be in any place like:

898564
432467

So what is the quantity of all possible numbers?

For me:

We know that the 1st digit can't be $0$, so $9$ possibilities for the first digit. We have $5$ remaining places, where one place belongs to the repeated digit and the other $4$ places belong to $4$ other digits. We also know that the repeated digit can be any of the $5$ other digits within the number, and the repeated digit can be in any other place, so $5$ places for the repeated digit to go. (Except if it's a $0$, then it only has $4$ places.)

I'm stumped.

Best Answer

Using recommendation of @lulu, lets separate our problem according to existence of zero such that

  • Zero repeats two times:$$\binom{5}{2}.9.8.7.6=30240$$

where $\binom{5}{2}$ means selecting positions for zeros except for the leading digit

  • Zero repeats only once:$$\binom{5}{1}\binom{9}{1}\binom{5}{2}.8.7.6=151200$$

where $\binom{5}{1}$ means selecting positions for zero except for the leading digit. $\binom{9}{1}$ means selecting repeating digit and $\binom{5}{2}$ means selecting position for repeating digits

  • No Zero: $$\binom{6}{2}\binom{9}{1}8.7.6.5=226800$$

$\binom{6}{2}$ means selecting position for repeating digits and $\binom{9}{1}$ means selecting repeating digit

$$30240+151200+226800=408240$$