There are four cards – ace of spades, ace of clubs, ten of spades and seven of clubs.
A♠; A♣; 10♠; 7♣
If I draw two random cards, what is the probability that I get two aces, given?
1. At least one of them is an ace
2. One card is an ace of spades
The problem can be solved in different ways, but we choose, as usual, the Bayes’ rule.
At least one of them is an ace
Estimating each parameter:
Probability of at least one Ace, given two aces, P(AAt1|AA) = 1
Probability of picking two aces, P(AA) = 1/6 (there are six ways of arranging four cards into pairs)
Probability of at least one Ace, given NOT two aces, P(AAt1|AAn) = 4/5
Probability of NOT picking two aces, P(AAn) = 5/6 [P(AA) + P(AAn) = 1]
Substituting the values,
One card is an ace of spades
Probability of Ace of Spades, given two aces, P(AAsp|AA) = 1
Probability of picking two aces, P(AA) = 1/6 (there are six ways of arranging four cards into pairs)
Probability of Ace of Spades, given NOT two aces, P(AAsp|AAn) = 2/5
Probability of NOT picking two aces, P(AAn) = 5/6 [P(AA) + P(AAn) = 1]
Substituting the values,
R Simulation
cards <- c("Ace of Spades", "Ace of Clubs", "Ten of Spades", "Seven of Clubs")
itr <- 100000
shuff <- replicate(itr, {
draw <- sample(cards, 2, replace = FALSE, prob = rep(1/4, 4))
if(any(str_detect(draw, "Ace of Spades"))) {
if(all(str_detect(draw, "Ace"))){counter <- "A"}
else{counter <- "B"}
}
else{counter <- "C"}
})
sum(shuff == "A") / (sum(shuff == "A") + sum(shuff == "B"))