Showing posts with label innumeracy. Show all posts
Showing posts with label innumeracy. Show all posts
0

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:

=IF(A6=B6,IF(RANDBETWEEN(1,2)=1,CHOOSE(A6,3,1,2),CHOOSE(A6,2,3,1)),6-A6-B6)
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?

0

Tackle That Math Problem!

Published on Sunday, July 27, 2014 in , , , ,

MariaDroujkova's photo of James TantonHave you ever been stumped by a math puzzle or problem?

Mathematician James Tanton understands that feeling, and he's designed an entire course to help you attack those seemingly impossible challenges!

I've mentioned James Tanton before (see previous mentions here), especially in the context of his Curriculum Inspirations video puzzles.

On the main Curriculum Inspirations page, he's included a useful list of 10 strategies for attacking such problems. They're taught as essays, such as this one for Strategy #1: Engage in Successful Flailing.

Recently, however, James Tanton has begun creating more lively video explanations of each strategy. Much of the advice can also apply to many real-world problems, as well. Check them out below:

Strategy #1: Engage in Successful Flailing


Strategy #2: Do Something


Strategy #3: Engage in Wishful Thinking


Strategy #4: Draw a Picture


Strategy #5: Solve a Smaller Version of the Same Problem


Strategy #6: Eliminate Incorrect Choices


Strategy #7: Perseverance is Key


Strategy #8: Second-Guess the Author


Strategy #9: Avoid Hard Work


Strategy #10: Go to Extremes

3

Danica McKellar's Math Bites

Published on Sunday, February 02, 2014 in , , , , , , , , ,

Danica McKellar's Math Bites seriesNo, I'm not insulting Danica McKellar's math ability, I swear! I even sell her math books over in the Grey Matters Store!

Math Bites is actually the name of Danica McKellar's new weekly video series from Nerdist, which started last month.

Math Bites can be found on YouTube, and you can subscribe to the Nerdist channel for regular updates, as well.

Each episode is only about 5-6 minutes long, and focuses on one math topic. The style is somewhat like that of Square One TV, in that there are short comedy skits and musical segments that help reinforce the concepts or give you breathing time to let the concepts sink in. I especially like the takeaway tips at the end of each episode, which summarize the important points of each episode.

The first episode focused on a topic near and dear to my heart, the constant Pi:



While many Grey Matters readers have memorized Pi to 400 digits, some might prefer the full Dance of the Sugar Pi Fairy to help them memorize Pi to 139 digits.

The second episode talked about the importance of being able to do math in your head. No, this episode doesn't talk about extraordinary mental math feats like those taught in the Mental Gym, but rather knowing how to do basic arithmetic and estimation well enough so that you don't get ripped off:



You can already get an idea of why I like this series so much. It touches on the basics of topics I've posted about many times before. I've posted about binary numbers both on their own, and their importance in Nim, so the 3rd episode on binary numbers was also helpful and entertaining:



The most recent episode as of this posting is about percentages, and focuses on how they can mislead you. Sometimes you can get taken advantage of when businesses can't do math, and also when businesses can do math, so percentages can be very important to understand:



Even if you missed the initial announcement of Math Bites, you're now completely caught up with the series. Here's hoping that Danica McKellar keeps this series up for a long time to come!

0

Yet Still More Quick Snippets

Published on Thursday, January 23, 2014 in , , , , , , , , , , ,

Luc Viatour's plasma lamp pictureFor January's snippets, I'm featuring an unusual mix.

This time around, I've got 3 different things for you: Math, memory...and Macs?!?

Numberphile took a breather from their usual number videos to do something a bit different. They interviewed UC Berkeley professor Edward Frenkel with the question, “Why do people hate mathematics?” It's an interesting topic and well worth your time:



• In the video above, they talk about the important roles of math teachers. Longtime Grey Matters readers know that I'm not just a big proponent of memorizing, but rather memorizing along with understanding. Above and beyond great sites that aid in mathematical understanding, such as BetterExplained and Plus magazine, there's also an excellent free ebook called Nix The Trix. It's aimed at students who are great with shortcuts, but never took the time to understand the foundations of what those tricks are actually doing. It can help teachers undo the damage by showing how to teach the actual mathematical basis, which is also a great help in understanding when to use the math tricks.

• Almost just in time for this month's snippets, Reddit featured an interesting and popular thread asking, “What are some things worth memorizing?” Yes, of course, there are the usual array of sarcastic and silly answers, but if you take the time to wade through some of the roughly 12,000 comments (at this writing), there are some great ideas. I won't rob you of the joy of discovery, especially as the reply you most enjoy may not even exist yet as I write this!

• If you've ever memorized something with the help of spaced learning, where the concept you're trying to memorize is reinforced 3 times at spaced intervals, you know how powerful it can be. There's now an online web service called MemStash which help you do this almost automatically. You save things you wish to remember by highlighting them in an online page, and then clicking a special MemStash bookmarklet. After that, they'll send you 3 reminders at spaced intervals, which can help you recall what you saved!

• OK, this last snippet isn't really along the usual Grey Matters topics, but I thought it would be fun to sneak it in. 30 years ago this week, the Apple Macintosh computer first came on the market. During Super Bowl XVIII on January 22, 1984, they aired their now-classic 1984 ad, announcing the upcoming release of the Macintosh on January 24th. The lesser-known January 24, 1984 introduction of the Macintosh has also been preserved on video:



That's all for this month's snippets. I hope you enjoy them!

0

Happy 27th Anniversary, Square One TV!

Published on Sunday, January 05, 2014 in , , , , , , ,

Square One TV logoObviously, I'm a big fan of mixing math and fun. It's time to give a little credit to one group that's responsible.

27 years ago this month, Square One TV, a PBS show teaching math with the use of comedy skits, music videos, and guest stars, premiered!

2 years ago, on Square One's 25th anniversary, I posted a tribute to this show, including some of my favorite segments.

At the time I was unable to provide links to complete episodes. Since then, however, several complete episodes have been uploaded to YouTube! Not every episode is available (yet?), but the complete episode guide will give you an idea of what's missing.

I've arranged the full episodes I can find into YouTube playlists by season, with the individual episodes arranged in order of broadcast. The season 1 playlist begins with the original IBM show promo, and then moves on to the very first episode. Here are all the YouTube playlists:

Season 1
Season 2
Season 3
Season 4
Season 5

If you watch at least 1 full episode, you'll note that roughly the last third of each episode is dedicated to continuing segment called Mathnet, a sort of mathematical Dragnet parody. Square One TV originally aired Monday throughly Friday each week, so these segments always started a new adventure on Monday, and continued through with the conclusion reached on Friday's episode.

