# How many eight digits numbers are odd?

So this is the exercise:

Let A be a set of numbers consisting of 8 digits: five digits 1 and three digits 2. For instance 11221211 is in A.

How many number in A are odd?

How many number in A are odd or start with the digit 1 (or both)?

Now here's what I thought for the first answer: If we try a number of eight digits in which the last one is odd, say 2*2*2*1*1*1*1*1 we get 8. Now there are still many combinations we would have to calculate and I think the best way would be 7 choose 3, where seven is the number of digits minus one (since the last digit that makes the number odd is excluded) and three is the number of twos. The result is 35. Now we can do 34 x 8, since 34 is the number of combination excluded the one we tried, and get the result 272. So have 272 odd numbers.

Now, I have no idea whether this is right or not, but I do know that it seems overly tricky. I also have no idea about the second question.

I hope my explanation is clear enough.

Can anybody help me out?

How many number in A are odd?

In order to produce an odd number, the last digit must be $$1$$. In this case, we have seven available slots to place the remaining digits, four $$1$$s and three $$2$$s. Observe that through symmetry, we have $$\binom73=\binom74=35.$$

How many number in A begin are odd or begin with the digit $$1$$?

Just like the previous question, we can fix the first digit to be $$1$$ (just like how we fixed the last digit to be $$1$$) and we get the same $$35$$ as we did before, but now we have to discount the overlap by the inclusion-exclusion principle. To get that number, we fix the first and last digits to be $$1$$, and now we want to arrange three $$1$$s and three $$2$$s among six slots. In total, we'll have $$35+35-\binom63=50.$$

For the first one, it is just $$7 \choose 3$$.

But more importantly: where does your calculation go wrong?

I think you are multiplying by $$8$$, because there are $$8$$ possible digits for the last digit. However, the last number was already fixed to be a $$1$$, and so there is really only $$1$$ possibility there. And, once you fix that as a $$1$$, there are $${7 \choose 3}=35$$ ways to put in the rest. So no, you don;t multiply by $$8$$.

Also, you don't subtract $$1$$ just because you 'tried' $$22211111$$ one already: that 'one" is course one of those $$35$$.

Put differently, there are $$34$$ numbers other than the $$1$$ number you tried, and hence there are $$1+34=35$$ total. But that's a silly way to calculate the total number ... for effectively you'd end up calculating $$1 + (35-1) = 1+34=35$$

So, the answer to the first question is just $$35$$

For the second question:

Well, we know that $$35$$ are odd, i.e. end with a $$1$$. And, by symmetry, there are also $$35$$ that start with $$1$$. So, you might think the total number is $$35+35=70$$. However, consider the fact that some numbers start with $$1$$ and end with $$1$$: those numbers you would end up counting twice. So, you need to subtract the number of numbers that start and and with a $$1$$. Now: if you fix the start $$1$$ and the end $$1$$: how many options do you have for placing the other $$6$$ digits?

You need to place the Three $$2$$'s in six positions, you you have $${6 \choose 3}=20$$ numbers that start and end with a $$1$$. Substrating those, you thus get $$70-20=50$$ numbers that start or end with a $$1$$
• @youser202342 Also: was the second question "odd or start with a $1$"? Commented Nov 6, 2019 at 16:56