Tour the U.S.!

Published on Sunday, May 28, 2017 in , , ,

Map of U.S.Starting in Delaware, you must tour the 48 contiguous United States, visiting each state exactly once. Where will you finish?

That's a puzzle from Futility Closet. I'll link directly to it later, so as not to get too far ahead. It's really a puzzle within a puzzle, however.

As anyone who has tried the Knight's Tour knows, moving around with the limitation of landing in each space only once can be quite a challenge.

The original Futility Closet puzzle can be solved either by thinking about that puzzle on its own with a little analysis. However, I think it might be a little more fun to try and solve the puzzle by trying various ways to get around the 48 contiguous United States, visiting each state exactly once.

To that end, I've written this as a puzzle you can play below. It's an interactive map, so you can scroll (by clicking and dragging outside of the U.S.) and zoom (using the + and - in the upper left corner of the map) as needed, which helps when you're trying access smaller states.

You start by clicking on any state. That state will turn blue, representing your current location. Some states will also appear in green, and these are states which border your current state, and to which you haven't already traveled.

To move to a new state, simply click on any one of the green states. Clicking on any other states won't have any effect. Once you click a green state, that state will become blue (again, denoting your current location), and a new set of bordering states will become green. Also, the state which you just left becomes red, which denotes that you can never move to that state again.

Quick side note: The way I've programmed it, you can't move directly from Arizona to Colorado or directly from New Mexico to Utah, as I didn't consider meeting at a single point to be a bordering state.

If you want to work on the original Futility Closet puzzle, zoom in on Delaware, and click on it to start. Otherwise, start on any state. Try and see if you can get to all 48 states just once each time. You'll get an alert if you've either solved the puzzle, or become trapped. In either case, the map will go blank and you can try again.

Even if you don't get all 48 states, try and beat your highest number of states each time. As you play, perhaps you'll even get a realization that will help you solve the original Futility Closet puzzle.

The more you try this, the better you'll get, and you'll probably be able to solve the 48-state U.S. tour puzzle and the Futility Closet puzzle before too long. At this point, you can challenge your friends, and show your skills at solving the tour. What kind of experience did you have solving the puzzle? I'd love to hear about it in the comments below!


The Collective Coin Coincidence

Published on Sunday, May 21, 2017 in , , , , , ,

Scam School logoThis week, Diamond Jim Tyler demonstrates a new take on an old trick. Regular Grey Matters readers won't be surprised to learn that I like it because it's based on math, and it's very counterintuitive. We'll start with the new video, and then take a closer look at the trick.

This week's Scam School episode is called The Collective Coin Coincidence, and features Diamond Jim Tyler giving not only a good performance, but also a good lesson in improving a routine properly:

Brian mentions that this was an update from a previous Scam School episode. What he doesn't mention is that you have to travel all the way back to 2009 to find it! The original version was called The Coin Trick That Fooled Einstein, and Brian performed it for U.S. Ski Team Olympic gold medalist Jonny Moseley. It's worth taking a look to see how the new version compares with the original.

Brian and Jim kind of rush through the math shortly after the 4:00 mark, but let's take a close look at the math step-by-step:

Start - The other person has an unknown amount of coins. As with any unknown in algebra, we'll assign a variable to it. To represent coins, change or cents, we'll use: c

1 - When you're saying you have as many coins (or cents) as they do, you're saying you have: c

2 - When you're saying you have 3 more coins than they do, the algebraic way to say that is: c + 3

3 - When you're saying you have enough left over to make their number of coins (c) equal 36, that amount is represented by 36 - c, so the total becomes: c + 3 + 36 - c

Take a close look at that final formula. The first c and the last c cancel out, leaving us with 3 + 36 which is 39. If you go through these same steps with the amount of coins (in cents, as it will make everything easier) as opposed to the number of coins, it works out the same way. This is what Diamond Jim Tyler means when he explains that all he's saying is that he has $4.25 (funnily enough, he says that just after the 4:25 mark).

As long as we're considering improvements, I have another unusual use for this routine. If you go back to my Scam School Meets Grey Matters...Still Yet Again! post, I feature the Purloined Objects/How to Catch a Thief! episode of Scam School, which I contributed to the show. It's not a bad routine as taught, but my post includes a tip which originated with magician Stewart James. This tip uses the Coin Coincidence/Trick That Fooled Einstein principle to take the Purloined Objects into the miracle class! I won't tip it here, so as not to ruin your joy of discovery.


