Looking Back At 2012

Published on Sunday, December 30, 2012 in , , ,

Loudon Dodd's head of Janus photoThis is the last post for 2012, so it's time for look back at the highlights of Grey Matters' posts over the past year.


The biggest event for Grey Matters in January, of course, was the release of Day One, my simplified day of the week for any date feat taught via ebook, software, and videos. In honor of the new year, I'm reducing it from $9.99 to $6.99 through January 7th!

Even before that, the year started off with the Sliding Calendar Puzzle and a blog post introducing it. When Scam School covered the classic 8 queens puzzle, I posted a working online version of the puzzle so you could try it out for yourself!

We also celebrated the 25th anniversary of Square One TV.


February's most popular post was Around The World in 7.2°, about Eratosthenes' estimation of the circumference of the Earth.

Sadly, we lost noted mathematician Nicolaas Govert de Bruijn in February. In his honor, I took a look at some of his discoveries, especially concerning how their use in performance magic and recreational mathematics.


Grey Matters celebrated its 7th anniversary this month. I can't believe we're already getting close to #8!

Appropriately for the month containing Pi Day, fun with geometry was a minor theme, featuring posts about fractal dimensions and tessellations.

Our favorite game Nim made another appearance, this time played with pizza so as to insure you get more than the other person.


National Poetry Month kicked off with a look at memorizing poetry.

Nim showed up once more, in the guise of an all-Xs version of tic-tac-toe called Notakto.

I also began a series of posts that closely examined various ways to determine someone's age. The approaches included algebraic methods, judging by appearances, and a combination of those two approaches.


April and May seemed to blend into a single month on Grey Matters. The age-guessing posts concluded with a method using a person's birthday and the day of the week on which they were born.

I expanded on the introduction of Notakto by posting 2 new tutorials, How to Play and Win Notakto and How To Play and Win Notakto: 3+ Boards.

Also in the spirit of revisiting past topics, I released a new free Knight's Tour web app, looked at Wythoff's Nim, and included some new touches for Day One.


It seems that June was a very eclectic month, beginning with a post on memorizing playing cards, and memorizing USA-related facts.

There was plenty of math that month, including free mathematical magic, the 100th anniversary of Alan Turing's birth. More unusual topics included calendar history and the arguments for Pi, Tau, and Eta!


A card trick based on de Bruijn's work started July's posts. Other fun feats included the estimation of square roots (including some tips and tricks) and techniques for division with decimal accuracy.

It was also a good month for videos about math and memory techniques.


No, Nim wasn't ignored in the latter half of the year. Nim updates were featured early on in this month.

August seemed determined to end on a down note, first with news about major math mistakes, followed by the sad news of Neil Armstrong's death.


Nim was very prominent this month, including a post on playing free Nim games on iOS devices, and how to win a version called Abacan (part 1, part 2).

“Card” Colm Mulcahy and a few others showed off some of their mental prowess in performances, and the Age Cards trick was re-examined to round out the month.


Inspired by my look at September's Age Cards post, Brian O'Neill shared his incredible game show version with Grey Matters readers. We also discovered a few other ways to play with the power of 2.

Overall, October seemed to be a fun month, especially since we had 10/11/12, a remembrance of Martin Gardner, and we even re-examined the Fibonacci addition trick!


Probability moved into the spotlight in November, with posts about using Wolfram|Alpha to visualize odds, a 2-card bet, and Bayes' theorem.

November drew to a close with some fun and unusual posts, including how to create your own personal equation and the Desmos Graphing Calculator.


This brings us to the final month of 2012, in which math magic took hold. The Desmos Calculator helped us examine some surprising aspects of the integer lattice in part 1 and part 2 of this mini-series.

The theme continued through posts about free math magic books, an improvement on the Wolfram|Alpha factorial trick, Robert Neale's imaginative routines, and one last visit from Nim when Scam School taught Dice Nim.

I hope you take the time to look back through the archives, and find a few new favorites to enjoy. In our next post, it will be time to start looking forward to 2013!


Scam School Takes on Dice Nim

Published on Thursday, December 27, 2012 in , , , ,

NIM is WIN upside down!Congratulations to Scam School on reaching 250 shows!

As with any good anniversary celebration, they invited back an old friend of their and ours - Nim! More specifically, their 250th episode looks at Nim with dice.

