Saturday, April 12, 2014

Math Awareness Month Part 2: Infinite Series

Today's page for Math Awareness Month is about a recent video that caused some huge debate. I saw the video a month or two ago, and was very intrigued. I showed it to some of my friends, and we were arguing about the content for quite a while. It also spread rapidly around the math department at Andover, with some teachers bringing up in their classes.

Take a look at the page and try some of the exercises. You will find the outcomes very interesting and mind-boggling. The concept of infinity is difficult for any human being to grasp, making it tons of fun to think about.

http://www.mathaware.org/mam/2014/calendar/infinity.html

Comment below what you think of the video. Do you think it is accurate? What do you think the fallacies are? How could this be a part of string theory if it is mathematically flawed?

In math class last week, we were given the following problem:







I then did the math and determined that the limit would be -1/12. I then called my teacher over, and pointed to that answer. Recalling the video, I asked him if I could rewrite that -1/12 as 1+2+3+4+5+6+7+... as my final answer. Thankfully, he got the reference. In addition to being a funny anecdote, the fact that people got the joke shows how wide of an audience this information has reached and captivated, which is amazing to see.

Saturday, April 5, 2014

Math Awareness Month Part 1: Magic Squares

I explained a bit in my last post that April is Math Awareness Month, as well as linked to the poster on www.mathaware.org. In honor of this occasion, I plan to make my posts this month relevant to the pages on the website and the mathematicians hosting them.

April 1st was a day on magic squares, and I am honored to have been the host of that page. There is a recent performance of me doing it, tutorials on how to make various magic squares, and different activities and questions that can further your magic square experience. Click here to see the page.

Saturday, March 29, 2014

Conclusion to Half-Tau Month

Though pi day passed a few weeks ago, my brother made the interesting observation that this month is "Pi Month." It is March of 2014, or 3/14. Since I spent the month focused on trigonometry, I never had a chance to honor this joyous occasion until today.

Interestingly, pi does play a huge role in trigonometry. From wrapping functions to sine curves to angle measurements, pi is always popping up. Though this is kind of interesting, trigonometry is also one of the areas where tau really shines. Having just finished topics such as trigonometry, polar coordinates, and wrapping functions, I have found that it is a real struggle to use pi. I found myself converting most of my problems to tau before solving them just because pi made it too confusion.

No video describes these sorts of issues better than Vi Hart's "Pi is (still) Wrong" video, which gets into some of the issues involved with using pi, one of these being trigonometry.


I would also like to make you all aware that next month is Math Awareness Month. The theme this year is Mathematics, Magic, and Mystery, in part to honor the centennial of Martin Gardner's birth. At www.mathaware.org, there is a poster with 30 squares on it to represent the 30 days of April. On each day of the month, the next square becomes active. I will try to keep an eye on these webpages, as I will probably use April to comment on the topics posted there. Also, April 1st is a page on magic squares, and I am extremely honored to be hosting that day.

Saturday, March 22, 2014

Rediscovering Trigonometry Part 4: More Useful Formulas

Click here to see part one of this four week series.
Click here to see part two of this four week series.

Click here to see part three of this four week series.


Now that we have discovered some useful trigonometric identities, we can continue to build on them and create many more. There are an infinite number of trigonometric identities out there (not all of them have been created of course), but we will stick to two in this post: the product-to-sum formulas and the sum-to-product formulas.

Take the four angle addition/subtraction formulas we discovered in our first week. I will use A and B as our letters rather than alpha and beta.

1. sin(A + B) = sinAcosB + cosAsinB
2. sin(A – B) = sinAcosB – cosAsinB
3. cos(A + B) = cosAcosB – sinAsinB
4. cos(A – B) = cosAcosB + sinAsinB

These can be messed with very easily to create some new formulas. For instance, adding together the first two formulas gives:

sin(A + B) + sin(A – B) = sinAcosB + cosAsinB + sinAcosB – cosAsinB
2sinAcosB = sin(A + B) + sin(A – B)
sinAcosB = [sin(A + B) + sin(A – B)]/2

We now have a new identity. This can be now be used to solve a whole new range of problems and generate a whole new range of identities. The same steps can be done by subtracting the second equation from the first, adding the third and fourth together, and subtracting the fourth from the third. This creates the four product-to-sum identities.














These four formulas can be rewritten in a way that converts the sum into a product. Let's rewrite the variables as the following:

a + b = A
a – b = B

Making this change, we can then perform some operations to get a whole new set of formulas. These are called the sum-to-product identities.
















These can then be built upon to generate whole new sets of formulas as well. Though the actual mathematics here might be a bit complicated, the idea is simple. Mathematics is always continuing to be developed, and this can be done through building upon previous ideas to form new ideas that help solve new problems. Trigonometry is a great place to see this sort of thing happen.

Saturday, March 15, 2014

Rediscovering Trigonometry Part 3: Half Angle Formulas

Click here to see part one of this four week series.
Click here to see part two of this four week series.


Last week, we figured out a way to figure out trigonometric functions for twice a given angle. This week, we will do the same, but for determining the trigonometric functions for half a given angle. First, let's discuss what half of an angle means.

Remember that there are 360° in a circle, or 360° in a full revolution. This means that a number like 370° can also be expressed as 10°. Though they are different measurements, plugging 370° into a trigonometric function will yield the same answer as 10°. It is also equivalent in most other situations in mathematics.

For double angle formulas, we did not need to discuss this. This is because when doing double angle formula calculations with these measurements, there would be no issue.

