## Nifty squaring technique

I just encountered this nifty way to easily square numbers in your head:

To calculate n^{2} for n between 40 and 50, first calculate n-25, then calculate (50-n)^{2}, then concatenate the two numbers.

So, for example, to calculate 46 times 46:

46 - 25 = **21**

50 - 46 = 4

4^{2} = **16**

So 46^{2} = 2116.

If the second number is one digit, then put a zero in front of it:

47 - 25 = **22**

50 - 47 = 3

3^{2} = **9**

So 47^{2} = 2209.

I assumed this was some kind of trick that just happened to work, by coincidence, for squaring one or two specific numbers. But nope, here's what's going on:

“Concatenation” really means you're multiplying the first number by 100 and then adding the second number. So what you're really doing is calculating (n - 25) * 100 + (50 - n)^{2}.

Which is (100n - 2500) + (50^{2} - 100n + n^{2}).

Or 100n - 2500 + 2500 - 100n + n^{2}.

Which is n^{2}.

And it turns out that it isn't only numbers between 40 and 50 that this works for; it's just that concatenation per se only works for numbers in that range. But using the mathematical formula above (rather than thinking of it as concatenation) works for any integer. For example:

26^{2} = (26 - 25) * 100 + (50 - 26)^{2} = 100 + 576 = 676.

Note that we needed to know the square of 24 there. So to be able to do this quickly in your head for numbers between 25 and 50, you have to have memorized the squares of the numbers from 1 through 24.

But if you know those squares and can do a little more mental math, then applying the technique to numbers in the range from 1 to 100 isn't too hard. For example:

1^{2} = (1 - 25) * 100 + (50 - 1)^{2} = -2400 + 2401 = 1.

99^{2} = (99 - 25) * 100 + (50 - 99)^{2} = 7400 + 2401 = 9801.

(And how did I know that 49^{2} is 2401, for use in both of those examples? Well, it's (49 - 25) * 100 + (50 - 49)^{2}.)

For numbers over 100, you have to do more calculations or memorize more squares. But still, the formula applies to all integers.

This technique is described in the book Cheaper by the Dozen, which my father read to us when I was a kid. But somehow I never learned it or never understood it or just forgot it along the way.

(Made some small changes to this entry about twelve hours after posting it, when I realized that concatenation per se doesn't work for numbers in the 25 through 40 range.)