probability of drawing a 5 card flush given n cards

1.1k Views Asked by At

Given $n$ random cards from a standard $52$ card deck, what is the probability of getting at least a 5 card flush within those $n$ cards? $n$ would be 5 <= $n$ < 17. The probability would get closer and closer to 1 as $n$ approaches 17. Basically, I need an equation to compute the increasing probability of getting at least a 5 card flush as you draw more and more cards from a 52 card deck.

Is it simply $$\frac {(^4C_1* ^{13}C_5)}{^{52}C_n}$$

4

There are 4 best solutions below

0
On BEST ANSWER

To make the formulas a little more compact, I'm going to use the notation $\binom pq$ rather than $^pC_q$ for number of combinations.

Notice that $^4C_1 \times {^{13}C_5} = \binom41\binom{13}{5}$ is a constant, whereas $^{52}C_n = \binom{52}{n}$ increases as $n$ increases, so $$ \frac{\binom41\binom{13}{5}}{\binom{52}{n}} $$ gets progressively smaller as $n$ gets larger, opposite from what you know the correct answer must do. Therefore this cannot be the answer.

The formula above is correct in the case $n=5$ only. It is true that the probability of drawing at least one $5$-card flush in $n$ cards can be expressed as a fraction with denominator $\binom{52}{n},$ but in general the numerator is larger than $\binom41\binom{13}{5}.$

Let $K(n)$ be the number of $n$-card hands with at least one $5$-card flush, so that the desired probability is $$ \frac{K(n)}{\binom{52}{n}}, $$ and let's see how we can compute $K(n)$ for a few different values of $n.$

For $n=6,$ we have to consider the $\binom{13}{6}$ different sets of $6$ cards that might be drawn from one suit times the $4$ different suits from which they might be drawn; but we also have to consider the $\binom{13}{5}$ different sets of $5$ cards that might be drawn from one suit times the $\binom{13}{1}$ ways to draw the sixth card from another suite times the $4\times3$ different permutations of suits from which they might be drawn. So $$ K(6) = 4 \binom{13}{6} + 12 \binom{13}{5} \binom{13}{1} = 207636. $$

For $n=7$ the possibilities are not just $7$ of one suit or $6$ of one suit and $1$ of another; it could be $5$ of one suit and $2$ of another, or $5$ of one suit and $1$ each of two others. In that last case, the only choices of suits are $4$ choices for the long suit and which of the other $3$ suits does not occur; it doesn't matter which of the two singleton suits we write first. So $$ K(7) = 4 \binom{13}{7} + 12 \binom{13}{6} \binom{13}{1} + 12 \binom{13}{5} \binom{13}{2} + 12 \binom{13}{5} \binom{13}{1}^2 = 4089228 $$

It's hard to imagine how we're going to write a simple formula for $K(n)$ using the usual combinatoric functions, since for the next few $n,$ each time we add a card we increase the number of different possible counts of cards by suit; for example, for $n=8$ the number of cards in each suit can be $8$ (all one suit), $7 + 1,$ $6+2,$ $6+1+1,$ $5+3,$ $5+2+1,$ or $5+1+1.$ The formula would not even fit on one line of this answer format.

For $n$ close to $17,$ the formulas are simpler if we count the number of non-flushes, that is, $\binom{52}{n} - K(n).$ For example, for $n=16,$ the only non-flushes obtained by drawing $4$ cards from each suit, $$ \binom{52}{16} - K(16) = \binom{13}{4}^4 = 261351000625. $$ For $n=15,$ we can only have $4$ cards from three of the suits and $3$ from the other, with $4$ different choices of the $3$-card suit, so $$ \binom{52}{15} - K(15) = 4 \binom{13}{4}^3 \binom{13}{3} = 418161601000. $$

For $n=14,$ the possible numbers of cards of each suit are $4+4+4+2$ or $4+4+3+3$, so $$ \binom{52}{14} - K(14) = 4 \binom{13}{4}^3 \binom{13}{2} + \binom62 \binom{13}{4}^2 \binom{13}{3}^2 = 364941033600. $$

Observing that $\binom{52}{6} - K(6) = 20150884$ and $\binom{52}{7} - K(7) = 129695332,$ we can see that the result of the computer calculation offered in another answer is correct for $n \in \{4,5,6,7,14,15, 16, 17\}.$

5
On

I've got kind of a dumb answer. I just wrote a program that counts the number $f$ of non-flush hands for a hand of $n$ cards and the total number of possible hands $t$ to arrive at the probability $P=1-f/t$.

