# How many $6$ digit numbers can you make with the numbers $\{1, 2, 3, 4, 5\}$ so that the digit $2$ appears at least 3 times?

I can't seem to understand.

I thought about it this way. We take a first example:

$222aaa$ for each blank space we have $5$ positions, so in this case the answer would be $125$ ($5 \times 5 \times 5$) numbers.

Now the position of the twos can change so we calculate the numbers for that taking this example:

$222aaa$ and the possibilities for this are the number of ways you can arrange $6$ digits ($6!$) and divide by repetitions so divided by $2 \cdot (3!)$ so answer $= 20$

So final answer should be $125 \cdot 20 = 2500$. But this answer is wrong and I don't understand why.

How many six-digit numbers can be formed using numbers from the set $\{1, 2, 3, 4, 5\}$ with replacement if the digit $2$ must appear at least three times?

There are $\binom{6}{k}$ ways of choosing exactly $k$ positions for the $2$'s and $4^{6 - k}$ ways to fill the remaining $6 - k$ positions with a number different from $4$. The number of six-digit numbers that can be formed using numbers from the set $\{1, 2, 3, 4, 5\}$ in which the digit $2$ appears at least three times can be found by adding the number of outcomes in which the digit $2$ appears exactly three times, exactly four times, exactly five times, and exactly six times $$\sum_{k = 3}^{6} \binom{6}{k}4^{6 - k} = \binom{6}{3}4^3 + \binom{6}{4}4^2 + \binom{6}{5}4^1 + \binom{6}{6}4^0 = 1545$$ (as Dionel Jaime found) or by subtracting the number of outcomes in which the digit $2$ appears fewer than three times from the total number of words that can be formed from the five numbers in the set when those numbers are used with replacement $$5^6 - \sum_{k = 0}^{2} \binom{6}{k}4^{6 - k} = 5^6 - \left[\binom{6}{0}4^6 + \binom{6}{1}4^5 + \binom{6}{2}4^4\right] = 1545$$

Where did you make your mistake?

By designating three positions for the $2$'s and then filling the remaining three positions with any of the five numbers in the set, you counted cases in which $2$ appears more than three times multiple times.

You counted cases in which the digit $2$ appears four times four times, once for each of the $\binom{4}{3}$ ways you could designate three of the four $2$'s as your three $2$'s. To see this, observe that you count the number $232422$ four times: $$\color{blue}{2}3\color{blue}{2}4\color{blue}{2}2$$ $$\color{blue}{2}3\color{blue}{2}42\color{blue}{2}$$ $$\color{blue}{2}324\color{blue}{22}$$ $$23\color{blue}{2}4\color{blue}{22}$$

You counted cases in which the digit $2$ appears five times ten times, once for each of the $\binom{5}{3}$ ways you could designate three of your five $2$'s as your three $2$'s. You counted cases in which the digit $2$ appears six times twenty times, once for each of the $\binom{6}{3}$ ways you could designate three of your six $2$'s as your three $2$'s. Notice that $$\binom{6}{3}4^3 + \binom{4}{3}\binom{6}{4}4^2 + \binom{5}{3}\binom{6}{5}4^1 + \binom{6}{3}\binom{6}{6}4^0 = 2500$$

Let ${S_n}$ be the number of ways you can have the digit 2 appears ONLY 3, 4 ,5 , and 6 times where $n = 3 , 4 , 5, 6$. We can then add $S_3 + S_4 + S_5 + S_6$ to get our answer. To find $S_n$, note that there are ${6}\choose {n}$ ways of arranging the 2's, and for each of those there are $6-n$ places for the other digits; however, we will not include 2 in these other digits or else we will end up overcounting. So we $4^{(6-n)}$ different numbers we can make.

So $S_3 =$ ${6}\choose{3} $$4^3 S_4 = {6}\choose {4}$$4^2$

$S_5 =$ ${6}\choose{5}$$4 = 24$

$S_6 =$ ${6}\choose{6}$ $=1$

Now just add these numbers up.

• This seems to be the correct answer exept S6=1 but I coudnt u derstand what you did..sorry...what do you mean "..6 digit 2 appears only 3,4,5 and 6 times where n = 3,4,5,6" ? – Alexandra Jul 16 '17 at 6:55
• Oops, sorry about that. I edited the 6 to a 1 and for example, $S_3$ is the number of 6 digit numbers you can make with the the digits {1, 2, 3, 4, 5} where exactly 3 of the digits are 2. Similarly $S_4$ is the number of 6 digit numbers you can make with the digits "{1,2,3,4,5} where exactly 4 of the digits are 2 and so on... – Dionel Jaime Jul 16 '17 at 6:57

Since you have only $5$ numbers, you can try it making cases

Case $1.$ When there are $3~2's$

$3$ spaces left

Case $1.a)$ When all the three numbers are different

Total numbers= $4\times 3\times 2=24$

Total permutation=$\frac{6!}{3!}=120$

Total cases=$24\times 120=2880$

Case $1.b)$ When two of three numbers are same

Total numbers=$12$

Total permutation=${6!}{3!2!}=60$

Total cases=$12\times 60=720$

Case 2. When there are $4 ~2's$

$2$ places left

Case $2.a)$ When the two numbers are different

Total numbers=$4\times 3=12$

Total permutation=$\frac{6!}{4!}$

Total cases=$12\times 30=360$

Case $2.b) When the two numbers are same Total numbers=$4$Total permutation=$\frac{6!}{4!2!}=15$Total cases=$4\times 15=60$Case$3.$When there are five$2's$Total cases=$4\times 6=24$Case$4.$When there are six$2's$Total cases=$1$Adding all will give$2880+720+360+60+24+1=4045$• There could be calculation mistake, but the way is appropriate – Atul Mishra Jul 16 '17 at 6:33 • Your answer is incorrect. In case 1(a), there are$\binom{6}{3}$ways to choose the positions of the three$2$'s,$4$ways to fill the leftmost open position,$3$ways to fill the middle open position, and$2$ways to fill the last open position, so there are$\binom{6}{3} \cdot 4 \cdot 3 \cdot 2 = 480\$ possible permutations. This is not the only error. For instance, you overlooked the possibility that one of the other digits is used three times. – N. F. Taussig Jul 16 '17 at 7:58