# Five digit numbers with each digit from the set {1, 2, 3, 4}: numbers with an even digit sum and numbers with more even than odd digits

This is a question in a book that I am studying, and I have attempted to answer it but got it wrong.
There were two parts that I wrong.
The question is about five digit numbers where the digits are 1, 2, 3, or 4.

The first part asked how many numbers were such that the sum of the digits was even. My answer was $$\binom{5}{0} (2^5) + \binom{5}{2} (2^2)(2^3)+ \binom{5}{4}(2^4)(2)$$ My thought process was to add up all of the possible numbers with an even number of odd digits. $$\binom{5}{0}$$ is for choosing 0 out of the 5 digits to be odd, and the following $$2^5$$ is for the remaining 5 digits, each of which has two choices for even numbers. $$\binom{5}{2}$$ is for choosing 2 out of the 5 digits to be odd, followed by $$2^2$$ to represent the two odd digits having 2 odd numbers to choose from, and the last $$2^3$$ to represent the remaining 3 digits having 2 even numbers to choose from. The last terms works similarly.

The second part asked how many numbers had more even digits than odd digits. My thought process here was that I needed at least 3 even digits, so I needed to choose 3 digits out of 5, assign them even digits, and then freely assign the remaining 2 digits. So, my answer was $$\binom{5}{3}(2)(4^2)$$ The book's answer for the first part was to choose 4 digits without restriction and then choose an even or odd last digit to make the sum even: $$(4^4)(2)$$ For the second part, it added up the all 3 even-digit numbers, 4 even-digit numbers, and 5 even-digit numbers: $$\binom{5}{3} (2^3)(2^2) + \binom{5}{4} (2^4)(2)+ \binom{5}{5}(2^5)$$ I understand why the book's answers work, but I'm not sure why my answers do not work. How should I have approached these questions?

• There is nothing at all wrong with the first solution. In fact, that would be the preferred method in the case where the character list contained more evens than odds or conversely. The book's method exploits a symmetry which, of course, doesn't hold in general.
– lulu
Commented May 10, 2021 at 19:54
• @lulu while the book used symmetry argument for the first part, they did not use it for the second part for some strange reason. In the second part, as it is five digit numbers, it is clear that there will be equal count of numbers with more odd digits and with more even digits. Commented May 10, 2021 at 20:24
• @MathLover That's a good point.
– lulu
Commented May 10, 2021 at 20:26

Your answer for the first part is numerically the same, just arrived at by a more tedious method. For the second part your approach overcounts numbers; with $$22424$$ for example, you would count the processes "pick positions $$1,2,3$$ first" and "pick positions $$3,4,5$$ first" that lead to this number as different, when they are not.

Your approach to the first part is correct and so is the answer. Please note that -

$$\displaystyle \small \binom{5}{0} \cdot 2^5 +\binom{5}{2} \cdot 2^5 + \binom{5}{4} \cdot 2^5 = 512$$

and so is the book answer,

$$\displaystyle \small 2 \cdot 4^4 = 512$$. The book goes by the fact that we have $$4$$ digits - $$\{1, 2, 3, 4$$ }, exactly two even and two odd to choose from. When you assign first four digits unrestricted, it will give you equal count of numbers that have odd sum and even sum. In other words, we will get $$\displaystyle \small \frac{1}{2} \cdot 4^4$$ numbers of $$\small 4$$ digits with odd sum and same count for numbers with even sum. Now if the sum of first four digits is odd, we can assign fifth digit as either $$1$$ or $$3$$, two choices. If the sum is even, you can assign fifth digit as either $$\small 2$$ or $$\small 4$$.

Coming to second part, please note that we are finding numbers that have more even digits than odd.

But your working $$\displaystyle \binom{5}{3} \cdot 2 \cdot 4^2$$ has duplicates. Please note that you are first choosing $$3$$ places and assigning even digits. Then for remaining two digits, you are assigning unrestricted. Think as an example what happens when you choose first three digits as part of $$\small {5 \choose 3}$$ and assign $$2$$ or $$4$$. The last two digits can again have $$2$$ or $$4$$ when you assign last two digits unrestricted. Similarly when you chose last $$3$$ digits as part of $$\small {5 \choose 3}$$, you can again have $$2$$ or $$4$$ in the first two digits as you are assigning first two digits unrestricted. This is just one example of how duplicates come in your solution.

One comment on the book solution for second part, it is not optimal either. As these are $$5$$ digit numbers made from $$\small \{1, 2, 3, 4 \}$$, you cannot have equal count of even and odd digits and due to symmetry, there will be equal count of numbers where there are more even digits or more odd digits. That leads to an answer of $$\ \displaystyle \small \frac{1}{2} \cdot 4^5 = 512$$. The book answer works out to the same.

For the first part you are correct, both expressions evaluate to $$512$$. For the second part, you are clearly overcounting. Suppose you choose the last $$3$$ digits to be even, and then you freely set the first two. There would be a case where all digits would be even. Now, suppose you choose the first $$3$$ digits to be even and freely set the other two. The same number can come up again. There can be many other such instances, this was just an example. Hence your method is wrong. Since you are interested in alternate approaches too, a good method for part $$2$$ would be to simply observe that either odd digits are more than even, or even digits are more than odd. So the number required would simply be $$\frac 12$$ of the total number of digits, hence $$512$$.