I'm self-learning combination theory and encountered this problem.
How many distinct $4$ digit number can be formed from picking numbers in $1,3,3,7,7,8$?
I'm thinking to permute all numbers then eliminate duplicates $3$ and $7$ so ${6!\over2!\times2!} = 180$. Then pick first $4$ digit and eliminate arrangement from the last two so $\frac{180}{2!} = 90$
I don't think this is correct since the second elimination will overcount.
How do I approach this kind of problems?
For $i\in\{1,3,7,8\}$, let $n_i \ge 0$ be the number of $i$s. The desired count is \begin{align} &\sum_{\substack{n_1+n_3+n_7+n_8=4:\\n_1 \le 1, n_3 \le 2, n_7 \le 2, n_8 \le 1}}\binom{4}{n_1,n_3,n_7,n_8} \\ &=\binom{4}{0,1,2,1} +\binom{4}{0,2,1,1} +\binom{4}{0,2,2,0} +\binom{4}{1,0,2,1} +\binom{4}{1,1,1,1} +\binom{4}{1,1,2,0} +\binom{4}{1,2,0,1} +\binom{4}{1,2,1,0} \\ &=\frac{4!}{0!1!2!1!} +\frac{4!}{0!2!1!1!} +\frac{4!}{0!2!2!0!} +\frac{4!}{1!0!2!1!} +\frac{4!}{1!1!1!1!} +\frac{4!}{1!1!2!0!} +\frac{4!}{1!2!0!1!} +\frac{4!}{1!2!1!0!} \\ &=12 +12 +6 +12 +24 +12 +12 +12 \\ &=102 \end{align}
An alternative approach is to use the principle of inclusion-exclusion, where the four properties to be avoided are $n_1 \ge 2, n_3 \ge 3, n_7 \ge 3, n_8 \ge 2$. Ignoring the properties yields $4^4$ four-digit numbers with digits from $\{1,3,7,8\}$. 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 $\{1,3,7,8\} \setminus \{i\}$. The $n_1$ and $n_8$ cases are identical, and the $n_3$ and $n_7$ cases are identical. The only pairs of properties that can be satisfied are $n_1=2$ and $n_8=2$, yielding $\binom{4}{2}2^{4-2-2}$ four-digit numbers. Putting it all together, we obtain $$4^4-2\left(\binom{4}{2}3^2+\binom{4}{3}3^1+\binom{4}{4}3^0\right)-2\left(\binom{4}{3}3^1+\binom{4}{4}3^0\right)+\binom{4}{2}2^0=102$$