Permutations and Combinations

How many numbers are there between $500$ and $1000$ which have exactly one of their digits as $8$?


We have $3$ digit numbers between $500$ and $1000$.

Case 1: $\;$ If the unit's place is $8$, then

the unit's place can be selected in $1$ way;

the ten's place can be selected from the digits $0, \; 1, \; 2, \; 3, \; 4, \; 5, \; 6, \; 7, \; 9$ $\;$ i.e. $\;$ in $9$ ways;

the hundred's place can be selected from the digits $5, \; 6, \; 7, \; 9$ $\;$ i.e. $\;$ in $4$ ways.

$\therefore$ $\;$ Number of ways of having a 3 digit number with 8 in the unit's place $= 1 \times 9 \times 4 = 36$ ways

Case 2: $\;$ If the ten's place is $8$, then

the unit's place can be selected from the digits $0, \; 1, \; 2, \; 3, \; 4, \; 5, \; 6, \; 7, \; 9$ $\;$ i.e. $\;$ in $9$ ways;

the ten's place can be selected in $1$ way;

the hundred's place can be selected from the digits $5, \; 6, \; 7, \; 9$ $\;$ i.e. $\;$ in $4$ ways.

$\therefore$ $\;$ Number of ways of having a 3 digit number with 8 in the ten's place $= 9 \times 1 \times 4 = 36$ ways

Case 3: $\;$ If the hundred's place is $8$, then

the unit's place can be selected from the digits $0, \; 1, \; 2, \; 3, \; 4, \; 5, \; 6, \; 7, \; 9$ $\;$ i.e. $\;$ in $9$ ways;

the ten's place can be selected from the digits $0, \; 1, \; 2, \; 3, \; 4, \; 5, \; 6, \; 7, \; 9$ $\;$ i.e. $\;$ in $9$ ways;

the hundred's place can be selected in $1$ way;

$\therefore$ $\;$ Number of ways of having a 3 digit number with 8 in the ten's place $= 9 \times 9 \times 1 = 81$ ways

$\therefore$ $\;$ Total number of numbers between $500$ and $1000$ which have exactly one of their digits as $8$

$=$ Case 1 $\;$ OR $\;$ Case 2 $\;$ OR $\;$ Case 3

$= 36 + 36 + 81 = 153$ numbers