How many six digit numbers are even or are divisible by 5

combinatoricsinclusion-exclusionpermutations

Here is my attempt:

$$\text{Let A be the set of 6-digit numbers that are even.}$$
$$\text{Let B be the set of 6-digit numbers divisible by 5.}$$
$$\text{Thus, $A\cap B$ is the set of 6-digit numbers that are even and divisible by 5.}$$
$$|A|=9\cdot 10^4\cdot 5,\space|B|=9\cdot 10^4\cdot 2$$
$$\implies |A\cup B|=9\cdot 10^4+9\cdot 10^4\cdot 5-|A\cap B| $$

I must use the Principle of Inclusion-Exclusion but I'm having difficulty finding $A\cap B$. I only know I have 2 choices (0 or 5) for the ones digit since it must be divisible by 5.

Best Answer

A number is even or a multiple of 5 exactly when it's final digit is one of $\{0,2,4,5,6,8\}$. There are $9$ possible choices for the first digit, $10$ choices for digits 2 to 5, and $6$ choices for the final digit, making a total of $9 \times 10^4 \times 6 = 540,000$ such numbers.

If you want to use the principle of inclusion-exclusion, observe that a number is even exactly when it ends in one of $\{0,2,4,6,8\}$, and is divisible by 5 exactly when the final digit is one of $\{0,5\}$. So, if a number is both even and divisible by 5, it must end in $0$, as the only number in both lists.

You have calculated $|A|$ and $|B|$ correctly, hopefully it is now clear that $|A \cap B|$ is just $9 \times 10^4$, and the final answer can be obtained with the inclusion-exclusion formula as you had in your question: $$9 \times 10^4 \times 5 + 9 \times 10^4 \times 2 - 9 \times 10^4 = 9 \times 10^4 \times 6 = 540,000.$$