Combinatorics – Combination of a 4-Digit Number

combinatorics

How many 4-digit numbers ($0000-9999$; including $0000$ and $9999$) can be formed in which the sum of first two digits is equal to the sum of last two digits?

Assumption : every number is valid even if it starts with a zero.

For ex: $1230, 0211, 4233$ and so on…

Best Answer

HINT: The possible sums of two digits are the integers from $0$ through $18$. There’s just one way to get a sum of $0$ or $18$. There are two ways to get a sum of $1$, $01$ and $10$, and two ways to get a sum of $17$, $89$ and $98$. It’s easy enough to work out the number of ways to get each possible sum:

$$\begin{array}{r|rr} \text{Sum}&0&1&2&3&4&5&6&7&8&9\\ \text{Sum}&18&17&16&15&14&13&12&11&10\\ \hline \text{Nr. of ways}&1&2&3&4&5&6&7&8&9&10 \end{array}$$

To get a number whose first two digits sum to $6$, say, and whose last two digits also sum to six, you must combine one of the $7$ possible pairs for the first two digits with one of the same $7$ possible pairs for the last two digits. You can do that in $7^2=49$ ways.

Can you finish the calculation from there?