Site icon R-bloggers

How to square numbers in your head

[This article was first published on Decision Science News » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

MENTALLY MULTIPLY NUMBERS BY THEMSELVES

Babbage’s Difference Engine is fueled by squares

Even in the age of ubiquitous computing, its usually faster to do a simple operation like squaring a number in your head as opposed to doing it on paper or firing up R. Everyday decision making in science needs to happen in a fast and frugal manner. Assuming you know your multiplication tables up to 10×10, here’s how to compute the squares of numbers up to 100 in your noggin (and beyond if you are willing to bootstrap).

A. If the number ends in 0, chop off the 0s, square what is left, and put back two 0s for each one you knocked off. Examples:

B. If the number ends in 5, chop of the five, take what is left and multiply it by the next highest number, stick 25 on the end Examples:

C. If the number is 1 greater than a number that ends in 5 or 0, first square the number ending in 5 or 0, as above, then add to this the number ending in 5 or 0 and the number. Examples:

If the number is 1 less than a number that ends in 5 or 0, first square the number ending in 5 or 0, as above, then subtract from this the number ending in 5 or 0 and the number. Examples:

D. If the number is 2 greater than a number that ends in 5 or 0, first square the number ending in 5 or 0, as above, then add to this four times the number that is 1 greater than the number ending in 5 or 0. Examples:

If the number is 2 less than a number that ends in 5 or 0, first square the number ending in 5 or 0, as above, then subtract from this four times the number that is 1 less than the number ending in 5 or 0. Examples:

Since every number is either 1 or 2 greater or less than a number ending in 0 or 5, we are done.

Happy squaring!

Proof of C: First part: (N+1)^2=N^2+N+(N+1), Second part (N-1)^2=N^2-N-N+1=N^2-N-(N-1)
Proof of D: First part: (N+2)^2=N^2+4N+4=N^2+4(N+1), Second part (N-2)^2=N^2-4N+4=N^2-4(N-1)

Photo credit: http://www.flickr.com/photos/mrgiles/325903759/

To leave a comment for the author, please follow the link and comment on their blog: Decision Science News » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.