One of the downsides of not having every episode of Square One available is that it's difficult to watch complete runs of the Mathnet adventures. Fortunately, fans have solved that problem by posting 26 of the 30 episodes on YouTube, which you can find in this playlist! The complete Mathnet episode guide, which includes spoilers, can help you catch up on the ones which still aren't available.

I hope you enjoyed this mathematical walk down memory lane. I'll leave you with my favorite segment of Square One TV, a video about how to solve almost any type of problem title “Change Your Point of View”:

2

Even More Quick Snippets

Published on Sunday, November 24, 2013 in , , , , , , ,

Luc Viatour's plasma lamp pictureNovember's snippets are ready, and they're chock full of some amazing and fun ways to get involved with math!

• If you enjoyed the recent Arthur Benjamin posts from MAA, It's All About The Benjamin and Fibonacci Meets Dr. Benjamin, you should know they have plenty more!

This includes Dr. Benjamin on how to square 2- and 3-digit numbers in your head (below) and an interesting little side story about how he discovered this principle on his own, even before learning algebra!



Among the other interesting goodies on their YouTube channel is James Tanton's Curriculum Inspirations, which feature challenging math puzzles. James Tanton helps you get started on these puzzles, and then encourages you to solve them on your own.

• Vi Hart, a longtime Grey Matteras favorite, has released a new video titled How I Feel About Logarithms. It's an intuitive and holistic look at logarithms that is probably quite different from any approach to the topic that you've seen before. Compare it to, say, the more linear (but still intuitive) approach used in BetterExplained.com's Using Logs In The Real World post, or Steve Kelly's Logarithms, explained.



• A while back, there was a company which produced a DVD series titled Total Breeze Mathematics. Their videos on memory and math shortcuts, which they made available for free on YouTube, were visual and very clear. Their company website and videos quickly disappeared, but fortunately there were those who managed to save the videos and have since reposted them. I've gathered them in their original order, and put them in a YouTube playlist, so you can enjoy them once again.



There are some parts missing, though. There was a 3-minute section on multiplying vertically and crosswise in one video. This can be replaced by viewing the Math Tutor videos on multiplying any 2 digit numbers, multiplying 3 digits by 1 digit, multiplying 3 digits by 2 digits, and multiplying 3 digits by 3 digits.

There's also a section on memorizing numbers that isn't included on the playlist. This free video by Dr. Benjamin on memorizing numbers covers the same technique.

• From 2007-2010, there used to be a magazine called iSquared, which focused on the interesting ways in which mathematics applied to the real world. Originally, it required a subscription, but the entire run of 12 issues has now been made available online for free! This is not only a fun read, but can also help you answer questions such as when you're going to use a particular math technique in the real world!

0

Pocket Calculator Power

Published on Thursday, April 04, 2013 in , , , , ,

Ralf Pfeifer's TI DataMath 2500 photoMy regular readers might be looking at the title and picture and wondering whether they're on the right blog. I normally post about doing math and memory in your head, not on a calculator.

However, using your brain in conjunction with a simple 4-function calculator, you can get much more out of them than you may have ever thought possible.

Since you only see functions for addition, subtraction, division, and multiplication (and sometimes a square root function) on a 4-function calculator, most people limit their use to just those few functions. However, even a simple pocket calculator has a few hidden features that, when combined with an understanding of varous aspects of math, allows you get much more out of it.

Before you try these out, make sure you're using an actual 4-function calculator, as more complicated calculators act differently. Many calculator apps on mobile devices appears to be 4-function calculators in one orientation, and scientific calculators in another orientation. Unless you discover for yourself otherwise, these calculator apps are generally always working as a scientific calculator, even when it appears otherwise.

Over at Ted's Math World, there's a very complete course in using a 4-function calculator, which includes these sections:

1: Introduction to Programming a Four-Function Calculator

2: Integer Powers

3: Integer Roots

4: Trigonometry

5: Compound Interest

6: Logarithms

7: Extra Decimals for Square Roots

8: Some Arithmetic Shortcuts

Even if you don't go through every section, at least go through the introduction section, as you may learn about some hidden features of your pocket calculator. Ted's Math World also features a very simple continued fraction approach to square roots, and in the Integer Roots section, you can learn how to enter this into your calculator.

Eddie's Math and Calculator Blog also has a course on calculator usage called Calculator Tricks. Surprisingly, there is very little crossover with the above course, and this one gets as far as dealing with 2 by 2 matrices! Eddie's course is available at these links: Part 1, Part 2, Part 3, Part 4, Part 5.

Back in 1974, when 4-function calculators were just starting to become affordable and popular, Popular Science wrote up an excellent guide, including many common real-word uses, such as photography, cooking, and shopping. True, you might have apps on your mobile device that handle similar functions today, but it's still good to know how to handle them yourself. The article, titled New Tricks For Pocket Calculators, can be found in the December 1974 issue of Popular Science, on page 96, page 97, page 98, page 118, and page 119.

Go through these resources, and you'll start to get a good idea of just how much more powerful your 4-function calculator can truly be!

Don't forget to keep an eye out for the occasional individual tips, as well. For example, here's a quick way to find any root on a 4-function calculator, as long as you have a square root button available:



One kind of math that doesn't get much coverage on calculators is modular arithmetic. If you're not familiar with modular arithmetic, BetterExplained.com and Martin Gardner (page 1, page 2) have excellent introductions.

Surprisingly, even many models of scientific calculators don't have basic modulo functions. In the few places I have seen methods for working out the modulus on a calculator, the methods were similar to the ones taught in this xkcd.com forum thread.

