Getting Squared Away

Published on Sunday, August 17, 2014 in , , , ,

Stefan Friedrich Birkner's square number imageOne of the more popular Mental Gym tutorials, probably because it's short and simple, is the Squaring 2-Digit Numbers Mentally tutorial.

Playing around with the methods in the math section of that tutorial, and doing a little research, I've run across an interesting pattern that make the calculations even simpler.

I'd noticed a pattern in some of the squares concerning their last two digits, but never really thought about the possibilities until I ran across this page about squares.

I've reproduced a slightly modified version of the number arrangement from that page below, but with the last two digits of each square highlighted. Although it's not shown here, the 2-digit pattern does continue on forever.

As I mention in the original tutorial, memorizing the squares of the numbers 1 through 25 is the most basic starting point, as is knowing how to square 2-digit numbers ending in 5. From here, though, we can take advantage of the pattern above in a different way.

SQUARING NUMBERS 26-50: When asked to square a number from 26-50, take the distance from 25 to that number, and multiply it by 100. Next, square the distance from the given to number to 50, and add it to the previous number you calculated. Those 2 steps give you the square.

For example, let's square 27. 27 - 25 = 2, so you multiply 2 × 100 = 200. The distance from 27 to 50 is 23, which you should know by heart as 529. Add 200 + 529 = 729, and you've got the answer to 27 squared!

How about, say, 38? How far is that from 25? Yes, it's 13, so we start with 1300. How far is 38 from 50? It's 12, and 12 squared is 144. 1300 + 144 = 1444, so we know 38 squared is 1444!

This approach makes numbers in the 40s almost ridiculously easy to square. You just say their distance from 25, then their distance from 50 squared. For 42, which is 25 + 17, you'd say, “17...” then square 8 (the distance from 42 to 50) and say, "..64!" With a little practice, numbers in the 40s almost square themselves!

SQUARING NUMBERS 51-75: As I mentioned above, the squares of the numbers beyond 50 continue with this pattern. Here are the squares of the numbers from 51 to 75, and here are just the last digits of each of those numbers.

The method for squaring these numbers is slightly different. After you're given the number, work out its distance from 50, add 25 to that distance, then multiply by 100. The final step is to square the distance from 50 to the given number, and add that to your previous calculation.

Let's use 56 as our first example. 56 - 50 = 6, so we add 6 + 25 = 31, and multiply by 100 to get 3100. 56, as we've already worked out is 6 away from 50, so we square 6 to get 36. 3100 + 36 = 3136, which is 56 squared! Notice that the 50s almost multiply themselves, just like the 40s did above!

Can you handle, say, 67 squared? That's 17 away from 50, so we work out 17 + 25 = 42, and 42 × 100 = 4200. Next, 17 squared is 289 (you know that from memory, right?), so we add 4200 + 289 = 4489!

SQUARING NUMBERS BEYOND 75: Squaring the numbers from 76 up to 125 can be handled just as in the original tutorial. You'll probably understand why this approach works more completely after seeing the pattern above.

Perhaps you can work out a method for numbers beyond 125? It can be done, but it's more than a minor variation on the above patterns.


Mind Your...Mental Math!

Published on Sunday, August 10, 2014 in , , , ,

Cover of Infinite Tower ebookPresh Talwalkar's Mind Your Decisions blog, has many interesting posts, some of which I've covered before.

I was thrilled recently when he began to make a series of videos about various mental math techniques!

It seemed to start about 2 months ago, when he posted the following video about squaring numbers ending in 5:

At the same time, he posted a companion video explaining why this trick worked:

Apparently, they've proved popular, as he's released a small series of them so far! Just like the above pair, each lesson provides a video teaching the method and an explanation behind the method. This is a good approach, as some may just want to impress their friends and family with a technique, without worrying about why it works, can just learn and go, while those who are more curious can take the extra step in learning about it.

Among the more unusual methods taught is the following method for squaring 34, 334, 3334, etc. and 67, 667, 6667 (explanation video):

A more standard technique is taught in this video about multiplying any 2 numbers between 11 and 19 (explanation video):

Presh Talwalkar has also made several short mental math videos that each teach simple techniques and includes simple explanations along the way. The first of these was a video on the rule of 72, a way of calculating how long it will take an investment to double:

Another one was this handy lesson in calculating percentages in your head:

My favorite of this group, however, is the following video on converting decimal numbers to binary in your head, as I've managed to impress even well-posted computer programmers with this feat:

If you enjoyed these videos, take a look around the rest of the Mind Your Decisions blog. Presh posts math puzzles every Monday, game theory posts every Tuesday, and other posts as thing grab his interest.


