14 July, 2015

One more formula for Squares of Integers

Even though I have left formal math behind several years ago (though somewhat later than it had left me behind!), I have always had a fascination for numbers, some of which has been applied in original musical concepts I have popularised over the years including Seamless Korvais.

This topic is completely off the music charts as it attempts to chart a different course in pure math in a fairly populated area - Squaring numbers. Doubtless there are several time-tested and elegant approaches to this including the most well known algebraic formula of (a+b)^2 and others based on pattern recognition.  I found another approach staring me in the face this afternoon, literally in my half-sleep state.

I roused myself to action and tested the concept. It seems to hold good from negative infinity to positive infinity and I decided to not get too greedy and ask for more but share it with heads wiser than mine in the field.  So here goes (in fairly simplistic, rather than formal terms)...


Explanations and examples: (I have uploaded an image file as the Blog formatting didn't seem to have options for exponents):


It can be tried out for any number.

  • Algebraic formula vs RK formula: While the algebraic formula is very elegant, my approach - which could be viewed as its (distant) cousin - may prove easier in the case of certain numbers.  
  • Other short-cuts vs the RK formula: Most of these are based on simple though multi-layered operations on number patterns. But they need different approaches for different numbers which means one needs to remember different short-cuts based on the final digit and/or the number of digits of the original number.  
RK method advantage

  • Uses one consistent approach across the board 
  • Eliminates one whole level of multiplication
  • Introduces the underscore _ symbol which can find use across the math world. 

I look forward to critical feedback from experts and enthusiasts!

4 comments:

Anonymous said...

Isn't this just a re-writing of (10A + B)^2 = 100A^2 + 20AB + B^2. In particular, rewriting the right side in modulo arithmetic (mod 10).

Anonymous said...

It is the same as (10A+B)^2 .. but just for grins.. here's the code to your formula..

#!/usr/bin/env python

def sq(num):
B = num % 10
A = (num-B)/10
p_q = B*B
q = p_q % 10
p = (p_q-q)/10
return int("%d%d" % (((10*A+2*B)*A)+p, q))

if __name__ == "__main__":
import sys
if len(sys.argv) > 1:
for i in sys.argv[1:]:
print i, i*i, sq(int(i))
else:
import random
for i in [random.randint(1,1000) for j in range(10)]:
print i, i*i, sq(int(i))

save it as sq.py and call it .. it will test some number randomly..

$ python sq.py
200 40000 40000
551 303601 303601
213 45369 45369
128 16384 16384
298 88804 88804
136 18496 18496
244 59536 59536
710 504100 504100
98 9604 9604
96 9216 9216

Anonymous said...

of course, the html destroyed the formatting of the python... :(

Anonymous said...

This is the same as this shortcut: https://www.cut-the-knot.org/arithmetic/rapid/Specifics/2DigitSquare.shtml .

Selective Moral Discomforts and Outrages of Convenience against Tyagaraja

As someone who has been passionate from early teens about making Carnatic Music socially broad based and initiated pioneering steps for the ...