4

Suppose we have a deck of 40 cards which has, 5 Aces, 6 Kings, 9 Queens, 20 Jacks. A game is played where a contestant will continuously draw cards until they have 5 matching cards (not necessarily in order). The cards are drawn without replacement.

I'm trying to find the probability of the contestant getting the five matching cards they get are all Aces (i.e. they have to get this before they get any other five matching cards).

Does anyone have any idea on how to approach this?

DH.
  • 342
  • 3
  • 21

2 Answers2

8

Suppose a win occurs when the fifth ace is drawn on draw $r+1$, for $0 \le r \le 16$. On the previous draw, the hand must have contained four aces and no more than four of any of the other ranks, and then the contestant must draw an ace on draw $r+1$.

Let's try to find the probability of being in a favorable state on draw $r$. There are $\binom{40}{r}$ possible hands of $r$ cards, all of which we assume are equally likely. We would like to count the number of hands containing exactly four aces and no more than four of any other rank, which we will call a "favorable hand". To do this, we will find the generating function of the number of favorable hands. Numbering the ranks from ace to jack as $1$ through $4$, let's say $n_i$ is the initial number of cards in the deck of rank $i$, for $i=1,2,3,4$, so $n_1 = 5$, $n_2=6$, etc. If we consider only cards of rank $i$, then the generating function for the number of hands containing zero to four of those cards is $$\sum_{j=0}^4 \binom{n_i}{j} x^j$$ The generating function for the number of ways to draw exactly four aces is simply $\binom{5}{4}x^4$; so the generating function for the number of favorable hands containing cards of all ranks is $$f(x) = \binom{5}{4}x^4 \prod_{i=2}^4 \sum_{j=0}^4 \binom{n_i}{j} x^j$$ I.e., the coefficient of $x^r$ when $f(x)$ is expanded, which which we will denote by $[x^r]f(x)$, is the number of hands containing exactly four aces and no more than four of any other rank. After some computation (I used Mathematica, but a pencil and paper computation should not be difficult), $$f(x) = 5 x^4+175 x^5+2975 x^6+32725 x^7+261800 x^8+ \\ 1544980 x^9+6741525 x^{10}+21960225 x^{11}+53723775 x^{12}+ \\ 96756975 x^{13}+122906250 x^{14} +102343500 x^{15}+45785250 x^{16}$$

The probability of a favorable hand of $r$ cards is then $$\frac{[x^r]f(x)}{\binom{40}{r}}$$ In order to win on draw $r+1$ the player must have a favorable hand on draw $r$ and then draw an ace on draw $r+1$, when there is one ace left in the deck and $40-r$ cards total. So the probability of a win on draw $r+1$ is $$\frac{[x^r]f(x)}{\binom{40}{r}} \cdot \frac{1}{40-r}$$ and the overall probability of winning is $$\sum_{r=0}^{16} \frac{[x^r]f(x)}{\binom{40}{r}} \cdot \frac{1}{40-r} = \boxed{0.00194347}$$ Edit (deleted)

Edit to the Edit

Prompted by one of the comments, I provided a list of learning resources for people who are new to generating functions and would like to learn about them. I have moved that list to a new question and answer here because it seems more suitable for development as a community resource. Please take a look.

awkward
  • 14,736
  • @user What do you mean by $p_1$? – awkward Mar 08 '19 at 18:20
  • @user Oh I see, you mean $p_i$ is the probability that rank $i$ is the first rank to get 5 cards. I haven't computed those other probabilities, but the probability I computed for aces is consistent with Monte Carlo results, so I'm pretty sure it's correct. If you see something wrong with the solution, please be specific. – awkward Mar 08 '19 at 19:59
  • @user OK, what are your numbers? – awkward Mar 08 '19 at 20:04
  • @awkward my monte carlo simulation comes up with the same answer as you awkward. Do you have any material to read about generating functions as I have not come across them before? – DH. Mar 08 '19 at 20:12
  • @DH. I would recommend actuarial course notes (if you can get your hands on them) great source for material on generating functions! – The Problem Mar 08 '19 at 20:14
  • @DH Many books on combinatorics discuss generating functions. One of the best books is "generatingfunctionology" by Wilf. You can find the book in pdf online, for free (but I think money spent on a hard copy is well spent). A couple of other books I think are noteworthy are "Concrete Mathematics" by Graham, Knuth, and Patashnik, and "An Introduction to the Analysis of Algorithms" by Sedgewick and Flajolet (which, despite the title, is mostly about generating functions). – awkward Mar 08 '19 at 20:18
  • @user Thanks, I will check and get back to you, but it will take a little time. – awkward Mar 08 '19 at 20:20
  • @user Using the method above, I calculate the probability that jacks will be the first to five ($p_4$) as $0.919792$, so we disagree there. I haven't computed the other probabilities, but I'm sticking with my original answer. One place I can think of where you might make a mistake is near the end: The probability that card $r+1$ is a jack is $16/(40-r)$, not $1/(40-r)$ as in the case of an ace. But I'm just guessing, not having seen your calculations. – awkward Mar 08 '19 at 20:41
  • You are right. This was my mistake. (+1) – user Mar 08 '19 at 20:48
  • @DH Another general book on combinatorics including generating functions is "Schaum's Outline of Theory and Problems of Combinatorics" by Balakrishnan. It is noteworthy for being inexpensive by comparison with most texts. – awkward Mar 08 '19 at 21:32
  • @DH.I have expanded the list of source material and incorporated it into the body of the answer, so please see above. And thank you for asking. – awkward Mar 09 '19 at 13:43
  • @awkward thank you. Still working through your answer but I haven't touched undergrad mathematics for a while. Do you have any recommendations for texts which have a practical approach with these type of problems? Also thank you for taking the time to recommend texts and your answer in general - very useful! – DH. Mar 11 '19 at 09:19
  • @DH Please take a look at the expanded list of recommendations: https://math.stackexchange.com/questions/3142386/how-can-i-learn-about-generating-functions/3142387 (The list continues to expand). One book I have not put in the list (so far) is "Applied Combinatorics" by Alan Tucker. I found the book easy to learn from (I think it was my first combinatorics text), so maybe it will help you too. – awkward Mar 11 '19 at 12:58
  • @DH Just FYI, I added Applied Combinatorics to the list. – awkward Mar 11 '19 at 13:50
  • @awkward thank you so much - appreciate the effort into your answer! Will take a look. – DH. Mar 11 '19 at 14:29
