Monty Hall Dilemma Simulation

Published on Sunday, April 16, 2017 in , , , , , ,

Quantockgoblin's 6-person demonstration of the Monty Hall DilemmaBlame Marilyn vos Savant. Back in 1990, Craig F. Whitaker of Columbia, Maryland wrote to her with a probability puzzle, and found he'd kicked up a hornet's nest! He asked, “Suppose you’re on a game show, and you’re given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say #1, and the host, who knows what’s behind the doors, opens another door, say #3, which has a goat. He says to you, 'Do you want to pick door #2?' Is it to your advantage to switch your choice of doors?”

Marilyn replied that, if you switch, your odds of winning the car are ⅔, and if you don't switch, your odds are only ⅓. It was difficult for many to believe. Even subsequent discussions about these probabilities, such as the Scam School episode on the Monty Hall Dilemma, find that the belief in a 50-50 chance prevails.

Despite all the numerous ways there are to explain it, practical demonstration if often the most effective way to see that the ⅔ odds of winning is correct.

Oxford Mathematics Professor Marcus Du Sautoy shows the effectiveness of practical demonstration to English comedian Alan Davies when it comes to the Monty Hall Dilemma:

While the practical demonstration in this video is effective, it's a little surprising that the switch approach won 4 times as often as it lost. This is one of the classic problems with using a small sample size (such as playing this game only 20 times). Over at Epanechnikov's blog entry on the Monty Hall Dilemma, he features a graph of repeated simulations that shows the problem with just 20 runs:

The probabilities don't even really start settling down to the calculations until about 300 trials have been run! To help see the true odds, why not use a computer to run thousands of simulations very quickly? Inspired by the spreadsheet approach used by Presh Talwalkar to simulate trials for a different probability puzzle, I decided to do the same for the Monty Hall Dilemma.

How do you set it up? The first column states the door which holds the car, and this is generated as a random integer ranging from 1 to 3. The second column states the door chosen by the player, and this is also generated as a random integer ranging from 1 to 3.

The next column is a little trickier. It's going to hold the door which is shown by the host, but there are restrictions on which door can be shown by the host, so we can't just randomly generate a number. The host will only show a door that was NOT chosen by the player and that the host knows will contain a goat. How do we communicate these restrictions to a spreadsheet? There are 2 cases to consider here. First, what happens when the door which contains the car DOESN'T match the door chosen by the player, such as when the car is behind door #1 and the player initially chooses door #2? In this case, the host can only show door #3. In fact, since 1 + 2 + 3 = 6, we can simply subtract the number of the door with the car and the number of the door chosen by the player from 6 to get the number of the door shown by the host.

That only works when the door chosen by the player and the door holding the car are different. What do we do when those two doors are the same? If the player chooses door #1 and the car is behind door #1, we can have the computer choose randomly between door #2 and door #3. A similar approach is used for the other 2 doors, of course. The final spreadsheet entry reads this way:

Translated into English, that says, “If the first two columns (the door hiding the car and the door chosen by the player) are the same, then choose a number, either 1 or 2, at random. If 1 is chosen, look at the number of the door hiding the car, and choose that item from the following list of numbers: 3, 1, 2 (So, if door #1 is hiding the car, choose the 1st number, 3, and so on). If 2 is chosen, look at the number of the door hiding the car, and choose that item from the following list of numbers: 2, 1, 3 (So, if door #1 is hiding the car, choose the 1st number, 2, and so on). Finally, if the first two columns don't match, just take the number 6, subtract the number of the door hiding the car, then subtract the number of the door chosen by the player, and use that as number of the door shown by the host.”

Fortunately, the final 2 columns are easier. The 4th column shows either a 1 if the players wins without switching, and a 0 if the player loses by not switching. Since the player only wins without switching when they chose the door containing the car initially, this column is only a 1 if the first 2 columns have the same number. For the opposite case, the 5th column shows either a 1 if the players wins by switching, and a 0 if the player loses by switching. In this case, a 1 is displayed only if the first 2 columns have different numbers.

Once we've got those columns set up as described above, we can copy them for as many trials as desired! I've set this up on Google Sheets to run 10,000 trials. The results are reported at the top, and take a few seconds to run (keep an eye on the progress bar in the upper right which will disappear when all the calculations are finished). For the "Player stays & wins" percentage calculation, the spreadsheet totals up all the 1s and 0s in the 4th column and divides by 10,000. For the "Player switches & wins" percentage calculation, the spreadsheet does the same thing for the 1s and 0s in the 5th column.

What do you think? Are 10,000 trials enough to convince you of the proper odds of the Monty Hall dilemma?


Out of Control

Published on Sunday, April 09, 2017 in , , , , ,

Scam School logoWould you believe tha another of my contributions has made it on to Scam School again? It was 2 other recent Scam School submissions that spurred me to restart Grey Matters, so it's looking like that was the right move.

Even if you've seen this week's Scam School episode, you may want to take a look at this post, as I'm going to give a few tips that may make this routine easier to learn.

Let's get started right away with this week's Scam School episode with a trick I dubbed “Out of Control”!

Quick side note: On one hand, I love being promoted as "the genius". On the other hand, I can't help but think of “genius” in this context.

This trick is actually a combination of two idea from two men who have far more a right to be called genius than me. The dealing procedure comes straight from Jim Steinmeyer's routine Remote Control, as published in Invocation #43 and the May 1993 issue of MAGIC Magazine. If you check those sources out, you'll see that not much has changed, as the original involves spelling the word C-O-L-O-R, and using the 9th card.

I combined this trick with a technique from Simon Aronson's “Try The Impossible” called Simon's Flash Speller. It's this part that may help make it easier to work out what you need to do. First, you'll need to quickly work out how many letters are in the name of the turned-up card. Here's the starting point:

  • For clubs, remember: 11 letters
  • For hearts or spades, remember: 12 letters
  • For diamonds, remember: 14 letters
Remember, that's just a starting point. From here, you may need to adjust the amount of letters, but only by adding or subtracting 1! What happens with which amount of letters?
  • If the value spells with 4 letters (four, five, nine, jack or king): Don't make any adjustment to the number of letters.
  • If the value spells with 3 letters (ace, two, six, or ten): Subtract 1 from the number of letters.
  • If the value spells with 5 letters (three, seven, eight or queen): Add 1 to the number of letters.
Once you've made that adjustment, you now know how many letters are in the card's full name! It seems difficult at first, but gets much easier with practice. 5 of Hearts? Hearts is 12 letters, and no adjustment needed, as F-I-V-E spells with 4 letters. 7 of Diamonds? Diamonds is 14, plus 1 for a 5-letter value (S-E-V-E-N), that's 15 letters. 10 of Clubs? Clubs is 11 letters, minus 1 for a 3-letter value (T-E-N), that's 10 letters.

From here, there are 6 ways the trick can go, so you have to quickly recall which out to use. There's really only 2 substantially different outs, with 12 and 13 letters. All the other outs are just modifications of those two. First, how do you handle cards whose names spell with 12 and 13 letters?
  • For 12 letters: Spell the name, and take the top card of those still in your hand.
  • For 13 letters: Spell the name, and take the last card that was dealt off.
How do you adjust this process for 14 or 15 letters? It's simple, you spell the value and suit without spelling O-F in the middle. This reduces any 14-letter card names to 12 letters and reduces any 15-letter card names to 13 letters. If you're keeping track, we've already covered 4 of the 6 possible outs!

The last two possibilities involve 10- and 11-letter card names:
  • For 10 letters: Spell T-H-E before the card name (such as T-H-E-A-C-E-O-F-C-L-U-B-S), resulting in 13 letters.
  • For 11 letters: Deal the turned up card aside, and spell its name with the next 11 cards, resulting in 12 cards being used.
Between determining the number of letter and which out to use, it can all seems a little confusing. However, like any good magic trick, it does take practice. The smoothness with which you can make this trick flow is the key to its deceptiveness.

For those who are wondering how the math of this trick works, the first deal is obvious. The selected card starts at the 10th position, of which 4 are dealt off, so it winds up at the 6th position. It's the second deal that is highly counterintuitive. In fact, watch the video starting at the 3:30 mark, and when they realize that the card winds up as the 13th card despite the two different spellings, Matt (the gentleman with the long beard, who has created his own original magic, as well!) comments, “My brain's breaking a little bit now!”

To explain, imagine you're doing this trick with cards numbered from 1 to 18, in order, with card 1 on top. If you deal 7 cards, as in the R-E-D-S-U-I-T possibility, as calculated on Wolfram|Alpha, you see that the 6th card from the top winds up being the 6th card from the bottom. If you deal 9 cards, as in the B-L-A-C-K-S-U-I-T possibility, Wolfram|Alpha tells us that, once again, the 6th card from the top winds up as the 6th card from the bottom.

It only seems like the different amount of letters should change the location of the card, but it actually has the same effect, as long as you deal past the selected card! If you have any further questions about this routine, or anything else on this blog, let me know in the comments below.


Leapfrog Division V: I've Been Schooled!

Published on Sunday, April 02, 2017 in , ,

x divided by y fraction iconA little over 4 years ago, I wrote a post inspired by Alexander Craig Aitken's approach to dividing by numbers ending in 9, called Leapfrog Division. It's a remarkably fun and simple technique, so if you haven't already checked it out for yourself, give it a read.

I wrote 3 more posts in that series. Leapfrog Division II dealt with dividing by numbers ending in 1. My last 2 posts before this year were Leapfrog Division III, which dealt with dividing by numbers ending in 8, and Leapfrog Division IV, which dealt with dividing by numbers ending in 2.

These were fine, but the latter 3 posts employed rules that became increasingly cumbersome, and were tricky to apply quickly and without error. Recently, however, I learned a far simpler approach that makes these later posts much simpler!

Let's start with credit where credit is due. The thanks should go to Saurabh G over at Hubpages. He had a post at Owlcation titled Divide Numbers Easily Using Vedic Mathematics: Fast and Easy Division Techniques. Towards the end of the post, there's a section with the heading, “How Do You Use Vedic Division When the Divisor Is More Than One Digit?”. The approach taught with numbers ending in 9 is demonstrated a little differently, but is mathematically identical to the original Leapfrog Division post.

The next section, “Multi-Digit Divisor Ending in 8 Example,” is what really struck me the most. He teaches an almost identical approach, and casually mentions that the quotient needs to be doubled before adding the remainder to the 10s place. Click on that link, read through the example, and then compare that approach to what I taught in Leapfrog Division III. I do mention a doubling idea, but the rules I taught are far more complex.

Using Saurabh G's vedic math approach, here's how his example (73 ÷ 138) would look written in the style of the Leapfrog Division posts. We start with the idea that 14 won't go into 7.3, so we start with a 0 and decimal point at the beginning of the answer, and work from there:

  • 73 ÷ 14 = 5 (remainder 3)
    (Double the 5 to get 10, add the 3 in the 10s place to get 40)
  • 40 ÷ 14 = 2 (remainder 12)
    (Double the 2 to get 4, add the 12 in the 10s place to get 124)
  • 124 ÷ 14 = 8 (remainder 12)
    (Double the 8 to get 16, add the 12 in the 10s place to get 136)
  • 136 ÷ 14 = 9 (remainder 10)
    (Double the 9 to get 18, add the 10 in the 10s place to get 118)
  • 118 ÷ 14 = 8 (remainder 6)
    (Double the 8 to get 16, add the 6 in the 10s place to get 76, and continue on from here, if desired....)

If you wrote down the quotients (the number in bold above) as you went, you'd have written down 0.52898 at this point, which is correct as far as we've gone.

Just to round things out, he includes a chart showing how to adapt this approach for numbers ending in 9 all the way down to 1! Think about that: It took me 3 years and 4 posts to cover numbers ending with 4 different digits, and increasingly difficult rules. Someone else comes along, teaches 2 examples in 1 post, and leaves his readers confident they can handle 9 different digits.

I tip my hat to you, Saurabh G! Thank you for sharing this approach, and giving me and my readers a simpler and more effective mental division tool.