Mandelbrot Set: What Exactly Are We Looking At, Anyway?

Published on Sunday, August 03, 2014 in , , ,

Wolfgang Beyer's Mandelbrot set renderingPictures of the Mandelbrot set, such as the one to the left, are pretty to look at, and fascinating when you zoom in to see more detail.

But the origin of the design often isn't made clear. In this post, I'm going to slowly step through each important detail in way that helps you understand it.

Recently, Numberphile posted a video about the Mandelbrot set, as explained by Dr. Holly Krieger of MIT:

Even this video tends to gloss over some points, so my explanation will be somewhat slower, and build up differently.


Let's start with something very familiar, the number line you probably grew up seeing in your elementary classroom every day.

Martin Smith-Martinez' number line image
We're also going to start with a very simple formula: z2 + c. The variable c will act as a chosen starting point, and we'll be putting different numbers in the formula, except that c will remain constant (c is for constant).

What about that z2, though? That, of course, represents z multiplied by itself, and we'll be changing the value of z. Where do we start? As in the video, the starting point for z will always be 0. The next value for z, though, is whatever we get out of the equation from the previous calculation.

One of the simplest starting point is 1, so let's demonstrate with that. Since we chose 1, the formula becomes z2 + 1. Using 0 for our initial value of z, we have 02 + 1 = 0 + 1 = 1. If we take this 1 and use it as our new value of z, and keep using the previous result for our new value of z, we get the following values:

  • 12 + 1 = 1 + 1 = 2
  • 22 + 1 = 4 + 1 = 5
  • 52 + 1 = 25 + 1 = 26
  • 262 + 1 = 676 + 1 = 677
You can, of course, continue doing this as long as you like.

Each of these repeated calculations is referred to as an iteration of the formula. Perhaps not surprisingly, these numbers get bigger quickly after only a few iterations. We can have Wolfram|Alpha run through the z2 + 1 formula for us. Click on the More button in the Values pod will show that after only 9 iterations, the number is already up to about 1.94727 × 1045 (roughly 2 followed by 45 zeroes)!


What's the big deal? Doesn't every number get bigger? No, not all of them do. One of the more interesting numbers that doesn't get bigger is -2. If we run z2 + (-2) through a few iterations, it quickly reaches a result of +2 and never gets any bigger!

If we use a number that's even slightly smaller than -2, such as -2.000001, we can see that such numbers will continue to grow. That's why the 2 cases in the video are defined as Case One: Blows Up and Case Two: Stays Small (<= 2), and why 2 is considered a special value in the Mandelbrot set.

Now, in the video, Dr. Krieger mentions that 14 is on the boundary, so what happens with that number itself? Not only does 14 NOT surpass 2, it never even reaches 0.5!

So, what we have so far is just a line from 2 to about 14. Why about? Well, 14 isn't as solid a border as -2. For example, we can move a tiny bit to the right on the number line, say to 100001400000, and we find that point never exceeds 2. That point is too small to accurate mark on the number line, as compared to the next handy fraction, such as 13, which eventually does grow past 2.


Let's finally get off the number line and jump into 2 dimensions. We could attempt to use standard graph paper-style Cartesian coordinates of the form (a, b), but the mathematics required to handle 2 separate coordinates quickly complicates the formula.

This is why the imaginary number plane and complex numbers come into the picture. Read BetterExplained.com's A Visual, Intuitive Guide to Imaginary Numbers to get a good grasp of how these work. If those interest you, you may want to read Intuitive Arithmetic With Complex Numbers and Understanding Why Complex Multiplication Works at the same website.

For c, let's try the complex set of coordinates 0.5 + 0.5i. Running those coordinates through Wolfram|Alpha we see that after only 14 iterations, the results become roughly (-6×10287) + (-4×10287i)!

Thanks to the effects of i, the results can obviously get into negative numbers quickly, and the answers get confusing. What we need to do, then, is translate each result into polar coordinates. We're not so much worried about θ (the angle), but rather r (the radius), which is measured as the distance from the origin point. The radius is always a positive number, and we can simply judge whether this is bigger than 2.

Converting (-6×10287) + (-4×10287i) to polar coordinates, we get a radius of roughly 7.2111×10287 units from the center, so these coordinate definitely escape 2!

To cover two dimensions, we need to focus on a particular range. In the video, Dr. Krieger talks about using a radius of 2 units in all directions, but most of the Mandelbrot pictures you see tend to use a range of -2 to +1 on the real number line, and i to -i on the imaginary plane.