0

Since I didn't quite understand some of the details of awkward's answer, I computed the probabilities by modelling the process as an inhomogeneous Markov chain with the $5$ absorbing states: $5$ aces first, $5$ kings first, $5$ queens first and $5$ jacks first, and $5^4$ non-absorbing states: $\ j_1\ \mathrm{aces,}$ $j_2\ \mathrm{kings,}$ $j_3\ \mathrm{queens,}$ and $j4\ \mathrm{jacks}$, for $\ j_i\in \{0,1,2,3,4\}$. I got exactly the same numbers he did for aces and jacks to be the first to five. The probabilities for all four cards being first to five were: \begin{eqnarray} \mathrm{aces} &:& 0.00194347\\ \mathrm{kings} &:& 0.00824479\\ \mathrm{queens} &:& 0.07001983\\ \mathrm{jacks} &:& 0.91979191 \end{eqnarray}

Details of the Markov chain

Let $\ T_{t,c}\ $ be the probability that the process has terminated by step $\ t\ $ with $\ 5\ $ of card $\ c\ $, $\ t=0,1,\dots,17\ $, and $\ c=1,2,3,4\ $ indicating ace, king, queen and jack respectively. Since $\ 17\ $ cards will have been drawn after step $\ 17\ $, there must be $\ 5\ $ cards of one of the denominations, so $\ \sum_{c=1}^4 T_{17,c}=1\ $, and $\ T_{17,1}\ $ is the probability that that denomination is the ace.

Let $\ P_t\left(j_1,j_2,j_3,j_4\right)\ $ be the probability that after step $\ t\ $ there are $\ j_1\ $ aces, $\ j_2\ $ kings, $\ j_3\ $ queens and $\ j_4\ $ jacks in the hand drawn. For convenience in the the following description, extend the domain of definition of $\ P_t\left(j_1,j_2,j_3,j_4\right)\ $ to include quadruples $\ j_1, j_2, j_3, j_3\ $ of which any member, or combination of mmbers, can take the value $\ -1\ $, by putting $\ P_t\left(j_1,j_2,j_3,j_4\right)= 0\ $ whenever that is the case.

Initially, we have $\ T_{0,c} = 0\ $ for all $\ c\ $, $\ P_0\left(0,0,0,0\right)=1\ $, and $\ P_0\left(j_1,j_2,j_3,j_4\right)=0\ $ if any $\ j_i\ne 0\ $, and \begin{eqnarray} P_{t+1}\left(j_1,j_2,j_3,j_4\right) = \frac{6-j_1}{40-t} &P_t&\left(j_1-1,j_2,j_3,j_4\right)+\frac{7-j_2}{40-t}P_t\left(j_1,j_2-1,j_3,j_4\right)\\ &+&\frac{10-j_3}{40-t} P_t\left(j_1,j_2,j_3-1,j_4\right)+\frac{21-j_4}{40-t} P_t\left(j_1,j_2,j_3,j_4-1\right)\ , \end{eqnarray} \begin{eqnarray} T_{t+1,1} &=& T_{t,1}+\left(t-40\right)^{-1}\sum_{j_2=0}^{\mathrm{min}(4,t-4)}\sum_{j_3=0}^{\mathrm{min}(4,t-j_2-4)}P_t\left(4,j_2,j_3,t-j_3-j_2-4\right)\\ T_{t+1,2} &=& T_{t,2}+\frac{2}{t-40}\sum_{j_1=0}^{\mathrm{min}(4,t-4)}\sum_{j_3=0}^{\mathrm{min}(4,t-j_1-4)}P_t\left(j_1,4,j_3,t-j_3-j_1-4\right)\\ T_{t+1,3} &=& T_{t,3}+\frac{5}{t-40}\sum_{j_1=0}^{\mathrm{min}(4,t-4)}\sum_{j_2=0}^{\mathrm{min}(4,t-j_1-4)}P_t\left(j_1,j_2,4,t-j_2-j_1-4\right)\\ T_{t+1,4} &=& T_{t,4}+\frac{16}{t-40}\sum_{j_1=0}^{\mathrm{min}(4,t-4)}\sum_{j_2=0}^{\mathrm{min}(4,t-j_1-4)}P_t\left(j_1,j_2,t-j_2-j_1-4,4\right) \end{eqnarray}

lonza leggiera
  • 28,646
  • 2
  • 12
  • 33