# Odds of drawing any 3 identical cards from 27-card deck (9 unique x 3 copies each) in 9 draws

I have a 27-card deck with 3 copies of each of 9 distinct cards. If I'm drawing 9 cards, what are the odds that I draw all 3 copies of any one of the 9 possible options? [Also known as "What are the odds of drawing all three of the same city in the Pandemic Legacy season 2 prologue game?"]

My initial approach was to count the number of possible matching hands versus the $${27 \choose 9}$$ total possible number of hands.

I figured that there are $${24 \choose 6}$$ possible ways to pick the rest of the 9-card draw after assuming one full set of 3 cards, so that makes $$9 * {24\choose6}$$ starting hands.

However, this double-counts hands that have two or more sets of 3 cards so I need to subtract those. Calculating that follows a similar approach, so we have to subtract $$8 * {21 \choose 3}$$ cards. Of course that latter bit double-counts the hands where our six cards are two sets of three. So we have to subtract the 7 such hands from that.

So my final formulation was: $$\frac{9 * {24\choose6} - (8 * {21\choose3} - 7)}{27\choose9}$$ ~= 25.6%

Does that seem right? If not, what am I doing wrong?

Sure, inclusion-exclusion (as you've done) is one way to do it. It's nice to check by doing it another way when you can. In this case, consider the ways to choose $$9$$ cards without choosing all three of any one "rank". You must either have $$9$$ singletons, or $$7$$ singletons and a pair, or $$5$$ singletons and two pairs, or $$3$$ singletons and $$3$$ pairs, or one singleton and $$4$$ pairs. Each singleton or pair can be chosen in three ways from its "rank". So this amounts to $$3^9+\frac{9!}{7!}\cdot3^8+\frac{9!}{5!2!2!}\cdot3^7+\frac{9!}{3!3!3!}\cdot3^6+\frac{9!}{4!4!}\cdot3^5=3523257$$ ways to not get three of any one "rank". Dividing this by the $${{27}\choose{9}}=4686825$$ draws gives a $$\frac{3523257}{4686825}\approx 75.174\%$$ chance of not getting three of a kind, which doesn't quite agree with your stated chance of getting one. You've done two small things wrong. First, when subtracting the double-counted cases (where you've drawn two sets of three and three leftovers), there are $${{9}\choose{2}}=36$$ (not just $$8$$) ways to choose the two ranks. Second, when adding back in the double-counted cases from that set (where you've drawn three sets of three), there are $${{9}\choose{3}}=84$$ possibilities (not just $$7$$). So you should get $$\frac{9\cdot{{24}\choose{6}} - 36\cdot {{21}\choose{3}} + 84}{{27}\choose{9}}=\frac{1163568}{4686825}\approx 24.826\% ...$$ this is now in exact agreement with the other approach.

Note: "probability" and "odds" are not the same thing. $$1:1$$ odds corresponds to probability $$\frac 12$$, for example. It looks like you are computing the probability, so that's what I have done below.

The approach is fine, but the arithmetic is not. There are $$\binom 92=36$$ ways to choose two cities and $$\binom 93=84$$ ways to choose three. Thus your numerator should be $$9\times \binom {24}6-36\times \binom {21}3+84$$ making your final answer $$\frac {1163568}{4686825}=.2483$$

As another approach:

Let's work backwards. Let $$p$$ be the probability that no three of a kind is drawn.

Then each city must be represented by $$0,1,2$$ cards.

If there are exactly $$n$$ cities for which you drew $$2$$ cards then there must be $$9-2n$$ cities for which you drew exactly $$1$$.

Assuming you drew exactly $$n$$ cities for which you drew two cards, then we need to choose those $$n$$ cities ($$\binom 9n$$), choose the two cards from each city (3), then choose the $$9-2n$$ cities for which one card will be drawn ($$\binom {9-n}{9-2n}$$), and choose the one card from each of those cities. Thus $$\binom 9n \times 3^n\times \binom {9-n}{9-2n}\times 3^{9-2n}$$

We need to sum these from $$n=0$$ to $$n=4$$ and divide by the total number of hands, namely $$\binom {27}9$$. Thus $$p=\sum_{n=0}^4 \binom 9n \times 3^n\times \binom {9-n}{9-2n}\times 3^{9-2n}\Bigg / \binom {27}{9}=\frac {3523257}{4686825}=.7517$$

So, barring arithmetic error, the answer to your question is $$1-p=\boxed {.2483}$$

Generating Function Approach

For each "suit" there is $$\binom30=1$$ way to choose $$0$$ cards, $$\binom31=3$$ ways to choose $$1$$ card, $$\binom32=3$$ ways to choose $$2$$ cards, and $$\binom33=1$$ way to choose $$3$$ cards.

Therefore, I counted the number of ways to draw no more than $$2$$ of each suit to be \begin{align} &\left[x^9\right]\left(1+3x+3x^2\right)^9\\[6pt] &=\left[x^9\right]\left((1+x)^3-x^3\right)^9\\[3pt] &=\left[x^9\right]\left(\binom90(1+x)^{27}-\binom91(1+x)^{24}x^3+\binom92(1+x)^{21}x^6-\binom93(1+x)^{18}x^9+\dots\right)\\ &=\binom90\binom{27}{9}-\binom91\binom{24}{6}+\binom92\binom{21}{3}-\binom93\binom{18}{0}\\[6pt] &=3523257 \end{align} Whereas, the number of ways to draw $$9$$ cards is \begin{align} \left[x^9\right]\left(1+3x+3x^2+x^3\right)^9 &=\left[x^9\right](1+x)^{27}\\ &=\binom{27}{9}\\ &=4686825 \end{align} this gives a probability for drawing at least one triple to be $$1-\frac{3523257}{4686825}\doteq0.24826359$$

Inclusion-Exclusion

Number of ways to draw a triple $$\overbrace{\overbrace{\ \ \ \binom{9}{1}\ \ \ }^{\substack{\text{choices}\\\text{of suit}}}\overbrace{\ \ \binom{24}{6}\ \ }^{\substack{\text{choices}\\\text{for rest}}}}^{\text{one triple}}-\overbrace{\overbrace{\ \ \ \binom{9}{2}\ \ \ }^{\substack{\text{choices}\\\text{of suits}}}\overbrace{\ \ \binom{21}{3}\ \ }^{\substack{\text{choices}\\\text{for rest}}}}^{\text{two triples}}+\overbrace{\overbrace{\ \ \ \binom{9}{3}\ \ \ }^{\substack{\text{choices}\\\text{of suits}}}\overbrace{\ \ \binom{18}{0}\ \ }^{\substack{\text{choices}\\\text{for rest}}}}^{\text{three triples}}=1163568$$ Number of hands $$\binom{27}{9}=4686825$$ Giving the probability of getting a triple to be $$\frac{1163568}{4686825}=0.24826359$$