[Math] How many integer numbers between 0 and 9999 are there that have exactly one digit 1 and exactly one digit 3

combinatorics

What do I need to think about this problem?

How many integer numbers between 0 and 9999 are there that have exactly one digit 1 and exactly one digit 3?

The only thing I know that the total configurations is $10^4$ so if I want to count the numbers which at least have 1 three firstly I get the numbers which not have three's $9^4$ and then subtract and the same for four but how can I count with more restrictions?

Best Answer

The position of the digit $1$ can be chosen in $4$ ways, the position of the digit $3$ can be chosen in $3$ ways. The remaining two digits should belong to the set $\{0,2,4,5,6,7,8,9\}$ which has $8$ elements.

Hence the number of integers between 0 and 9999 that have exactly one digit 1 and exactly one digit 3 is $$4\cdot 3\cdot 8\cdot 8=768.$$