Besides a range, we also need to choose a “resolution.” To keep things simple, we might choose a resolution such as 70×30. So, we'd break up the space from -2 to +1 into 70 equally-spaced coordinates horizontally, and we'd break up the space from i to -i into 30 equally-spaced coordinates vertically.

Then, for each of those 2100 (70 × 30) coordinate pairs, we'd put them in complex coordinate form (a + bi), and assign that to c. We'd run through z2 + c for that set of coordinates and see if the radius ever became larger than 2 (in other words, whether there's a limit to the iterations). If so, we would assign a white square to it. If not, we would assign a black square to it (or an asterisk, if we're working in ascii).

Mapping those results gives you an image that appears as follows (click the image to see a larger version):

Elphaba's ascii Mandelbrot rendering
This picture is the result of 2100 calculations, with each calculation being iterated to varying degrees. Is it any wonder than the Mandelbrot set couldn't have been discovered until computers became commonplace?

Now things are starting to look much more familiar! For a better picture, just as you would with any display, you increase the resolution. Given 300×220 as the resolution, you would get an even clearer picture (click the image to see a larger version):

Connelly's hi-res b&w Mandelbrot rendering


Those simple black and white versions only show which sets of complex coordinates, when iterated through z2 + c, fall into which of the 2 cases. The pictures you usually see are much more colorful. What is the deal with those pictures?

Instead of asking just a yes-or-no question (Does the radius of the iteration ever exceed 2?), we change the question to “How long before the radius of the iteration exceeds 2?” If the radius of the iteration never exceeds 2, we use black. If the radius of the iteration exceeds 2 after 1 iteration, we'll use a color we'll call color 1, after 2 iterations we use a 2nd color, after 3 iterations we use a 3rd color, and so on.

That approach, known as the escape time algorithm, gives us the standard Mandelbrot set images with which you are likely familiar (click the image to see a larger version):

Wolfgang Beyer's colored Mandelbrot set rendering
Notice that you even get better contrast with this version, as you can see “branches” that aren't easily seen in the black-and-white versions.

As an aside, that name, escape time algorithm, brings up a good point. In the Numberphile video above, they make it sound as if distance is important. Instead, it's actually the amount of iterations it takes a number to escape the value of 2. The Mandelbrot isn't a measurement of distance, but rather time.

The colors chosen are usually a matter of personal preference, which is why you see so many different variations. If you don't like the banding effect of sudden color changes, there are even ways to smooth that out.

Remember how it's impossible to tell when moving the tiniest amount to the right of 14 on the number line would result in a set of iterations whose radius would ever exceed 2? Thanks to computers, we can choose a smaller range, an appropriate resolution, and zoom in to study the complexity of that particular area (known to Mandelbrot set fans as “Elephant Valley”):

Consider that all these results have been coming from iterating the same equation, z2 + c. What happens if we try taking z to another power, such as z3 + c or z4 + c? Here's what happens when changing those powers from 2 to 5:

Alex Tav's Mandelbrot animation for z to powers from 2 to 5
Once you understand the basics, there's plenty of ways to explore the amazing world of fractals such as these. I've written on fractals several times on Grey Matters, including Iteration, Feedback, and Change: Fractals, R.I.P. Benoît Mandelbrot (November 20, 1924 - October 14, 2010), and A Closer Look, so you can explore further if you wish.


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


Become a Mathematical Ninja!

Published on Sunday, July 20, 2014 in , , , ,

Waifer X's logarithm key photoWith bizarre interests such as memory techniques and mental math feats, it's not often I run across a kindred soul, even on the internet!

That's why I was thrilled to recently discover Colin Beveridge's Flying Colours Maths site! He started it in 2008, and regular Grey Matters readers will find plenty of interesting items in his blog.

Most of the mathematical feats on this site are told via the stories of the Mathematical Ninja. Looking through these stories, I realize that not only does Colin just tell the stories differently, but he also has a different enough take on mental math that there are feats and principles I've never covered on Grey Matters.

One of the simpler examples of this is Converting Awkward Fractions to Decimals. The principle is simple enough, in that you can scale any fractions up to 17ths (and many beyond that) to get denominator within 5% of 100. From here, scaling the numerator up and making a small adjustment can give you a startlingly accurate decimal.

My favorite Flying Colours feat, however, has to be the Nth Root Feat, best described by Colin himself:

“Pick a number* between 1 and 10 – don’t tell me what it is. Pick another number between 1 and 100 – you can tell me that one. Now work out the first number to the power of the second for me on this handy calculator, and I’ll tell you the first number.”
Even if you've practiced the cube, fifth, and square root feats, you'll realize this is on another level. You'll definitely want to be familiar with logarithms and the previously-mentioned fraction feat before trying this.