That method is certainly useful, but I never cared for the back-and-forth nature of it. I developed another method (other people must have come across this, but I've never found a reference to it) which takes you straight to the answer. Let's say you're trying to figure out what 83 mod 13 equals. Simply enter 83 - 13 = on the calculator, and you'll see 70. Hit equals again, and you see it drop down again to 57. Keep hitting the equals button until you come to a positive number that is less than 13, and that's your answer! In this case, the answer is 5.

For any number x mod y, just start with by entering x - y =, and then keep hitting the equals button until you wind up with a non-negative number that's less (LESS - not LESS THAN OR EQUAL TO) than y, and that's the final answer.

This answer works well when the numbers are relatively close, or at least have the same number of digits. What happens, though, if you have to work out something like 96,528 mod 17?!? In this case, we use powers of 10 to help. What number starts with 17, ends in 1 or more 0s, and is less than 96,528? It's easy to see that 17,000 fits the bill, so we start with 96,528 - 17,000 =, and keep hitting the equals button until we get a non-negative number that is less than 17,000. After this, we wind up with 11,528. Now, drop a zero from 17,000 to get 1,700, and repeat the process starting with 11,528 - 1,700 =, resulting in 1,328. Repeating this with 170, we work our way down to 138. Finally, we go through this process one last time with 17, and we come to our final answer, which is 2.

So, when working through any modular problem, you can not only take the number itself out, but add an appropriate number of zeroes to the end, and them out by the hundreds, thousands, millions, or whatever scale is needed! This approach may take longer, but it goes to the answer directly, and helps you understand the process of modular arithmetic.

You can also use a similar process with addition in order to find congruent numbers. What numbers are congruent to 2 modulo 6? Start with 2 + 6 =, and you'll get 8. Hit equals again, and you should get 14, then 20, and so on. Each of the displayed results are numbers that are congruent to 2 modulo 6: 2, 8, 14, 20, 26, 32, etc.!

Give a little thought, a little fun, and a little effort to your simple 4-function calculator, and you just may be surprised by what you can do with it!

0

Bringing Pi Digits to Life

Published on Thursday, February 21, 2013 in , , ,

Mehran Moghtadaei's Pi Digit GraphicIt's one thing to be able to memorize 400 digits of Pi. It's another thing altogether to be able to make the feat memorable and interesting for you audience.

Sure, 400 is an impressive number of Pi digits to memorize, but what do 400 digits really mean? What kind of detail are we talking about?

Numberphile, who has done numerous Pi videos already, has recently released a new video about Pi and the size of the universe, that starts to give you an idea of the sense of Pi's scale:



It almost seems strange that so few digits should be able to take us from the width of a hydrogen atom all the way up to the diameter of the universe. Each place in Pi (as in the tenths, the hundredths, the thousandths, and so on) represents a place that's smaller than the previous one by a factor of 10. There's a classic 1977 film called Powers of 10 that does a wonderful job of dramatizing just how few power of 10 are needed to cover the entire scale of the universe:



This film may look familiar, either because you may have seen it in school, or you've seen one of its parodies, such as in Men In Black, Contact, or The Simpsons.

A good way of keep thing in mind is Tim Rowett's poem, Space:

Seven steps each ten million to one
Describe the whole space dimension
The Atom, Cell’s girth
Our bodies, the Earth
Sun’s System, our Galaxy – done!

– Tim Rowett, Three Limericks – On Space, Time and Speed
BetterExplained.com's article on how the digits of Pi were determined in ancient times gives you a sense of scale in a different manner, and is done so with their usual startling clarity.

As I've mentioned before, memorization and understanding together give you a more complete picture than either could ever do separately.

0

Create Your Own Personal Equation!

Published on Sunday, November 25, 2012 in , , , , ,

XKCD comic #10

“...I don't write jokes in base thirteen.”
-Douglas Adams, after being told that 6 × 9 is 42 in base 13
After glancing at the post title, you're probably wondering what I mean by “your own personal equation.” I'll give you an example I created specifically for grey matters:



No, I don't expect you to do that calculation in your head. Click on that equation to have Wolfram|Alpha do the math for you.

In the area that says Result, click the Hide block form button, then click the More digits button (also under Result) 2 or 3 times.

Surprise! The answer to that math problem is:



How did I develop an equation that results in my blog's name over and over again? How can you create an equation that gives your name or other short phrases?

BASE 36?!?

If you're used to working with just the digits 0 through 9 (base 10), you might be wondering how letters can even show up as the answer to a mathematical equation.

The answer is that we're a base other than base 10. You might be familiar with base 16, also called hexadecimal, in which you count with the letters A through F, like this: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10, 11...and so on.

If this talk of other number bases confuses you, take some time to read BetterExplained.com's Number Systems and Bases post and/or watch WhyU's Decimal, Binary, Octal, & Hexadecimal video. Both of these resources explain other number bases very clearly.

To be able to create a phrase using any letters (or numbers) we want, we'll need a base that uses all 10 digits plus all 26 letters, which is why we use base 36. So, the last step in our equations will always involve converting an answer to base 36.

WORKING BACKWARDS

We'll find the equation we need by working backwards. The first step is to think of a short phrase you want to use. The shorter the phrase, the smaller the resulting division problem will be. The phrase can only contain letters or numbers, with no spaces, punctuation or other characters. For an example, I'll choose the phrase greymatters, since it's my blog's name.

Go to Wolfram|Alpha, and type in a zero, followed by a decimal point, followed by your phrase repeated 2 or 3 times, followed by an underscore (_) and the number 36. Our greymatters example entry appears like this:



That underscore followed by the 36 simply tells Wolfram|Alpha that the number is to be read as base 36. The repeated use of the phrase lets Wolfram|Alpha know that this represents a repeating decimal.

When you have your entry set up like that hit enter, and Wolfram|Alpha will give you the corresponding number in base 10. If you click on the above entry, you'll see results for the example entry.

At this point, Wolfram|Alpha shows 3 “pods” (Wolfram|Alpha's term for those framed boxes) marked Input interpretation, Decimal form, and Other base conversions. All you need to focus on here is the number in the Decimal form pod. In our greymatters example, that number is:



Clicking or touching the number in the Decimal form pod makes Wolfram|Alpha use that as a new input, and it will return a fraction in the Rational approximation pod. Clicking on the decimal number above will give the fraction shown below, which you should recognize from the start of this post (I've added commas for clarity):



At this point, click or touch this fraction (the number in the Rational approximation pod) to use it as input. Click the fraction above to do this now.

All you have to do now is type the phrase in base 36 after the fraction, and then hit Enter. Check your work by clicking the Hide block form button, and then the More digits button 2 or 3 times, both in the Result pod, and making sure your chosen phrase repeats endlessly. Click the button below to see the end result:



Now try creating your own phrase in the same way. Use a friend's name, and send the Wolfram|Alpha link to them (reminding them to click on the Hide block form button, and then the More digits button 2 or 3 times in the Result pod, of course), and they'll wonder how you figured that out!

TIPS

• The repeating of the phrase is very important, because otherwise the result won't necessarily have all the letters you need. If I started from the input 0.greymatters_36 (no repeat), the result I get is 0.grexum2rp5hzjk..._36, and you can see that only the first few letters were retained.

• You don't have to use base 36. Base 36 simply makes sure that every letter A through Z is available. Once you have a phrase, such as markjones, you can note that, in that phrase, the letter S is the furthest letter in the alphabet, and that it's the 19th letter of the alphabet. Add 10 (for the digits 0 through 9) to 19 to get 29, which means you can make the name markjones repeat in base 29 (or any base from there up to base 36). Just make sure you use the same base throughout the process.

• You can precede the repeating portion with a non-repeating portion. In a forum over at reddit in r/math, where I first ran across this technique, reddit user divergentdave used this tip to create this amusing phrase, which Eduard Khil fans will recognize.

Inspired by a different part of pop culture, I created an equation based on an early XKCD comic titled Pi Equals:

XKCD comic #10

The equation for this one is quite long, but it still works. Click the equation below to see the result:



If you're curious, the name of that top number is roughly 1.178 trevigintillion, a 73-digit number, while the bottom number is roughly 388 duovigintillion, 72-digit number!

Having calculated a joke in base 36, I now understand why Douglas Adams doesn't write jokes in base 13.

RELATED

If you enjoyed this unusual way of coding long information with a short equation, you also might enjoy Martin Gardner's story of Dr. Zeta, and his technique for coding an entire encyclopedia with just a single mark on a rod.

The endlessly repeating messages made me think of Futility Closet's Blank Column puzzle, which you may also enjoy.

What creative phrases and uses can you come up with for this amusing and amazing technique? I'd love to hear your ideas in the comments!

0

Bayes' Theorem

Published on Sunday, November 11, 2012 in , , , ,

mattbuck's Bayes' Theorem neon sign photoEver wonder what happens to those amazing breakthroughs you hear about on the news, but never hear about again? Somehow, when they're finally released, the amazing qualities of, say, that new wonder drug, never seem to reduce the suffering the way most people hoped.

Look through the reports on the test results of those breakthroughs, and you'll frequently find one line that says p < 0.05. In other words, the tests indicate that the results reported on in the report had only a 5% chance of happening randomly.

If I flip a coin 20 times, and heads shows up 15 or more times (in other words, greater than 14 times), we can work out that there is roughly a 2.07% chance of that happening at random. Reporting on this, we'd note that p < 0.05, and use this to justify examining whether the coin is really fair.

That works great for events dealing with pure randomness, such as coins, but how do you update the probabilities for non-random factors? In other words, how do you take new knowledge into account as you go? This is where Bayes' theorem comes in. It's named after Thomas Bayes, who developed it in the mid-1700s, but the basic idea has been around for some time.

You should be familiar, of course, with the basic formula for determining the probability of a targeted outcome:



The following video describes the process of Bayes' theorem without going into any more mathematics than the above formula, using the example of an e-mail spam filter:



To get into the mathematical theorem itself, it's important to understand a few things. First, Bayes' theorem pays close attention to the differences between the event (an e-mail actually being spam or not, in the above video) and the test for that event (whether a given e-mail passes the spam test or not). It doesn't assume that the test is 100% reliable for the event.

BetterExplained.com's post An Intuitive (and Short) Explanation of Bayes’ Theorem takes you from this premise and a similar example, all the way up to the formula for Bayes' theorem. It's interesting to note that it's effectively the same as the classic probability formula above, but modified to account for new knowledge.

The following video uses another example, and is also simple to follow, but delves into the math as well as the process. Understanding the process first, and then seeing how the math falls into place helps make it clear:



The tree structure used in this video helps dramatize one clear point. Bayes' theorem allows you to see a particular result, and make an educated guess as to what chain of events led to that result.

The p < 0.05 approach simply says “We're at least 95% certain that these results didn't happen randomly.” The Bayes' theorem approach, on the other hand, says “Given these results, here are the possible causes in order of their likelihood.”

If I shuffle a standard 52-card deck, probability tells us that the odds of the top card being an Ace of Spades is 1/52. If I turn up the top card and show you that it's actually the 4 of Clubs, our knowledge not only chance the odds of the top card being the Ace of Spades to 0/52, but gives us enough certain data we can switch to employing logic. Having seen the 4 of Clubs on top and knowing that all the cards in the deck are different, I can logically conclude that the 26th card in the deck is NOT the 4 of Clubs.

We can switch from probability to logic in this manner because we've gone from randomness to certainty. What if I don't introduce certainty, however? What if I look at the top card without showing it to you, and only state that it's an Ace?

This is the strength of Bayes' theorem. It bridges the ground between probability with logic, by allowing you to update probabilities based on your current state of knowledge, not just randomness. That's really the most important point about Bayes' theorem.

There's much more to Bayes' theorem than I could convey in a short blog post. If you're interested in a more in-depth look, I suggest the YouTube video series Bayes' Theorem for Everyone. I think you'll find it surprisingly fascinating.

4

My 2 Cards? What Are The Odds?

Published on Thursday, November 08, 2012 in , , , ,

Scam School logoWe're going to jump all the way back to 2009, to the 60th episode of Scam School (At this writing, that was 183 episodes ago).

In that episode, host Brian Brushwood presented a scam whose odds sounded almost too good to be true. I'll investigate the actual odds in this post.

In episode 60 of Scam School, there are 2 scams that are taught. This post focuses on the “Playing The Odds” scam which starts at the 4:33 mark in the following video:



What are the chances of two named values being together in a deck of cards? Brian mentions his experience of the probabilities in his write-up:

Amazingly (and to just about everyone's disbelief), it seems that about 70% of the time, any two named values will just happen to be side by side in a shuffled deck of cards!

(by the way, math wizards: if you can figure out a way to calculate the exact odds on this, I'm all ears. After hours of playing with the numbers, I finally gave up and just did a brute force calculation: after 50 trials, I ended up averaging about a 70% success rate)
It's not easy to develop probability equations for this challenge. Just defining all the possible arrangements involved is a challenges. I don't doubt that this is why Brian gave up playing with the numbers, and turned to brute force calculations, otherwise known as the Monte Carlo method.

James Grime filmed a response video in which he explains the difficulty of calculating the odds via equations, and the result of his own Monte Carlo simulations:



The video shows a probability of 48.3%, and the information box in the video says that other experiments moved that closer to 48.6%.

After watching this video, I wrote and ran my own Monte Carlo simulations in jQuery. I had the computer mix the deck using this implementation of the modern Fisher–Yates shuffling algorithm, which a quick pencil-and-paper exercise will make clear.

After running 10 million trials of my own simulation, my results suggested a 48.63627% chance of succeeding, effectively the same 48.6% chance described above. In short, the person betting against the 2 values showing up next to each other will win roughly 51.4% of the time. With such a low probability of success, how did this bet manage to become popular?

The first thought I had about this was that perhaps it involved paying less than true odds. The odds of you winning this bet are roughly 1.056 to 1 against. In other words, as long as you can convince someone to bet at least $1.06 to every $1 you bet, you could still make money with this bet over the long term. That doesn't seem very likely.

Many bets hinge on a little wordplay. For example, there's a classic bet where you claim you can name the day someone was born, with an accuracy of plus or minus 3 days. Once they put up their money, you simply say “Wednesday,“ and take their money. Since every day of the week is plus or minus 3 days from Wednesday, you can't lose.

In a similar manner, perhaps we can use wordplay to give us a better margin of error for this bet. What if, instead of mentioning that the cards must be next to each other, the bet was that the two values would be within 1 card of each other? If the two cards show up right next to each other, as in the original bet, this sounds exactly like what you bet. In addition, it also covers the possibility of the 2 values showing up with 1 card between them.

I re-programmed my simulation to include the new possibilities, ran it another 10 million times, and came up with about a 73.6% chance of success, or odds of roughly 2.8 to 1 in favor of winning!

Brian's own test trials intrigue me. Assuming that he wound up winning 34 out of those 50 times, which seems reasonable given the “about 70%” phrasing, Wolfram|Alpha says there's only about a 0.44% chance, or odds of about 224 to 1 against winning 34 or more out of 50 such trials! As with any trials, though, long shots can and do happen.

Alternatively, that claim might be a scam...

0

A Puzzle with its Ups and Downs

Published on Sunday, November 04, 2012 in , , , , , ,

Konrad Jacobs' photo of Martin GarnderMartin Gardner made many puzzles and magic tricks popular over the years.

This post focuses on one particular bar bet whose popularity seems to come and go like the tide. It involves nothing more than 3 glasses and someone to challenge.

Martin Gardner first wrote up this puzzle in his December 1963 Scientific American column. It was later reprinted in the “Parity Checks” chapter of Martin Gardner's 6th Book of Mathematical Diversions from Scientific American.

A brief write-up of it is also found in his book Entertaining Science Experiments with Everyday Objects under the name “Topsy-Turvy Tumblers,” and Google Books has made the Topsy-Turvy Tumblers page available online for free.

Usually, it's described with the objective as getting all 3 cups mouth up, but it's easy enough to alter the goal to getting all 3 cups mouth down, as in the following video:



Whether you decide your challenge will be to get all the cups face-up or face-down, the process is the same. The spectator must follow your action exactly, do everything in 3 moves, and wind up with the cups facing the same way as you.

The three moves are a throw-off. When you look at the alternating set-up at the beginning, it's easy to see that you could achieve the goal by just flipping the two outer cups. Once you realize this, it becomes an easy way to check that you have the cups set in the right position for the correct goal when you do it, and in the wrong position for the wrong goal when the other person does it.

The pattern of moves they have to follow is easy enough. Turn the two rightmost cups, followed by the two outer cups, followed by the two rightmost cups again. When performing this, you really only need to think of this as right-outer-right.

Most people who do this puzzle stop with this once they win their money or drink. There is, however, a little-known sequel to this puzzle. Martin Gardner and Karl Fulves developed it together, but taught it with pennies instead of cups, so few have made the connection between the two routines.

In the sequel, you bet that you can get all 3 glasses facing the same way while blindfolded, and without even knowing the arrangement of the glasses!

You explain that you are going to be blindfolded, or otherwise prevented from seeing and touching the cups (this could be done over the phone, if desired). You mention that since you'll be blindfolded, you need a little leeway and will instruct the other person to flip the glasses one at a time.

The original write-up is a little hard to find, but thankfully, it was printed up in the American Scientist article, “Puzzles and tricks from Martin Gardner inspire math and science,” which is available for free online. It was also discussed further in the January 2012 issue of the College Mathematics Journal, which is also available in full online, in an article by Ian Stewart titled, “Cups and Downs.”

How is this possible? The method is simply this: First, you tell them to flip the leftmost glass. Next, you tell them to flip the middle glass. At this point, you ask them whether all the glasses are facing the same way yet. If so, you stop, of course, and if not, ask them to flip the leftmost glass one more time. At this point, the glasses are guaranteed to all be facing the same way!

After the second flip, the step where you flip the middle glass, you may get lucky and hear audible gasps, indicating that the people are amazed you reached your goal so quickly without looking.

If you don't hear any reactions after the second flip, you'll need to ask a question without appearing to do so. The most effective way to do this is simply to ask, "The cups aren't all facing the same way, are they?" Note that this starts with a negative statement, and then asks the question briefly.

If they reply that the cups are NOT facing the same way, you simply say, “I didn't think so,” and then make the last flip. This way, it sounds to the audience like you knew that wasn't the case all along.

If they reply that the cups ARE all facing the same way now, you say, “I thought so! Thank you!” When it happens this way, it simply seems like you're confirming your success, and knew your challenge was complete!

The Ian Stewart article linked above explains the mathematics behind this in a very clear manner, largely with a simple diagram of a cube. The American Scientist article also features a 4-object flipping sequence in which 2 objects are flipped at a time, and it still takes 3 moves or less without looking.

Play around with this bet, and better yet, take the time to examine the mathematics behind it. For such a seemingly simple bit of business, it has plenty to teach.

0

Understanding Math with Wolfram|Alpha

Published on Thursday, November 01, 2012 in , , , ,

1958 USPS postage stamp honoring Paul Revere superimposed on Mangan2002's photo of a basketball displayIn the past, I've discussed standard ways of visualizing mathematical concepts, including ways to grasp pi and get a sense of scale. What if you need to create your own visualizations, however?

It turns out our old friend Wolfram|Alpha is not only good at working out the math, but making it easier to grasp, as well.

Let's say you work for a company that's giving a holiday dinner for all 3,000 of its employees. As part of this dinner, there will be a drawing in which one of the employees will win a new car.

Your probability of winning the car, of course, is 1 in 3,000, and you really want to understand what this probability means. So, you might try working out 1/3,000 on Wolfram|Alpha, and seeing that this is equivalent to 0.03333%. All that really happened here is that you now have a different number to ponder. We know that a probability of 1 in 3,000 and 0.03333% is a slim chance, but it's all still too abstract.

As explained in the book Made To Stick, the trick to taking something abstract and making it concrete is to describe it in a way that can be experienced through the senses. My blog post on concreteness as it applies to magic performances goes into more detail, as well.

Instead of simply seeing the numbers as chances, then, what if we imagined the 3,000 represented some kind of physical space? For example, 3,000 might be pictured as 3,000 miles. What does 3,000 miles look like? Entering 3,000 miles in Wolfram|Alpha, we find out that this distance is about ¾ the length of the Amazon river, 20% longer than the distance from New York to Los Angeles, or about ⅛ the circumference of the earth at the equator.

It's getting easier to picture, but still a little hard to grasp. Let's try scaling things down to inches and see what happens. 3,000 inches is 10% longer than a Boeing 747, or the height of a 28-story building. That's good, but perhaps picturing it as an area, in square inches would be better.

Trying out 3,000 square inches, we see that this is roughly the size of the surface area of 11 NBA basketballs! This is a great image, as it's well within the realm of the average person's experience.

Remember, though, that we're trying to picture what 1 in 3,000 looks like, so we need to picture 1 square inch, as well. Wolfram|Alpha says that 1 square inch is about the size of a postage stamp, which is another great image.

Putting this together, we see that 1 in 3,000 can be pictured as the area of a postage stamp as compared to the surface area of 11 NBA basketballs! The image below gets the concept across quickly and directly.

1958 USPS postage stamp honoring Paul Revere superimposed on Mangan2002's photo of a basketball display

Now that you can see the drawing as 11 basketballs covered in stamps, with a hope of the company picking your single stamp out of those, it's more easily understood.

It's best to play around with different ways of seeing the numbers involved to find the best image. Switching to metric, we see that 1 cm and 3,000 cm gives the image of the width of a CD case as compared to the length of the average blue whale. There's also the volume of volume of 26 M&MS as compared to 950 large eggs.

There's nothing that says you have to use physical space, either. 1 in 3,000 could just as easily be thought of as a single second out of an average college lecture, the mass of a ¾-full can of soda as compared to the that of 2 dairy cows, and more!

Note that, while discovering the images requires particular units of measurement, presenting the images doesn't require disclosing units at all. Stamps, basketballs, CD cases and blue whales become the units themselves. When exploring various images, you'll find that larger numbers generally require smaller units.

Play around with numbers you use, and see what you discover. If you find any numbers you've been able to make visual with amazing or amusing images, I'd love to hear about them in the comments!

0

Power of 2

Published on Thursday, October 18, 2012 in , , , ,

LaMenta3's binary pillow photoThe recent Age Cards posts showed us one amazing application of the number 2 (base 2, in that case).

Today, we'll investigate some more amazing and surprising uses of the number 2, including some that can make you look like a genius!

For much of what you're going to learn here, you'll want to be comfortable with multiplying by 2 in your head, as well as the ability to easily divide by 2 mentally.

Incredibly, even if you can only multiply and divide by 2, you can still multiply any 2 numbers together! This is made possible by an unusual approach known as “Russian peasant multiplication” (sometimes also called “Egyptian multiplication”). It's explained in the following video:



Yes, this works with any 2 numbers, but depending on the numbers chosen, you may wind up adding more or fewer digits. If you're interested as to why this works, Dr. Math has some excellent explanations on this page, as well as this page.

Using a similar process, including the habit of dropping any decimals after dividing by 2, you can also quickly and easily convert any decimal number to a binary number. How? You take any given number, ask yourself whether it's odd or even. If it's odd, you're going to write down a 1, and if it's even, you'll write down a 0. You then divide by 2, and repeat this process. When you've completed this step all the way down to 1, you're done.

To make this clearer, let's try a small example, such as 19. Working this out step-by-step, we get this:

19 is odd: 1
(19/2 = 9.5, round down to get 9)
9 is odd: 1
(9/2 = 4.5, round down to get 4)
4 is even: 0
(4/2 = 2)
2 is even: 0
(2/1 = 1)
1 is odd: 1

Working from top to bottom, we write these numbers down from right to left (opposite of the way you would normally read) to get 10011. Double checking with Wolfram|Alpha, we see that 10011 is indeed the binary for 19.

As you can see, this is actually a bit simpler than the Russian peasant multiplication, but comes across as more impressive.

Let's try this with a higher number, such as 76, and simulate how you'd think and write it when showing this to someone else (the steps of dividing by 2 and rounding down are implied from one step to the next), noting that each step's result is written to the left of the previous result:

Think: 76 is even...
Write: 0

Think: 38 is even...
Write: 00

Think: 19 is odd...
Write: 100

Think: 9 is odd...
Write: 1100

Think: 4 is even...
Write: 01100

Think: 2 is even...
Write: 001100

Think: 1 is odd...
Write: 1001100

Yep, 1001100 is binary for 76! From the point of view of anybody watching, you seem to just work out the binary equivalent of the given number in your head without breaking a sweat!

Once you're comfortable converting decimal to binary, it's not hard to learn to work the other way.

To take a binary number and convert it, you're going to start from the leftmost 1. The leftmost binary digit will always be a 1 because, just like in decimal, you can put as many zeroes as you want to the left side without changing the number.

You start at the leftmost 1 with a mental total of 1. Every time you move to the right, regardless of the digit, you're always going to multiply by 2. If the digit you're at is a 1, then you're going to add a 1. Next, you move to the right again and multiply by 2, adding 1 if the digit is 1, and so on until you get to the rightmost digit.

Let's how this system is used to translate the binary number 11001. We start at the leftmost 1, with a mental total of 1:

11001
Mental Total: 1

(Move a digit to the right...)
11001
Mental Total: 1 * 2 = 2, 2 + 1 = 3 (the 1 is added because this digit is a 1)

(Move a digit to the right...)
11001
Mental Total: 3 * 2 = 6

(Move a digit to the right...)
11001
Mental Total: 6 * 2 = 12

(Move a digit to the right...)
11001
Mental Total: 12 * 2 = 24, 24 + 1 = 25 (the 1 is added because this digit is a 1)

Our final mental total is 25, so if we did this right, 11001 in binary should be 25 in decimal. A quick double-check with Wolfram|Alpha proves this is correct!

You can even work through this verbally quite easily, in this manner: “1...2.3...6...12...24.25!”

These binary and decimal conversions are derived from what's known in mathematics as Horner's method. This was originally developed as a way of evaluating polynomials, such as 3x2+2x+7 (Here's a quick tutorial on how to do that). However, since any number in any number base can be treated as a polynomial, such as 327 = (3 * 102) + (2 * 101) + (7 * 100), Horner's method also turns out to be useful for converting numbers from one base to another. You can learn the generalized method for converting any number in any base to decimal here.

Now you have 3 new amazing, and even amusing, abilities - Russian peasant multiplication, decimal-to-binary conversion, and binary-to-decimal conversion. Practice them, and you'll find them fun and maybe even useful!

0

Mistakes in Math

Published on Thursday, August 23, 2012 in , , ,

Eric Haddox' picture of the 2007 Guatemala sinkholeNaturally, everybody makes mistakes. In fact, it's an important part of the learning process.

People are especially quick to learn from mistakes that have large impact. If you ever wondered in school about the importance of doing the math right, today's post will show you many examples of what can happen when the math is done wrong.

When you're in school and, say, working through a word problem, and you make an error, the worst that happens is that you lose a few points on the assignment. Mathematical errors that happen in stories are often interesting and even amusing because they don't have any real world effect.

In Edgar Allan Poe's The Gold Bug, there's an error of trigonometry concerning the discovery of the treasure, but errors like this are easily ignored and don't effect enjoyment of the story. If you're not familiar with The Gold Bug story, there are many places you can read it or watch it online.

Math mistakes get much more serious when they affect our lives, however. The most common example happens in everyday shopping. Many retailers take advantage of consumers' inability to handle math on the stop by employing intentional math mistakes. Just last month, The Atlantic published an article about this called, “The 11 Ways That Consumers Are Hopeless at Math.” You'll probably recognize many of these approaches from personal experience.

Unintentional mistakes, as you're no doubt aware, can have a great cost in your personal or business life.

In the London Olympics, Tunisian weightlifter Khalil El Maoui was in second place after the first part of weightlifting competition. Unfortunately, because of a math error made by his coach, El Maoui wasn't present for the next part of the competition.

If you think affecting the outcome of a game for 1 person is bad, how about affecting the outcome for 14 people? That's just what happened back on April 30 of this year at the Golden Nugget Hotel and Casino in Atlantic City. Their playing card supplier, Gemaco, had accidentally provided several unshuffled decks, even though they're supposed to provide shuffled decks. Naturally, the players recognized the patterns and took advantage of them to win. The game quickly went from a $10 per hand game to about $5,000 per hand. By the time the mistake was uncovered, the players had won a combined total of $1.5 million!

In this case, the original error wasn't mathematical itself, but the assumptions made on the part of the supplier and the casino did have a mathematical impact on the odds, and thus the outcome of the game. The decision by the casino to not allow many of the players to cash out their winnings may amplify the damage, should the general public see this as the casino being unfair.

The math mistake that are most likely to stick out in people's minds, however, are the ones that cost lives. The TV show Modern Marvels regularly features episodes about engineering disasters, and it's amazing how often the tiniest error can cause the most major disaster. Cracked.com also has an amazing collection of 6 of the smallest math errors, and their horrific consequences.

Many people don't care for studying math because of the relentless focus on precision. When you realize that math interprets and affects the real world, the need for that precision quickly becomes apparent.

0

Mental Math FREEBIES

Published on Thursday, August 09, 2012 in , , , , , , ,

Procsilas Moscas' number grid pictureIn today's post, I've gathered a few free goodies for you!

They're all about mental math, so you may wind up learning something if you go through all of them!

2011 “Lightning Calculation” Calendar: Yes, August 2012 is probably a strange time to be recommending a 2011 calendar, but this calendar still has a valid purpose. Each month teaches new mental math techniques, and the calendar itself then gives you related daily challenges to practice! Naturally, there are calendar calculations, but there's multiplication, squaring, trigonometry and more. If you like this calendar, you might want to explore the rest of the author's site, as well.

Short-Cut Math: This is a clearly-written guide to the mental math shortcuts you're most likely to need during your lifetime. Various publishers still market this book, but the original at the link is still public domain. The section on the under-utilized technique of casting out 9s always makes me think of this amusing anecdote, in which an adult learns the technique for the first time, and it actually provokes a violent reaction!

Ars Calcula: This is a simple blog about mental math, and each entry teaches one specific mental math technique. It's not much else than that, but it neither claims nor needs to be any more. The multiplication guide is especially handy, as it gives a sort of hierarchy of when each multiplication technique is appropriate.

Vedic Mathematics: My Trip to India to Uncover the Truth (Alex Bellos): Back in 2011, Gresham College hosted a series of lectures about early mathematics in various cultures. In my opinion, Alex Bellos had the most intriguing lecture of the group, in the video below. Vedic Mathematics is said to be an ancient approach to mathematics, but Alex Bellos questions that history, and then even questions whether the answer is important or not. His powerpoint slides, a transcript, and both audio and video of this presentation are available for download at the link (scroll down to Crore blimey! My trip to India to Uncover the Truth about Vedic Mathematics).



Arthur Benjamin at Etech: You've more than likely seen Arthur Benjamin's Mathemagic performance at TED, but that video only gives a taste of his complete show. This paragraph's main link, however, is a more complete, 37-minute-long version of his show at Etech. There are many aspects you wouldn't expect, such as opening with a card trick, and even teaching the audience some mental math they can use!



Everything above is free and legal to download if you wish to save it to your hard drive. This may not seem like much, but if you take the time to really explore each item, you'll have enough food for thought for quite some time!

1

Great Free Online Math Tools

Published on Thursday, July 19, 2012 in , , , , , ,

Proferichardperez' drawing with several images representing different areas of mathematicsExploring mathematical concepts is now easier and more impressive than ever before, thanks to computers and the internet.

In this post, we'll look at some incredible mathematical tools, all of which are available online for free!

Wolfram|Alpha - If you're not already familiar with Wolfram|Alpha, especially considering the numerous mentions I've made of it here on Grey Matters, you're in for a treat. Instead of simply searching for sites that may or may not answer your question, it simply tries to answer your question directly. I suggest watching Stephen Wolfram himself introduce the concept via video (Part 1, Part 2). You can get a better idea of its capabilities through the Wolfram|Alpha blog, examples, and tumblr blog, as well. You can even use your queries to develop embeddable widgets for your own website!

(Click here to watch part 2)


Google Calculator - Google's search engine has a built-in calculator. While it doesn't give you all the features of Wolfram|Alpha, it's still quite impressive. It can handle arithmetic, conversions, graphing, and more! Soople is a site with a graphical front end for Google calculator, so you can get a better idea of its capabilities.

Instacalc - No, this isn't as big a name as either of the first two, but that doesn't mean it's any less valuable. Instacalc is an online calculator designed to let you work with multi-step calculations. You can even embed your calculations, as I did in my post on Gas Math.

GeoGebra - GeoGebra is a VERY impressive CAS (Computer Algebra System). I include it here, as it runs primarily as a sort of Java web app, but is also available as an offline application. As seen in the video below, GeoGebra is primarily used to develop interactive “worksheets” that can help users explore mathematical concepts. For example, here's an interactive worksheet I developed to help Grey Matters readers explore the Estimating Square Roots technique I recently posted.

It's often also used to teach students mathematical concepts by having them develop interactive worksheets for themselves. If you're familiar with Wolfram's CDF format, as used in Wolfram|Alpha Pro and Mathematica, the concept is similar, except you can develop these for free, instead of paying hundreds of dollars. You develop your worksheet using graphics pages, an algebra view for managing variables, and even a spreadsheet.



The level of support for GeoGebra is awesome, especially considering it's a free program. There's a Wiki to help you learn how to use it, a site where you can download tens of thousands of worksheets (and upload your own!), a forum, and a wide variety of instructional videos to help you along.

CodeCogs Online LaTeX Equation Editor - LaTeX is a language used to define the typesetting features of documents, in such a way as to give consistent results across different platforms. It's found favor with mathematicians (Wolfram|Alpha's output is rendered with LaTeX), as it allows a more effective display of formulas and equations. For example, the following display is difficult to achieve in standard HTML, but easily achieved in LaTeX, with help from CodeCogs (click to see the LaTeX markup behind it):



CodeCogs also offers a web interface for turning C or C++ code into online calculators (login required), and a LaTeX rendering engine for Excel.

Mathway - Mathway offers several online calculators, each geared to a specific mathematical subject, such as algebra, trigonometry, or calculus. It's entry method similar to CodeCog's LaTeX Equation Editor, but Mathway will work through the problem, as opposed to simply displaying it. With a free account, you can even save your calculations as worksheets to be used over and over again (free accounts see only the results, while paid accounts allow you to see the intermediate steps).

There are many more tools I can post, but the ones above are the current stand outs. If you program in Javascript, you might want to check out ASCIIsvg and/or JSXGraph.

Wikipedia provides an online calculator comparison chart here, and a computer algebra system comparison chart here, if you'd like to explore even more resources.

0

Chinese Remainder Theorem

Published on Sunday, January 22, 2012 in , , , ,

Lone Star Showdown 2006 TAMU band by JohntexI've talked about the modular arithmetic before, especially as it related to the day for any date feat.

In this post, we're going to take it out of the calendar feat's shadow, and give it a starring role in its own feat!

If you remember doing division before you learned about fractions, you remember doing problems such as 21 ÷ 4 = 5 remainder 1. Modular arithmetic is simply focusing on the remainder exclusively. 21 modulo 4, for example, just equals 1, because when you divide 21 by 4, 1 is the remainder.

If we're talking at 10 AM, and I agree to call you in 5 hours, then you know to expect a call from at 3 PM. You did 10 + 5 = 15, but you know that hours aren't numbered any higher than 12, so you just subtracted 15 - 12 to get 3. This is modular arithmetic, and is also why it has the nickname “clock arithmetic.”

Let's try comparing the modular arithmetic patterns of two numbers, say, 2 and 4. Since 2 times 4 = 8, we'll compare the remainders as they run from 0 to 8:



What if I were to tell you that I was thinking of a number from 0 to 8. I then gave you a further clue that, when divided by 2, it has a remainder of 1, and when divided by 4, it has a remainder of 3, we run into a problem. Look at the chart. That description fits both 3 and 7, and there's no way to work out which of the two. The problem is that the pattern of remainders, when divided by 2 and 4, repeats 2 times from 0 to 8.

If we try this with, say, 3 and 6, and ran up to 18 (3 × 6) you can see in this chart that there are 3 times where a pattern of 3 remainders repeats.

If we want to identify a number by its remainders alone, is there some way to make sure that no repeating pattern emerges? Notice that, when we used 2 and 4 (and went up to 2 × 4, the remainder patterns repeated 2 times, and that 2 is the largest common factor of 2 and 4. Similarly, when we used 3 and 6 (and went up to 3 × 6), the remainder patterns repeated 3 times, and that 3 is the largest common factor of both 3 and 6.

If we want no repeating patterns, then what we're really saying is that, when performing modulo a and b, running from 0 up to a × b, we would like each number combination to only show up 1 time. For this to be true, we simply have to make sure that the greatest common factor of the numbers involved is 1!

This is the basic idea of the Chinese Remainder Theorem. Martin Gardner discusses this idea in more detail in his book Aha!: Aha! Insight and Aha! Gotcha (Spectrum). You can find the relevant pages online here and here, thanks to Google Books.

When using two numbers, it's pretty easy to make sure their only common factor is 1. If we use, say, 4 and 5, and go up to 20, we can already know that there won't be any repetitions, because the largest factor common to 4 (factors: 1, 2, 4) and 5 (factors: 1, 5) is 1.

The Chinese Remainder Theorem also tells us we can go further, and even use 3 or more numbers, and they won't repeat (up to a × b × c ×...) as long as their largest common factor is 1! The easiest way to do this, of course, is to turn to our old friend, prime numbers.

In the Martin Gardner book linked about, he talks about a version of a trick where someone thinks of a number from 1 to 1,000, and gives you the remainders after dividing by 7, 11, and 13. Since 7 × 11 × 13 = 1,001, you'll get a unique combination of remainders for any number given. But what about the version he mentions from 1 to 100 with 3, 5, and 7? What's the formula for that?

Let's take the approach in his article and apply it. For the remainder after dividing by 3, we need a multiple of 5 × 7 that's 1 greater than a multiple of 3. 35 doesn't work, because 34 isn't a multiple of 3. 70, being 69 + 1, works perfectly, though. OK, we start with 70 × a (or 70a for short).

What about 5? Let's look at the multiples of 3 × 7. There's 21...perfect! It's already 1 more than a multiple of 5. OK, now we've got 70a + 21b. What about 7? 3 × 5 = 15, and 15 is already 1 more than a multiple of 7. For all three numbers, we now have 70a + 21b + 15c. Divide that total by 105 (3 × 5 × 7), and the remainder will be the number you're looking for!

You could do that on a calculator, but if you're familiar at all with Grey Matters, you'll know that I encourage you to do things like that in your head. However, I understand that it can be tricky.

A magician named Tom Harris, back in 1958, proposed a different approach that required no calculation. You memorize the number combinations with help from the Peg/Major system, linking the combined numbers you get to the unique answer for that combination. For example, if someone gives you the numbers 1, 0, and 3, you would recall the phonetic equivalent “twosome”, and remember that you linked that to the word “toes,” which translates to 10.

This is a bit of work, but we have an advantage over someone trying to do this in 1958. Using a spreadsheet program makes an easy grid, and will handle listing the numbers from 1 to 100 for you, and will even handle working out the remainders for you. To find words for each combination, you can use some of the mnemonic generators listed here (My favorite for this would be pinfruit). Those familiar with the Peg System will already have 100 words ready for the answer numbers.

Naturally, I've developed a Wolfram|Alpha widget that can make things easier on your audience members:

I'll leave you with one last related challenge. James Grime needs help counting his juggling balls. Can you use what you've learned to help? When you're ready, here's the answer video.