Let's jump right into the 250th episode:

If you think about it, Dice Nim is really just standard single-pile Nim played backwards. As a matter of fact, go to the Single-Pile Nim Strategy Calculator, and use the following settings:

• Player who makes the last move is the: Winner
• Maximum number of objects (limit): 50
• Nim Game is played: up to limit
• Number of objects used per turn ranges from 1 to: 6

Click the Calculate Nim Strategy button, and you'll note that the Nim Strategy Calculator returns exactly the same strategy Brian teaches in this episode. Try playing around with Dice Nim using this calculator, and see how choosing other strategies, or even using dice with more or fewer sides affect the game.

One nice touch that Brian uses in the video is the use of 2 dice. If he were to use just 1, the other people might notice that he's simply giving it a half turn after they play. When they play a 4, he gives it a half turn to the 3 on the opposite side, and so on. With 2 dice, the playing of opposite sides isn't as obvious.

Here's an interesting thought: What if you were to play Dice Nim (with 1 instead of 2), and the rules specified that only you could only make a quarter turn each time? With a 5 on top, for example, you couldn't play 5 on your next turn, obviously. The 2 would be on the bottom, so you also couldn't play 2. You would be limited to rotating a quarter turn to 1, 3, 4, or 6.

There is a version of Dice Nim played exactly like this, called 31. The object is to be the person who either makes the running total exactly 31, or forces the other person to go over 31.

If you're interested in the strategy for this version, I wrote it up back in June of 2011, along with the game of 50 strategy. The next column even teaches how to play the quarter turn version to any number, so you can let the other person choose the goal.

Granted, carrying dice around with you is unusual (except maybe here in Las Vegas, NV), but not shocking. With a little practice, you can have a little fun, and maybe even win a few drinks.


12 Days of Christmas

Published on Saturday, December 22, 2012 in , , , , , ,

Hans van de Bruggen's Partridge and Turtle Dove pictureNote: This post first appeared on Grey Matters in 2007. Since then, I've made it a sort of annual tradition to post it every December, with the occasional update. Enjoy!

Since the focus of this blog is largely math and memory feats, it probably won't be a surprise to learn that my favorite Christmas carol is The 12 Days of Christmas. After all, it's got a long list and it's full of numbers!

On the extremely unlikely chance you haven't heard this song too many times already this holiday season, here's John Denver and the Muppets singing The 12 Days of Christmas:

The memory part is usually what creates the most trouble. In the above video, Fozzie has trouble remembering what is given on the 7th day. Even a singing group as mathematically precise as the Klein Four Group has trouble remembering what goes where in their version of The 12 Days of Christmas (Their cover of the Straight No Chaser version):

Just to make sure that you've got them down, I'll give you 5 minutes to correctly name all of the 12 Days of Christmas gifts. Those of you who have been practicing this quiz since I first mentioned it back in 2007 will have an advantage.

Now that we've got the memory part down, I'll turn to the math. What is the total number of gifts are being given in the song? 1+2+3 and so on up to 12 doesn't seem easy to do mentally, but it is if you see the pattern. Note that 1+12=13. So what? So does 2+11, 3+10 and all the numbers up to 6+7. In other words, we have 6 pairs of 13, and 6 times 13 is easy. That gives us 78 gifts total.

As noted in Peter Chou's Twelve Days Christmas Tree page, the gifts can be arranged in a triangular fashion, since each day includes one more gift than the previous day. Besides being aesthetically pleasing, it turns out that a particular type of triangle, Pascal's Triangle, is a great way to study mathematical questions about the 12 days of Christmas.

First, let's get a Pascal's Triangle with 14 rows (opens in new window), so we can look at what it tells us. As we discuss these patterns, I'm going to refer to going down the right diagonal, but since the pattern is symmetrical, the left would work just as well.

Starting with the rightmost diagonal, we see it is all 1's. This represents each day's increase in the number of presents, since each day increases by 1. Moving to the second diagonal from the right, we see the simple sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12, which can naturally represent the number of gifts given on each day of Christmas.

The third diagonal from the right has the rather unusual sequence of 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91. This is a pattern of triangular numbers.

