Monday, August 30, 2010

A little math puzzle

A week or two ago an eighth grade girl who lived down the street from one of my good friends told me how much she liked math; I told her that I would send her a math puzzle and leave a little prize with my friend that she could claim if she solved it.

Actually, the first thing I told her was that she could have the prize if she figured out what perfect numbers were and described them to me. I figured she would consult an encyclopedia or her math teacher, but she proceeded to text "what is a perfect number" to ChaCha and read me the answer verbatim. So I called her a cheater and then resolved to come up with a puzzle she couldn't just look up the answer to.

Anyway, while I was walking to the grocery store the other day, the following little puzzle occurred to me. Unfortunately, I'm worried its a little too easy, since you can get the answer without really knowing what's going on, so it's not going to work as a puzzle form the little mathematician. But I liked it enough I wanted to put it someplace. Don't worry, its pretty easy, but it's based on something kind of neat that I didn't personally realize until the other day. Here goes:

The king's royal mathematician is about to retire, and he has to name a successor. He has two students, both with excellent marks on their exams and both of whom have shown real promise as mathematicians and as mental calculators. Thus, the old man announces a test: In the presence of the king and his court, he will write a 5-digit number on a piece of parchment and place the parchment on the table before the two students. Whichever one of them can be the first to correctly tell the king what the first (one's place) digit in the square of the number on the parchment is will be the new royal mathematician. However, to prevent them both from simply blurting out a guess (with a one-in-ten shot at winning), anyone who answers wrongly will be executed.

When the day of the test arrives the old man takes his quill pen, dips it in the bottle of ink, and carefully writes down his number of choice. Then, to ensure everything is fair, he squares the number himself, whispers the answer in the king's ear and turns around to place the parchment on the table and begin the test. However, just then the mathematician clutches at his chest, and falls over on the table, dead of a heart attack. As he falls, he knocks over the ink bottle, spilling it across the parchment and obscuring everything except the one's-place digit of the number he had written, which is a 7.

"Sire," says the first student, "I know the answer." He announces it to the court and the king nods in amazement.

The question is, what did he say, and, given that his life was on the line, how could he be so sure?

Answer and explanation is below the fold



As I said, it's quite simple, and you might even arrive at the answer through simple pattern recognition. For example, with a pencil and paper (or maybe in you're head, if you're really good enough to be a 16th century royal mathematician!) then you might notice that

72 = 49
172 = 289
272 = 729
1072 = 11449

And all the one's places are coming out to be 9's. You might quickly imagine that this is no coincidence, and that the square of any number that ends in a seven will end in a nine. You'd be right. But if that was your strategy, I claim that the student in the puzzle would still be faster than you, because, in fact, he knew what shortcut he was going to take coming in and was prepared to do it no matter what number was written down, and without having to check to see if there was a pattern.

In other words, we've just seen (but not proven) that the square of any number that ends in a seven will end in a nine, but now we're actually going to prove a "stronger result." Well, we're going to "almost" prove it. First, consider any two-digit number. If you think about it, you can see that any two digit number whose digits are "A" in the ten's place and "B" in the one's place can be written as :

10A + B

This is just the definition of how our decimal system works. If you don't see why, plug in some real number's and you'll get it. For example, 27 = (10*2) + 7.

Okay, so we have an expression for any two digit number you want. Then the square of that number is

(10A + B)2 = (10A + B)(10A + B) = (100A2 + 20AB+ B2)

But look at that expression on the right. Since the first two terms are divisible by 10, they have to end in a zero. Don't believe me? Pick any number you like and multiply it by ten. Look, now it ends in zero!

So I add two numbers that end in zero to the number B2. The result will be some multi-digit number, but the one thing we know for sure is that the number in the one's place will be the same as the number in the one's place of B2, because nothing else will contribute. Thus, if you give me any two digit number, all I have to do is square the digit in its one's place, and look at the one's place digit of the result. Whatever that is is the one's place number of the total number square. Yikes, that's not very clear in words. So here are a few examples:


882 = 7744, which has the same one's place digit as 82 = 64
392 = 1521, which has the same one's place digit as 92 = 81
622 = 3844, which has the same one's place digit as 22 = 4

And so on. But wait, I can prove an even stronger result: There was nothing fancy about the fact that I used a two digit number. I could have written some three digit number "ABC" as 

100A+10B+C

And then its square would have been 

(100A + 10B +C)2 = (100A + 10B+ C)(100A + 10B + C) = (100A2 + 20AB+ B2)

                               = (10000A2 + 2000AB + 100B2+ 200AC + 20BC + C2)


Once again, the only number without a zero in the one's place comes from squaring the one's place of the original number. 


You can actually prove that this works for a number with any number of digits, but it's a bit too complicated to write out here. However, I think at this point you can totally see why it should be true. So this is what the mathematician's student knew: You can find the one's place digit of any square just by looking at the one's place digit of the original number.


BUT WAIT! ORDER NOW AND I'LL PROVE AN EVEN STRONGER RESULT


Okay, like any good infomercialist, I'm lying a little bit. I'm not going to prove the stronger result, but I am going to tell it to you and again I'll think you'll agree it seems pretty likely that it's true (It is true). It also doesn't matter whether I square the number, cube it, or take it to the 96th power. The one's place digit will always come directly from the square, or cube, or 96th power, of the original one's place digit. 


Isn't that cool? It's not so surprising when you see how it works, but somehow, I didn't expect it. When you give me an expression like 41521, my first reaction is that there's no way I could know anything about the resulting number without access to a calculator. Not even a calculator, maybe, but a good mathematical computer program.

And it's true, I can't tell you much. But I can tell you that the digit in the one's place is a 5, because I know* that any power of 5 ends in a 5, so 521 ends in a 5, and so 41521 does too.

And so it does. My trusty computer program Mathematica tells me that
561 = 9528181711266673515671651927285783235073089599609375

Just as we suspected. Look at us, we could be royal mathematicians!

*Yes, I cheated a bit here and used an additional piece of knowledge. How Do I know that any power of five ends in a five, and not, perhaps, a zero? See if you can work that out for yourself.





No comments:

Post a Comment