August 15, 2004
Vedic, schmedic

Gary Farber points to this Wired article about something called "Vedic math" - what that is, they never really tell us - which has some practical application if you're interested in quickly solving some arithmetic problems. Since the example given is presented more or less as magic, and since I believe in de-mystifying math, I feel the need to do a little explaining.

Here's the cited example:

Shetty did not know the original Sanskrit verses, but he did know how to crack the square of 85 in less than a second. "To find the square of any number ending with 5, just put 25 on the right-hand side," he said. "Take the number that precedes five. In this case it is 8. Add 1 to it. So in this case it becomes 9. Multiply 8 and 9. You get 72. 7,225 is the square of 85. It's easy."

Here are two simple reasons why this works. Let x be "the number that precedes five" as stated above. Then the number you want to square can be represented as 10x + 5. Squaring that gives

100x^2 + 100x + 25

which can be rewritten as

100 * x * (x + 1) + 25

which is what happens when you take the number that precedes 5 (that's x), add one to it (x + 1), multiply them together, and put the result to the left of the 25 (which is to say, multiply that result by 100). Note that this will work whatever your choice of x is - the formula holds for squaring 1235 or 6587465125, just as it did for squaring 85.

Method two:

Notice in the example cited that you can express the number "85" as both "80 + 5" and "90 - 5". With that in mind, let x + 5 represent a number that ends in 5 (the number x is therefore a multiple of 10, such as 80). The expression x + 10 - 5 then represents the same number. The square of x + 5 can then be written as

(x + 5) * ((x + 10) - 5)

Multiply it out to get

(x * (x + 10)) + ((x + 10) * 5) - (x * 5) - 25

Rearranging and multiplying out the second term, we get

(x * (x + 10)) + (x * 5) - (x * 5) + 50 - 25

which reduces to

(x * (x + 10)) + 25

Which again is the desired formula. In this case, you're recognizing that "the digit to the left of the five" is in the tens place, so adding one to it is really adding ten to the actual number it represents. Going back to the example, this is just saying that to square 85, you multiply 80 and 90, then add 25. And again, this works for whatever number-ending-in-five you want to square, though of course the bigger that number, the harder it'll be to do in your head.

Now, if you're like me, the next thing to pop into your head after working through this is "I wonder how it works in general". For example, what's the magic formula for squaring two number that end in 6? Using Method One, we square 10x + 6 to get

100x^2 + 120x + 36

which we rewrite as

100x^2 + 100x +20x + 36

and then reduce to

100 * x * (x + 1) + 20x + 36

Expressed in words, this is "Take the digit next to the six, add one to it, and multiply those two numbers, then multiply that by 100. Now multiply that number by 20, add 36 to that, and add the two new numbers you got for the answer." In practical terms, to square the number 86, do the same thing as before to get 7200, then add 160 (for 8 times 20) and 36, to get a final answer of 7396. Piece of cake, right?

A little noodling around will show that for the cases of numbers ending in 6 through 9, the formula will always start with the 100 * x * (x + 1) term and will always end with the square of the last digit (36, 49, 64, and 81). The middle term will be 20 times the difference between that number and 5, multipled by the last digit. That means the middle term for the case where the number ends in 7 will be 40x (20 times the difference between seven and five, which is two, times the original digit which we represent as x in the formula), 60x for 8 and 80x for 9. The formula is the same for the cases of numbers ending in 4, 3, 2, and 1, except you subtract the middle term instead of adding it - e.g., the formula for squaring a number that ends in 4 is

100 * x * (x + 1) - 20x + 16

Maybe I'm the mutant here, but I think working through this easy little bit of algebra to learn what these formulas are (and I hadn't even known they existed before I read that article) is way more fun than learning a bit of rote memorization that's only useful in one specific case. Whoever said that math is hard is really missing out.

Posted by Charles Kuffner on August 15, 2004 to Technology, science, and math | TrackBack

And our newest winner for Geek of the Week...

Chuck Kuffner, in the first ever unanimous vote!

(And may I now sheepishly admit that I found that post cool as hell?)

Posted by: Ron Zucker on August 16, 2004 12:51 PM

Thanks! I'm glad someone liked it. :-)

Posted by: Charles Kuffner on August 16, 2004 1:31 PM

I liked it too. Here's a shorter explanation for the example given:

First, a well-known algebraic identity:


Add y^2 to both sides:


So, if x=85 and y=5, then


Similarly, 35^2=30*40+25=1225. Works for any small number ending in 5.

Although this method doesn't generalize to squaring numbers ending in 6-9 like yours, it can be used to calculate other products quickly. For example,

34*36=35^2-1^2=1225-1=1224, 33*37=1221, etc.

Posted by: Mathwiz on August 16, 2004 4:33 PM

its just mind blowing!!!!!!!!
i am in class xi.
i have,myself, found a formula for calculating squares of nos. ending with 1,2,3&4, between
well yours one is a fantastic one.

Posted by: Saurabh Sethia on July 11, 2006 8:54 AM