Results 1 to 24 of 24

Thread: Probability problem with 52-card deck.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Probability problem with 52-card deck.

    There are 52 cards in a regular deck, 13 per suit. If you deal 13 cards to a person, what is the probability that he will be void in some suit? Id est: That he will have no cards in some suit?
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  2. #2
    Addicted Member
    Join Date
    Mar 2001
    Posts
    157
    After 3 cards, the prop of having a void suit is 1.
    On the 4th card, the prob. of having a void suit changes. If we pick any one suit not represented in the first three cards, the prob. of it not being represented in the first :
    4 cards is 36/49
    5 cards is (36/49) * (36/48)
    13 cards is (36/49) * (36/48) * .... * (36/40)
    = (36^10) / (49*48*47*46*45*44*43*42*41*40)
    = (36^10)/(49! / 39!)
    = 0.1226

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151

    Not even close.

    Kedaman and Chrisf: Do not feel too bad. I got it wrong the first time and a few bridge playing mathematicians agreed with me.

    This Thread was started because of my initial error, and the errors made by several others.

    I initially calculated that C(39, 13) is the number of ways 13 cards can be selected from a 39 card deck (Id est: From a deck missing one suit). Multiply by four due to there being four suits. Then divide by C(52,13) to convert to a probability.

    The above looks correct, and was agreed to by several of my friends, but is not correct. Later, when I discovered the correct answer, I posed the problem to a few more people, all of whom came up with incorrect analyses.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I am almost surprised, well I guess this could be fun
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    Are you dealing four hands Guv, or just taking the top 13 cards from a shuffled deck?

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hmm..Tell me if I'm wrong but, I don't think the order matters which you pick up the cards, so others picking card in between wouldn't differ from the case them picking cards afterwards.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Smile What the hell

    I doubt if I can solve it but here's my idea:

    If I start by calculating the odds of getting 13 cards and none of which is a, say, heart, here are the odds (I think):

    39/52 * 38/51 * 37/50 ... 28/41 * 27/40 = 0.0128

    Now since the odds we want are for any suit (i.e. hearts OR clubs OR diamonds OR spades), The probability is 0.0128 * 4 = 0.0511


    Now, having said that, I'm almost certain my calculation is flawed because intuition tells me that it's much more likely to be devoid of one particular suit with a hand of 13 cards. Can't think why though...
    Last edited by simonm; Oct 1st, 2001 at 05:00 AM.
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  8. #8
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    I just thought that if you were the first of the four hands to be dealt then as your last card is dealt there is/could-be a 1/4 chance of an individual card, whereas if you were the fourth hand dealt the last card is rather predetermined. Maybe it doesn't change the total probabilities though.

  9. #9
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    Trying it from another direction:
    If I have 13 cards, there are 39 possible distributions of suits.
    13, 0, 0, 0
    12, 1, 0, 0
    11, 2, 0, 0
    11, 1, 1, 0
    10, 3, 0, 0
    10, 2, 1, 0
    10, 1, 1, 1
    9, 4, 0, 0
    9, 3, 1, 0
    9, 2, 2, 0
    9, 2, 1, 1
    8, 5, 0, 0
    8, 4, 1, 0
    8, 3, 2, 0
    8, 3, 1, 1
    8, 2, 2, 1
    7, 6, 0, 0
    7, 5, 1, 0
    7, 4, 2, 0
    7, 4, 1, 1
    7, 3, 3, 0
    7, 3, 2, 1
    7, 2, 2, 2
    6, 6, 1, 0
    6, 5, 2, 0
    6, 5, 1, 1
    6, 4, 3, 0
    6, 4, 2, 1
    6, 3, 3, 1
    6, 3, 2, 2
    5, 5, 3, 0
    5, 5, 2, 1
    5, 4, 4, 0
    5, 4, 3, 1
    5, 4, 2, 2
    5, 3, 3, 2
    4, 4, 4, 1
    4, 4, 3, 2
    4, 3, 3, 3

    21 of these possibles are void in at least one suit.
    So it may be 21/39 of holding a void.

    but the probabilities of each distribution are not even and I suspect this needs to be taken into account. I can work out the prob of a 13, 0, 0, 0 hand, but how many ways can you have a 4,3,3,3 etc ?

  10. #10
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Question

    Starman,

    You must be way off, surely? How can there be a greater than 50/50 chance of being void in one particular suit?

    But, following your logic and counting the number of combinations of each distribution:

    13, 0, 0, 0 x4 * 4
    12, 1, 0, 0 x12 * 12
    11, 2, 0, 0 x12 * 12
    11, 1, 1, 0 x12 * 12
    10, 3, 0, 0 x12 * 12
    10, 2, 1, 0 x24 * 24
    10, 1, 1, 1 x4
    9, 4, 0, 0 x12 * 12
    9, 3, 1, 0 x24 * 24
    9, 2, 2, 0 x12 * 12
    9, 2, 1, 1 x12
    8, 5, 0, 0 x12 * 12
    8, 4, 1, 0 x24 * 24
    8, 3, 2, 0 x24 * 24
    8, 3, 1, 1 x12
    8, 2, 2, 1 x12
    7, 6, 0, 0 x12 * 12
    7, 5, 1, 0 x24 * 24
    7, 4, 2, 0 x24 * 24
    7, 4, 1, 1 x12
    7, 3, 3, 0 x12 * 12
    7, 3, 2, 1 x24
    7, 2, 2, 2 x4
    6, 6, 1, 0 x12 * 12
    6, 5, 2, 0 x24 * 24
    6, 5, 1, 1 x12
    6, 4, 3, 0 x24 * 24
    6, 4, 2, 1 x24
    6, 3, 3, 1 x12
    6, 3, 2, 2 x12
    5, 5, 3, 0 x12 * 12
    5, 5, 2, 1 x12
    5, 4, 4, 0 x12 * 12
    5, 4, 3, 1 x24
    5, 4, 2, 2 x12
    5, 3, 3, 2 x12
    4, 4, 4, 1 x4
    4, 4, 3, 2 x12
    4, 3, 3, 3 x4

    ---- ---

    560 340

    Prob. = 340 / 560 = 0.607


    And that is just ridiculous!?!
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  11. #11
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    simonm, I'm not sure I agree with the number of combinations you have offered

    for 13,0,0,0 - four ways to do this- one for each suit

    for 12,1,0,0 -

    pick one suit, there are 13 ways to take 12 cards

    multiplied by 39 for the remaining cards, multiplied by 4 to try all the suits

    making 2028 possible 12,1,0,0 hands

    It gets a lot worse as you go down the list

    but I think that these totals for the voids against the total possible hands will be the answer.

  12. #12
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    39/52 * 38/51 * 37/50 ... 28/41 * 27/40 = 0.0128
    ...
    The probability is 0.0128 * 4 = 0.0511
    This sounds good, and I tested it empirically, and it seems to be correct
    PHP Code:
        int in[4],out[4],intot,temp;
        
    unsigned int case_=0,total=0;

        for (;; ){
            
    in[3]=in[2]=in[1]=in[0]=13;
            
    out[3]=out[2]=out[1]=out[0]=0;
            for(
    intot=52;intot>39; ){
                
    temp=rand()%intot--;
                for (
    inti=in;temp>=0;++i)temp-=*i;
                --(*--
    i);
                ++
    out[i-in];
                if (!(
    out[3]==0||out[2]==0||out[1]==0||out[0]==0))break;
            }
            if (
    intot==39&&(out[3]==0||out[2]==0||out[1]==0||out[0]==0))case_++;
            
    total++;
            if (!(
    total&1048575))cout << (double)case_/(double)total << " ( " << case_ << " : " << total << ")" << endl;
        } 
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  13. #13
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Smile Aha!

    Starman, I see what you are saying and it does get very complex.

    So, I worked out the probabilities with a much simpler example (deck of 9 cards, 3 suits and a hand of three cards).

    I first assigned probabilities your way:

    3,0,0 1
    0,3,0 1
    0,0,3 1
    2,1,0 9
    2,0,1 9
    1,2,0 9
    1,0,2 9
    0,2,1 9
    0,1,2 9
    1,1,1 27

    Therefore Probability of not getting a suit = 67/94 = 0.7128

    Then I used my method:

    (6/9 * 5/8 * 4/7) * 3 = 0.7143

    Very close but not quite the same. Curious...
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  14. #14
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Unhappy Language

    Kedaman

    I know you prefer C++ but this is (generally) a VB forum.

    Unfortunately, not being familiar with C++ I don't understand your example program.
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  15. #15
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Simon
    well i didn't code that for just anyone to understand, I code in C++ because it's easier for me and i posted it for anyone to find bugs in it.

    not going into too much detail, this is what it does in an infinite loop:

    1. reset amount per suit picked (out) and left(in)
    2. pick 13 random cards by index of 0 to amount of cards left
    - if no suit is void, exit the loop
    3. total is incremented and case_ is incremented in case there is some void suit.
    4. each 1048576'th iteration, show current statistics
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  16. #16
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    simonm,

    I make that 57 hands with a void out of 84 possible hands

    =0.67857

    it's not as close to your answer now - either right or wrong :7).

    I've been looking along the lines of:
    (using your 9 card pack)

    1st - any card will do = 9/9
    2nd - any card will do = 8/8
    3rd - must not be the third suit = 4/7
    =.5714

    but this doesn't agree with your answer either although it's nearly an anagram.

    back to excel.......

  17. #17
    Fanatic Member simonm's Avatar
    Join Date
    Sep 2000
    Location
    Devon, England
    Posts
    796

    Red face Oh dear...

    OK, I can't add up!

    I stand by the result of my method though. Besides, it's been verified by Kedaman's cryptic function.
    1st - any card will do = 9/9
    2nd - any card will do = 8/8
    3rd - must not be the third suit = 4/7
    =.5714
    I think this is flawed becasue you are not taking account of the possibility that the first two cards you drew might have been the same suit. In that case, the last card you draw could be anything (it doesn't matter).
    Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment.

  18. #18
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    simonm

    yes, that's where it all goes horribly confusing

    1st - any will do = 9/9
    2nd
    a) 2/8 of matching the 1st
    b) 6/8 of not

    3a - 6/7 'safe' cards
    3b - 4/7 'safe' cards

    a) 9/9 * 2/8 * 6/7 = 12/56 = .21428

    b) 9/9 * 6/8 * 4/7 = 24/56 = .42857

    but I think this just gives the chances of having a pair instead of a triple and has nothing to do with the actual question

    combin(52,13)=635013559600 possible bridge hands.

    some are void and I'm still trying to guess how many

  19. #19
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I still wonder what's wrong with my analogy, is anyone finds the flaw i'd be glad to know
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  20. #20

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151
    If you shuffle the deck thoroughly, it does not matter whether you deal 13 cards off the top or deal four hands and examine one of them. The odds are the same for 13 cards chosen by any random process. Of course, if you have information about one hand at the table, it will affect the odds relating to any of the other three.

    Kedaman and Simon are getting close. The formula for the combination of 39 cards taken 13 at a time is.

    C(39,13) = 39!/13!*26!

    The above is the number of hands which can be made up using only 39 cards from 3 suits. If you divide by C(52,13) you get the probability of a hand containing a void in the fourth suit.

    The above is the approach I took. Then I multiplied by four to get the probability of a void in any suit. On my calculator, I got the following.

    C(39,13) / C(52,13) = .012 790 948, which is the probability of a 13-card hand with no Spades.

    Multiply by 4 = .051 163 792, which is not the probability of a hand with a void !!! ??

    Permutations, combinations, and probability have subtle pitfalls for the unwary.

    I, and several bridge playing mathematicians, accepted the above as correct. Then I wrote a program for my hand calculator to calculate various bridge table probabilities. There are 21 patterns with void suits. When I added the 21 probabilities, I did not get the above, and thought I had a bug in the program.

    Then I realized the subtle error in the above analysis. Does anybody else see it?
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  21. #21
    Addicted Member
    Join Date
    Mar 2001
    Posts
    157
    Guv,
    Some of the combinations which have a void in the fourth suit also have a void in one or two other suits, so are 'counted' more than once when you multiply by 4.

  22. #22

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151
    ChrisF: You got it.

    All hands with distributions like 0 0 6 7 are counted twice: Once with the Spade void hands and once with the Heart void hands.

    The four hands with three voids (0 0 0 13) are counted three times.

    Hence the correct calculation is as follows.

    [ 4 * C(39, 13) - 6 * C(26, 13) + 4 * C(13, 13 ) ] / C(52, 13)

    this results in .051 065 521, which is close to the incorect value I originally computed.

    You must add 4 * C(13, 13 ), which equals 4, because subtracting hands with two voids overcorrects slightly by subtracting out all the hands with three voids.
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

  23. #23
    Addicted Member
    Join Date
    Feb 2001
    Posts
    198
    My way Works!!!! - it's just takes a while

    Now I know the answer it's easier.

    I was calculating the different numbers of possible hands but couldn't get the totals to add up to the total possible hands.
    The problem appears when duplicate amounts of two suits are present - I've fixed that now.

    continuing from 11,2,0,0

    11,1,1,0 - 78 (ways of 11) X 13 (ways of 1) X 13 (ways of 1) X 3 (positions for the 0) X 4(suits) = 158184

    10,3,0,0 - 286 ways for 10 X 286 ways for 3 X 3 X 4=981552
    etc. etc. etc.
    To save a very overlong post, the totals for the voids are:
    4
    2028
    73008
    158184
    981552
    6960096
    6134700
    63800880
    52200720
    19876428
    287103960
    689049504
    35335872
    689049504
    2296831680
    1684343232
    459366336
    4134297024
    8421716160
    5684658408
    7895358900


    Add this lot together to get: 32427298180

    Divide by the total possible hands : 635013559600

    Result: 0.051065521

    (full calculation available on request)

    I think I prefer the look of
    4 * C(39, 13) - 6 * C(26, 13) + 4 * C(13, 13 ) ] / C(52, 13)
    It's obviously quicker.

    Nice question Guv.

  24. #24
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Nothing wrong with my algoritm either, It approached the correct value but as Simon's value was close I thought his was the correct analytical solution.

    This listing shows that it doesn't converge towards .05116 but rather towards .05106. I expect if I wait enough the 5'th digit and later the 6'th will stabilize and so on..
    0.0507059 ( 53169 : 1048576)
    0.0508876 ( 106719 : 2097152)
    0.0509485 ( 160270 : 3145728)
    0.0508549 ( 213301 : 4194304)
    0.0508642 ( 266675 : 5242880)
    0.0509036 ( 320258 : 6291456)
    0.0508945 ( 373567 : 7340032)
    0.0508931 ( 426922 : 8388608)
    0.0509138 ( 480483 : 9437184)
    0.0508969 ( 533693 : 10485760)
    0.0509373 ( 587528 : 11534336)
    0.0509635 ( 641269 : 12582912)
    0.0509798 ( 694931 : 13631488)
    0.0509904 ( 748542 : 14680064)
    0.051 ( 802161 : 15728640)
    0.0510134 ( 855863 : 16777216)
    0.0510173 ( 909423 : 17825792)
    0.0510189 ( 962950 : 18874368)
    0.051018 ( 1016428 : 19922944)
    0.0510449 ( 1070490 : 20971520)
    0.0510505 ( 1124137 : 22020096)
    0.0510491 ( 1177634 : 23068672)
    0.051055 ( 1231306 : 24117248)
    0.0510482 ( 1284671 : 25165824)
    0.0510595 ( 1338495 : 26214400)
    0.0510725 ( 1392389 : 27262976)
    0.0510765 ( 1446056 : 28311552)
    0.0510786 ( 1499674 : 29360128)
    0.0510803 ( 1553285 : 30408704)
    0.0510829 ( 1606929 : 31457280)
    0.0510835 ( 1660513 : 32505856)
    0.0510744 ( 1713773 : 33554432)
    0.0510753 ( 1767358 : 34603008)
    0.051078 ( 1821011 : 35651584)
    0.0510827 ( 1874742 : 36700160)
    0.051084 ( 1928358 : 37748736)
    0.051076 ( 1981613 : 38797312)
    0.0510798 ( 2035318 : 39845888)
    0.051078 ( 2088806 : 40894464)
    0.0510714 ( 2142090 : 41943040)
    0.0510788 ( 2195962 : 42991616)
    0.0510924 ( 2250120 : 44040192)
    0.051089 ( 2303538 : 45088768)
    0.05109 ( 2357155 : 46137344)
    0.0510914 ( 2410796 : 47185920)
    0.0510895 ( 2464278 : 48234496)
    0.0510855 ( 2517648 : 49283072)
    0.0510867 ( 2571279 : 50331648)
    0.0510873 ( 2624876 : 51380224)
    0.051085 ( 2678324 : 52428800)
    0.0510903 ( 2732175 : 53477376)
    0.0510858 ( 2785500 : 54525952)
    0.0510861 ( 2839088 : 55574528)
    0.0510857 ( 2892630 : 56623104)
    0.0510822 ( 2945999 : 57671680)
    0.0510818 ( 2999535 : 58720256)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width