But what can triangular numbers tell us about the 12 days of Christmas? If you look at where the 3 in this diagonal, it's southwest (down and to the left) of the 2 in the second rightmost diagonal. If, on the 2nd day of Christmas, you gave 2 turtle doves and 1 partridge in a pear tree, you would indeed have given 3 gifts, but does the pattern hold? On the 3rd day, you would have given 3+2+1 (3 French hens, 2 turtle doves and a partridge in a pear tree) or 6 gifts total, and sure enough, 6 can be found southwest of the 3! For any of the 12 days, simply find that number, and look to the southwest of that number to see how many gifts you've given by that point! Remember when figured out that the numbers 1 through 12, when added, totaled 78? Look southwest of the 12, and you'll find that same 78!

Let's get really picky and technical about the 12 days of Christmas. It clearly states that on the first day, your true love gave you a partridge in a pear tree, and on the second day your true love gave you two turtle doves and a partridge in a pear tree. You would actually have 4 gifts (counting each partridge and its respective pear tree as one gift) by the second day, the first day's partridge, the second day's partridge and two turtle doves. By the third day, you would have 10 gifts, consisting of 3 partridges, 4 turtle doves and 3 French hens.

At this rate, how many gifts would you have at the end of the 12th day? Sure enough, the pattern of 1, 4, 10 and so on, known as tetrahedral numbers, can be found in our Pascal's Triangle as the 4th diagonal from the right.