! flush.f90 -- Calculates probability of getting a flush
module FlushFun
   use ISO_FORTRAN_ENV
   implicit none
   integer choose(0:13)
   contains
      function nfree(n)
         integer n
         integer(INT64) nfree
         integer n1, n2, n3
         integer(INT64) L1, L2, L3
         nfree = 0
         do n1 = max(0,n-12), min(4,n)
            L1 = choose(n1)
            do n2 = max(0,n-n1-8), min(4,n-n1)
               L2 = L1*choose(n2)
               do n3 = max(0,n-n1-n2-4), min(4,n-n1-n2)
                  L3 = L2*choose(n3)
                  nfree = nfree+L3*choose(n-n1-n2-n3)
               end do
            end do
         end do
      end function nfree
      function ntotal(n)
         integer n
         integer(INT64) ntotal
         integer i
         ntotal = 1
         do i = 1, N
            ntotal = ntotal*(52-i+1)/i
         end do
      end function ntotal
      subroutine init_params
         integer i
         integer(INT64) j
         integer(INT64) fact(0:13)
         fact = [(product([(j,j=1,i)]),i=0,13)]
         choose = [(fact(13)/fact(i)/fact(13-i),i=0,13)]
      end subroutine init_params
end module FlushFun

program flush
   use FlushFun
   implicit none
   integer(INT64) free, total
   real(REAL64) probability
   integer n
   call init_params
   write(*,'(a)') '\begin{array}{rrrl}'
   write(*,'(a)') '\text{Cards} & \text{Non-Flush} & \text{Total} & \text{Probability}\\'
   write(*,'(a)') '\hline'
   do n = 4,17
      free = nfree(n)
      total = ntotal(n)
      probability = 1-real(free,REAL64)/total
      write(*,'(*(g0))') n, ' & ', free,' & ',total,' & ',probability,' \\'
   end do
   write(*,'(a)') '\end{array}'
end program flush

$$\begin{array}{rrrl} \text{Cards} & \text{Non-Flush} & \text{Total} & \text{Probability}\\ \hline 4 & 270725 & 270725 & 0.0000000000000000 \\ 5 & 2593812 & 2598960 & 0.19807923169267161E-002 \\ 6 & 20150884 & 20358520 & 0.10198973206303807E-001 \\ 7 & 129695332 & 133784560 & 0.30565769323455561E-001 \\ 8 & 700131510 & 752538150 & 0.69639844837102283E-001 \\ 9 & 3187627300 & 3679075400 & 0.13357924113216058 \\ 10 & 12234737086 & 15820024220 & 0.22662968679070705 \\ 11 & 39326862432 & 60403728840 & 0.34893320019744667 \\ 12 & 104364416156 & 206379406870 & 0.49430799449026441 \\ 13 & 222766089260 & 635013559600 & 0.64919475199817445 \\ 14 & 364941033600 & 1768966344600 & 0.79369814767023128 \\ 15 & 418161601000 & 4481381406320 & 0.90668912929163414 \\ 16 & 261351000625 & 10363194502115 & 0.97478084575449575 \\ 17 & 0 & 21945588357420 & 1.0000000000000000 \\ \end{array}$$ Not carefully checked, but at least it gives the right answers for $n\in\{4,5,17\}$.

EDIT: To show how you could solve this problem by hand I wrote a program that really does find all the partitions of $n$ into $4$ integers in $[0,4]$. The most partitions you get is $8$ for $n=8$. Consider the partition $8=4+2+2+0$. In the table below this is represented as $4$ clubs, $2$ diamonds, $2$ hearts and no spades, but there are actually $$\frac{4!}{1!2!1!}=12$$ Ways to choose the suits. For the given choice of suits, there are $\binom{13}{4}=715$ ways to select $4$ clubs, $\binom{13}{2}=78$ ways to select $2$ diamonds, $\binom{13}{2}=78$ ways to select $2$ hearts, and $\binom{13}{0}=1$ way to select $0$ spades, so there are $12\times715\times78\times78\times1=52200720$ possible non-flush hands with the $4-2-2-0$ distribution. Here is the program that shows these calculations:

