This one involves clever reasoning, logic, and a nimble mind. I want you to find the odds in favor of being dealt each of the following hands:
Royal Flush 4 of a Kind Straight Flush Flush Straight Full House Two Pair 3 of a Kind Pair High Card **************************************************** **************************************************** 07-17-02, 08:29 PM Mack Tuesday First, let's count the total possible number of hands you can be dealt. This number is 52!/5!47! or 2598960.
By "high card" I assume you mean getting exactly one ace in your hand and nothing else that's interesting. Counting the hands that have one ace and no sets of face value matches, we have 4*48*44*40*36/4! = 506880. This is because there are 4 possible aces to be chosen for the first card, 48 non-aces for the second, 44 cards that have different face values from the ace and the second card, etc., and we need to divide out the 24 equivalent permutations for each combination. Of these 506880, 4*12*11*10*9/4! = 1980 are flushes because there are 4 suits, and the rest of the factors are determined similarly to the former calculation above. Also, 45 = 1024 are straights and 4 are straight flushes. So the total number of "high card" hands is 506880 - 1980 - 1024 + 4 = 503880, and the probability of receiving such a hand is about 0.194.
Now for the pair. There are 13 different face values and 4 suits, so there are 13*4*3/2 = 78 different kinds of pairs. The other three cards must all have different face values from each other and from the pair; there are 48*44*40/6 = 14080 such triplets. 78*14080 = 1098240. This yields a probability of about 0.422.
Four of a kind: 13*48 = 624. Probability: 0.000240.
Straight flush: 9*4 = 36. Probability: 0.0000138.
Royal flush: 4. Probability: 0.00000154.
There could be mistakes here. I recall that the pair is less likely to appear than my calculation indicates. I don't see my error, though. Isn't it also true that a full house beats a straight? ******** 07-17-02, 11:57 PM DrGerard There are C(52,5) [pronounced "52 choose 5"] different (unordered) hands of 5 cards from a deck of 52 (this means 2598960 different hands). All of these are equiprobable, so it's only a matter of counting how many fall into each type to determine the probability of that type. The "C" notation is also a good summary of how a numerical result can be obtained. For example, a straight flush is obtained by choosing one suit among 4 and the highest card among 9 (namely 5 corresponding to {A,2,3,4,5} which is the lowest straight to K corresponding to {9,10,J,Q,K} which is the highest straight flush below a Royal Flush). We may summarize that as C(4,1)C(9,1) or 36. For a mathematician, the probability of a straight flush (royal flush excluded) is thus 36/2598960 or 3/216580. The gambling vocabulary used in the question is slightly different; the "odds" of an event are said to be x to y "in favor" when the probability is x/(x+y), so that the above may be expressed by stating that the "odds in favor" of a straight flush are 3 to 216577. I'll leave it up to you to choose whichever expression you prefer, by expressing the probability P as a fraction and the so-called "odds" between quotes:
* Royal Flush: C(4,1)C(1,1) = 4; P = 1/649740 ("1 to 649739 in favor" or "649739 to 1 against") * Straight Flush: C(4,1)C(9,1) = 36; P = 3/216580 ("3 to 216577") * 4 of a Kind: C(13,1)C(48,1) = 624; P = 1/4165 ("1 to 4164") * Full House: C(13,1)C(4,3)C(12,1)C(4,2) = 3744; P = 6/4165 ("6 to 4159") * Flush: C(4,1)C(13,5) - 36 - 4 = 5108; P = 1277/649740 ("1277 to 648463") * Straight: C(10,1) 45 - 36 - 4 = 10200; P = 5/1274 ("5 to 1269") * 3 of a Kind: C(13,1)C(4,3)C(12,2) 42 = 54912; P = 88/4165 ("88 to 4077") * Two Pairs: C(13,2)C(4,2)C(4,2)C(44,1) = 123552; P = 198/4165 ("198 to 3967") * Pair: C(13,1)C(4,2)C(12,3)43 = 1098240; P = 352/833 ("352 to 481") * High Card: (C(13,5)-10)(45-4) = 1302540; P = 1277/2548 ("1277 to 1271")
A word of explanation for the last count. "High Card" means that the hand is "none of the above" so that two such hands are compared "highest card first" to decide who wins. Such a hand may be obtained by choosing independently a set of 5 values among the [C(13,5)-10] which do not make up a "straight" (like {A,2,3,4,5} or {10,J,Q,K,A}) and assign suits that are not all identical to the cards (among 45-4 possibilities). You may verify that the total of all of the above is 2598960 = C(52,5), as it should (because every hand is of one and only one of the types listed).
Comparing these results to those of Mack Tuesday (except for the "High Card" hand, for which we have different interpretations), we find an error only when counting straights and/or flushes (which is obscured by a different interpretation of the rules): It seems that Mack considers that only 9 sequences (instead of 10) count as a "straight". (I do seem to recall that {A,2,3,4,5} is a valid "tenth" straight, but rules may differ...) If that's the case, there should be only 32 straight flushes instead of his 36 (for which our agreement is a coincidence) because 4 Royal Flushes have to be deducted. Similarly, these 32+4 combinations (which are both straights and flushes) should be deducted from his raw count of 9216 and 5148 for straights and flushes; the correct counts are thus 9180 and 5112. If your own rules allow {A,2,3,4,5} as a valid straight, the list I give above is correct (and checks out as explained above)... Otherwise, if you only allow 9 types of straights, replace the counts for straight and/or flushes (4, 36, 5108, 10200 and 1302540) by 4, 32, 5112, 9180 and 1303560 = (C(13,5)-9)(45-4). smile ******** 07-18-02, 01:15 PM Bibc14 i wrote out a program in MATLAB for some project for a class in college, that dealt you random cards and a dealers hand, and told you what you had and what the dealer had and if you had won,
and a second part of the program that dealt out about 10000 hands and determined the probablility of getting a certain hand,
if anyone is curious, i might be able to dig it up.
i think my only flaw was that when it selected a random card, it did not remove that card from the deck, so you still had the same chance of pulling another card because there were still 52 (but if you pulled a card already in the hand, it would just select another card, so you would not get any duplicates.)
i couldnt figure out how to get rid of the card from the pool that it randomly chose cards from, and if i wanted to create a whole bunch of different pools, with certain cards missing i could have done that, but that would have taken forever, anyways, if anyone is curious just email me, i dont think you even need matlab to use the program. -chris ******** 07-18-02, 03:03 PM DrGerard From a logical standpoint the following two things are perfectly equivalent:
* Removing a card from the pool once you draw it. * Ignoring a new draw if it happens to match an old one.
In other words, Bibc14, your approach is perfectly sound from a probabilistic point of view and should not be called a "flaw" (just a "design choice"). Of course, this means that you may have to waste a little bit of computer time in the not-too-frequent case where a draw in invalid and has to be ignored, but this is mostly irrelevant.
You may want to know that a standard algorithm to generate a random integer between 0 and n is to use a random bit generator to generate a bit pattern of the same length as the binary representation of n and discard the result (i.e., start over from scratch) whenever such a random "draw" happens to be greater than n. Since an invalid draw like this happens with a probability less than ½, the average number of draws needed to get a valid one is less than 2. This means that there is little incentive to produce a "more efficient" random number generator if a well-designed random bit generator is already available.
It's easy to see that some "improvements" on such a simple design may well be dubious, because the increase in complexity has a price which may not be justified: For example, one could perform "early" comparisons of the leading bits of n against the leading bits of the random bit string being generated (for the purpose of aborting the generation of trailing bits as soon as they are known to be useless). That could only lead to very little increase in performance, if any, but a substantial increase in complexity. Bad idea.
If you want a simple computerized way to draw cards "without replacement", you may want to avoid subsequent bookkeeping by "shuffling" the deck of n cards so that any of the n! arrangements is equally probable. One standard way to do this is to have each card in an array of size n and have an index i run from 1 to n. At each step generate a random integer j, between 1 and i (included), and swap the cards in positions i and j. That's all there is to it! at the end you have a deck for which each of the n! possible permutations have an equal chance of occurring... Once you have such a shuffled deck, draw as many cards as you need "from the top". Just like in real life (only better, since the shuffling is mathematically "perfect" with the above procedure). smile ******** 07-18-02, 10:47 PM Bibc14 Doc, thanks for the tips, i tried to find the program but either its not where i though it was, or i deleted it.
either way, there was a bonus to looking for it, i figured out a way to edit my webpage hosted by my school, from my house, so i updated it a little. If anyone is interested you can check it out, just check my profile. (and dont give me any grief about the way it looks, i typed out the code by hand)
-Chris ******** 07-20-02, 11:06 PM coldfuse but so many online sources are in agreement already. For one of these, click here. ******** 07-21-02, 01:58 AM DrGerard Internet sources are notoriously unreliable, because some Web authors are unwilling or unable to check their sources. When a precise answer has already been posted here, shipping people to sources that are merely in "rough agreement" may thus not serve any useful purpose. Sorry about this, Coldfuse, nothing personal... wink
Also, it's much better to show people how these things are done than to sneer because somebody else has already done them! ******** 07-21-02, 07:29 PM DrGerard Let me propose a generalization of WoK's question, so that only the mathematical approach advocated by Mack Tuesday and myself could possibly work: Bibc14's suggestion of an actual computer simulation would be too fuzzy and/or too time-consuming, whereas Coldfuse would --probably-- have a difficult time locating an answer on the Internet for any q in "q-card stud" (Coldfuse's previous link gives a rough answer only when q is 5 or 7)... Here's the new question:
What's the probability of getting a given poker hand (5 cards) when you are dealt q cards? [Only the highest 5-card hand matters.]
Let me give you the answer for the simplest case of a "Royal Flush" to discuss what's involved (which sometimes goes by the name of "inclusion-exculsion" enumeration). You need to know that the value of C(n,p) is zero when p is negative (and n is nonnegative):
The probability of getting at least one (5-card) Royal Flush when dealt q cards is:
C(4,1)C(52-5,q-5) - C(4,2)C(52-10,q-10) + C(4,3)C(52-15,q-15) - C(4,4)C(52-20,q-20) in C(52,q)
You may verify that this is equal to 1 when q is 49 or more (it's "only" 10804/10829 when q is 48), because you may always form at least one Royal Flush from a deck unless you remove at least 4 cards! On the other hand, you would need to remove at least 8 cards from a deck (all tens and fives) to suppress all straight flushes...
What's the above counting all about? Well, the first term is the sum of the ways you can obtain a Royal Flush in any of the 4 suits. In this first term, you have counted (at least) twice all the hands (of 10 cards or more) with (at least) 2 Royal Flushes, so we deduct the number of such hands. However, with such a deduction, we have deducted 3 times the hands with 3 Royal Flushes; those appeared 3 times in the original count and are thus no longer counted, so we add the 3rd term to correct this. The fourth term is the final subtraction corresponding to hands with 4 Royal Flushes (which may only occur if you are dealt at least 20 cards). That's what "inclusion-exclusion" counting is all about: I advise you to commit the principle to memory (whether or not you decide to toy with this silly "q-card stud" idea). cool ******** 07-21-02, 08:04 PM WiteoutKing My, my, an active thread for this scenario. Aren't you all glad I didn't ask you to find them for the second hand? I'll throw out my own thoughts and see what happens. Here's what I'm thinking:
Royal Flush: A Royal Flush consists of 10, J, Q, K, A of the same suit, and this happens in only 4 hands. Now we have to come up with the total number of hands.
Total Hands: C1*C2*C3*C4*C5 C1=52 C2=51 C3=50 C4=49 C5=48
So now we have odds of 452*51*50*49*48)-4
452*51*50*49*48)-4 113*51*50*49*48)-1 1:78160800, which would then be about 4 in a 300 million, or .000000013, not even close to ur answers, that could be good or bad...
4oK (WoK, 4oK, ironic!) This one's interesting, well, not really, anyway, there are 13 different faces, so there are 13 hands for just the first 4 cards. Following that can be any of the remaining 48 cards, so we have 13*4852*51*50*49*48)-13*48 484*51*50*49*48)-48 14*51*50*49)-1 1:499799 Somehow, I came up with a quite different number from Mack and Doc. The odds here are slightly better than 2 in a million, or .000002
Straight Flush: 2-6, 3-7, 4-8, 5-9, 6-10, 7-J, 8-Q, 9-K, NO 10-A 8 hands of 4 suits... 32 hands, which means... 3252*51*50*49*48)-32 126*51*50*49*3)-1 1:9746099, which is about 1 in 10 mil, or .0000001, suddenly im having bad feelings about this... 07-21-02, 09:43 PM DrGerard WoK, your justified "bad feelings" are coming from the fact that you are mixing ordered hands and unordered ones [you should not do that]. In particular your count of the number of hands is 120 times too large; either that or you have to maintain an "ordered" philosophy throughout when counting other hands (it's a very annoying thing to do, I recommend strongly against that approach; on the other hand, mastering the use of "choice numbers" allows you to make short order of a question like this one).
Start over... Take your time and/or look at my own counts for inspiration (I hate to say so myself, but they are correct). Sorry if/when I sound patronizing (I have to seize the opportunity before I turn senile). wink
Also, I now regret humoring you by presenting results (against my better judgement) in the popular form of "odds in favor". You should refrain from doing that, actually. It's much better to stick with probabilities; talk of a probability of 1/3 as being "1 in 3". In this day and age, the equivalent expressions of "odds" as either "1 to 2 in favor" or "2 to 1 against" will be more confusing than helpful for most people, IMHO. ******** 08-02-02, 10:27 PM jc7k I find this thread very interesting. As a fairly new poker player I enjoy going through the exercise of understanding expected value based on odds of each hand in relation to the size of the pot. While I find the expression of these probabilities expressed in decimal easier for comparisons among different poker hands, I also make an effort to memorize the odds. The odds are useful at the table for quick check against the pot odds to see if the potential winnings justifies continuing with potential hand that I'm drawing to. I play Texas Hold'em and find this kind of mathematical analyses invaluable.
It would be interesting if Doc and say something about how having different number of players at the table may (or may not) affect one's chance of making a certain hand. I am also interested in some analyses on Three Card Poker, in particular how one calculates the house edge. There are some numbers on www.thewizardofodds.com, but I am more interested in the process and approach than just the final answer.
Thanks! ******** 08-04-02, 11:40 AM WiteoutKing In the situation above, where the hand mentioned is the dealt hand, it should have no effect on the odds. However, if the hand mentioned was the drawn hand, then that would be a different story entirely. As you could imagine, the odds mostly increase dramatically for the drawn hand in comparison to the dealt hand. ******** 10-27-03, 07:46 AM taz hi chris i was wondering if i can have a look at ur program matlab as i have to do something similaire to it i have to creat an algorithm to count the probabilities of a winning poker game so i was just wondering if i can get some help form ur program thank u ******** 01-25-04, 08:55 AM Don Anglen DrGerard, I trying to calculate the probability of having a straight flush or royal flush from 26 cards. Your message is by far the closest anyone has come to answering this. I see the Royal Flush, but how do I use this for a (straight flush) and/or (straight flush or Royal Flush) ?
quote:Originally posted by DrGerard: Let me propose a generalization of WoK's question, so that only the mathematical approach advocated by Mack Tuesday and myself could possibly work: Bibc14's suggestion of an actual computer simulation would be too fuzzy and/or too time-consuming, whereas Coldfuse would --probably-- have a difficult time locating an answer on the Internet for any q in "q-card stud" (Coldfuse's previous link gives a rough answer only when q is 5 or 7)... Here's the new question:
What's the probability of getting a given poker hand (5 cards) when you are dealt q cards? [Only the highest 5-card hand matters.]
Let me give you the answer for the simplest case of a "Royal Flush" to discuss what's involved (which sometimes goes by the name of "inclusion-exculsion" enumeration). You need to know that the value of C(n,p) is zero when p is negative (and n is nonnegative):
The probability of getting at least one (5-card) Royal Flush when dealt q cards is:
C(4,1)C(52-5,q-5) - C(4,2)C(52-10,q-10) + C(4,3)C(52-15,q-15) - C(4,4)C(52-20,q-20) in C(52,q)
You may verify that this is equal to 1 when q is 49 or more (it's "only" 10804/10829 when q is 48), because you may always form at least one Royal Flush from a deck unless you remove at least 4 cards! On the other hand, you would need to remove at least 8 cards from a deck (all tens and fives) to suppress all straight flushes...
What's the above counting all about? Well, the first term is the sum of the ways you can obtain a Royal Flush in any of the 4 suits. In this first term, you have counted (at least) twice all the hands (of 10 cards or more) with (at least) 2 Royal Flushes, so we deduct the number of such hands. However, with such a deduction, we have deducted 3 times the hands with 3 Royal Flushes; those appeared 3 times in the original count and are thus no longer counted, so we add the 3rd term to correct this. The fourth term is the final subtraction corresponding to hands with 4 Royal Flushes (which may only occur if you are dealt at least 20 cards). That's what "inclusion-exclusion" counting is all about: I advise you to commit the principle to memory (whether or not you decide to toy with this silly "q-card stud" idea). Cool ******** 01-26-04, 03:13 PM Don Anglen DrGerard, Why is the probability of getting one of the 40 straight flushes 41584 out of 52C7 and not 43240(40C1 * 47C2) out of 52C7?
quote:Originally posted by DrGerard: Let me propose a generalization of WoK's question, so that only the mathematical approach advocated by Mack Tuesday and myself could possibly work: Bibc14's suggestion of an actual computer simulation would be too fuzzy and/or too time-consuming, whereas Coldfuse would --probably-- have a difficult time locating an answer on the Internet for any q in "q-card stud" (Coldfuse's previous link gives a rough answer only when q is 5 or 7)... Here's the new question:
What's the probability of getting a given poker hand (5 cards) when you are dealt q cards? [Only the highest 5-card hand matters.]
Let me give you the answer for the simplest case of a "Royal Flush" to discuss what's involved (which sometimes goes by the name of "inclusion-exculsion" enumeration). You need to know that the value of C(n,p) is zero when p is negative (and n is nonnegative):
The probability of getting at least one (5-card) Royal Flush when dealt q cards is:
C(4,1)C(52-5,q-5) - C(4,2)C(52-10,q-10) + C(4,3)C(52-15,q-15) - C(4,4)C(52-20,q-20) in C(52,q)
You may verify that this is equal to 1 when q is 49 or more (it's "only" 10804/10829 when q is 48), because you may always form at least one Royal Flush from a deck unless you remove at least 4 cards! On the other hand, you would need to remove at least 8 cards from a deck (all tens and fives) to suppress all straight flushes...
What's the above counting all about? Well, the first term is the sum of the ways you can obtain a Royal Flush in any of the 4 suits. In this first term, you have counted (at least) twice all the hands (of 10 cards or more) with (at least) 2 Royal Flushes, so we deduct the number of such hands. However, with such a deduction, we have deducted 3 times the hands with 3 Royal Flushes; those appeared 3 times in the original count and are thus no longer counted, so we add the 3rd term to correct this. The fourth term is the final subtraction corresponding to hands with 4 Royal Flushes (which may only occur if you are dealt at least 20 cards). That's what "inclusion-exclusion" counting is all about: I advise you to commit the principle to memory (whether or not you decide to toy with this silly "q-card stud" idea). Cool ******** 01-28-04, 12:25 AM DrGerard To Don Anglen:
The count of 40 C(47,2) = 43240 is erroneous because it ignore the proper "inclusion-exclusion" approach you should use in such cases, as mentioned in this post of mine you keep quoting (you're embarrassing me). In other words, your selection of a "featured" straight flush among 40 followed by a choice of 2 more card will make you select several times any hand containing 2 or more straight flushes. Therefore, you are overcounting the things.
I have just posted a detailed explanation at numericana.com about what the raw "inclusion-exclusion" enumeration entails in this case. This does lead to:
40 C(47,2) - 36 C(46,1) = 41584
Instead of posting the thing directly here, I'll edit the Numericana article as time permits (don't hold your breath), since I have a clue that there's a more elegant method to arrive at the result when the size of the hand is arbitrarily large (7 cards are easy to handle even with the wrong approach).
I won't give you the answer for 26 cards for now... I'll just remark that there's only one hand of 44 cards without a straight flush in it: The probability of having a straight flush with 45 cards is 100%... Cool ******** 02-04-04, 07:22 AM Don Anglen DrGerard, Any possible answer yet for at least one straight flush(or Royal Flush) in 26 cards? It's betweern .47 and .6
I won't give you the answer for 26 cards for now... I'll just remark that there's only one hand of 44 cards _without_ a straight flush in it: The probability of having a straight flush with 45 cards is 100%... Cool[/QUOTE] ******** 02-04-04, 10:26 PM DrGerard Well, if you insist here's a quick two=step process to count the number of 26-card hands with at least one straight flush.
First, compute for any q between 0 and 13 the number N(q) of q-card hands of the same suit which contain at least one straight. N(q) is clearly 0 when q is less than 5, otherwise we have N(5)=10, N(6)=71, N(7)=217, N=(8)=371, N(9)=384, N(10)=234, N(11)=77, N(12)=13, N(13)=1. Rather than expend gray matter counting this, we may spend a fraction of a second of computer time to examine directly the 8192 bit patterns corresponding to all possible hands of any size (see details at the above link).
The second step is a straight "inclusion-exclusion" enumeration using the above, by considering the nonexclusive possibilities of having straight clubs, straight hearts, straight diamonds, or straight spades. All told, this can be counted as the sum of the following expression [of 4 terms] for all indices such that q1+q2+q3+q4=q (such indices tell how many cards of each suit we have):
Although there are a priori 4 C(q+3,3) terms in this sum (this would be 14616 for q=26) most of these are zero because one of the indices is more than 13 or an argument of N is less than 5. For q=26, there are thus "only" 2336 nonzero terms to add or subtract. The final result is that there are exactly 255774304012724 different ways to pick 26 cards containing a straight [or royal] flush among the 495918532948104 possible hands of 26 cards. This corresponds to a probability of about 51.576% of having a straight flush among q=26 cards. At the above link, I give a table of the corresponding numbers for any q from 4 (result is 0%) to 45 (result is 100%)...
Enjoy. Cool
Edited to repair link
[This message was edited by methos on 02-04-04 at 11:16 PM.] ******** 02-04-04, 10:39 PM DrGerard For some reason, I haven't been able to edit the previous post, because of login problems... Forgive the rough edges, especially about the link to numericana.com. ******** 02-05-04, 02:16 AM Don Anglen
DrGerard, Thank you. Smile Very good! I thought it was about .5. "quick two=step", "is easily obtained" For you, yes. For me, no.
This message has been edited. Last edited by: DorianGreyed,
Posts: 1363 | Location: Lowell, MA, USA | Registered: 06-03-02
For the record, the number of combinations of q cards containing at least one straight [or royal] flush is given by the following expression, which boils down to no more than 1195 nonzero terms (when q=35) and "only" 508 nonzero terms for q=26:
In this, N(m) is the number of combinations of m cards of the same suit which contain at least one straight flush, namely N(5)=10, N(6)=71, N(7)=217, N=(8)=371, N(9)=384, N(10)=234, N(11)=77, N(12)=13, N(13)=1. N(m) is zero when m is less than 5 or more than 13.
The number of combinations of q cards which contain at least one straight/royal flush is then equal to the coefficient of xq
in the following expression: