# How many different 4-digit numbers can be made with the digits from 12333210?

How many different 4-digit numbers can be made with the digits from $$12333210$$?

Attempt. So I've tried splitting into cases:

Case 1: Only single letters.

1 2 3 0, except for when 0 is at the first place, so total arrangements minus the arrangements where 0 is in the first place. That is: $$4!-3!$$ (I think)

Case 2: One double only.

So either (the "[]" represent the remaining letters for the other 2 places), 1 1 [2,3,0], or 2 2 [1,3,0], or 3 3 [1,2,0]. $$\frac{4P2}{2!}\cdot 3P2\cdot 3-\frac{3P2}{2!}\cdot 2P1\cdot 3$$ the $$4P2$$ is for the double to be arranged in the any 2 of 4 places, the $$3P2$$ is the 3 remaining letters to be arranged in the 2 remaining places, and times 3 because we have 3 cases of this as I wrote above, and finally substracting the other term for the arrangements where 0 is in the first place, $$3P2$$ to arrange the double onto the remaining 3 places, $$2P1$$ to arrange the remaining 2 letters onto the last space and 3 times due to the 3 cases. And any of the $$/2!$$ is to account the repeated digits on the doubles.

Case 3: 2 doubles?? I'm unsure whether I should compute this because it may be accounted on the 2nd case already

Case 4: 1 triple.

The only way to exist a triple is the one such that 3 3 3 [0,1,2], substracting once again the times where 0 is in the first place: $$\frac{4P3}{3!}\cdot 3P1-1$$ $$\frac{4P3}{3!}$$ on account of the triple to be arranged on the 4 places, $$3P1$$ for the 3 remaining letters to be arranged at the remaining space and $$-1$$ on account of the arrangement where 0 is in the first place and followed by 333. Hence my final answer would be to add all these 3 or 4 cases, but I'm unsure if any case arrangement is wrong, if I should account for the 3rd case or not, and if I've managed with the "0 can't be on the first place" correctly by accounting it on each case individually.

And please, if I have something wrong with my arrangements calculations, please let me know why my thinking is incorrect, I've added the reason to everything I've posted as a result for a reason.

Your working is correct but you need to count numbers with two doubles separately. It is not counted in case $$\small 2$$.

Here is an alternate solution before I come to your working.

Count of four digit numbers $$\displaystyle \small = 3 \cdot (3^3 - 2) + (3^4 - 3 - 2 \cdot 2 \cdot 4) = 137$$

Explanation:

First term is four digit numbers with zero. There are $$3$$ places for zero. Rest of the digits can be any permutations of $$1, 2, 3$$ with repetition except no triples of $$1$$ and $$2$$ (as we have only two $$1$$'s and $$2$$'s).

Second term is four digit numbers without zero. All digits have choice of $$1, 2, 3$$ except that we cannot have any of them $$4$$ times so we subtract $$3$$. We also cannot have triples of $$1$$ or $$2$$. For each triple, we can have fourth digit from remaining two and they can be in any of the four places. So we subtract $$\displaystyle \small 2 \cdot 2 \cdot 4$$.

Case $$3$$: Two doubles. First choose two doubles from $$\{1, 2, 3\}$$ and so count of $$4$$ digit numbers,

$$= \displaystyle \small {3 \choose 2} \frac{4!}{2!2!} = 18$$

Case $$1$$: All digits are different. Choose one of the three places for $$0$$ and then remaining $$3$$ digits can be permuted in $$3!$$ ways. So count of $$4$$ digits numbers $$\displaystyle \small = 3 \cdot 3! = 18$$

Case $$2$$: One double. Choose one double from $$\{1, 2, 3 \}$$ and then we either have other two digits from rest of $$\{1, 2, 3 \}$$ one each or we have one of them along with $$0$$. So count of $$4$$ digit numbers,

$$\displaystyle \small = {3 \choose 2} \cdot \bigg[\frac{4!}{2!} + 2 \cdot \frac{3 \cdot 3!}{2!} \bigg]= 90$$

Case $$4$$: Triple. We have total of $$\displaystyle \small 2 \cdot 4 + 3 = 11$$ four digit numbers.

That leads to total count of $$\displaystyle \small 137$$ four digit numbers.

The problem can be also computed from the given digits as

($$4$$ digit numbers without $$0$$) + $$3\times$$($$3$$ digit numbers with $$0$$ appropriately inserted )

Thus (coefficient of $$x^4 + 3\times$$(coefficient of $$x^3))\;$$ in $$(1+x+\frac{x^2}{2!})^2(1+x+\frac{x^2}{2!} + \frac{x^3}{3!}) = 62+3\cdot25 = 137$$

If this method is unknown to you, it is well worth learning, you can look here for a simple explanation for a well-known prototype.

For $$i\in\{0,1,2,3\}$$, let $$n_i \ge 0$$ be the number of $$i$$s. Apply the principle of inclusion-exclusion, where the four properties to be avoided are $$n_0 \ge 2, n_1 \ge 3, n_2 \ge 3, n_3 \ge 4$$. Ignoring the properties yields $$4^4$$ four-digit numbers with digits from $$\{0,1,2,3\}$$. If we specify $$n_i=k$$, we have $$\binom{4}{k}$$ choices of positions for the $$i$$s and $$3^{4-k}$$ ways to populate the remaining $$4-k$$ positions with $$\{0,1,2,3\} \setminus \{i\}$$. The $$n_1$$ and $$n_2$$ cases are identical. No pairs of properties can be satisfied. Putting it all together, we obtain $$4^4 - \left(\sum_{k=2}^4 \binom{4}{k}3^{4-k} + 2\sum_{k=3}^4 \binom{4}{k}3^{4-k} + \binom{4}{4}3^{4-4}\right)=162$$ four-digit numbers that might include a leading zero.

To count the cases with leading zero, consider three-digit numbers with digits from $$\{1,2,3\}$$ that avoid $$n_1 \ge 3$$ or $$n_2 \ge 3$$. Another application of inclusion-exclusion yields $$3^3 - 2\binom{3}{3}2^{3-3} = 25.$$

So the final count of four-digit numbers with no leading zero is $$162-25=137$$.