The detail and varied approaches in his multi-part series on squaring 3-digit numbers (Part I, Part II, Part III) are wonderful examples of his approach to mental math.

Don't pay attention to only the Mathematical Ninja to the exclusion of all else on the site; there's plenty more to discover! If you've ever been astounded by James Martin's amazing appearance on Countdown, you'll appreciate Colin's down-to-earth analysis of how James made those calculations.

The puzzle about the absent-minded professor and his umbrella is one of the best ways to introduce people to Bayes' theorem, as well. It's easily understandable for most people, and even clarifies some of the trickier aspects.

I don't want to ruin too much, however, so I suggest exploring Flying Colours Maths for yourself! If you find something you find especially interesting, let me know about it down in the comments!


Multiplying with a Parabola!

Published on Sunday, July 13, 2014 in , ,

Marcelo Reis' y=x*x parabola imageEven when you think you understand a concept, even one as simple as basic multiplication, you can come across a different perspective that makes you take a closer look.

In this post, we'll look at an almost magical way to multiply in a very visual manner!

Tipping Point Math recently posted this unusual multiplication technique in their Multiplying with a Parabola! video:

I had to try this technique out for myself, so I headed over to Desmos.com and created this interactive version (The image below also links to the interactive version).

The Desmos.com version lets you multiply any 2 whole numbers ranging from -15 to 15, using the sliders in boxes 2 and 3 on the right. Clicking on the dot where the line crosses the vertical (y) axis will display the coordinates, and the y-coordinate will be the answer to the multiplication problem. You can also click the arrows just to the left of boxes 2 and 3 to start and stop animation of the points.

Play around with it for a while, and discover the possibilities. By clicking on the wrench image on the upper right side of the screen, you can adjust the settings, including “Projector Mode”, which can make the graph less cluttered.

Working with this interactive version, you'll quickly find the answer to the challenge of multiplying 7 by -4 given in the video above. You may also find new questions, however!

For example, setting the sliders to multiply 5 by -5 puts the 2 lines in the same place, and gives the same point! With only 1 point, how does the computer know at what slope to draw the line? The short answer is that there's a bit of a cheat here. The computer will always draw a line through the coordinates (a, a2) through (0, ab), so the line is forced to give the right answer. More generally, though, there is a surprising way to mathematically define a line with a single point, as explained in this half-hour video about Galileo's laws of falling bodies.

Surprisingly, this basic idea can be expanded to handle a wide variety of calculations. For example, James Grime uses the graph of y = x3 - 3x to create his cubic curve calculator:

Graphical calculators such as this are known of nomograms, and are often both an art and a science. Ronald Doerfler's My Reckonings blog has some amazing examples of nomograms that are likely to boggle your mind. Even some of the simpler nomograms, such as this Educated Monkey tin toy, or this nomogram from Popular Mechanics for calculating the day of the week for any date, are still astounding to use and explore.

If you've run across any interesting nomograms yourself, feel free to share them in the comments below!


How to Be a Mental Financial Wizard!

Published on Sunday, July 06, 2014 in , , ,

freephotoshop.org's Money stack imageMoney is a tough enough subject on its own. Compound interest seems difficult to wrap your head around, and nearly impossible to calculate without specialized tools.

In this post, however, you'll not only wrap your head around compound interest, but learn some amazing ways to estimate answers quickly in your head!

Compound interest is really all about the time value of money. OK, granted, that sounds like I just switched one buzzword for another. Perhaps having German Nande explain the time value of money in his TED-Ed video will help:

Perhaps figuring out that 10% added to $10,000 is $11,000, but wouldn't it be difficult to work out how long it would take $10,000 to turn into $110,000? Our first tool will begin to make calculations like this easy.

• The Rule of 72: This is one of the most well-known rules in finance. BetterExplained.com has an excellent article on the Rule of 72. In short, if you divide 72 by the interest rate in question, you'll get the number of years it will take your money to double at that interest rate.

For example, for the 10% example in the video, you'd work out 72 ÷ 10 = 7.2, which means it would take about 7.2 years to double your money at 10%. How long would it take at 6%? You work out 72 ÷ 6 = 12, so it would take 12 years to double your money at 6% interest.

To figure out the amount of time it would take to accumulate $110,000 at 10% compound interest, we could think about it in the following manner. In 7.2 years, the $10,000 would double to $20,000. In another 7.2 years (14.4 years total), the $20,000 would become $40,000. Another 7.2 years (21.6 years) would bring $80,000, and a final 7.2 years would take it to $160,000, so we can say that getting to $110,000 would take somewhere between 22 and 29 years.

