Black Jack Odds

Summary

Here we seek to understand the impact of additional card draws on the probability of being dealt a blackjack. To this end, we have built a simulation program that recapitulates the rules of the games to the extent needed on a two card draw per player and evaluating only if the player receives a blackjack or not. First, we find that our simulation, when replication numbers are large enough (100 repeats of 10,000 hands), consistently produce the expected probability of our theoretical calculation of a two card draw, 4.8%. Furthermore, our simulation identifies that the number of cards drawn does not impact the probability of receiving a blackjack. Specifically, we calculate the probability of two consecutive draws as 4.8215%. and three draws 4.8242% (when three cards are drawn and the probability of a blackjack is evaluated for the first and third card). Statistically, we calculate that there is only a 11.6% chance these result could have been produced if the probabilities of the two draws differ. Furthermore, we calculate that there is only a 7.6% chance of observing the 3 card distribution if the actual probability was 4.9%. Therefore, we agree with our initial hypothesis that additional card draws do not impact the probability of receiving a black jack.

Introduction

The original problem is presented below.

You are playing a game of black jack.

Assume the following

*You are playing with one opponent, and your opponent is the dealer

*10, Jack, Queen & King are all worth 10 & Aces are worth 11.

*You have Blackjack when the values of both your cards add up to 21

*There is only one deck of cards being dealt out

What are the odds that you will be dealt blackjack on the first deal?

Little ‘r’ your response

Enjoy!

Most people agree that the probability of receiving a blackJack on two consecutive card draws is 2X(4X16)/(52X51) or roughly 4.8%. There is some significant disagreement on whether dealing one card to the dealer between the two cards dealt to the player will affect the probability of receiving a black jack. On this second scenario many people update their calculation to 2X(4X16)/(52X50) and calculate a 4.9%. Here we will use a simulation that will recapitulate this game. We will repeat the draw of two or three cards (10,000 draws per experiment) many times (100) and calculate the frequency of black jack. We expect that two cards chosen at random will produce a blackjack at a frequency of about 4.8%. I hypothesize that this number will not change if we choose three cards and than evaluate if the first and third produce a blackjack.

Method

Our deck of cards

Here we use a simplified set of cards. Because we are only evaluating for a blackjack on two cards, only some card values are important; aces and cards valued at 10 points. There are 4 aces and 16 cards values at 10 points. Therefore, the deck presented below is adequate for our experiment.

Cards <- as.vector( 
        c( 
        rep(11L,4) ,
        rep(10L,16),
        rep(1L, 52-16-4)
)
)

Cards
##  [1] 11 11 11 11 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10  1  1  1
## [24]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [47]  1  1  1  1  1  1

The above output shows our deck has 52 cards where 4 cards have the value of 11 (the aces) and 16 have a value of 10. The remainder of the cards have been give a value of one.

Dealing your hand

Here, I have written a program to randomly select two cards from our deck. At the same time I evaluate the two cards to see if they produce a black jack. This is called “Two_Card_Deal”. I also have created a second function that will randomly selects three cards from our deck and then evaluates the first and third card to see if they produce a black jack. This second program is called “Three_Card_Deal”. By default these programs will sample 100 draws. They output the % blackjacks produced.

library(data.table)
library(magrittr)


Two_Card_Deal <- function(Hands = 1e2L) {
        Count_Win <- 0L
        
        for(i in 1:Hands) {
                
                if (Cards[sample(52L,2)][c(1,2)] %>% sum() == 21) {
                        Count_Win <- Count_Win +1L        
                }
                
                
        }
        Count_Win/Hands * 100
}



Three_Card_Deal <- function(Hands = 1e2L) {
Count_Win <- 0L
        
        for(i in 1:Hands) {
                
                if (Cards[sample(52L,3)][c(1,3)] %>% sum() == 21) {
                Count_Win <- Count_Win +1L        
                }
                
                
        }
        Count_Win/Hands * 100
}

Testing these functions

