Combinatorial Analysis: The fundamental principle of counting

75 Views Asked by At

Where is my logic wrong? I want to count how many numbers with the digit $2$ there are between $100$ and $400$. I thought the following: I will separate in cases.

First case. The first digit is one, the second is two, and the third is anyone. So I have $1*1*10=10$. For the second case, the first number is still one, the second is anything but two, as I already used it in the first case and the last one is two. So it will be $1*9*1=9$.

For the third case, the first digit is two and the last two, any one. So it will be: $1*10*10=100$. For the next case, the first number is three, the second is two and the third is anything, so we have: $1*1*10=10$.

For the final case, we have: the first number is three, the second is anything but two, and the third is two: $1*9*1=9$. Adding up, you have $138$. Where did I go wrong? I know it's not difficult to analyze the amount of numbers with the digit two in another way. But I would like to solve this using the fundamental counting principle.

2

There are 2 best solutions below

0
On

Let $A_1$ be the set of numbers with a $2$ in the first digit.
Let $A_2$ be the set of numbers with a $2$ in the second digit.
Let $A_3$ be the set of numbers with a $2$ in the third digit.

The Inclusion-Exclusion Principle says that the count of numbers with a $2$ is $$ \overset{100\\}{|A_1|}+\overset{30\\}{|A_2|}+\overset{30\\}{|A_3|}-\overset{10\\}{|A_1\cap A_2|}-\overset{10\\}{|A_1\cap A_3|}-\overset{3\\}{|A_2\cap A_3|}+\overset{1\\}{|A_1\cap A_2\cap A_3|}=138 $$ So, your answer seems correct.

2
On

$160$ is the answer to a different question, namely "How many $2's$ are needed to write all the natural numbers from $100$ to $400$."

To see that, note that there are $10\times 10=100$ integers in the range with first digit $2$.

There are $3\times 10=30$ integers in the range with second digit $2$.

There are $3\times 10=30$ integers in the range with third digit $2$.

Hence, altogether, you need $$\boxed{100+30+30=160}$$

$2's$ to write all those natural numbers.