[Math] How many different three-digit numbers contain both the digit $2$ and the digit $6$

combinatoricspermutations

How many different three-digit numbers contain both the digit $2$ and the digit $6$?

There are six possible permutations: $$
\overline{26x},\ \overline{62x},\ \overline{2×6},\ \overline{6×2},\ \overline{x26},\ \overline{x62}.
$$

In the first four groups $x$ can be any number in $[0,9]$, in the two last groups $x$ can be any number in range $[1,9]$. So
$$
4 \times 10 + 2 \times 9 = 58.
$$
However, the right answer is $52$. Could you, please, point out the mistake in the reasoning?

Best Answer

Your method overcounts the numbers $266(26x;2x6),622(62x;6x2),262(26x;x62),626(62x;x26),662(6x2;x62),226(x26;2x6)$

Another approach to this problem

Case 1 : The 3 digit number contains all distinct digits

Numbers formed= $\binom {8}{1}.3!$

But we also count in this the numbers which start with 0 so we subtract them.

Numbers in this case hence=$\binom {8}{1}3!-2!=46$

Case 2: The 3 digit number contains exactly 2 digits same.

The two digits can be $2$ or $6$

Hence numbers in this case = $\binom {2}{1}\cdot \frac {3!}{2!}=6$

Hence total numbers required =$46+6=52$