# Blackjack

The expected outcome of a Blackjack play can be calculated as follows Here we assume that the two probabilities are independent from each other, not exactly correct but a good approximation for large number of decks. $$ E_{i,k} = X_{j,l} P_{i,j} P'_{k,l} $$

- \(X_{j,l} \): the outcome value when your hand is \(j \) and dealer’s final hand is \(l \)
- \(P_{i,j} \) the probability that your next hand will \(j \) given that your current hand is \(i \)
- \(P'_{k,l} \) the probability that dealer's final hand will be \(l\) given that your dealer's open card value is \(k\).

Here is the outcome matrix \(X_{j,l} \) for a *unit* bet.

Note that the outcome matrix is mostly symmetrical. There are two (important) exceptions:

- If a player's hand is 21 in the first two cards it is called
*natural*or*blackjack*and she immediately wins (unless dealer reveals also a natural). And the house pays 3/2 of her bets. - If a player is busted she immediately loses her bet (even if dealer is also busted).

The first (resp. second) exception is in the favor of the player (resp. the house). But the probability values of these two events are quite different. Player gets a natural with probability \(\sim \frac{1}{21}\). On the other hand both player and dealer are busted in the same play with probability is \( \sim \frac{1}{12} \) It is not easy to calculate this probability. Here we assume that the player follows exactly the dealer’s strategy (hit until 17). So the house gets an edge \( +1 \times \frac{1}{12} - \frac{1}{2} \frac{1}{21} \sim \frac{1}{16} \)

\(P_{i,j} \) is determined mainly by the player's move.
In the trivial case, if the player *stays* then \(P_{i,i} = 1 \) and \(P_{i,j} = 0 \; \forall j \neq i \).
Otherwise she chooses to *hit* and gets a new card.
The probability for allmost all card values \( 2 \dots 9 \) is \( \frac{4}{52} = \frac{1}{13} \).
There are two exceptions for the value \(10\) the probability is \( \frac{4}{13} \)
since there are 4 kinds of cards having card value \(10\) which are: 10, J, Q and K.
The value of a A card is either \(1\) or \(11\) depending on the player's hand.
The priority is for the value \(11\) but if the player would be busted if we count A as a \(11\) then we count as a \(1\).
So for \( i \leq 10 \) we count A as \(11\) otherwise as \(1\).

The dealer follows a fixed strategy, *hit until \(17\)*.
We can model this with a markov chain.
We construct 1-step transition probability matrix similar to the probability matrix that we construct for \(P_{i,j} \).
The only difference is that the states \(\geq 17\) are absorbing states,
which means when the dealer reaches at that state will state at that state.
Then we calculate n-step transition probabilities by multiplying 1-step transition probability matrix n times.