Shortcut for squaring numbers

Taq Karim
Math Musings
Published in
5 min readOct 15, 2017

--

In a previous article, we explored a trick for squaring numbers that end in — 5 really quickly.

Here, we will attempt to extrapolate our findings to the general case, ie: squaring all numbers.

Let’s begin by considering 26 * 26.

26 * 26 = 
(20 + 6)(20 + 6) =
20*20 + 20*6 + 6*20 + 6*6 =
20(20 + 6 + 6) + 6*6 =
20(20 + 12) + 6*6 =

We started by attempting the approach that worked for us in our approach for squaring numbers ending in — 5 quickly. However, it’s clear this rapidly breaks down since the sum of 6+6 is 12, which is not a multiple of 10…

However! We can do this:

26 * 26 = 
(20 + 6)(20 + 6) =
20*20 + 20*6 + 6*20 + 6*6 =
20(20 + 6 + 6) + 6*6 =
--------- ^ FROM PREVIOUS BLOCK20(20 + (5+1) + (5+1)) + 6*6 =

Our “trick” here is to define 6 in terms of 5. This is useful because now we can still determine at least some parts of our product with a technique that we know works:

26 * 26 = 
(20 + 6)(20 + 6) =
20*20 + 20*6 + 6*20 + 6*6 =
20(20 + 6 + 6) + 6*6 =
20(20 + (5+1) + (5+1)) + 6*6 =
--------- ^ FROM PREVIOUS BLOCK20(20 + 5 + 5 + 2) + 6*6 = // commutative property of addition
20(20 + 10) + 20(2) + 6*6 =
2*10(10(2+1)) + 20(2) + 6*6 =
2(2+1)*10*10 + 6*6 + 20(2) =

Aha! This is cool — since we now see that the same trick for squaring numbers that end in — 5 can actually be replicated for at least one number that ends in — 6, with a few caveats:

  1. Instead of concatenating 25 — or 5 x 5, we concatenate 36 — or 6 x 6. This is actually fairly reasonable.
  2. It appears that we need to add 40 to this new number we get (636). I’ll call this number the adjustment factor. However, adding the adjustment factor to our concatenated result (636) does seem to give us the correct answer — 676. Intriguing!

Before getting too ahead of ourselves, let’s attempt this technique once again with 27 * 27:

27 * 27 = 
(20 + 7)(20 + 7) =
20*20 + 20*7 + 7*20 + 7*7 =
20(20 + 7 + 7) + 49 =
20(20 + (5+2) + (5+2)) + 49 =
20(20 + 5 + 5 + 4) + 49 =
20(20 + 10) + 20(4) + 49 =
2*10(10(2+1)) + 20(4) + 49 =
2(2+1)*10*10 + 49 + 20(4) =

Let’s compare the results for 26 * 26 and 27 * 27 in one block for convenience:

26 * 26 = 2(2+1)*10*10 + 6*6 + 20(2) =
27 * 27 = 2(2+1)*10*10 + 7*7 + 20(4) =

Based on our results, it appears that the pattern here is:

Given: 10p + q,
(10p + q)(10p + q) = p(p+1)*100 + q*q + 20(???)

Ok! This is useful since it appears that we can take an approach to squaring numbers that end in — 6 or — 7 that is very similar to our approach with squaring numbers that end in — 5. 👍

But what to do with our adjustment factor? If we can come up with a way to describe that adjustment factor, we are more or less done. Let’s explore the solution to 36*36 to get better insight:

36 * 36 = 
(30 + 6)(30 + 6) =
30*30 + 30*6 + 6*30 + 6*6 =
30(30 + 6 + 6) + 6*6 =
30(30 + (5+1) + (5+1)) + 6*6 =
30(30 + 5 + 5 + 2) + 6*6 =
30(30+10) + 30(2) + 6*6 =
3*10(10(3+1)) + 30(2) + 6*6 =
3(3+1)*10*10 + 6*6 + 30(2) =

From our observations above, we can start to formulate a pattern:

26 * 26 = 2(2+1)*10*10 + 6*6 + 20(2) =
27 * 27 = 2(2+1)*10*10 + 7*7 + 20(4) =
36 * 36 = 3(3+1)*10*10 + 6*6 + 30(2) =
Given: 10p + q,
(10p + q)(10p + q) = p(p+1)*100 + q*q + p*(???)*10

Essentially, the 20 or the 30 from the adjustment factor is simply the digit in the tens place. Sweet 👍

The 2, 4, etc can actually be represented in terms of q. Check it:

26 * 26 = 2(2+1)*10*10 + 6*6 + 20(2) =
27 * 27 = 2(2+1)*10*10 + 7*7 + 20(4) =
28 * 28 = 2(2+1)*10*10 + 8*8 + 20(6) =
29 * 29 = 2(2+1)*10*10 + 9*9 + 20(8) =

The pattern above shows us that we can arrive at the 2, 4, 6, 8 number by:

Given: 10p + q,
(10p + q)(10p + q) = p(p+1)*100 + q*q + p*(2*(q - 5))*10
or,
(10p + q)(10p + q) = p(p+1)*100 + q*q + 2*p*(q - 5)*10

Put another way, the adjustment factor is simply the difference between number and 25 (or 35 if it’s in the 30s, 45 if in 40s, etc) times 2 times the digit in the tens place (2 if 20s, 3 if 30s, 4 if 40s, etc).

Now, with this approach we can compute say 59 * 59 as follows:

First, we take the number in the tens place.

In this case — 5.

Add 1 to the number in the tens place.

So 5+1, which is 6.

Multiply our first number (5) by the second number (6).

Ok, so 5 * 6 = 30.

Great! Almost there, hold 30 in the back of your head for a bit.

Take the number in the ones place (9) and square it.

9^2 = 9 * 9 = 81

Subtract 59 from 55 (4) and multiply that by 2 (8) and multiple that by 50 (400).

59 - 55 = 4
4 * 2 = 8
8 * 50 = 400

Concatenate our previous product (30) with our square (81) and add 400

3081 + 400 = 3481

If we plug in 59 * 59 into a calculator, it can be easily verified that this result above does work 👍

In fact, it should also work for numbers < 25, 35, etc. Let’s example 94 * 94:

  • First, we take the number in the tens place: 9
  • Add 1 to the number in the tens place: 10
  • Multiply our first number (9) by the second number (10): 90
9*10 = 90
  • Take the number in the ones place (4) and square it: 16
4*4 = 16
  • Subtract 94 from 95 (-1) and multiply that by 2 (-2) and multiply that by 90 (-180).
94 - 95 = -1
-1 * 2 = -2
-2 * 90 = -180
  • Concatenate our previous product (90) with our square (16) and add -180.
9016 - 180 = 8836PS: a quick shortcut for subtracting those two numbers mentally would be this --9016 - 200 = 8816 + 20 = 8836

If we plug in 94 * 94 into a calculator, it can be easily verified that this result above does work 👍

--

--

Taq Karim
Math Musings

Engineering @Oracle , Faculty @GA + @BaruchCollege . Prior: @PlaceExchange , @sharehoney , @RubensteinTech , @joinpursuit , @TheKingsCollege