Chinese Remainder Theorem II

Published on Sunday, May 14, 2017 in , , ,

Lone Star Showdown 2006 TAMU band by JohntexBack in January of 2012, I wrote about the Chinese Remainder Theorem. Also, Martin Gardner taught the basics well in his book Aha!: Insight, including a trick where you can determine someone's secretly chosen number between 1 and 100 just from hearing the remainders when divided by 3, 5 and 7. Going over that post again, I've developed a few improvements to this trick that make it seem much more impressive, and maybe even easier to do.

The first problem is getting the remainders. With a standard calculator, it's not easy to do. The answer here is to simply have them divide the number by 3, 5 and 7, and have them tell you ONLY the number after the decimal point. Using the amount after the decimal point, you can work out the remainder. When dividing by 3, there are 3 possibilities for numbers after the decimal point:

  • Nothing after the decimal point: Remainder = 0
  • Number ends in .3333...: Remainder = 1
  • Number ends in .6666...: Remainder = 2
To find the remainders when dividing by 5:
  • Nothing after the decimal point: Remainder = 0
  • Number ends in .2: Remainder = 1
  • Number ends in .4: Remainder = 2
  • Number ends in .6: Remainder = 3
  • Number ends in .8: Remainder = 4
If you read my Mental Division: Decimal Accuracy tutorial, you'll get familiar with the 7s pattern. It's trickier than 3 or 5, but easily mastered. You only need to pay attention to the first 2 digits after the decimal point:
  • Nothing after the decimal point: Remainder = 0
  • Number ends in .14: Remainder = 1
  • Number ends in .28: Remainder = 2
  • Number ends in .42: Remainder = 3
  • Number ends in .57: Remainder = 4
  • Number ends in .71: Remainder = 5
  • Number ends in .85: Remainder = 6
Using the decimals makes the trick seem more difficult from the audience's point of view, but it only requires a little practice to recognize which numbers represent which remainders.

The other improvement involves the process itself. Have them start by dividing their number by 7 and telling you the numbers after the decimal point. Using the steps above, you can quickly determine the remainder from 0 to 6. If the remainder is between 0 and 5, you can remember them by touching that many fingers of your left hand to your pant leg (or table, if present). For a remainder of 6, just touch 1 finger from your right hand to your pant leg or table.

What ever the remainder, imagine a sequence starting with this number, and adding 7 until you get to a number no larger than 34. For example, if the person told you their number ended in .42, you know the remainder is 3, and the sequence you'd think of is 3, 10, 17, 24 and 31 (we can't add anymore without exceeding 34). If the remainder was determined to be 4, instead, the sequence you'd think of would be 4, 11, 18, 25 and 32.

Next, ask the person to divide by 5, and tell you the part of the answer after the decimal point. Once you get this number, recall your earlier sequence (which can be recalled via the number of fingers resting on your pant leg or table), and subtract the new remainder from each number, until you find a multiple of 5. For example, let's say that when dividing by 7, their remainder was 4, so the sequence was 4, 11, 18, 25 and 32. Let's say that when dividing by 5, their remainder was 3. Which number from your initial sequence, when it has 3 subtracted from it, is a multiple of 5? is 4-3 a multiple of 5? No. Is 11-3 a multiple of 5? No. Is 18-3 a multiple of 5? YES! Now you have the number 18.

Whatever number you have at this point, is the smallest of 3 possible numbers. The other 2 possibilities are 35 more than that number and 70 more than that number. At this point, you can know that the chosen number is either 18, 53 (35+18) or 88 (70+18). The remainder when dividing by 3 will determine which one of these is the correct answer. For example, if they say their number, when divided by 3, ends in .3333..., you know the remainder is 1. So, run through all 3 numbers quickly and ask yourself which one is 1 greater than a multiple of 3. Is 18 - 1 a multiple of 3? No. Is 53 - 1 a multiple of 3? No. Is 88 - 1 a multiple of 3? YES! Therefore, their number must be 88.

