How many such numbers in 5-digit decimal expansion such that: (1) 3rd digit is 7 and digit 5 there is neither time or (2) there is no number more than once. My solution: Let a set $A$ is a set of numbers satisfying (1), Let a set $B$ is a set of numbers satisfying (2) Let's calculate $$| A | = 8 \cdot 9 \cdot 9 \cdot 9$$ And now: $$| B | = 9 \cdot 8 \cdot 7 \cdot 6 \cdot 5$$ Now, if these numbers in $A$ that satisfy $B$, de facto: $$| A \cap B | = 8 \cdot 8 \cdot 7 \cdot 6$$ Thus, in principle, inclusions and exclusions: $$| A \cup B | = 9 \cdot 8^3 + 9 \cdot 8 \cdot 7 \cdot 6 \cdot 5 -8 \cdot 8 \cdot 7 \cdot 6 = 17040$$ OK?
Community wiki answer so the question can be marked as answered:
As noted in the comments, there are three errors in the calculation.
For $|B|$, the choice of the non-zero first digit still leaves $9$ digits to choose from, so $|B|=9\cdot9\cdot8\cdot7\cdot6$.
For $|A\cap B|$ we have to avoid both $5$ and $7$, and again $0$ in the first digit, which leaves $7\cdot7\cdot6\cdot5$ choices.
In the last equation you wrote $9\cdot8^3$ instead of $8\cdot9^3$.
So the correct total is
$$ |A\cup B|=8\cdot9^3+9\cdot9\cdot8\cdot7\cdot6-7\cdot7\cdot6\cdot5=31578\;. $$