If you look at the 2nd rightmost diagonal, you'll see the number 2, and you'll see the number 4 two steps southwest (two steps down and to the left) of it, which tells us you'll have 4 gifts on the second day. Using this same method, you can easily see that you'll have 10 gifts on the 3rd day, 20 gifts on the 4th day, and so on. If you really did get gifts from your true love in this picky and technical way, you would wind up with 364 gifts on the 12th day! In other words, you would get 1 gift for every day in the year, not including Christmas itself (also not including February 29th, if we're talking about leap years)!

If you're having any trouble visualizing any of this so far, Judy Brown's Twelve Days of Christmas and Pascal's Triangle page will be of great help.

One other interesting pattern I'd like to bring up is the one that happens if you darken only the odd-numbered cells in Pascal's Triangle. You get a fractal pattern known as the Sierpinski Sieve. No, this won't tell you too much about the 12 days of Christmas, except maybe the occurrences of the odd days, but it can make a beautiful and original Christmas ornament! If you have kids who ask about it, you can always give them the book The Number Devil, which describes both Pascal's Triangle and Sierpinski Sieve, among other mathematical concepts, in a very kid-friendly way.

There's another 12 Days of Christmas calculation that's far more traditional: How much would the 12 gifts actually cost if you bought them? PNC has been doing their famous Christmas Price Index since 1986, and has announced their results. Rather than repeat it here, check out their site and help them find all 12 gifts, so that you can some holiday fun and then find out the total!

Since my Christmas spending is winding up, I'm going to have to forgo the expensive version, in favor of Miss Cellania's internet-style version of The 12 Days of Christmas. Happy Holidays!


The Genius of Robert Neale

Published on Thursday, December 20, 2012 in , , , , , , , ,

Robert Neale performing Trapdoor Card for Michael Weber on the Celebration of Sides videoRobert Neale is a magician who is an incredible thinker in terms of methods, as well as a very spirited artist when it comes to presentation.

In this post, you'll get a glimpse of the mind of this amazing performer and inventor.

Back in 1983, Robert Neale released what has become one of his best-known routines, called the Trapdoor Card. This week's episode of Scam School teaches this classic, but sadly neglects to credit the inventor:

Robert Neale himself has given Scam School permission to perform and teach his classic Rock/Paper/Scissors routine back in episode #71, published as “My First Trick” in Neale's book, Tricks of the Imagination:

Perhaps part of Neale's genius is in creating things that are so simple and yet so deceptive that those who aren't directly familiar with his work just think they're things that “have always been around.” Earlier this year, bicyclecards.com presented his Hypercard, first as a puzzle, then in a post explaining how it's made. They correctly credit Martin Gardner with popularizing it, but never mentions Robert Neale himself. Here's a video created by a reader of that tutorial:

If you really want to see the man himself at work, as well as learn some of his amazing thinking, the easiest place to begin is his Celebration Of Sides video. In this video, you see not only his amazing and ingenious approach to creating routines, but his warm and charming ways of presenting even the most abstract concepts. Here's a quick glimpse of some of the things shared on this video:

Hopefully, you've enjoyed this look at some of the work of one of the most creative thinkers in magic, and maybe even learned something new.


Still More Quick Snippets

Published on Sunday, December 16, 2012 in , , , , ,

Luc Viatour's plasma lamp pictureThe last snippets of 2012 are ready!

December's snippets switch back and forth between the nitty-gritty side and the cultured side.

• Picking up from the last entry from November's snippets, it seems that the Tau vs. Pi fight has intensified. This month, NumberPhile treats us to a Tau vs. Pi smackdown:

• Instead of having your math wrestling-style, you might prefer it a bit more cultured. If so, you're in luck, as the Museum of Mathematics, or MoMath for short, had its grand opening in New York on December 12, 2012! Vi Hart's father, George Hart, designed many of the exhibits, and takes us on an opening day tour:

• It was while I was putting together my 2nd integer lattice post that I first took notice of the MyWhyU YouTube channel. They seem to have the same knack for clear explanations as BetterExplained.com, but everything is explained through cartoons. Even their homepage is set up like a notebook, to give it a friendly feel.

Compare BetterExplained's introduction to number systems, to WhyU's introduction (mainly comparing the modern approach to Roman Numerals):

• Since we had the better cultured version of mathematics videos above, how about a better cultured version of an educational video website? You're probably familiar with TED.com, and their amazing selection of free videos from knowledgeable lecturers.

The people behind TED.com have added a new website called TED-Ed, and a corresponding YouTube channel. The TED-Ed site goes beyond videos to include quizzes and other resources that make it possible to get an idea of just how much you or your students are learning. It even allows you to create your own video/quiz/resource combinations! You can get a better idea of TED-Ed's features from their website tour:


Wolfram|Alpha Factorial Trick...Improved!

Published on Thursday, December 13, 2012 in , , ,

Wolfram|Alpha knowledge engineI was recently playing around with the Wolfram|Alpha Factorial Trick I wrote up a year ago, and I made a discovery that makes the feat much simpler!

The factorial of a number is the number you get when you multiply a whole number times all the numbers less than itself down to minus 1. For example, 5 factorial = 5 × 4 × 3 × 2 × 1 = 120.

Naturally, the larger the number, the more multiples of 5 and 2 you're going to use, so factorial often have a large number of zeroes at the end, known as trailing zeroes.

In this feat, you're able to quickly and easily give the number of trailing zeroes for the factorial of any number from 1 to 1000!

Make sure to read the original post, and are familiar with the basics of the routine. You should also be familiar with the fact that an exclamation point is used in math to denote factorial, such as 5! = 5 factorial = 5 × 4 × 3 × 2 × 1 = 120.

This new approach involves doubling a number chosen by the audience 1 or more times, so you first need to know exactly how many times to double the chosen number. As long as you know your powers of 5, this part is easy:

If the chosen number is at least 50 and less than 51, then you won't need to double it at all, and the answer will have no trailing zeroes.

If the chosen number is at least 51 and less than 52, then you'll only need to double the chosen number once. If the chosen number is at least 52 and less than 52, then you'll only need to double the chosen number 2 times. See the pattern?

Even though you'll be writing doubled numbers down, you're going to need to perform the doubling in your head. You can learn how to multiply 2-digit numbers by any 1-digit number in your head via MathTutor video, if needed. They also have a similar video that teaches you how to apply the same technique to 3-digit and higher numbers.

Now, you're about to learn the surprising power of simple doubling. I'll use 16 as a starting example. 16 is between 51 and 52, so I'll only need to double it once, so I think 16 × 2 = 32, and write down 32.

All you need to do know is cover up the rightmost digit of the doubled number, and that's the number of trailing zeroes in the factorial! In our example, the rightmost digit is 2, so we cover that up, leaving the 3. That means that 16! should have 3 trailing zeroes, and Wolfram|Alpha confirms that here.

If we try that with 22, we note it's also between 51 and 52, so we'll only need to double it 1 time, as well. 22 × 2 = 44, and if we cover up that rightmost 4, that leaves us with 4. Sure enough, 22! has 4 trailing zeroes!

When we have to double the chosen number more than once, there's are additional steps to take, but they're similar to what you've already learned. Also, when doubling 2 or more times, writing the doubled numbers down becomes very handy.

Let's try the new approach with the number 42. It's between 52 and 53, so we'll have to double it twice.

The first doubling of 42 is 84, and 84 doubled is 168, so yo'd write down those two numbers:

Just as before, you're going to cover up the rightmost digit of the first doubling (the 4 in 84). With the second doubling, you're going to cover up the rightmost 2 digits. In our example, we're covering up the 6 and the 8 in 168. With those numbers out of sight, you're left with 8 and 1:

All you do now is add up those remaining numbers! 8 and 1 are 9, and 42! does indeed have 9 trailing zeroes.

Notice the pattern when using 2 or more doublings. With the first doubling, you're ignoring the rightmost digit, and with the second doubling, you're ignoring the rightmost 2 digits. For the 3rd doubling, you'd ignore the 3 rightmost digits, and so on.

As a final example, let's work through this process with 137. 137 is between 53 and 54, so we'll need to double it 3 times, like this:

For the first, second, and third doublings, ignore the rightmost 1, 2, and 3 digits respectively, and add up the remaining numbers (in your head, not on paper):

Checking with Wolfram|Alpha again, we verify that 137! has 33 trailing zeroes.

Why does this work? It works for the same reason as the trick for dividing by 5 that's taught in the 2nd video in the original post. Dividing by 5 is the same thing as multiplying by and dividing that result by 10, which is easier to do in our heads. Dividing by 52, then, is the same thing as multiplying by 22, then dividing it by 102. Dividing by 53, then, is the same thing as multiplying by 23, then dividing it by 103.

The doubling of each number, of course, is the multiplying by 2. The simple act of ignoring the rightmost digits in each doubling is the same as dividing the first number by 10, the second number by 100, and so on, and the rounding those numbers down.

137 ÷ 5 = 27.4, and rounding that down lets us know that there are 27 sets of 5 in 137. See how this is the same as doubling 137 and ignoring the rightmost digit?

Similarly, 137 ÷ 25 = 5.48, and rounding down gives 5 complete sets of 25 in 137. Finally 137 ÷ 125 = 1.096, so we know there's only 1 complete 125 in 137.

The doubling process simply allows us to multiply by 2, which is easier for most people, and the concept of “ignoring” digits is disguising the decimals and even the division by powers of 10!

When actually performing this, it's good to have a reason to justify why you're writing down a series of doubled numbers. I suggest showing someone Russian Peasant Multiplication first, as taught in my Power of 2 post. Since you already have 1 column of doubled numbers at the end of that (make sure you don't use the column of halved numbers), you can use it for the factorial feat you just learned.

It may seem a little strange at first, but once you get the hang of it, it's quick fun and easy.


Free Math Magic!

Published on Sunday, December 09, 2012 in , , , , , , , ,

Free Mathematical Magic eBooks from Peter McOwan and othersIt seems British Magician and math professor Peter McOwan, with help from a few others, has been busy putting together an astounding array of mathematical magic in recent years.

They've made all these works available in the form of e-books and videos, and generously posted them all on the web for free! In this post, I'll let you know where you can find this amazing body of work.

Manual of Mathematical Magic: Regular Grey Matters readers will already known about this book by Peter McOwan and Matt Parker, since I wrote about it back in June.

This book is very well organized. The tricks are taught in sections by the type of math involved, such as arithmetic, algebra, geometry, and so on. Each trick is subdivided, as well, into the trick as it appears to your audience, the method behind the trick, the math behind the method, and even where to find the same type of math in your everyday life!

There is a nice build to this manual. Early on, you learn a few routines that are simple, and you often find that later routines build on these simple skills.

The Magic of Computer Science, Vols. I and II: With a daunting title like The Magic of Computer Science, you might worry about whether these volumes would be filled with complex math and special programs. Fortunately, both of these volumes are a lot more human-friendly.

Volume I, in fact, teaches computer concepts using only a deck of cards. It's amazing how you can start from a trick in which you predict the total of 4 cards chosen by the audience, and then learn that this trick's principle is what makes CAT scans possible!

Volume II also uses cards quite a bit, but also has tricks with other props. There's an amusing and amazing vanishing robot routine, using a downloadable graphic available on this page. My favorite routine in this book, however, is “The Power of Prophecy,” in which someone takes a number of cards from the deck without you peeking, yet you can apparently divine how many they've taken. Even if you're familiar with this routine from other sources, the related lessons in algebra and modeling systems are worth reading.

Maths Made Magic: This book is clearly designed to appeal to the Harry Potter crowd, right down the visual design. It's made to look like it was printed on old, yellowed paper, and presents the routines as if they were spells and sorcery.

The methods, all real-world mathematics, are explained simply, yet still manage to teach advanced concepts quite well. As a matter of fact, Maths Made Magic uses more advanced math than many other math magic resources I've come across. It's not often you see magic tricks that help you understand sine and cosine, or simultaneous equations mixed with the Pythagorean theorem.

Mathematical Magic: Mathematical Magic isn't an ebook. Instead, it's an iTunes U course, playable through iTunes on your computer, or the iTunes U app on an iOS-based mobile device.

Besides the medium, the Mathematical Magic course is different in that not every routine is explained (Don't worry, most of them are explained). Knowing that all the routines are math-based, though, I like the fact that not all the tricks are explained. It's a sort of test of your observation and critical thinking skills that have hopefully been developed by reading and trying out the other routines.

Illusioneering: Clever Conjuring Using Secret Science & Engineering: If you're ready to get away from cards and pure mathematics, there's still plenty of magic to be had use scientific principles. Illusioneering features magic with liquids, wheels, balloons and other assorted props.

The math is still there, underlying the science, but these tricks tend to play bigger and be more visual than those in the previous books. The Illusioneering homepage also features videos of many of the effects (including their methods), as well. The Illusioneering book and videos are also available via iTunes U.

The price is certainly right, so take some time to download these resources, explore, and have some fun!


Math Out in the Field (Part 2)

Published on Thursday, December 06, 2012 in , , , ,

Integer lattice on DesmosThis post picks up from the previous post, in which I explored an integer lattice using Desmos.

Today, we'll keep exploring the integer lattice, and see what other surprises it offers!

As before, the 20 by 20 integer lattice is here (opens in new window), and the 10 by 10 integer lattice is here (opens in new window). The latter functions better on mobile devices. Clicking on the options button in the upper right corner, then selecting Projector mode is also recommended.


We left off in the last post talking about prime numbers, integers (whole numbers) that are only even divisible by 1 and themselves. This seemed like a good place to continue the discussion.

If you take a look at the column (3,y), or the row (x,3) for that matter, you'll notice that only every 3rd dot isn't visible. This shouldn't be surprising by now, since we know from the previous post that only the dots that are visible are the ones that are coprime (their only common divisor is 1).

Similarly, with (x,2) and (2,y) only every 2nd one isn't visible, with (x,5) and (5,y) only every 5th one isn't visible, and so on. It's a simple pattern, but one that can help you easily pick out the prime numbers in even very large integer lattices.


For the next couple of surprises, I've set up a 2nd set of lattices. Here's the new 20 by 20 lattice (opens in a new window), and this link goes to the new 10 by 10 lattice (opens in a new window).

In either of these, start clicking on the Xs in the icons of the formulas until you get down to the next set of text instructions. When you do this, diagonal purple lines will appear. First, notice that diagonals not highlighted by purple lines have missing dots, while the highlighted diagonals have unbroken lines of dots (at least when they're not crossing an axis or going off the other edge of the grid).

What's so special about these purple lines? In each (x, y) pair, the sum of x and y add up to prime numbers! For example, in the coordinates (1,6), (2,5), (3,4), (4,3), (5,2), and (6,1), all the pairs add up to 7, and they're all visible! These are the dots highlight with the formula y=7-x, where x is greater than 0.

It turns out that, regardless of the size of the integer lattice you use, coordinate pairs whose sum is a prime number will always have an unbroken line of visible dots (again, as long as neither coordinate is 0). But what exactly does this mean?

From the previous post, we know that the dots on the lattice are only visible when their coordinate pair is coprime. So, we can determine from this that any two non-zero positive integers whose sum is a prime number must be coprime to each other! Take another look at all the pairs above that total 7, and you'll see that none of those pairs can be reduced!

This surprising discovery, done with a grid and simple arithmetic, is part of the reason I find the integer lattice so fascinating.


Imagine that the integer lattice we've been using is extended infinitely on flat plane. Is it possible to draw a line that never hits any grid point?

Going back to the previous post once again, we know that a line that goes from (0,0) through (x,y) must have a slope of yx. Conversely, a line with slope yx can always be drawn from (0,0) to (x,y).

Since (x,y) coordinates on the integer lattice are, by definition, always integers, we're basically looking for numbers that aren't expressible as fractions. Fortunately, there is a large category of such numbers, known as irrational numbers. The video below will explain about them in a little more detail:

On the integer lattices to which I linked at the beginning of DIAGONAL PRIMES section above, scroll down just past the instructions which read, “Click on the Xs in the icons below to display orange lines whose slopes are irrational numbers (numbers that can't be represented by a fraction b/a).”

Just below those instructions, I've set up lines with slopes of Pi and the square root of 2, both prominent irrational numbers. Click on the Xs on the icons to make those visible. You'll probably want to click on the icons of the purple lines to turn them off again.

These lines, as we've said, will never hit any integer point on the grid. Although, they can come extremely close. If you're looking at the 20 by 20 grid, you may notice that the orange line with a slope of the square root of 2 goes right through the dot at (12,17). If you zoom in far enough, using either your mouse's scroll wheel or the + and - buttons in the upper left of the grid, you'll see that it actualyy misses the dot by a very tiny amount.

Some quick arithmetic will tell us how close. A line going from (0,0) through (12,17) must have a slope of 1712, but our line is actually the square root of 2. Wolfram|Alpha shows us that the two differ by less than 2510,000!

In Wikipedia's entry on the square root of 2, it mentions that some known approximations for it include 32, 1712, 577408, and 665,857470,832. So, a line drawn from (0,0) through (408,577) will appear to be very close to a line with a slope equal to the square root of 2, but they will eventually diverge.

The same is true with Pi approximations, as well.


Here's where everything comes together in a surprising way. Let's figure out what the chances are of a randomly selected coordinate pair being visible. This sounds challenging, but if we break it down, we can make it manageable.

We'll use m and n to represent two randomly chosen integers. What is the probability that m is evenly divisible by 2? That's easy, it's 12, or .5 (a 50% chance). The same is true for n.

The probability of both m and n being evenly divisible by 2, then, is 12 × 12, or 14. The probability of at least 1 of the 2 randomly chosen numbers NOT being even divisible by 2, then, is 1 - 14, which is 34.

If we wanted to work out the odds of two randomly chosen integers both being divisible by 3, that's 13 × 13 = 19. Conversely the probability of at least 1 of the 2 digits not being divisible by 3 is 1 - 19, or 89.

To check the odds of two randomly chosen numbers not having 2 or 3 as a common factor, then, is 34 × 89 = 23.

You might think that we could just continue working on this way, working out the probabilities for numbers divisble by 4, 5, 6, and so on. We actually don't need to use composite numbers (numbers even divisible by numbers other than themselves and 1) such as 4 and 6. This is because of the fundamental theorem of arithmetic, which states that every integer greater than 1 is either prime itself or is the unique product of prime numbers. To answer our question, what we need to do is work through the above process using only prime numbers.

So, the process for working this out from prime numbers from 2 on up would appear as:

The proper mathematical shorthand for this would be to say that p represents the set of all prime numbers, and then use the product operator like this:

Using Wolfram|Alpha's Prime[n] function, which returns the nth prime number, and its Product[] function, which works as the product operator above, we can work out the probability of two chosen numbers not having the first n prime factors in common.

Checking for just the first 4 prime numbers (2, 3, 5, and 7), we find that there's a roughly 62.69% chance that two randomly picked integers will not have 2, 3, 5, and 7 as common factors. Applying this to the first 10 prime numbers gives a roughly 61.23% chance, a small drop from the previous percentage.

As you try this with the first 100 prime numbers, the first 1,000 prime numbers, the first 10,000 prime numbers, and so on, you start to notice that the changes get smaller and smaller, and get closer and closer to a single number. What number is it?

Amazingly, as you apply this formula with more and more numbers, it approaches 6/π2 (roughly 60.79%)! That's quite surprising, since the formula we used really only involved prime numbers.

The 30-minute video The Story of Pi has a nice segment (shown below) about the integer lattice and this appearance of Pi (only plays from 18:27 to 20:17):

That video is also a nice way to wrap up this series of posts about the integer lattice. If you enjoyed it, Martin Gardner has an entire chapter on the integer lattice in Martin Gardner's Sixth Book of Mathematical Diversions from Scientific American, in which he takes it in even more surprising directions!


Math Out in the Field (Part 1)

Published on Sunday, December 02, 2012 in , , ,

Integer lattice on DesmosSince writing my previous post, I've been having more fun with Desmos.

For today's post, I though we'd use it to take a field trip of sorts, through a mathematical orchard, planted on a grid.

If you've ever driven by one of those groves or orchards where all the plants are evenly spaced, you'll have an idea of the type of layout that we're going to use.

Think of a 20 by 20 grid on graph paper, and you're standing at the southwest corner of the grid, at what would be marked as (0,0). On every grid point marked by two non-negative integers (whole numbers equal to 0 or more), except for (0,0) of course, there are very thin and tall sticks, all of which are exactly the same size and shape. So, there are sticks at (0,1), (1,1), (2,1), and so on.

This is the field we'll explore in this post.


Imagine standing at (0,0), and facing directly north. You would naturally see the stick at (0,1). It's not hard to understand that you couldn't see the sticks directly behind it when looking straight at the first stick.

Sure, in the real world you could lean a bit to one side or the other to see them, but in our field trip on this grid, we're going to look at things as if you're always standing straight and looking directly ahead. Don't worry, I'm done sound like your parents.

With these assumptions under our belt, it's easy to understand that you wouldn't be able to see every stick. The question then becomes, which grid points are visible from (0,0), and which ones aren't?


This is where Desmos comes in. I've set up a 20 by 20 grid here (also known as an integer lattice) and a 10 by 10 integer lattice here (works better on mobile devices. You'll probably want to click on the options menu in the upper right and turn Projector Mode on.

All the integer grid points have sticks, but the dots on the grid show only the sticks that are visible from (0,0). Note the instructions in the upper left, which explains the meaning of the sliders and the red and blue dots.

Looking at the grid, it's easy to see why, say, (0,2), (2,0), and (2,2) are obscured, but is there any pattern to which sticks are hidden, and which ones aren't?

Let's examine a more obscure spot. Examine the point (6,9) by moving the a slider to 6 and the b slider to 9. You should see a blue dot at (6,9), and note that the red dot blocking it is located at (2,3).

Hmmm...if you take the 2 from (2,3), and multiply by 3, you get the 6 from (6,9). If you multiply the 3 from (2,3) by 3, you get the 9 from (6,9). Could this be a pattern?

Let's try looking at (4,10), and sure, enough, it's marked with a blue dot, blocked by a red dot at (2,5)! If you divide both 4 and 10 by 2, you get 2 and 5 respectively. This will probably remind you of your days in school when you learned about reducing fractions.

Any time you set a pair of coordinates, and the two numbers have a factor of 2 or more in common, you'll find that the dowel at that point will be blocked. If you reduce the coordinates in the same way you'd reduce a fraction, you'll find a red dot at that coordinate pair, because it's blocking your view of the blue dot.

As a matter of fact, we can turn the coordinates into a very important fraction, the fraction that represents the slope of the line! Here's a quick refresher course on how to work out the slope of any line:

Setting the coordinates (a,b), then, means that for every horizontal unit a we travel, the line must go up by an amount equal to b, so the slope of the line that goes through (0,0) and (a,b) must be ba.

It's because of this, as well of the ease of having a (0,0) viewpoint, that we can treat the coordinates as a fraction in this manner.

From (0,0) to (6,9), we draw a line with a slope of 96. For the same reason we can reduce 96 to 32, we can now work out that not only will the dowel at (6,9) not be visible, but that it will be blocked by the dowel at (2,3)!


Do you remember the basic building blocks all numbers, the prime numbers? Prime numbers are numbers whose only factors are themselves and 1. For example, 7 is a prime number, because it's only factors are itself (7) and 1.

When you reduce fractions to a minimum, as we've been doing, you get two integers (whole numbers) whose only factors in common is 1. This is similar to prime numbers, but is slightly different. Two integers like this are known as coprime integers.

2 and 3 from our above example are coprime, as are 2 and 5. Try looking at (8,7) on the Desmos demo, and you'll see that no dowel is blocking your view of it! 8 itself isn't prime, but 8 and 7 together are coprime, because 1 is their only common factor.

So far, just walking around an imaginary field, we've come across coordinates, slopes of lines, fractions, as well as prime and coprime numbers!

There's more treasures to uncover on the integer lattice, but I have to save some surprises for my next post.