Here, the Most Significant Digit has $9$ possibilities where as other digits have $10$. So, lets divide the cases
- MSD is either $2$ or $5$ $(2$ ways$)$ - We select one position for the other selection $(2$ or $5)$ in ${}^3C_1$ ways and the $2$ other positions can be filled in $10 \times 10 = 100$ ways. But here we will overcount. So, lets subdivide the cases
- One 5, One 2: $2 \times 3 \times 8 \times 8 = 384$
- One 5, Two 2s, 2 is MSD: $3 \times 2 \times 8 = 48$
- One 5, Two 2s, 5 is MSD: $3 \times 8 = 24$
- One 2, Two 5s: $48 + 24 = 72$ (Similar to One 5, Two 2s)
- Two 2s, Two 5s: $\frac{24}{2!2!} = 6$
- One 5, Three 2s, 5 is MSD: $1$
- One 5, Three 2s, 2 is MSD: $3$
- One 2, Three 5s: $4$ (Similar to One 5, Two 2s). So totally, $384 + 72 + 72 + 6 + 4 + 4= 542.$
- Otherwise - We select $2$ positions for $2$ and $5$ in ${}^3C_2 = 3$ ways and MSD can be filled in $7$ ways $($excluding $0,2,5)$ and the other remaining position in $10$ ways. So, totally $2! \times 3 \times 7 \times 10 = 420$ numbers. Again we overcount. So lets divide to subcases
- One 5 and One 2: $2 \times 3 \times 7 \times 8 = 336$
- One 5, Two 2: $3 \times 7 = 21$
- One 2, Two 5: $21.$ So, totally $336 + 21+21 = 378.$
Thus, total numbers $= 542 + 378 = 920.$
Better Way:
For the numbers in set $S$ having at least one digit as $2$ AND one digit as $5$
Inclusion-Exclusion Principle:
$\mid 2 \cup 5 \mid = \mid 2 \mid + \mid 5\mid - \mid 2 \cap 5 \mid $
$\implies \mid 2 \cap 5 \mid = \mid 2 \mid + \mid 5\mid - \mid 2 \cup 5 \mid $
Here, $\mid 2\mid$ is the count of numbers having at least one digit as $2.$
$\mid 2 \mid = 9000 - $ count of numbers with none of the digits as $2.$
$\qquad = 9000 - 8 \times 9 \times 9 \times 9 = 9000-5832 = 3168.$
Similarly, $\mid 5 \mid = 3168.$
$\mid 2 \cup 5\mid = 9000 - $ count of numbers with no $2$ or $5$
$\qquad = 9000 - 7 \times 8 \times 8 \times 8 = 9000 - 3584 = 5416.$
So, $\mid 2 \cap 5 \mid = 3168 + 3168 - 5416 = 920.$