[Math] Number of nine digits numbers whose sum of the digits is even

combinatorics

I am reading Mathematical Circle. Problem $48$ in chapter two says that

How many nine-digit numbers have an even sum of their digits?

I am trying in this way, that we can divide the problem in four cases.

  1. $1$ even digit and $8$ odd digits
  2. $3$ even digits and $6$ odd digits
  3. $5$ even digits and $4$ odd digits
  4. $7$ even digits and $2$ odd digits

For the first case we get $4 \cdot 5^8 +5\cdot 5^7 \cdot 5$ number of solution. Because if the even digit is placed in first place (left to right) then we get $4\cdot 5^8$ ways to write the number and if an odd digit is placed in first place then we get $5\cdot 5^7 \cdot 5$ ways to write the number. Similarly for the second case we get $4\cdot 5^8+5^9$ , for the third case we get $4\cdot 5^8+5^9$ and for the fourth case we get $4\cdot 5^8+5^9$ ways to write the number. So total number is $ 4 \cdot (4\cdot 5^8+5^9)$.
The answer is different. So Where I have made a mistake?
Thanks.

Best Answer

There are $900000000$ nine-digits numbers and exactly half of them have an even sum of digits (because every number can be paired with another of the opposite parity by changing the last digit).

Related Question