The number of integers between 10000 and 100000 with exactly two equal digits Find the number of integers between 10000 and 100000 (inclusive) with exactly two equal digits.
I thought of writing it as 1abcd. If one a,b,c,d is 1 then there is 9 ways of selecting the first of the remaining three digits, 8 ways for the second, and 7 ways for the third. So in total 24. Now I consider abcd. If a = b, there are 24 ways of selecting b, c and d. And again 24 if a = b, similarly 24 if b = c. I'm pretty sure my reasoning is messed up here, so I'm going to stop (because I excluded 1 from the possibilities, and we could have say a = b = 1, which I don't know how to deal with). 
Could someone please show me the proper way to do the question? 
 A: I don't know that there is a "proper way". There will definately be easier and harder ways.
But anyway, I would approach this by looking at the number of ways to choose 5 numbers with exactly two equal, then permuting these to all their possible orders.
$(x,x,a,b,c)$ is the set of numbers to permute. This only represents the set of numbers, it does not mean that we are only looking at the number $xxabc$. Later on, when we permute, this set will represent all possible ways of ordering $(x,x,a,b,c)$. for instance, $xxabc,axxbc,xbcax$ etc.The symbol $x$ represents the repeated number.
For the first case, we do not include zero because it can't go in the first position, which leaves us with only 9 numbers to choose from.
To fill out a, b and c in all the possible ways is $\binom{8}{3}$. We use 8 instead of 9 because we need to leave a number that $x$ can be. Then we multiply this by the number of ways to order these 5 digits, which is $5!$. Then we divide this by 2 because we don't want to count the two ways that $x$ can be ordered.
There are 9 different ways to choose which value $x$ will have (becasue we are neglecting zero at this point), so we have to multiply by 9.
So by this point we have:
$9*\binom{8}{3}*\frac{5!}{2}$
This covers numbers such as 13325, 66123, 79827 etc.
The next case is for when we have a single zero, which is slightly different because it can't go in the first position. In this case we have 10 numbers to choose from (0,1,...,9)
$(x,x,0,a,b)$ is the set we want to permute. The number of ways to fill out a and b are $\binom{8}{2}$ because we already have chosen two distinct digits. Now, out of the 5 digits, we can place only 4 in the first position (because zero can't go there), then we can place 4 in second, 3 in third etc, so instead of $5!$, in this case we get $4*4*3*2*1=4*4!$
We also have to divide by two because we don't want to count the number of ways that $x$ can be ordered. Then we multiply by 9 because again, the two $x$'s can be any number from 1 to 9.
This covers numbers such as 10233, 11098, 99054 etc.
By this point we have:
$9*\binom{8}{3}*\frac{5!}{2}+9*\binom{8}{2}*\frac{4*4!}{2}$
Now finally for the case when $0$ is the repeated number.
We will ignore the first digit for now. This leaves us with the four digit set $(0,0,a,b)$. There are $\binom{9}{2}$ ways to fill out a and b here. There are $4!$ ways to order these elements. We divide by 2 because we don't want to count the number of ways that 0 can be ordered. By this point, we have chosen 3 distinct numbers with 7 remaining to chose from for the first position. So to count for the different numbers that can take the first position, we multiply by 7.
This covers numbers such as: 10023, 98700, 20980 etc.
All together this gives a total of:
$\binom{9}{2}*\frac{4!}{2}*7+9*(\binom{8}{3}*\frac{5!}{2}+\binom{8}{2}*\frac{4*4!}{2})=45360$
A: This answer assumes that exactly $2$ equal digits means that there is a digit appearing twice and then $3$ other distinct digits.
If $0$ is the digit that appears twice then you have $6$ options how to place the zeros. Once you placed them you have $7\cdot 8\cdot 9$ options to choose and arrange the other $3$ digits.
If the digit that appears twice is not $0$ then you have $9$ options for that digit. Now there are $2$ options.
Option 1 - One digit from that pair appears as the most significant digit in which case there are $4$ options remaining for the other digit from the pair and again $7\cdot 8\cdot 9$ options to choose and arrange the other $3$ digits.
Or option 2 - The digit that appears twice does not appear as the most significant in which case there are $6$ options for that pair, then $8$ options to choose the most significant (because it can't be $0$ and then $7\cdot 8$ options for the remaining $2$ digits.
So in total we have:
$$
6 \cdot 7 \cdot 8 \cdot 9 + 9(4 \cdot 7 \cdot 8 \cdot 9 + 6 \cdot 8 \cdot 7 \cdot 8) = 45360
$$