sin(2 • 10°) = sin(20°)
sin(2 • 370°) = sin(740°) = sin(740° - 720°) = sin(20°)

Note that 720° is two full revolutions around a circle, and thus, it can be subtracted off when performing a trigonometric operation.

But performing a half angle calculation will create more of an issue. Let's use 10° and 370° again.

sin(1/2 • 10°) = sin(5°)
sin(1/2 • 370°) = sin(185°)

These answers are not the same. Since they are both in the 0° - 360° interval, we cannot make any assumptions. We do know that the sine and cosine of 185° are the negative sine and negative cosine of 5° respectively, but this proves that they are not equal. If one were go up to 730°, they would be back to normal, however.

sin(1/2 • 730°) = sin(365°) = sin(365° - 360°) = sin(5°)

This means that for every angle, the half sine and half cosine function should yield two answers. The two answers should have the same absolute value, but different signs (they are the same number, but one is negative and one is positive). You may already have a function in your head that can create this type of situation, but we will be able to derive it as well.

Take a variation of the cosine double angle formula that we derived last week:

cos(2α) = 1 – 2sin2α

Let's try to isolate sinα. We would first add that to the left hand side and subtract the cosine of 2α over to the right hand side.

2sin2α = 1 – cos(2α)

Divide through by 2 to get:

sin2α = (1 – cos(2α))/2

And square root both sides to get:

sinα = ±√((1 - cos(2α))/2)

Notice how there is a ± sign in front of the square root. This is because when one squares a positive or negative value, it becomes positive. For instance, the equation x2 = 25 would be solved as x = ±5 because (5)(5) = 25 and (–5)(–5) = 25. The same thing happened here. But also remember what we found before. We proved through logic that the half sine and half cosine of an angle has two answers, one negative and one positive. With that in mind, we can see that this is the accurate way to write the square root (some derivations call for just a positive answer such as the Distance Formula).

Let's replace angle α with α/2 to keep the half angle definition. This gives a formula of:

sin(α/2) = ±√((1 - cosα)/2)

Let's derive a cosine half angle formula. We can take another variation on the cosine double angle formula and go forward.

cos(2α) = 2cos2α – 1

This time, we will only need to add one to both sides to isolate the cosα term. Let's also flip the equation around to make it simpler.

2cos2α = 1 + cos(2α)

Divide through by 2 to get:

cos2α = (1 + cos(2α))/2

And square rooting both sides yields:

cosα = ±√((1 + cos(2α))/2)

Again, we end up with a ± sign in the formula. This means that we probably did everything correctly, as logic shows we will need this sort of sign to create two answers. Rewriting α as α/2 gives a final formula of:

cos(α/2) = ±√((1 + cosα)/2)

It is tough to see what these formulas actually look like in this formatting, so I have written them out in LaTeX so you can see what is going on more conveniently.


These formulas themselves are pretty cool, but the logic involved in finding them is also very interesting. The fact that we could predict the nature of the function before we even found it is really helpful. This can be huge in trying to figure out the right way to go about solving a problem.

Saturday, March 8, 2014

Rediscovering Trigonometry Part 2: Double Angle Formulas

Click here to see part one of this four week series.


Last week, we developed some formulas that could calculate the sine, cosine, and tangent of the sum and difference of two angles. This proves useful when trying to calculate the exact sines/cosines/tangents of angles that are not in special right triangles (45-45-90, 30-60-90, 18-72-90).

What if we wanted to find the exact values for double a certain angle. Let's say we know the following:

sin18 = (√(5) - 1)/4
cos18 = (√(10 + 2√(5)))/4

How could we calculate the sine of 36°? We know the sine angle addition formula from last week, but it would be much easier to have a generalized version of this. Let's take a look at it.

sin(α + β) = sinα cosβ + cosα sinβ

What if we were finding the sine of 2α? Let's see what the formula would tell us:

sin(2α) = sin(α + α) = sinα cosα + cosα sinα = 2sinα cosα

So with some pretty simple computations, we get the formula:

sin(2α) = 2sinα cosα

That's a pretty simple formula. To find the sine of 36°, we could just do some easy manipulation with the values from up top.

sin36 = sin(2 • 18) = 2 • ((√(5) - 1)/4) • ((√(10 + 2√(5)))/4) = (√(10 - 2√(5)))/4

This sort of computation is clearly very useful when you are studying trigonometry. It wouldn't be practical in the sense that we use it in our day-to-day lives, but I think it is clear how useful this is to mathematicians and astronomers. I also find it really cool that these seemingly random irrational values can be derived exactly using just some basic mathematics.

Let's create a cosine formula. We know from last week that:

cos(α + β) = cosα cosβ – sinα sinβ

Substituting α in for β gives:

cos(2α) = cos(α + α) = cosα cosα – sinα sinα = cos2α – sin2α

This is the formula that naturally comes out:

cos(2α) = cos2α – sin2α

Knowing that sin2α + cos2α = 1, this can be rewritten in a few different ways:

cos(2α) = cos2α – sin2α
cos(2α) = 2cos2α – 1
cos(2α) = 1 – 2sin2α

This is extremely convenient, as the problem can be made much easier depending on what information you have. If you only know the sine of the angle, the third formula will work. If you only know the cosine, the second formula will work. There are also times where the first formula might be most convenient.

As you can see, it is pretty simple to do the work to come up with the double angle formulas, probably even easier than applying them in many cases. I encourage you to do the same process as we have done for sines and cosines to generate one for tangents, using the tangent formula we found last week. You will get a very pretty result.

