A deck has 32 cards divided into 4 types, each with 8 cards. In how many ways can we choose 6 cards so that all four types of cards are included among them?
Solution

Let's divide the appropriate choices of cards into two groups:

a) Group $S_{1}$: Two types are represented by two cards each, and the other two remaining types by only one card each.

b) Group $S_{2}$: One type is represented by three cards, and the other three remaining types by only one card each.

To count the number of cards in $S_{1}$, we can first choose the two types that will be represented by two cards from $\binom{4}{2}$ ways. Then, we can choose two cards from the 8 of each of these types in $\binom{8}{2} \cdot\binom{8}{2}$. Finally, we can choose the remaining cards from the remaining groups in $\binom{8}{1} \cdot\binom{8}{1}$ ways. Therefore, the number of elements in $S_{1}$ is

$$
\binom{4}{2} \cdot\binom{8}{2} \cdot\binom{8}{2} \cdot\binom{8}{1} \cdot\binom{8}{1}=\binom{4}{2} \cdot\binom{8}{2}^{2} \cdot 8^{2}
$$

To count the number of cards in $S_{2}$, we can initially choose the type that will be represented by 3 cards from $\binom{4}{1}$ ways. Then, the three cards of this type can be chosen in $\binom{8}{3}$ ways. Finally, we can choose the remaining cards from the three remaining groups in $\binom{8}{1} \cdot\binom{8}{1} \cdot\binom{8}{1}$ ways. Therefore, the number of elements in $S_{2}$ is

$$
\binom{4}{1} \cdot\binom{8}{3} \cdot\binom{8}{1} \cdot\binom{8}{1} \cdot\binom{8}{1}=\binom{4}{3} \cdot\binom{8}{3} \cdot 8^{3}
$$

Thus, the number of choices is

$$
\binom{4}{2} \cdot\binom{8}{2}^{2} \cdot 8^{2}+\binom{4}{3} \cdot\binom{8}{3} \cdot 8^{3}=415744
$$