2

Before I ask the question, I should mention I already saw this and just don't get it.

I have a 40 card deck with cards I'll label:

A (3 copies) B (3 copies) C (3 copies) D (2 copies) E (1 copy) F (2 copies) G (3 copies) H (1 copy) I (11 copies)

And I need to know for a hand of 5, and a hand of 6, what the likelihood of getting any one (or more) of the following is:

(A and B), (A and G), (A and C), (A and F), (H alone), (E and I), (E and C), (E and H), (E and G)

What is it/how can I do it?

  • 1
    If you are able to write a computer program, it is often pretty simple to write a simulation to just simulate 1000 opening hands, and to estimate the probability that way. Your question has so many special cases, that analytic solutions tend to be quite burdensome to compute. – John May 21 '15 at 19:24
2

I'm going to post again because I thought of something else that might be an answer to your question.

Probability theory is complicated to learn and it's very tedious to calculate something like this. If I were solving this problem, I would write a program to simulate a few thousand card draws and just look at the relative frequency.

If you wrote it in javascript, it might look something like this:

<!DOCTYPE HTML>
<p id="out"></p>
<script>
var deck = [
  'A','A','A', /*(3 copies)*/
  'B','B','B', /*(3 copies)*/
  'C','C','C', /*(3 copies)*/
  'D','D', /*(2 copies)*/
  'E', /*(1 copy)*/
  'F','F', /*(2 copies)*/
  'G','G','G', /*(3 copies)*/
  'H', /*(1 copy)*/
  'I','I','I','I','I','I','I','I','I','I','I', /*(11 copies)*/
];

function draw_hand(cards) {
  var hand = [];
  var drawn_cards = []; //array to make sure we don't draw the same card twice
  for(var i = 0; i < cards; i++) {
    // pick a random card
    var card_index = Math.floor((Math.random() * deck.length) + 1);
    while(drawn_cards.indexOf(card_index)>=0) {
      // keep picking new cards until we find one that we haven't picked before
      card_index = Math.floor((Math.random() * deck.length) + 1);
    }
    drawn_cards.push(card_index);
    hand.push(deck[card_index]);
  }
  return hand;
}

// I didn't put in all the combos from the question post
var A_B_combos = 0;
var A_G_combos = 0;
var E_I_combos = 0;
var total_deals = 100000;

for(var deals = 0; deals < total_deals; deals++) {
  var hand = draw_hand(5);
  if(hand.indexOf('A')>=0 && hand.indexOf('B')>=0) {
    A_B_combos = A_B_combos + 1;
  }
  if(hand.indexOf('A')>=0 && hand.indexOf('G')>=0) {
    A_G_combos = A_G_combos + 1;
  }
  if(hand.indexOf('E')>=0 && hand.indexOf('I')>=0) {
    E_I_combos = E_I_combos + 1;
  }
}

document.getElementById("out").innerHTML += "A and B: "
    + A_B_combos + "/" + total_deals + " or "
    + Math.floor(10000*(A_B_combos/total_deals))/100 + "%  <br/>";
document.getElementById("out").innerHTML += "A and G: "
    + A_G_combos + "/" + total_deals + " or "
    + Math.floor(10000*(A_G_combos/total_deals))/100 + "%  <br/>";
document.getElementById("out").innerHTML += "E and I: "
    + E_I_combos + "/" + total_deals + " or "
    + Math.floor(10000*(E_I_combos/total_deals))/100 + "%  <br/>";
  </script>

That will run if you copy that into notepad, save it as cards.html or something, then open it with chrome.

1

The name of that sort of problem in probability is 'draw without replacement'.

When you do this sort of problem, it's easier to first figure out the probability of not getting what you want, then subtracting that from 100% to get the probability you're interested in.

First, we'll find probability of finding H alone. We start by finding the probability of having a hand without H. If we draw 5 cards, then the probability of the first one not being H is 39/40, then, if that happened, the probability of the second one not being H is 38/39. We want the probability of all draws not being H, so we multiply the individual probabilities with each other. The probability of all 5 cards not being H is (39/40) * (38/39) * (37/38) * (36/37) * (35/36) if you multiply that out, you get .875, so that's a 87.5% chance of not getting H in a hand of 5, subtract the percentage from 100 and you have 12.5% chance of getting that H. If you do the same thing with 6 cards, you get 85% of not and 15% of getting it.

Did you follow all of that? I hope so, because combinations of 2 cards will get more complicated.

Doing the same thing we did for H, we can find that the probability of getting at least 1 A is 33.75%. The probability of getting at least 1 B is the same, but getting at least one of each together is a little harder.

To find the probability of drawing an opening hand with A and B (P[A and B]), we need to find 3 probabilities first, the probability of drawing just A but not B (P[A and ~B]), the probability of drawing just B but not A (P[~A and B]), and the probability of drawing neither A or B (P[~A and ~B]).

For P[A and ~B], take P[A] * P[~B]. That's 0.3375 * 0.6625 = .2235. (NOTE: This is technically incorrect. It's an approximation that works okay when A and B are a lot less than the total number of cards)

Since the number of As is the same as the number of Bs, P[~A and B] is the same.

The neither part is similar to the 'not H' problem. Same as last time we do cards-in-deck-that-are-neither/total-cards-in-deck. Again for a hand of 5 cards: (34/40) * (33/39) * (32/38) * (31/37) * (30/36) gives you 0.4228 for drawing neither A or B.

Then we do P[~A and ~B] + P[~A and B] + P[A and ~B] = 0.4228 + 0.2235 + 0.2235 = 0.8698. That's the probability of drawing 5 cards without the A and B combo. So, you'll have a 13.02% chance of having that combo.

I hope that's enough info for you to calculate the other combinations you're interested in.

Not the answer you're looking for? Browse other questions tagged or ask your own question.