# How many $4$-digit numbers can be formed from the digits $1,2,3,4,5,6,7$ if each digit can only be used once and sum of digits is even?

How many $4$-digit numbers can be formed from the digits $1,2,3,4,5,6,7$ if each digit can only be used once and sum of digits is even?

$7 \cdot 6 \cdot 5 \cdot 4 = 840$ numbers

Okay, I can solve all $4$-digit numbers, each digit used just once, but how can I meet the condition: sum of digits must be even?

• For the sum to be even, either all $4$ numbers are odd, $2$ are odd and $2$ are even or all $4$ are even. Oct 5, 2017 at 6:00
• One way is to break the problem into pieces. If the sum of digits is even, then the number could have (a) 4 even digits (b) 2 even digits and 2 odd digits (c) 4 odd digits. Try to work out how many in each group. Hint: 0 in group (a). Oct 5, 2017 at 6:00
• Please read this tutorial on how to typeset mathematics on this site. Oct 5, 2017 at 10:09

The hints in the comment section provides valuable insights to the problem.

I will write a complete answer just to be sure you understand the hints.

There are $3$ cases whereby the sum of the $4$ digits is even,

(1) All $4$ digits are odd.

(2) All $4$ digits are even.

(3) $2$ digits are odd and $2$ digits are even.

First, note that there are $4$ odd digits and $3$ even digits in the set $\{1,2,3,4,5,6,7\}$.

Since each digit can only be chosen once, there is $4$ ways of choosing the first odd digit from $\{1,3,5,7\}$,

followed by $3$ ways of choosing the second odd digit from the remaining $3$ digits,

followed by $2$ ways of choosing the third odd digit from the remaining $2$ digits,

followed by $1$ way of choosing the forth odd digit from the remaining $1$ digit.

So, there are $4\times 3 \times 2\times 1 = 4!$ possibilities for Case (1).

Now on to Case (2),

there are $3$ even digits in $\{1,2,3,4,5,6,7\}$, namely $2,4,6$.

Remember that the $4$ digit number must contain different digits, we cannot use either $2$, $4$ or $6$ more than once to construct the $4$ digit number.

And furthermore, there are only $3$ even digits available, so it is impossible to construct any $4$ digit number with no repetition of a digit.

Hence, there is $0$ possibilities for Case (2).

Finally, let's move on to Case (3), which is slightly more difficult.

We first do an unordered selection of $2$ odd digits from $\{1,3,5,7\}$.

which gives $\binom{4}{2}$ possibilities,

followed by an unordered selection of $2$ even digits from $\{2,4,6\}$.

which gives $\binom{3}{2}$ possibilities.

An example would be choosing the digits $1, 5, 2, 4$.

We can quickly see that a valid $4$ digit number would be $1524$.

Note that other permutations of the $4$ digits also form a valid $4$ digit number,

example, $5124$ and $1542$.

and, there are $4!$ permutations in total.

So, by the product rule, there are $\binom{4}{2} \times \binom{3}{2} \times 4!$ possibilities.

Finally, by sum rule, there are a total $4! + 0 +\binom{4}{2} \times \binom{3}{2} \times 4!$ possibilities for the $3$ mutually exclusive cases.