# How many number with 4 digits, beginning with $1$ and have exactly two identical digits?

The numbers $1447$, $1005$, and $1231$ have something in common. Each is a four-digit number beginning with $1$ that has exactly two identical digits.

How many such numbers are there?

I have check all the possible cases satisfying the require condition are $$11xy,\qquad 1x1y,\qquad1xy1\qquad 1xxy,\qquad1xyx,\qquad1yxx.$$

maybe I am missing something. Can anyone help from here?

There are $9 \cdot 8$ numbers of each of your cases ($x$ can be any digit but 1, so 9 choices, and $y$ can be any digit but 1 or x, so 8 choices). So the total is $$\underbrace{9 \cdot 8}_{11xy}+\underbrace{9 \cdot 8}_{1x1y}+\underbrace{9 \cdot 8}_{1xy1}+\underbrace{9 \cdot 8}_{1xxy}+\underbrace{9 \cdot 8}_{1xyx}+\underbrace{9 \cdot 8}_{1yxx}=6\cdot 9 \cdot 8=432$$ numbers.

• To consider the complement is not a slick idea after all, so I simply removed my previous incorrect answer. (+1) to you. Jan 23, 2018 at 17:50

We can find out how many numbers have no repeated digits. There are $9 \cdot 8 \cdot 7 =504$

How many numbers have two different repeated digits. There are three different paces would could stick a 1, and then nine other digits we can use to make a pair in the two remaining spots. So $9 \cdot 3 = 27$

How many have three identical digits? There are $\binom{3}{2}$ places we could stick two more ones, and then 9 other digits. So $3 \cdot 9$. And then nine other numbers of the form $1xxx$. So 36 total.

There is one number with four repeated digits.

So the number of numbers with exactly two repeated digits, is 1000 minus everything we found above,

$1000 - 504 - 27 - 36 - 1 = 432$

Number of ways the two digits are chosen so that there are not 3 ones= ${10 \choose 2}$ - 9 =45 - 9 = 36
Total number of ways the digits can be arranged = $36 \times 2 \times 6 = 432$