Also, it can be fun to play around with these and find the exact sines and cosines of various angles. You will also see that there are many ways to write these different values. This is because they are irrational numbers. You could find the sine of 105° by doing sin(45 + 60), sin(90 + 15), sin(180 - 75), or many other variations. These could very well give different looking answers, but if the math was correct, the actual results will be equal.

Saturday, March 1, 2014

Rediscovering Trigonometry Part 1: Addition and Subtraction Formulas

In January, I did a series with some heavier mathematics, involving lots of number theory, combinatorics, and some fairly difficult manipulation. Last month, we took a little rest from this by talking a bit about casino games and optimal strategies. The mathematics we used was more probability and game theory. This month, I thought we could explore something completely different that is also extremely interesting. It is taught in school (much of the material in this post actually comes straight from my math class), but maybe not in a fun, thought-provoking way. This month, we will dive into trigonometry.

If you want to brush up on your basic foundational trigonometry, please click here. It is my post on the Law of Cosines, but also explains at the beginning what the sine, cosine, and tangent functions are. I will make sure to prove any other trigonometric identities we use in this series (or link to a proof), so all you need to know is what a sine, cosine, and tangent is.


Now we are ready to derive our first identity. We will try to figure out a simpler way of writing sin(α+β). There are many proofs of this, but I am using one that I found at www.themathpage.com. Let's start with a diagram to help explain this idea.


Create the line AB.
Rotate it to point C, creating the angle α.
Rotate it to point D, creating the angle β.
Draw DE perpendicular to AB.
Draw DF perpendicular to AC.
Draw FG perpendicular to AB.
Draw FH perpendicular to ED.

We are trying to figure out the sine of α+β, which can be written as (ED/DA). First, let's determine the value of the angle HDF (which has already been written in for us).

Note that the lines HF and AG are parallel, with a transversal (a line that intersects both lines) of AF. In geometry, there is a theorem called the Alternate Interior Angle Theorem, that essentially tells us that in this circumstance, the measure of angle GAF is equal to the measure of angle AFH. In other words, angle AFH has a measure of α. Noting that angle AFD has a measure of 90 and AFH has a measure of α, that means angle HFD would have a measure of 90–α. Since a triangle has 180 degrees, having two angle measures in a triangle is enough to get the third. Triangle HFD has an angle of 90, an angle of 90–α, and one more angle that creates a sum of 180 degrees. Do the math and you will find that the angle must be α, and thus, angle HDF has a measure of α as depicted in the diagram.

Now we can try to find the formula. Let's start with the following equality:

ED = GF + HD

Note that we are trying to find what (ED/DA) equals. Because of this, let's divide both sides by DA.

(ED/DA) = (GF/DA) + (HD/DA)

Let's complicate some terms on the right hand side. Multiply the fraction on the left by (AF/AF) and the one on the right by (FD/FD)

(ED/DA) = (GF/AF)(AF/DA) + (HD/FD)(FD/DA)

(ED/DA) is simply the sine of α+β. Looking back at the diagram, (GF/AF) would be the sine of α. (AF/DA) would be the cosine of β. (HD/FD) would be the cosine of α. (FD/DA) would be the sine of β. This gives us the following formula:

sin(α + β) = sinα cosβ + cosα sinβ

This is a beautiful result. The sine of the sum of two quantities can just be pulled apart so easily. This is really cool on its own, and furthermore, it ends up being the foundation of tons more identities. Let's say we wanted to find the sine of α–β. We could just plug (-β) in for β and see what we get.

sin(α – β) = sinα cos(-β) + cosα sin(-β)

These negative terms can be analyzed in a number of ways, but the easiest way to do it is to look at the graphs of the sine and cosine functions.

Graph of y = sin(x)

Graph of y = cos(x)

Notice how the sine graph is symmetric over the origin. Any sin(x) will equal -sin(-x) and any sin(-x) will equal -sin(x). On the other hand, the cosine graph is symmetric over the y-axis. Any cos(x) will equal cos(-x) and -cos(x) will equal -cos(-x). This enables us to simplify the formula much more.

sin(α – β) = sinα cos(-β) + cosα sin(-β)
sin(α – β) = sinα cosβ + cosα (-sinβ)
sin(α – β) = sinα cosβ – cosα sinβ

Fantastic. What if we wanted to find the cosine of the sum of two angles? Going back to our original diagram, we can start with the following expression:

EA = GA - FH

Dividing through by AD creates the desired left hand side.

(EA/AD) = (GA/AD) - (FH/AD)

Multiply the term on the left of the right hand side by (AF/AF) and the right term by (DF/DF) to get:

(EA/AD) = (GA/AF)(AF/AD) - (FH/DF)(DF/AD)

And turning this into the appropriate functions gives:

cos(α + β) = cosα cosβ – sinα sinβ

Doing the same thing as before gives a subtraction formula of:

cos(α – β) = cosα cosβ + sinα sinβ

Finally, let's try to create a tangent formula. Knowing that dividing the sine by the cosine will give the tangent, let's try dividing the two formulas by each other.

sinα cosβ + cosα sinβ
cosα cosβ – sinα sinβ

Divide each term through by cos cosβ.

(sinα cosβ)/(cosα cosβ) + (cosα sinβ)/(cosα cosβ)
(cosα cosβ)/(cosα cosβ) – (sinα sinβ)/(cosα cosβ)

Many terms will now cancel.

(sinα)/(cosα) + (sinβ)/(cosβ)
1 – ((sinα)/(cosα))((sinβ)/(cosβ))

