If I have $~18~$ cards: $~1,~1,~1,~2,~2,~2,~3,~3,~3,~4,~4,~4,~5,~5,~5,~6,~6,~6~$ how many different hands of $~9~$ cards are possible. The order of the cards does not matter.

So $~1,~4,~5,~3,~6,~2,~4,~2,~2~$ is the same as $~1,~2,~2,~2,~3,~4,~4,~5,~6~$ etc so they should not be counted as different hands.

I've looked everywhere but I cannot find any relevant information which could help me. I can only find either answers for simpler questions or answers for incredibly harder questions when I looked and the answer (to me) doesn't seem obvious.

Edit: This question is similar though subtly different from the 10 cards out of a super deck as in this question the size of the hand exceeds the number of duplicate elements making it a much more complex question.


marked as duplicate by vonbrand, mrtaurho, Feng Shao, The Count, nmasanta Aug 28 at 1:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    $\begingroup$ @PsychoCom this is not a duplicate of that, but is related. See my comment on the linked question where I point out that the handsize in that problem is less than or equal to the number of copies of each individual card, a very convenient property. We in that problem could never "run out" of any particular type of card. This problem however we can run out of a particular type of card which complicates matters. Still, with correct application of inclusion-exclusion, the techniques used there can be salvaged. $\endgroup$ – JMoravitz Aug 27 at 13:09

If you don't mind using computers to help., this would be the coefficient of the $x^9$ term in the expansion of $(1+x+x^2+x^3)^6$ which would be $580$.

If you want a more pen-and-paper approach., then you can describe the problem as a "stars and bars" style problem with inclusion-exclusion.

Going through the example, we would have a final total of:


  • $\begingroup$ Can you elaborate on how does inclusion-exclusion come into play under this situation, when a particular type of card might "run out"? $\endgroup$ – PsychoCom Aug 27 at 13:15
  • 1
    $\begingroup$ @PsychoCom this related question shows another example. The short version is that the first term in my answer was the number of hands had we not bothered paying attention to the limited amount of each card available. We subtract the known "bad" outcomes where we had run out of a particular card. We had subtracted too much in doing that though, so we add back the amount of arrangements had we ran out of two cards simultaneously. $\endgroup$ – JMoravitz Aug 27 at 13:18
  • 1
    $\begingroup$ We would continue back and forth subtracting then adding as necessary, as per inclusion-exclusion, but we are able to stop there as it is impossible with a nine card hand to have taken too many of three or more card types at once, as that would have required us take more than nine cards to do so. $\endgroup$ – JMoravitz Aug 27 at 13:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.