Two_Card_Deal(1e0)
## [1] 0
Two_Card_Deal(1e2)
## [1] 4
Two_Card_Deal(1e2)
## [1] 2
Two_Card_Deal(1e2)
## [1] 1
Three_Card_Deal(1e0)
## [1] 0
Three_Card_Deal(1e2)
## [1] 3
Three_Card_Deal(1e2)
## [1] 6
Three_Card_Deal(1e2)
## [1] 6

These examples show the functions will produce differing results every time they are run, just like actual poker. The result show how many times a blackjack was delt each time. When the function is told to deal 1e0 or 1 time, very few blackjacks are observed. When told to run 1e2 (100) times we observe more black jacks. We expect to recieve about 5 blackjacks everytime 100 hands are dealt. However, sometimes we are more or less lucky. Therefore, the number changes every round.

The experiment

Here we run the experiment. The majority of this code stores the results from the Two and Three hand draw programs into a data.table called Score. Additionally and more importantly, the program will loop over the programs a specified number of times. By default the program will loop 1e2 or 100 times.

experiment <- function(Rep_Numb = 1e2L, Hands = 1e2L) {


Score <- data.table(Wins = rep(0,Rep_Numb*2), Draw = "Temp")
Score[1, Wins := Two_Card_Deal(Hands)]
Score[1, Draw := "Two_Card"]
Score[2, Wins := Three_Card_Deal(Hands)]
Score[2, Draw := "Three_Card"]



for (i in seq(3,Rep_Numb*2,2) ) {
        
        Score[i, Wins := Two_Card_Deal(Hands)]
        Score[i, Draw := "Two_Card"]
        Score[i+1, Wins := Three_Card_Deal(Hands)]
        Score[i+1, Draw := "Three_Card"]
   
            
}

Score <<- Score 


}


experiment(Rep_Numb = 1e2L, Hands = 1e5)

Results

Here I display the output of the experiment. I should note that the experiment took approximately 1 hour to run.

 Score
##       Wins       Draw
##   1: 4.871   Two_Card
##   2: 4.799 Three_Card
##   3: 4.756   Two_Card
##   4: 4.849 Three_Card
##   5: 4.797   Two_Card
##  ---                 
## 196: 4.745 Three_Card
## 197: 4.828   Two_Card
## 198: 4.881 Three_Card
## 199: 4.848   Two_Card
## 200: 4.643 Three_Card
        Score %>% summary()
##       Wins           Draw          
##  Min.   :4.643   Length:200        
##  1st Qu.:4.777   Class :character  
##  Median :4.828   Mode  :character  
##  Mean   :4.823                     
##  3rd Qu.:4.871                     
##  Max.   :5.022
        Score[Draw == "Two_Card",Wins %>% mean]%>%round(digits = 4)
## [1] 4.8215
        Score[Draw == "Three_Card",Wins %>% mean]%>%round(digits = 4)
## [1] 4.8242

Score and summary show the raw numbers of this experiment. This isn’t all that helpful on its own. The averages calculated are slightly more useful. From these we can say that the two methods, two and three card draws, seems to produce very similar results and as we expected. They are close to 4.8%. So, how similar are the two ways of dealing? Let’s produce some visualization to aid in our analysis.

        library(ggplot2)
        
        ggplot(Score, aes(Wins, ..count..,  color = Draw)) +
                geom_density(position="dodge", alpha = 0.5, size = 1)+
                #geom_histogram(binwidth = 1, color = 'black', position="dodge", alpha = 0.5, size = 1) +
                geom_vline(xintercept = Score[Draw == "Two_Card",Wins %>% mean]%>%round(digits = 4), color = 'blue', size=1.2, alpha =0.6, linetype="dashed")+
                geom_text(
                        aes(
                                label = as.character(   paste0(Score[Draw == "Two_Card",Wins %>% mean]%>%round(digits = 4),"%")   ), 
                                y=-3,
                                x = (Score[Draw == "Two_Card",Wins %>% mean]%>%round(digits = 4)) + 0.1
                        ), 
                        color = 'blue',
                        size = 4) +
                
                geom_vline(xintercept = Score[Draw == "Three_Card",Wins %>% mean]%>%round(digits = 4), color = 'red', size=1.2, alpha =0.6, linetype="dashed") +
                geom_text(
                        aes(
                                label = as.character(   paste0(Score[Draw == "Three_Card",Wins %>% mean]%>%round(digits = 4),"%")   ), 
                                y=-3,
                                x = (Score[Draw == "Three_Card",Wins %>% mean]%>%round(digits = 4)) -0.1
                        ), 
                        color = 'red',
                        size = 4) +
                scale_color_manual(values=c("blue", "red")) +
                scale_fill_manual(values=c("blue", "red"))