Turning the sine and cosine ratios into tangents gives a formula of:

tanα + tanβ
1 – tanα tanβ

And there's the formula! If you wanted to create a subtraction formula, you would just note that the tangent function is symmetric over the origin (or it is an odd function), and plug in the necessary values to get:

tanα – tanβ
1 + tanα tanβ

I think that these are really cool formulas. But they are also very practical. For instance, let's say you want to find the exact sine of 75°. We know that sin(45) = (√2)/2, sin(30) = 1/2, cos(45) = (√2)/2, and cos(30) = (√3)/2. So, this can be determined with the sine angle addition formula.

sin(75) = sin(30 + 45) = sin30cos45 + cos30sin45 = (1/2)((√2)/2) + ((√3)/2)((√2)/2) = (√(2) + √(6))/4

Knowing that the Greeks did some manipulation with the regular pentagon to find an exact sine of 72°, we can plug all of this information into the sine angle subtraction formula to find the exact sine of 3°. We can then eventually make our way down to 1°, which gives us the ability to generate the sines of all of the angles on the trig tables that mathematicians now use today.

Next week, we will use these formulas to create more generalizations that will make many of these trig table computations much much simpler. And give us some really pretty formulas in the process.

Saturday, February 22, 2014

Gambler's Ruin Problem Part 4: Odds in Video Poker

Click here to see part 1 of this four week series.
Click here to see part 2 of this four week series.
Click here to see part 3 of this four week series.


Suppose that you find yourself in a city with a casino and you have $60 in your pocket. There is a concert in town that you really want to see, but the tickets cost $100. You decide that you will place $1 bets until you either reach $100 or go broke. Which casino game should you play? How likely are you to reach your goal of $100?

This week is the final week in my series on the Gambler's Ruin Problem, which I have explained again in the paragraph above. We have analyzed roulette, craps, and blackjack, finding out various odds, expected values, and success probabilities. Here is what we have so far:

GameAvg Gain Per $1 BetP of Reaching $100
Favorable Game (51-49 odds)92.6%
Fair Game (50-50 odds)60%
Blackjack-0.5¢47.8%
Craps-1.4¢28%
Roulette-5.3¢1.3%

Let's see how video poker fairs. I chose not to do Texas Hold'em or another popular version of real poker because there is so much strategy involved, and determining a universal statistic is near to impossible. If you are also considering reading players, pot odds, and the occasional bluff, it becomes extremely complicated. However, video poker is another game that is you against the house and can be played with a more concrete strategy like blackjack. Let's go over the rules.


As you can see in the picture, video poker is pretty much a slot machine, except it gives much better odds. The game of poker played on it is five card draw. The player is given five cards to start. They then are given the opportunity to either keep them all, get rid of one, get rid of two, get rid of three, get rid of four, or get rid of all of them. The cards they got rid of are then replaced, and the hand they have left is identified and the proper money exchange is made. If you are unfamiliar with the poker hands, click here. This is the list of odds the casino gives for each hand:

Royal Flush - 250:1
Straight Flush - 50:1
Four of a Kind - 25:1
Full House - 9:1
Flush - 6:1
Straight - 4:1
Three of a Kind - 3:1
Two Pair - 2:1
Pair of Jacks or Better - 1:1


As you can see, the rarer the hand, the bigger the payoff is. This creates the difficulty in choosing which cards to hold and which to discard in any given turn.

I will start by just going through the basic strategy. Then, we will look at some of the exceptions and why they are encouraged.

