Shuffle cards deck help- Pls

#1
Hey, I found online this problem about a deck of cards but I’m stuck on it,

We have three decks of 52 cards, 4 suits of 13 cards. We shuffle them separately and separate each deck into two piles of 26 cards. Now ask someone to take a card from 4 of the 6 available piles, one per pile, and we see that 4 kings have come out. So let's take the 2 piles from which no cards have been drawn, put the 4 kings inside, and shuffle again. You now have 56 shuffled cards. Divide into 2 piles and take the first 4 cards from one of the piles. What is the probability that these 4 cards are 4 kings with the same suits as those obtained at the beginning?

I first used the combinations formula, as we have 4 kings and 56 cards in the deck. Having this expression: 4!/56!. Afterwards I divide it for 52! as it its important not only the options in which those 4 kings are in the deck but also the other 52 cards which might be in a position or in another. Having as a final result 4!/((52!)(56!)). Nevertheless I suspect that this doesn’t considerate the possibility of having other kings (in the 52 cards deck before joining the 4 kings that we have taken outside) that are the same suit as the 4 kings we are adding to the deck; and those should also be taken into account. Having arrived here I’m also trying to approach the problem using the Bayes theorem P(A I B)=P( A intersection B)/( P(B), but as the A and B from the P( A intersection B) are not independent, I cannot use it.

If you would mind giving me some way to continue or recommendation, or anything it would be a lot of help,
Thanks!
 

fed2

Active Member
#2
Basically, you need to compute the chance of getting a certain combination of suits in your intial draw of 4, then compute the chance of getting a match given a certain suit selection. Then you will add up the product of the Chance of getting an intial suit draw * the chance of getting a match conditional on the suit selection.


The initial suit selection basically goes like this:
Either your selection of 4 'half-decks' spans 2 actual decks, or it spans 3 (with one deck taking both splits.
spanning 2 happens with prob = 3/(6 choose 4), spanning 3 with prob 3*2^2/choose(6,4)

So, whats the chance you get 3 of one type of suite, one of another? This can only happen if you selection spans 3 decks. You need 2 successful binomial experiments, and a succes on the hypergeometric experiment, being the draw fro the two split decks having common origin.

so prob = (span 3 decks) *1/4)^2 * (1/6), the hypergeometric experiment has 1/6 for each selection, the binomial experiments 1/4 on each.

so prob = 0.00833,

of curse there are ( 4 choose 2) ways to select which suits are 3 and 1 time selected.

i checked this by simulation, it is pretty darn close. You should definitely set up simulation.


The other combinations are computed similarly.

It goes on from there but my brain is melting so I have to stop this. Good luck on your problem.


Enjoy some r-code:

C-like:
Deck = sort( rep(1:13,4) ) + 1:4/10  #rank.suit

#take 3 decks
threeDecks = list( Deck, Deck, Deck );



##simulation, the holy grail of probablity.
doOne = function(i){
 
  check = T;
  while( check == T){
 
    #shuffle each
    
    myDecks = lapply( threeDecks, sample);
    
    #splitEach
    
    splitDecks = lapply( myDecks, split, f=  1*(1:52 <= 26) )
    splitDecks = unlist(splitDecks, recursive = F)
    names(splitDecks) = 1:6
    
    #choose 4, at random;
    hasKings = as.vector( unlist(  lapply( splitDecks, function(x){ any( floor( as.numeric(x) ) == 13 )}  ) ) );
    
    if( sum(1*hasKings)  >= 4 ){
    
    sampledDecks = sample(splitDecks[hasKings])
    chosenDecks = sampledDecks[1:4]

    #take top card;

    topCards = unlist(  lapply( chosenDecks,
                                function(x){ x[min( which( floor( as.numeric(x) ) ==  13) )] }   
                                )  )
    
    ranks = as.vector( floor(topCards) )
    suits = as.vector(  round( 10*( topCards - ranks  ) )  )

    augmentedDeck = as.vector(  unlist( c(topCards, sampledDecks[5:6]) )  )
    
    matchTry = sample(augmentedDeck)[1:4];
    matchRanks = floor(matchTry)
    matchSuits = round( 10*( matchTry - matchRanks  ) )
    gotMatch = (  all(  sort(matchSuits) == sort(suits) ) & all(ranks == matchRanks)   )

     gotMatch = -( (1.0*!gotMatch ) + 1  )
    
     check = F;
     return( c( sort(suits) )   );
 
    }
      
  }
}

A = lapply(1:10000L, doOne)
B = lapply( A, round)
C = lapply(B, factor, levels = c(-2,-1, 1,2,3,4))
D = lapply(C, table)
E = data.frame(  do.call('rbind',D)  );
E$type = paste( E$X1, E$X2, E$X3, E$X4 );
table(E$type)/10000

##########Lets get analytic...
pSpan3 = (3 * 2^2 / choose(6,4));#chance that 4 selected  span 3 decks
pSpan2 = (3 / choose(6,4));#chance that 4 selected  span 2 decks


###Get 3 of one suit 1 of another, happens only if 3 decks spanned, then
p3_1 = pSpan3*choose(4,2)*(1/4)^2*(1/6);
 
#3
Hi fed2,
Thanks for the advice. I didn’t think this problem could be that laborious. I’m going to try to follow your steps. Thank you very much for your answer including the code. I appreciate it.