That's accurate as far as it goes, but can we do better?

• The Rule of 114 and 144: As pointed out over in allfinancialmatters.com, there are similar rules for finding out how long it takes your money to triple and quadruple. For tripling, divide 114 by the interest rate, and for quadrupling, you divide 144 by the interest rate.

Let's see if we can't work out the $110,000 with these new tools. If we could have the original $10,000 triple, then quadruple (or vice-versa) at 10% interest, that would be 12 times our original amount. So, to determine the tripling time, we work out 114 ÷ 10 = 11.4 years. From there, the quadrupling time would be 144 ÷ 10 = 14.4 years. 11.4 + 14.4 = 25.8, or about 26 years. That's the same amount of time in the video!

That's not bad for a mental estimate. There's plenty that can and can't be done with these rules. For example, investopedia points out that using the long term inflation rate of 3%, you can compare prices from years ago to today's prices. At 3%, inflation should double prices every 24 years (72 ÷ 3 = 24), so prices should quadruple every 48 years, and so on.

The caveats explained in MindYourDecisions.com's post on the Rule of 72 should be understood. The rule of 72 doesn't apply when you're getting a variable return (such as stocks and bonds), the interest rate in question is too extreme, or when additional money is regularly added.

That last point is especially interesting. Just how do you calculate interest when regular amounts are included as you go?

• The Rule of 6: Fortunately, MindYourDecisions.com has an answer for that, as well. In that posts example, the author supposed that you add $100/month to an account at 5% interest for 1 year. The calculation shortcut simply involves multiplying the regular deposit amount by the interest rate and the number 6.

The answer given by this estimate is 6 × $100 × 0.05 = 600 × 0.05 = 30. $30 then is the estimate, which is pretty good compared to the actual calculated total of $32.26. If you want to see the accuracy of this formula for yourself, you can play with the numbers involved at this Wolfram|Alpha link. Simply set d to the regular deposit amount (d=100 in this example), and p to the percentage rate (5% is given by p=0.05); Wolfram|Alpha will then return two variables, u, which is the exact amount of dollars in interest you can expect, and v, which is the mental estimate.

Perhaps this rule should be called the rule of half, since you can apply this to any amount of months simply by halving the total number of months involved. How much, for example, could you expect in interest by putting in $150 per month at 4% interest per year, for 5 years (60 months)? We multiply 30 months (half of 60) × $150 per months × 0.04 = $4,500 * 0.04 = $180 in interest. The actual amount, as calculated here, is $181.82, using an additional variable, m, to represent the number of months in question (m=60 for 60 months).

Practice these financial tips, and be ready to astound your friends and family with your financial wizardry!


Pi VERSUS Tau?!?

Published on Saturday, June 28, 2014 in , , ,

Bruce Torrence's Pi vs. Tau photographThis week's post is a day early because today is Tau Day!

Tau, for those not familiar with it, is the mathematical constant equal to 2 × π (Pi), or roughly 6.28, and is represent by the greek letter Tau: τ. Today (6/28), we're going to look at the internet battle that's erupted over π versus τ since 2010.

The opening salvos in this year's battle were already launched back on Pi Day by DNews, with their Is Tau Better Than Pi? video:

3 days ago, Scientific American continued with their post, “Why Tau Trumps Pi”. Just 1 day later, prooffreader.com jumped in with Pi vs. tau: Ultimate Smackdown.

Starting at about 2:40 into the DNews video above, they come very close to a good answer. Yes, geometry and trigonometry rely heavily on 2π, and in those cases τ makes more sense, especially when it comes to concepts like τ radians in a circle. However, π has plenty of uses beyond those subjects on its own.

I'm in favor of adopting τ as a commonly-used constant, but not as a replacement for π. Talking about τ versus π to me is like getting in a heated argument over degrees versus radians. Which one is better? The answer can be degrees OR radians, depending on the context of the problem at hand. Should we use base 10, base 2, or base e in logarithms and exponents? Again, the answer depends on the context.

Kalid Azad of BetterExplained.com has 3 questions that can make even the toughest math concepts understandable: What relationship does this model represent? What real-world items share this relationship? Does that relationship make sense to me? In fact, as James Sedgwick points out in his essay, “The Meaning of Life”, you only have meaning if you have a relationship set in a context.

Yes, the endless internet battles over Pi versus Tau can be fun, but when it comes down to the important aspects, I believe we should focus on solving the problem at hand, and using the most effective tools. Besides, if we only keep one or the other, that's one less geeky holiday to celebrate in the year.

Happy Tau Day!