This was the question in one of the online test I was giving for preparation of an exam. I was not convinced by the final answer so I wanted to discuss it.
Consider a set S = {1000, 1001, 1002, ........ 9999}. The numbers in set ‘S’ that have atleast one digit as 2 and atleast one digit as 5 are ________.
I solved it using complimentary counting.
Final answer will be
All total numbers from 1000 to 9999 both inclusive - All such numbers that do not have either a 2 or a 5.
Now Let A:All 4 digit numbers do not having 2 B : All 4 digit numbers do not having 5
$|A|=8*9*9*9=|B|$
$|A \cap B |=7*8*8*8$
$|A \cup B|=|A|+|B|-|A \cap B|=2(8*9*9*9)-(7*8*8*8)=8080$
So my answer will be $9000-8080=920$
But in solution they have given answer to be 2752. Which one is correct?
Your answer is correct; it's a mistake in the test. A rough estimate shows that your answer is in the right ball park: We need a $2$ and a $5$, we can pick their places in $4\cdot3=12$ ways, and we can fill the two remaining places in roughly $10^2=100$ ways, that would make $1200$. That's much closer to your number, and we've clearly over- and not undercounted.