1. With two pair or higher, keep the cards needed for the hand and discard the rest (for instance, draw one card in a two pair, don't draw any in a flush)
2. With one pair, keep the pair and discard the rest
3. With no high cards, discard all five
4. With one high card, keep it and discard the rest
5. With two high cards, keep them and discard the rest
6. With three or four high cards, keep two. If there are two of the same suit, keep them. Otherwise, take the two with the lowest value.

Pretty simple when it comes to poker strategy. That one won't take up an entire book. Now let's look at some exceptions. The first one is the following:

If four cards are in a straight flush, discard the fifth one (but don't break a straight or flush unless it can become a royal flush)

For instance, take the following example:

7C  8C  9C  JC  JD

In this hand, the basic strategy would say to discard the seven eight and nine, but this exception tells us to discard the jack of diamonds. Let's see why. There are 52 cards in a deck, and five have been used in this hand. So, the remaining possibilities to take the place of the jack of diamonds should total 47.

Here are the possible hands and their probabilities:

P(Straight Flush) = 1/47
P(Flush) = 8/47
P(Straight) = 3/47
P(2 Jacks) = 2/47
P(Nothing) = 33/47

EV(Discard JD) = (1/47)(50) + (8/47)(6) + (3/47)(4) + (2/47)(1) + (33/47)(-1) = 79/47 ≈ $1.68

And here are the possible hands and their probabilities for keeping the jacks:

P(4 of a Kind) = (3 ways of choosing)(2/47 third jack options)(1/46 fourth jack options) = 3/1081
P(Full House) = (3 ways of choosing placement of third jack)(2/47 third jack options)(46/46 • 3/45 pair options) + (12 value choices of three of a kind)(4/47 first cards)(3/46 second cards)(2/45 third cards) = 62/5405
P(3 Jacks) = (3 ways of choosing placement of third jack)(2/47 third jack options) = 6/47
P(2 Pair) = (3 ways of choosing)(47/47 • 3/46 pair options) = 9/46
P(2 Jacks) = 1 - P(4 of a Kind) - P(Full House) - P(3 Jacks) - P(2 Pair) = 7161/10810

EV(Keep Jacks) = (3/1081)(25) + (62/5405)(9) + (6/47)(3) + (9/46)(2) + (7161/10810)(1) = 17397/10810 ≈ $1.61

As you can see, keeping the jacks has less of a payoff than this exception. It isn't a huge difference, but still one to take note of.

Here are some other exceptions:

If you have four cards in a flush, go for the flush.
If you have three cards in a royal flush, go for the royal flush.
If you have an open-ended straight, go for the straight.
If you have three straight flush cards, go for the straight flush.
If you have J 10 suited, Q 10 suited or K 10 suited, keep the 10 in addition to the high card.

All of those exceptions could be proven with the probability techniques. Using this strategy, you will have very similar odds to blackjack with about a 0.5¢ loss per turn. Most players will lose 4¢ per turn, so this puts us way ahead of the game.

GameAvg Gain Per $1 BetP of Reaching $100
Favorable Game (51-49 odds)92.6%
Fair Game (50-50 odds)60%
Blackjack-0.5¢47.8%
Video Poker-0.5¢47.8%
Craps-1.4¢28%
Roulette-5.3¢1.3%
Average Vegas Slot Machine-6.6¢0.5%

I added an average for Vegas slot machines onto the bottom of our table just to give a taste as to how bad their odds are. Of course, each slot machine varies and I'm not sure how accurate the information I found was for them. But the odds for the games we discussed are all completely based on mathematics and are a lot of fun to play around with. If you play other games in the casino, I'm sure you can determine all of the same information for the Gambler's Ruin Problem and looking for optimal strategy.

So what's the answer to the Gambler's Ruin Problem? I don't know. We took a close look at many different games, but we can never have enough information to have a solid answer. There are dozens of different games and bets out there, many of whom can't be completely analyzed with probability and game theory. But this problem is a gateway to having fun with numbers and probability to make yourself a better player at the casino and learn a bit about mathematics. I hope some of the things we've learned in the last month become useful to you next time you have sixty bucks in a city with a casino.

Saturday, February 15, 2014

Gambler's Ruin Problem Part 3: Odds in Blackjack

Click here to see part 1 of this four week series.
Click here to see part 2 of this four week series.


We spent the last two weeks talking about the Gambler's Ruin Problem and how it is a gateway to analyze different games like craps and roulette. Here is a refresher of what we have discovered so far, as well as what the Gambler's Ruin Problem is:

Suppose that you find yourself in a city with a casino and you have $60 in your pocket. There is a concert in town that you really want to see, but the tickets cost $100. You decide that you will place $1 bets until you either reach $100 or go broke. Which casino game should you play? How likely are you to reach your goal of $100?

And here were the probabilities we found for all bets in roulette, the pass line bet in craps, and the other two control statistics.

GameAvg Gain Per $1 BetP of Reaching $100
Favorable Game (51-49 odds)92.6%
Fair Game (50-50 odds)60%
Craps-1.4¢28%
Roulette-5.3¢1.3%

We found that roulette is a game of minimal strategy; each bet had the same expected value. Craps is a more difficult game because of the many different bet options each with different perks and odds, but players still don't have to worry about utilizing strategies on the fly. Blackjack starts to get into some more complicated strategy building.


Though there are other players at the table, like craps and roulette, blackjack is a game of you against the house (which is represented by the dealer). You will receive two face up cards and the dealer will receive one face up and one face down card. The sum of the numbers on the card is what your total is (J = 10, Q = 10, K = 10, A = 1 or 11). For instance, K 2 would be 12, 9 7 would be 16, A 5 would be 6 or 16. Hands with an ace counting for eleven are called soft hands because they are easier to work with; they can be lowered by ten at any time if need be.

Once you get your two hands, the dealer will ask if you want to "hit" or "stand." Hitting is when you take another card and add it to your total. Standing is when you do not take any more cards and your hand becomes final. If you hit and your total goes over 21, you "bust" and lose your bet.

Once everyone at the table stands or busts, the dealer then turns over his facedown card. He then must hit until his total is 17 or above. Once he gets to there, he must stand. You then lose your bet if his/her total beats yours and you get even money (1:1) if you beat his/her total.

When you get 21 with just two cards (A K, A J, etc), your hand is called blackjack. As you can see on the table above, blackjack pays 3:2 instead of just 1:1. This is one of the perks that you have as a player; the dealer cannot request that you pay him extra because he got blackjack.

As a player, you also have a few additional betting options that I will explain below.

Doubling Down is when you double your bet on the table and agree to only take one more card. With certain types of starting hands, you can increase your payoff in this way.

Splitting is only allowed when you have two cards of the same number. You can "split" the cards, put a second equal bet on the other card, and play both hands simultaneously against the dealer. Most casinos let you re-split cards, but rarely do they let you double down after splitting.

Taking Insurance is only allowed when the dealer's face up card is an ace. You can bet up to half of your original bet that the dealer's facedown card is a 10, J, Q, or K. This bet pays 2:1, as depicted on the table above.

Blackjack doesn't have to deal with as many weird ratios and random bets as craps does, but developing strategy becomes more difficult because of this. Aside from taking insurance, it is all just inflicting different probabilities into a lone 1:1 bet. But how can we optimize our odds on this 1:1 bet?

When you think about it, it seems like you have a pretty big advantage over the dealer. You can stand before 17, hit after 17, split, double down, take insurance, and get paid 3:2 on blackjack. How do the casinos make money? Well, there is one thing that the dealer has an advantage on, which doesn't even cross our minds. Every time you bust, you lose. Even if the dealer busts. This one advantage is what makes blackjack worth it for the casinos.

This doesn't mean that we can't try our best though. A beginner might just make random bets based on intuition, but more experienced players are able to get their odds much closer to 1:1. Let's start with looking at when to hit or stand. First, hard hands:

Dealer's Up Card Hit Until You Reach
7, 8, 9, 10, A 17
4, 5, 6 12
2, 3 13

So let's say your starting hand is 7 2 and the dealer is showing a 3.

7 2
? 3

Your total is nine, and you hit until you reach 13. So you hit.

7 2 2
? 3

Now your total is eleven, so you must hit again.

7 2 2 K
? 3

Now your total is 21, and you obviously would stand here.

7 2 2 K
5 3 J

You win! Great job. That guideline is probably the most basic part of the strategy, and will come into play in almost every round. If you memorize any of the strategies I discuss here, that is the one to remember.

That was for hard hands (without an ace acting as an eleven). What about soft hands?

Dealer's Up CardHit Until You Reach
9, 10, ASoft 19
8 or belowSoft 18

Let's try it.

A 5
? 9

Our strategy says we should hit.

A 5 7
? 9

Now we have a hard hand of thirteen, so we must switch back to the hard hand strategy and hit until we reach seventeen.

A 5 7 4
? 9

This is one of the most debated parts of blackjack. We have a hand totaling sixteen and we need to hit or stand. Many players are conservative and choose to stand here. However, we know that probability tells us to hit. You could map out all of the possible outcomes of this hand for yourself and the dealer and compare them, and you would find that hitting actually does end up giving you more success.

A 5 7 4 Q
? 9

And you busted.

A 5 7 4 Q
K 9

But you would have lost anyways, so hitting was worth a try on that one. Now let's look at double down and splitting strategies.

Your First Two CardsDouble if Dealer Has
Total 1110 or below
Total 109 or below
Total 94, 5, 6
A2 through A74, 5, 6

When do you splitIf Dealer Has
A, 8any card
4, 5, 10never
2, 3, 6, 72, 3, 4, 5, 6
92, 3, 4, 5, 6, 8, 9

Those are for doubling down and splitting. What about taking insurance? This is the easiest rule of them all.

Don't take insurance

Ever. Let's look at why. The dealer's face down card could be any of the following:

A  2  3  4  5  6  7  8  9  10  J  Q  K

There are nine cards that don't win you the bet and four cards that do. So, the fair odds for the casino to offer would be 9:4. But, they only offer 2:1 or 8:4, meaning that insurance is not worth it (unless you are a card counter).

If you figure out the expected value of your $1 bet incorporating all of these strategies, you end up getting an average loss of 0.5¢. This is much better than craps and roulette! These are the best odds we have seen so far!

GameAvg Gain Per $1 BetP of Reaching $100
Favorable Game (51-49 odds)92.6%
Fair Game (50-50 odds)60%
Blackjack-0.5¢47.8%
Craps-1.4¢28%
Roulette-5.3¢1.3%

These odds are not bad. In fact, we are not far from having a 50-50 shot of turning our $60 into $100!

This strategy is great. But what I always wonder is why it works. Why do we hit on sixteen if the dealer has a seven showing? Let's figure it out.

First, we determine the dealer's odds of busting with a seven. To do this, we start with the odds of busting with sixteen (the dealer won't bust if they get to seventeen because they are required to stand). This is a sum of their odds of getting a 6, 7, 8, 9, or 10 as their next card value (remember that 10 can be achieved four ways).

P(bust with sixteen) = P(6) + P(7) + P(8) + P(9) + P(10)
P(bust with sixteen) = 1/13 + 1/13 + 1/13 + 1/13 + 4/13
P(bust with sixteen) = 8/13 ≈ 0.615

Now, we can determine the odds of busting with a fifteen. They could either hit and get a 7, 8, 9, 10, or an ace followed by a bust.

P(bust with fifteen) = P(7) + P(8) + P(9) + P(10) + [P(A) • P(bust with sixteen)]
P(bust with fifteen) = 1/13 + 1/13 + 1/13 + 4/13 + [1/13 • 8/13]
P(bust with fifteen) = 99/169 ≈ 0.586

We could then figure it out for busting with a fourteen. They could either hit and get a 8, 9, 10, ace-bust, or two-bust.

P(bust with fourteen) = P(8) + P(9) + P(10) + [P(A) • P(bust with fifteen)] + [P(2) • P(bust with sixteen)]
P(bust with fourteen) = 1/13 + 1/13 + 4/13 + [1/13 • 99/169] + [1/13 • 8/13]
P(bust with fourteen) = 1217/2197 ≈ 0.554

This process can be continued until you get to the probability of busting with a seven, which ends up being around 0.262. All of the probabilities of the dealer's outcomes with certain face up cards are on the table below:


So the chances of our sixteen beating the dealer's seven if we stand is 0.262; the only way we would win is if the dealer busts. If we hit, then we have a good chance of busting but also a chance of getting a number between 17 and 21, each with their own chance of winning.

P(win with an A) = P(dealer busts) + ½P(dealer gets 17)
P(win with an A) = 0.262 + ½(0.369)
P(win with an A) = 0.447

P(win with a 2) = P(dealer busts) + P(dealer gets 17) + ½P(dealer gets 18)
P(win with a 2) = 0.262 + 0.369 + ½(0.138)
P(win with a 2) = 0.730

P(win with a 3) = P(bust) + P(17) + P(18) + ½P(19)
P(win with a 3) = 0.262 + 0.369 + 0.138 + ½(0.079)
P(win with a 3) = 0.809

P(win with a 4) = P(bust) + P(17) + P(18) + P(19) + ½P(20)
P(win with a 4) = 0.262 + 0.369 + 0.138 + 0.079 + ½(0.079)
P(win with a 4) = 0.886

P(win with a 5) = P(bust) + P(17) + P(18) + P(19) + P(20) + ½P(21)
P(win with a 5) = 0.262 + 0.369 + 0.138 + 0.079 + 0.079 + ½(0.074)
P(win with a 5) = 0.963

P(win with a 6, 7, 8, 9, 10, J, Q, K) = 0

Now that we have all of this, let's do an expected value equation to see what our average odds are.

EV(hit on 16) = (1/13)(0.447) + (1/13)(0.730) + (1/13)(0.809) + (1/13)(0.886) + (1/13)(0.963) + (8/13)(0) = 0.295

So hitting on 16 gives 0.295 odds while standing gives 0.262 odds. And surprisingly enough, the hitting odds do end up better. Yes you are likely to bust when you hit, but it is better than banking on the worse odds of the dealer busting. The strategies for all of the other things can be derived in similar ways.

Next week, we will complete our series on the Gambler's Ruin Problem and see if video poker can offer odds as good as blackjack.

Saturday, February 8, 2014

Gambler's Ruin Problem Part 2: Odds in Craps

Click here to see part 1 of this four week series.



This week is week two in a four week series on the Gambler's Ruin Problem. Unlike my series on the proof to Bertrand's Postulate, this one can be started in the middle if you have an understanding of some elementary probability concepts like expected value. It will take away some of the initial surprise when faced with the probability of success in previous games, but it is not like Bertrand's Postulate where I am recalling or building upon information that was developed in an earlier post. They are all very separate pieces of information that can be understood on their own or together as an attempt at the Gambler's Ruin Problem.

The idea of the Gambler's Ruin Problem is simple. Here is the problem if you have forgotten it:

Suppose that you find yourself in a city with a casino and you have $60 in your pocket. There is a concert in town that you really want to see, but the tickets cost $100. You decide that you will place $1 bets until you either reach $100 or go broke. Which casino game should you play? How likely are you to reach your goal of $100?

Last week, we discovered that roulette loses on average 5.3¢ per dollar bet, which gives you a shockingly low 1.3% chance of reaching your goal of $100.

Game Avg Gain Per $1 Bet P of Reaching $100
Favorable Game (51-49 odds) 92.6%
Fair Game (50-50 odds)
60%
Roulette
-5.3¢
1.3%
Note: I added a 51-49 "favorable game" and its statistics. This was not discussed last week, but it is more informative for our needs than a 100% probability game like we discussed last week. It has a 2¢ average gain and a 92.6% success probability.

We have found all of the necessary data with roulette, and odds didn't look great. So let's try another game. This week we will look at craps, which is one of the most popular casino games involving dice.


The rules of craps take a couple minutes to remember in its entirety, but are pretty easy to understand.  This explanation comes from bigmcasino.com, which laid them out very well.
The players take turn rolling two dice. The player that is rolling the dice is considered the shooter. The shooter MUST bet at least the table minimum on either the pass line or the don’t pass line.
The game is played in rounds consisting of two phases: come out and point.
Come Out – to start a round, the shooter makes a “come out” roll
If the come out roll is a 2, 3, or 12, then the round ends. The rules of craps state that the shooter is said to “crap out” and players lose their pass line bets.
If the come out roll is a 7 or 11, this results in a win for pass line bets.
The shooter continues to make come out rolls until he rolls 4, 5, 6, 8, 9, or 10. This number becomes the point and in turn the point phase begins.
Point – during this phase, if the shooter rolls a point number then it’s a win for the pass line bets. If the shooter rolls a seven, it’s a loss for the pass line bets and the round is over.

There are many different bets that can be made in craps, but each can be analyzed through probability. I don't have nearly enough time and energy to go through them all, but I will discuss a few.
The most common craps bet is the pass line bet. This is the one discussed in the rules that wins on a seven, eleven, or the roll of the point number. To figure out its odds, we can just create a table of percentages for each of the eleven possible dice totals, determine the probability of winning the pass line bet, and perform an expected value equation like we mastered last week.
Come Out Roll Odds for Pass Line
2 0
3 0
4
5
6
7 1
8
9
10
11 1
12 0

I have already put in the ones that we know from the craps rules. The other six become point rolls and need to appear before a seven. Here are the possible roll totals from two dice:


Let's start with determining the odds for four. There are three ways to roll a four, six ways to roll a seven, and twenty-seven ways to roll something else. To determine the odds of success with a four, there are a few different methods. We will use a more logical method the first time, and then discover a quicker method to figure out the rest.

To roll a four before a seven, you must add up the probabilities of rolling it on the first try, rolling something other than a four/seven on the first and a four on the second, rolling something else on the first two and a four on the third, and so on. 

Rolling a four on the first try would be simply 3/36. Rolling something else on the first try (27 possibilities) and a four on the second try, the odds would be (27/36)(3/36). Rolling something else the first two times and a four on the third would be (27/36)(27/36)(3/36), or (27/36)2(3/36). Rolling something else on the first three times and a four on the fourth would be (27/36)(27/36)(27/36)(3/36), or (27/36)3(3/36). This pattern will continue forever.

Adding this infinite series up will give the following:

3/36 + (27/36)(3/36) + (27/36)2(3/36) + (27/36)3(3/36) + (27/36)4(3/36) + ...
(3/36)(1 + 27/36 + (27/36)+ (27/36)+ (27/36)+ ...)
(3/36)(36/9)
1/3

So your probability when rolling a four is 1/3. That way was the most direct way to calculate it, but also a little complicated and requiring some basic knowledge of infinite series. A much easier approach would be to realize that the remaining 27 options have no significance as to your success. There are 3 good rolls and 6 bad rolls and that is all that matters.

So out of the nine total significant rolls, three of them are winners. Using this logic, the odds for success would be 3/9, or 1/3 as discovered before. Either method generates a 1/3 chance of success.

Using the approach we just discovered, we can very quickly determine the odds for the other totals and complete the table from before.

Come Out RollOdds for Pass Line
20
30
41/3
52/5
65/11
71
85/11
92/5
101/3
111
120

This could then be used to determine the probability of winning the pass line bet. Keep in mind that it is not averaging the eleven totals, but multiplying their odds by roll frequency.

(1/36)(0) + (2/36)(0) + (3/36)(1/3) + (4/36)(2/5) + (5/36)(5/11) + (6/36)(1) + (5/36)(5/11) + (4/36)(2/5) + (3/36)(1/3) + (2/36)(1) + (1/36)(0) ≈ 49.293%

There is about a 49.293% chance of winning the pass line bet. Let's see what our expected value is when we make a dollar bet.

EV($1 bet on pass line) = 0.49293(1) + 0.50707(-1) = -1.4¢

A pass line bet in craps has an average loss of 1.4¢, which is much better than the 5.3¢ loss we continued to see in roulette. But are there other bets in craps that beat that?

Another bet in craps is called the don't pass line. This is pretty much betting that the shooter will lose rather than the shooter winning. Seems fair, right? It actually seems pretty favorable. But before you bet your mortgage payment on it, keep in mind one little rule. If the shooter rolls a twelve on his come out roll, then it is a push. In other words, a roll of twelve will not be included in the table or equations.

Come Out RollOdds for Don't Pass Line
21
31
42/3
53/5
66/11
70
86/11
93/5
102/3
110
(1/36)(1) + (2/36)(1) + (3/36)(2/3) + (4/36)(3/5) + (5/36)(6/11) + (6/36)(0) + (5/36)(6/11) + (4/36)(3/5) + (3/36)(2/3) + (2/36)(0) ≈ 47.929%

EV($1 bet on don't pass line) = 0.47929(1) + 0.52071(-1) = -4.1¢

With this minuscule adjustment of pushing a twelve, this bet actually becomes less favorable than the pass line bet. Rather than losing 1.4¢ on average, you would lose 4.1¢. Still better odds than roulette, but why bet against the shooter when you are benefiting more by betting for him?

There are many more bets in craps that I don't have the time to go through, but I would encourage you to perform the calculations with some of them. If you play craps at the casino, try taking one of your favorite bets and see if it measures up to the pass line bet or other options either within craps or in other casino games. Here are a few different options:

Place Bets are bets on a specific number. After the come out roll, if your number appears before a seven, you win the bet. Place bets on a six or eight pay 7:6, bets on a five or nine pay 7:5, and bets on a four or ten pay 9:5.

Place to Lose Bets are bets against a specific number. After the come out roll, if a seven appears before your number, you win the bet. Place to lose bets on a six or eight pay 4:5, bets on a five or nine pay 5:8, and bets on a four or ten pay 5:11.

Buy Bets are like place bets, except the casino gives you better odds in exchange for a 5% commission fee for making the bet. For instance, a $1 bet would be split where about 4.76¢ go to the casino and 95.24¢ go towards your bet. Buy bets on a six or eight pay 6:5, bets on a five or nine pay 3:2, and bets on a four or ten pay 2:1.

Lay Bets are like place to lose bets, except the casino gives you better odds in exchange for a 5% commission fee for making the bet (see buy bets). Lay bets on a six or eight pay 5:6, bets on a five or nine pay 2:3, and bets on a four or ten pay 1:2.

Hard Way Bets are bets on a specific pair (either two 2's, two 3's, two 4's, or two 5's). After the come out roll, if your pair appears before a seven, you win the bet. In the United States (and most other countries) hard way bets on a pair of twos or fives pay 9:1 and bets on a pair of threes or fours pay 7:1.

Hop Bets are bets on a specific combination of numbers (1&4, 3&5, 2&2, etc.), but they only last for one roll. During the point rolls, you can make a hop bet for that turn. If you get your combination, you win. If you don't, you lose that money. Hop bets on a combination with two different numbers (such as 1&4 and 3&5) pay 15:1 and bets on a pair (such as 2&2 and 4&4) pay 30:1. This is different from a hard way bet because the hop bet lasts for one turn while the hard way bet lasts until the shooter gets a seven.

There are still even more bets such as odds bets and proposition bets, but these should be a good start. The most common craps bet is the pass line bet, so we will use this when comparing casino games. Our table of games now looks like:

GameAvg Gain Per $1 BetP of Reaching $100
Favorable Game (51-49 odds)92.6%
Fair Game (50-50 odds)60%
Craps-1.4¢28%
Roulette-5.3¢1.3%

If you find some craps bets or combinations of bets (ex: pass line/odds - odds bets cannot be placed on their own) that have better odds than the ones we've discussed, please comment your insights. Probability in casino games is always a fun area of mathematics to discuss and debate about.