Q:

How many 5 digit numbers can be formed from 1-8, in which one digit appears only once and 2 other digits appear twice?

Example : 35573 is such a number while as 33345 is not.

A:

I think Pieter21 gave a very good hint.
There are ${{8}\choose{2}} = 28$ ways to  pick the two digits that repeat.
Since each of these two numbers are repeated twice, there is only $5-2\times2= 1$ digit that needs to be chosen out of the $6$ remaining digits. Therefore, there are ${{6}\choose{1}} = 6$ ways to choose the remaining digit.
However, we also need to consider that these numbers may have different orderings (i.e. 33445 and 34345 are different numbers despite having used the same digits.) As a result, there are $5!$ ways to arrange the digits.
We also need to consider that because we have $2$ pairs of the same digit, we need to divide by $2!2!$ to consider the cases that repeat.
Putting all of this together, we have $\dfrac{28\times6\times120}{4} = 5040$ numbers.