! flush2.f90 -- Calculates probability of getting a flush
module FlushFun
   use ISO_FORTRAN_ENV
   implicit none
   integer choose(0:13)
   contains
      function nfree(n)
         integer n
         integer(INT64) nfree
         integer n1, n2, n3, n4
         integer(INT64) L1, L2, L3, L4
         integer(INT64) term
         integer current, w1, w2, w3, w4
         nfree = 0
         write(*,'(a)') '$$\begin{array}{rrrr|r|rrrr|r}'
         write(*,'(a)') '\rlap{\text{Number}}&&&&'// &
            '&\rlap{\text{Hands in Suit}}&&&&\\'
         write(*,'(a)') '\clubsuit&\diamondsuit&\heartsuit&'// &
            '\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&'// &
            '\heartsuit&\spadesuit&\text{Total}\\'
         write(*,'(a)') '\hline'
         do n1 = min(4,n), (n+3)/4, -1
            L1 = choose(n1)
            w1 = 1
            current = 1
            do n2 = min(n1,n-n1), (n-n1+2)/3, -1
               L2 = choose(n2)
               current = merge(current+1,1,n2 == n1)
               w2 = w1*current
               do n3 = min(n2,n-n1-n2), (n-n1-n2+1)/2, -1
                  L3 = choose(n3)
                  current = merge(current+1,1,n3 == n2)
                  w3 = w2*current
                  n4 = n-n1-n2-n3
                  L4 = choose(n4)
                  current = merge(current+1,1,n4 == n3)
                  w4 = w3*current
                  term = 24/w4*L1*L2*L3*L4
                  write(*,'(*(g0))') n1,'&',n2,'&',n3,'&', &
                     n4,'&',24/w4,'&',L1,'&',L2,'&',L3,'&', &
                     L4,'&',term,'\\'
                  nfree = nfree+term
               end do
            end do
         end do
         write(*,'(*(g0))') '\hline&&&&&&&&\llap{\text{Hands for ',n,' cards:}}&',nfree
         write(*,'(a)') '\end{array}$$'
      end function nfree
      subroutine init_params
         integer i
         integer(INT64) j
         integer(INT64) fact(0:13)
         fact = [(product([(j,j=1,i)]),i=0,13)]
         choose = [(fact(13)/fact(i)/fact(13-i),i=0,13)]
      end subroutine init_params
end module FlushFun

program flush2
   use FlushFun
   implicit none
   integer(INT64) free
   integer n
   call init_params
   do n = 4,17
      free = nfree(n)
   end do
end program flush2