## Warning: Width not defined. Set with `position_dodge(width = ?)`

This code produces a density plot using the results of the test. We separate the two type of deals by color, as shown in the legend. Both have a normal distribution (gaussian). Both are centered at about the same point; the means are shown by colored dashed lines and their values are listed below the graph. This mean should approximate the actual probability of drawing a blackjack. If we ran this experiment an infinite number of time is would exactly equal the probability. However, I should say that the number of replications is already in excess of the minimum needed. For all intents and purposes it is infinite. Let’s see how this data looks when graphed as box plots.

ggplot(Score, aes(Draw, Wins, fill = Draw))+
        geom_boxplot(alpha = 0.2, size = 1.3) +
        geom_boxplot(fill = NA, alpha = 1, size = 1.3) +
        scale_color_manual(values=c("blue", "red")) +
        scale_fill_manual(values=c("blue", "red"))

The graphs show a compelling story. The results are the same. However, can we describe this in a statistical way? In other words, how confident are we that a two card draw and a three card draw produce the same probability of a blackjack? This is a ideal case to utilize a students t-test. Below, I do just that.

t.test(x =Score[Draw == "Two_Card", Wins], y= Score[Draw == "Three_Card", Wins] ) 
## 
##  Welch Two Sample t-test
## 
## data:  Score[Draw == "Two_Card", Wins] and Score[Draw == "Three_Card", Wins]
## t = -0.27498, df = 197.69, p-value = 0.7836
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.02157279  0.01629279
## sample estimates:
## mean of x mean of y 
##   4.82151   4.82415

This analysis shows that there is a low chance the actual probabilities between the two dealing methods differ and based on our statistics, we are relatively certain of this.

There is one more important calculation that we can perform. What is the probability of observing the distribution produced from the 3 card draw if the actual probability was 4.9%? We can answer this by calculating the standard deviation (sd) of the simulation and use this to calculate the number of sds the theoretical mean is from the calculated mean. We can than use a precalculated table to look up the probability of observing a number that many sd away with the function pnorm.

Other_Probability <- (4*16*2)/(50*52)*100
Other_Probability
## [1] 4.923077
mean <- Score[Draw == "Three_Card",Wins %>% mean()] 
mean
## [1] 4.82415
Distance_From_Mean <- (Other_Probability - mean)

sd <- Score[Draw == "Three_Card",Wins %>% sd()]
sd
## [1] 0.0692201
SD_From_Mean <- Distance_From_Mean/sd
SD_From_Mean
## [1] 1.429165
(pnorm(SD_From_Mean,lower.tail = FALSE) * 100)
## [1] 7.647844

Here we find there is only a 7.6% chance of observing a number at least as far from the mean as our theoretical probability. This shows that our theoretical model, where the probability of a blackjack on a three card draw is calculated differenctly from the two card draw, is very unlikely.

Conclusion

Here identified that additional card draws has no impact on the probability of receiving a blackjack. Interestingly, because the three card hypothese had a probability very close to the two cards hypothesis a large number of replications were needed. Further investigations would benefit from multithreading processing. To this end I recommend using larger numbers of deals are lower numbers of repeats.

Mathmatical Proof

Many thanks to Ilyse for providing the mathematical proof. Shown in the picture below is the mathematical proof showing that the probability of a three or two card deal is equivalent. This proof employs the transitive property of multiplication and cleverly rearranges the numerators. This allows us to then factor out the odds that the dealer’s card imparts onto our problem. This probability turns out to be a factor of 1 and thus does not affect the final numbers. Samir- when do you fly me to Vegas?

altText