There are certainly other approaches. In fact, a magician's magazine called Pallbearer's Review once presented this trick as a challenge, asking their readers to supply their methods. They received a wide variety of entries and many approaches. Most of them involved far more difficult methods than the above approach, which I prefer for actual performance.


Yin-Yang Challenge

Published on Sunday, April 30, 2017 in , , ,

yin yang symbol, drawn mathematicallyFor this post, I'd like to turn to a variation of a classic Henry Dudeney puzzle, from his book Amusements in Mathematics. It can also be found in Martin Gardner's October 1960 Scientific American column, or his book, New Mathematical Diversions, as the 5th puzzle ,“Bisecting Yin and Yang”, in chapter 12, “Nine Problems”.

As you've no doubt guessed, this puzzle involved the yin (dark) yang (light) symbol. For this puzzle, I've drawn it in a very mathematically precise way over at Desmos. The outside is a unit circle (so, the radius is 1 unit), the main semicircular divisions of the design have a radius of 12 unit, and the opposite-color dots have a radius of 16 unit. Here's the challenge: What's the equation of the line that divides the design so that each side of the line contains exactly equal amounts of the dark and light portions?

As with many puzzles, this one seems hard, until you break it down into simpler steps. Let's start with a much easier puzzle: If the top half of the puzzle were dark, and the bottom half light, as in this rendering, where would you draw the line? The answer is easy. It should be a vertical line, so the equation would be x=0.

Next, we change the design a bit, so as to get closer to the yin yang symbol. Starting with the previous design, we cut a half circle (12 unit radius, remember?) of the dark portion from the right side, and add that to the left side, giving us the design below. The vertical line obviously won't work anymore, and we'll need to rotate that line by some amount to compensate, but how much?

Again, the secret is to take steps slowly. If you remember your high school geometry, you remember that the formula for a circle is A=πr2, and that our design as a whole, being a unit circle, has an area equal to π.

The formula for the semicircle we've moved, then, is A=12πr2. Plugging in 12 for the radius, we get π8 units. So, to compensate for π8 units out of a full circle with an area of π-units, we simply rotate the formerly-vertical line counterclockwise by 18 of the circle, or 45°! The upper left quadrant completely dark, so that makes this adjustment simple. The blue line is the dividing line for this design:

This, in fact, is the answer to the original puzzle as posed by Dudeney and Gardner. This is NOT the answer to the problem I posed above. When I first ran across this puzzle, it annoyed me that it wasn't done with the full yin yang symbol. The dots are a symbol of how, in nature, nothing is purely one thing or the other, and are a very important part of the design.

It's time to go back to the full design. Compared to the previous step, we're going to be removing some of the dark area from the right side to the left side. This means that we'll end up rotating our dividing line some distance clockwise this time, and we need to figure out by how much. Yes, once again, we'll be using our area formulas to work out the adjustment. We even know that the result should be easy to interpret, since the result will π over something, and this comes out of a π-unit circle.

The dots, of course, are full circles, so we use the formula for the area of a full circle once again. The dots have a radius of 16 of a unit, and plugging that into the formula, we get π36. In other words, the line needs to be moved back clockwise 136 of a full circle, or 10°. That brings the line to being 35° off of the original vertical line.

A 35° line must be our answer, right? Wrong. Go back and look at the original question: Here's the challenge: What's the equation of the line that divides the design so that each side of the line contains exactly equal amounts of the dark and light portions? We need to work out enough details for the line equation y = mx + b, where m is the slope, b is where the line crosses the y-axis, and y and x remain as variables. The line, of course, crosses the y-axis at 0, so b = 0. That reduces the equation to just y = mx, so we need to figure out the slope.

First, angles are usually measured in relation to the positive x axis, so we're actually talking about a 125° (35° + 90°), or 25π36 radians (Confused? Read Intuitive Guide to Angles, Degrees and Radians). In geometry, we'd say we were trying to calculate rise over run (rise ÷ run). In trigonometry, we're trying to calculate the opposite site of the angle by the adjacent side (Confused? Read How To Learn Trigonometry Intuitively), and that means we need to use the tangent!

So, the equation is y = tan(25π36)x, or y = tan(125°)x, if you prefer. The actual slope is an irrational number which is roughly equal to -1.428148. There you have it, the equation to a line which divides the design into equal parts of light and dark, as shown below.


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.