And here are the tables in prints out: $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&0&0&0&4&715&1&1&1&2860\\ 3&1&0&0&12&286&13&1&1&44616\\ 2&2&0&0&6&78&78&1&1&36504\\ 2&1&1&0&12&78&13&13&1&158184\\ 1&1&1&1&1&13&13&13&13&28561\\ \hline&&&&&&&&\llap{\text{Hands for 4 cards:}}&270725 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&1&0&0&12&715&13&1&1&111540\\ 3&2&0&0&12&286&78&1&1&267696\\ 3&1&1&0&12&286&13&13&1&580008\\ 2&2&1&0&12&78&78&13&1&949104\\ 2&1&1&1&4&78&13&13&13&685464\\ \hline&&&&&&&&\llap{\text{Hands for 5 cards:}}&2593812 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&2&0&0&12&715&78&1&1&669240\\ 4&1&1&0&12&715&13&13&1&1450020\\ 3&3&0&0&6&286&286&1&1&490776\\ 3&2&1&0&24&286&78&13&1&6960096\\ 3&1&1&1&4&286&13&13&13&2513368\\ 2&2&2&0&4&78&78&78&1&1898208\\ 2&2&1&1&6&78&78&13&13&6169176\\ \hline&&&&&&&&\llap{\text{Hands for 6 cards:}}&20150884 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&3&0&0&12&715&286&1&1&2453880\\ 4&2&1&0&24&715&78&13&1&17400240\\ 4&1&1&1&4&715&13&13&13&6283420\\ 3&3&1&0&12&286&286&13&1&12760176\\ 3&2&2&0&12&286&78&78&1&20880288\\ 3&2&1&1&12&286&78&13&13&45240624\\ 2&2&2&1&4&78&78&78&13&24676704\\ \hline&&&&&&&&\llap{\text{Hands for 7 cards:}}&129695332 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&0&0&6&715&715&1&1&3067350\\ 4&3&1&0&24&715&286&13&1&63800880\\ 4&2&2&0&12&715&78&78&1&52200720\\ 4&2&1&1&12&715&78&13&13&113101560\\ 3&3&2&0&12&286&286&78&1&76561056\\ 3&3&1&1&6&286&286&13&13&82941144\\ 3&2&2&1&12&286&78&78&13&271443744\\ 2&2&2&2&1&78&78&78&78&37015056\\ \hline&&&&&&&&\llap{\text{Hands for 8 cards:}}&700131510 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&1&0&12&715&715&13&1&79751100\\ 4&3&2&0&24&715&286&78&1&382805280\\ 4&3&1&1&12&715&286&13&13&414705720\\ 4&2&2&1&12&715&78&78&13&678609360\\ 3&3&3&0&4&286&286&286&1&93574624\\ 3&3&2&1&12&286&286&78&13&995293728\\ 3&2&2&2&4&286&78&78&78&542887488\\ \hline&&&&&&&&\llap{\text{Hands for 9 cards:}}&3187627300 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&2&0&12&715&715&78&1&478506600\\ 4&4&1&1&6&715&715&13&13&518382150\\ 4&3&3&0&12&715&286&286&1&701809680\\ 4&3&2&1&24&715&286&78&13&4976468640\\ 4&2&2&2&4&715&78&78&78&1357218720\\ 3&3&3&1&4&286&286&286&13&1216470112\\ 3&3&2&2&6&286&286&78&78&2985881184\\ \hline&&&&&&&&\llap{\text{Hands for 10 cards:}}&12234737086 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&3&0&12&715&715&286&1&1754524200\\ 4&4&2&1&12&715&715&78&13&6220585800\\ 4&3&3&1&12&715&286&286&13&9123525840\\ 4&3&2&2&12&715&286&78&78&14929405920\\ 3&3&3&2&4&286&286&286&78&7298820672\\ \hline&&&&&&&&\llap{\text{Hands for 11 cards:}}&39326862432 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&4&0&4&715&715&715&1&1462103500\\ 4&4&3&1&12&715&715&286&13&22808814600\\ 4&4&2&2&6&715&715&78&78&18661757400\\ 4&3&3&2&12&715&286&286&78&54741155040\\ 3&3&3&3&1&286&286&286&286&6690585616\\ \hline&&&&&&&&\llap{\text{Hands for 12 cards:}}&104364416156 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&4&1&4&715&715&715&13&19007345500\\ 4&4&3&2&12&715&715&286&78&136852887600\\ 4&3&3&3&4&715&286&286&286&66905856160\\ \hline&&&&&&&&\llap{\text{Hands for 13 cards:}}&222766089260 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&4&2&4&715&715&715&78&114044073000\\ 4&4&3&3&6&715&715&286&286&250896960600\\ \hline&&&&&&&&\llap{\text{Hands for 14 cards:}}&364941033600 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&4&3&4&715&715&715&286&418161601000\\ \hline&&&&&&&&\llap{\text{Hands for 15 cards:}}&418161601000 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline 4&4&4&4&1&715&715&715&715&261351000625\\ \hline&&&&&&&&\llap{\text{Hands for 16 cards:}}&261351000625 \end{array}$$ $$\begin{array}{rrrr|r|rrrr|r} \rlap{\text{Number}}&&&&&\rlap{\text{Hands in Suit}}&&&&\\ \clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Ways}&\clubsuit&\diamondsuit&\heartsuit&\spadesuit&\text{Total}\\ \hline \hline&&&&&&&&\llap{\text{Hands for 17 cards:}}&0 \end{array}$$

0
On

An alternative approach is use a generating function.

Let $a_n$ be the number of $n$-card hands which do not include a 5-card flush, i.e., each suite has 0,1,2,3, or 4 cards in the hand. Define the generating function $$f(x) = \sum_{n=0}^{\infty} a_n x^n$$ Then $$f(x) = \left[ 1 + \binom{13}{1} x + \binom{13}{2} x^2 + \binom{13}{3} x^3 + \binom{13}{4} x^4 \right]^4$$ which yields, on expansion (I used a computer algebra system) $$f(x) = 1+52 x+1326 x^2+22100 x^3+270725 x^4+2593812 x^5+20150884 x^6+129695332 x^7+700131510 x^8+3187627300 x^9+12234737086 x^{10}+39326862432 x^{11}+104364416156 x^{12}+222766089260 x^{13}+364941033600 x^{14}+418161601000 x^{15}+261351000625 x^{16}$$

The probability that an $n$-card hand does not include a 5-card flush is $$p_n = \frac{a_n}{\binom{52}{n}}$$ so, for example, $$p_6 = \frac{20150884}{\binom{52}{6}} = 0.989801$$ and the probability a 6-card hand does include a 5-card flush is $1-p_6 = 0.010199$.

1
On

A simple approach! You draw say 10 cards. The probability that any of these cards is a particular suite is 1/4. Conversely the prob that any card in not say a diamond is 3/4. Then what is probability that 5 cards are the same suite is inverse that any 5 cards are Not the same suite. This is simply 3/4 ^ 5 = 23.7%. So prob of a simple 5 card flush from 10 cards is 76.3% which to a card player feels about right! Cheers