PDA

View Full Version : Help with a probability problem

Actree
07-01-2010, 09:10 PM
You have a deck of 60 cards which contains 4 red and 4 blue cards. You draw 7 cards from the deck, what is the probability that you'll have at least one red card AND at least one blue card?

Dason
07-01-2010, 09:15 PM

Actree
07-01-2010, 09:39 PM
This is not for any assignment. I just have a curiosity for a certain probability in a card game.

I think it might be this but I'm way off:

(COMBIN(60,4)*4+COMBIN(60,4)*COMBIN(4,2)+COMBIN(60,4)*COMBIN(4,3)+COMBIN(60,4))^2/COMBIN(60,7)^2

Actree
07-01-2010, 10:33 PM
As you know this is from Magic the Gathering. Most people play 60 card decks. Many combos requires two pieces (cards) to function so I want to know the probability. If anyone can help correct my formula I'd appreciate it.

Dason
07-01-2010, 11:50 PM
Ah. Sorry about that. We get a lot of people posting that basically just want us to do their homework so my standard response probably seems a little cold if that's not what you're looking for. Once again I apologize.

Let's get to work: My response would be to find all possible hands that don't meet your requirement. Seems easier.
So we could either have no blues in our hand. We could have no reds in our hands. But both of these include the possibility of having none of either in the hand so we'll have to subtract that out once when we're done.

My code in R:

> 1-((choose(56,7)*2-choose(52,7))/choose(60,7))
[1] 0.1454057

I also ran a quick simulation and got results that seemed to verify. I let the numbers 1-60 simulate the deck of cards and let 1-4 be "red" 5-8 be "blue" and then simulated grabbing 7 cards and seeing if it met our conditions.

containsRed <- function(x){
tst <- x %in% 1:4
return(sum(tst)>0)
}

containsBlack <- function(x){
tst <- x %in% 5:8
return(sum(tst)>0)
}

wanted <- function(x){
ans <- containsRed(x) & containsBlack(x)
return(ans)
}

mean(replicate(100000,wanted(sample(1:60,7))))

with the following results:

> mean(replicate(100000,wanted(sample(1:60,7))))
[1] 0.14597

Seems pretty close. Anybody see any errors?

Actree
07-02-2010, 12:02 AM
Thanks a lot Dason.

From playing a lot I had a notion that the probability is 14% but just wanted to be sure.