# How many $4$ digit even numbers have all $4$ digits distinct?

How many $4$ digit even numbers have all $4$ digits distinct ?

This question has been asked if we replace even with positive.

I was solving this Problem like: For first position $1-9$ (No $0$) for next $0-9$ (leaving out the digit which has been choose) for next $0-9$ (leaving out $2$ digits), but on last digit I get stuck. From what I should choose. Will it be $0, 2, 4, 6, 8$, because number needs to be even? How should I solve it?

• First pick the last digit, (in two cases; case I: 0, case II: 2,4,6,8) then pick the first digit then the middle two digits – user21965 Sep 14 '13 at 18:41

On problems like this one, it is best to start counting with what has the most constraint. Here we need the last one even, and the first one to be non-zero. The two central ones don't have constraint aside being distint of everyone else.

We start by dividing the counting whether the last digit is $0$ or not.

• If the number ends with a $0$ then there are $9$ choices for the first digit, $8$ for the second and $7$ for the third, which makes $1\times 9\times 8\times 7=504$ possibilities.

• If the number is even ending with something else than $0$ then there are $4$ choices for the last digit, $8$ choices for the first digit (no $0$ nor the last digit), $8$ for the second digit and $7$ for the third digit, which makes $4\times 8\times 8\times 7=1792$

Together, this gives $2296$ numbers with $4$ distinct digits that are even. Note that this does not allow leading $0$, as you see to want it based from the question.

If we are allowed to put 0 as the first digit, then 4th digit has 5 possibilities (0,2,4,6,8), 3rd - 9 possibilities, 2nd - 8, 1st - 7. This gives 5*9*8*7=2520

Let's count illegal numbers with 0 as the 1st digit. 4 possibilities for the 4th number (2,4,6,8), 8 for 3rd, 7 for 2nd. This gives 4*8*7=224