The number of $3$-digit even numbers in which all digits are different

combinatorics

I am trying to answer an exercise:

What is the number of $3$-digit even numbers in which all digits are different?

I've done the following (I've made a special notation to describe the counting which I'll explain below). I started with the case in which the last digit is $0$, and then I choose one $x_1$ in which $x_1\neq 0$, that is: I have $9$ choices. And then I choose $x_2 \neq x_1$. This gives me $9\times 8 =72$ numbers. Notice that I choose the digits in the order $x_1,x_2,\dots$ and $[x,y]\setminus a$ means that I am removing $a$ from my possible choices $x,\dots , y$.

$$\frac{x_2}{[1,9] \setminus x_1} \quad\frac{x_1}{[0,9]\setminus 0} \quad \frac{0}{}$$

Now I could count in the other direction. And it still would give me the same value.

$$\frac{x_1}{[1,9] } \quad\frac{x_2}{[0,9]\setminus 0 \setminus x_1} \quad \frac{0}{}$$

Now, when I try to do it with $2$, I get:

$$\frac{x_2}{[1,9] \setminus 2 \setminus x_1} \quad\frac{x_1}{[0,9]\setminus 2 } \quad \frac{2}{}$$

And this gives me: $9\times 7=63$, now If I do it from the other direction, this gives me:

$$\frac{x_1}{[1,9] \setminus 2 } \quad\frac{x_2}{[0,9]\setminus 2 \setminus x_1} \quad \frac{2}{}$$

Which is $8\times 8=64$. I don't get what I am missing here.

Best Answer

How many three-digit positive even integers are there with distinct digits?

Since the leading digit cannot be zero, we distinguish between two cases:

  1. The units digit is $0$.
  2. The units digit is $2$, $4$, $6$, or $8$.

Case 1: The units digit is $0$.

There is one way to pick the units digit. There are nine ways to choose the hundreds digit since it cannot be zero. There are eight ways to pick the tens digit since it cannot be equal to $0$ or the hundreds digit. There are $9 \cdot 8 \cdot 1 = 72$ such numbers as you found.

Your second method is also correct.

Case 2: The units digit is $2$, $4$, $6$, or $8$.

There are four ways to pick the units digit. For each such choice, there are eight ways to pick a hundreds digit that is different from the units unit and that is not equal to zero. For each such choice of the units digit and hundreds digit, there are eight ways to choose the tens digit since it must differ from both the hundreds digit and the units digit. Hence, the number of such numbers is $8 \cdot 8 \cdot 4 = 256$.

Total: Since the two cases are mutually exclusive and exhaustive, there are a total of $72 + 256 = 328$ three-digit even positive integers with distinct digits.

What was your error?

There are $8 \cdot 8 = 64$ three-digit positive integers with distinct digits ending with $2$ since there are eight ways to choose a non-zero hundreds digit that is different from $2$ and eight ways to choose a tens digit different from $2$ and the hundreds digit.

You attempted to count this set by choosing the tens digit first. If you do that, you have to distinguish between the case when the tens digit is $0$, in which case the hundreds digit can be chosen in eight ways since it cannot be $0$ or $2$, and the case when the tens digit is not $0$, in which case the tens digit can be chosen in eight ways since it cannot be $0$ or $2$ and the hundreds digit can be chosen in seven ways since it cannot be $0$, $2$, or the tens digit. That gives you $8 \cdot 1 \cdot 1 + 7 \cdot 8 \cdot 1 = 8 + 56 = 64$, as before.

Upshot: Start with the restrictions first, then fill in the remaining digits to avoid having to distinguish between cases.