Saturday, November 5, 2011

Square Root Extraction the Japanese Way

A comment came today from Murai Takayuki (村井 剛志) in comment on my piece on calculating logarithms by hand. In that post I suggested that a certain weariness also accompanies pulling square roots by hand. Murai wrote: “In Japanese schools we learn a method resembling long division for finding square roots by hand. If you haven't ever heard about this method I would love to tell you about it!!” Now it turns out that I’ve also published here a relatively easy method (link), but I’m always game for new ways—hence I asked for enlightenment and immediately got it by a returning e-mail. The missive took the form of two images. You can see one of them here on the left. Clicking through it will make it big; Esc will bring you back. Murai’s accompanying instructions, alas, were pretty brief: “I think you can figure out how it works with these two images.” I was flattered but baffled. Now it so happens that at least 65 years have passed since I was in school and learning such things; therefore I utterly failed to grasp the progression of numbers. English language web sites all flunked too—as indeed I had expected them to do. Then a brilliant notion came. I tried a web search in German and rapidly found multiple sites able to give me what I needed. As in Japan, so in Germany. Herewith, therefore, the results. (Mind, I could have asked Murai to help as well, but I thought he’d already done enough.) So let us take the problem presented in that image. The other JPEG Murai sent is much the same. In that one the square root of 5 is pulled using the method I describe below.

We want the square root of 628.5049. The first step is to divide the number into pairs from the back as follows:

06 28 | 50 49

The first step is by eyeballing, the other steps are by using two formulae.

Step 1: Determine the closest square to the first group. In our case that is 4, 2*2. The root we used is also the first digit of our answer.

Step 2: Deduct the actual number from the first pair, thus 06 - 4. Next pull down the next pair of numbers awaiting action and place them alongside. Here is how it looks:

Note that the root of that 4 is now the first digit of our answer, already in place. The \/ symbolism ahead of the first digit is meant to represent the square root symbol (√).

Step 3: This step and all successive iterations have the same requirement. We want to do two things in this and every succeeding step, if necessary. First, we want to calculate the next digit of our answer. That is done by Formula 1:

[1] Next digit = Int(R / (20*A))

R here is our Remainder (2 28 above) and A is our current Answer, thus the 2 following the equals sign above. The Int means that whatever answer we get will be only the integer part. In this particular instance the formula fleshes out as 228 / (20*2) or 228/40 = 5.7. The Int prefix renders the answer as 5. That is the next digit of our answer.

Next we want to calculate the number to deduct from our Remainder. The formula for that is the following:

[2] New Deducter = ((20*A)+L)* L

Here L is the Last digit to be added to Answer, 5 in this case. The formula fills in as follows: ((20*2)+5)*5 = 45*5 = 225. This is our New Deducter. We put it in place and add the Last digit to the answer. Here is what it looks like now:

Step 4: Notice that after deducting the New Deducter from the last Remainder, we also crossed the decimal point. For this reason we now also add a decimal point to our Answer.

The two formulae we used in the last step are employed again. Formula 1 produces zero. Here the actual numbers: 350 / (20*25) = 350 / 500 = 0.7 = 0 when chopped to an integer. That 0 is our new digit, the Last digit to be added. Formula 2 also produces a 0 as our New Deducter: ((20*25)+0)*0 = 500 * 0 = 0. Our calculation now looks as follows:

Step 5: In this case Step 5 happens to be the last. Note, again, that we have deducted the 0 and were left with the same number. But we’ve also pulled down the last pair to be considered in our calculation. And we’ve added the 0 to our Answer. Here the two formulae used for the last time:

Formula 1: 35049 / (20*250) = 35049 / 5000 = 7.0098 = 7.
Formula 2: ((20*250)+7)*7) = 5007* 7 = 35049.

Notice that in using these formulae, we ignored the decimal point in the Answer. Our New Deducter now has the same value as our last Remainder, hence we are done. In other cases we can stop as soon as we are happy with the number of digits we have produced. The final picture:


With this explanation, Murai’s presentation will become quite clear—and the derivation of those initially mysterious numbers like the 45, 500, and the 5007 will be evident. Come to think of it, the real virtue of this method is that it is very easily rendered into a quite brief algorithm in Visual Basic. Those who know that language will need no help from me in writing the subroutine.

Added later: In playing with these algorithms, I discovered an interesting problem when applying it to the square root of 99. The layout then is the following:

\/99 | 00 00 00 00 00 = 9
     81
  18   00


The nearest square to 99 is 81. That leaves 18, and the first digit of our answer is 9. Adding two zeroes to the Remainder, we get 1800. Then, applying Formula 1, we get 1800 / (20 * 9) = 1800 / 180 = 10. But the square root of 99 is actually 9.94987… per Texas Instruments calculator. Therefore Formula 1 seems to misfire. The rule here appears to be that if the answer to Formula 1 is 10, it must be reduced by one. If we make that adjustment and proceed to the next step using 9 instead of 10, the answer comes out correctly. But my sources do not mention this rule. Perhaps Murai can come to our rescue…

Added Even Later: I received appropriate instructions from Murai Takayuki. The method finally makes sense. To make it plain I provide a new post (link) titled “Japanese Method for Pulling Square Roots by Hand.”

2 comments:

  1. If you want to know why this algorithm actually works, find a book called "First Lessons in Algebra" by Ebenezer Bailey. It's from 1834, but this is the best book on Algebra I know. Somewhere around pages 200..215 a general method is described for taking square roots of any polynomial, which works also with numbers in place-value system (eg. decimal system). That's because place-value numbers are actually polynomials, where x=10 and digits are cofactors of the subsequent powers of x=10 (or other base).

    This method makes use of the known binomial formula, `(a+b)^2 = a^2 + 2ab + b^2`, but backwards: knowing the power (that is, the whole right side) it tries to deduce the square root (left side inside the parentheses, that is, `a+b`). To do that, first it takes the suqare root of the first term of the power, `a^2`, to get `a` (the first part of the root). Next, it needs to find `b`. To do that, we need to divide `2ab` from the power by `2a`, that is the double of `a` we've already found. This gives us `b`. But now we need to make sure that `b` is really a part of the root, or we need to calculate further. So we have to bring down all the remaining part `2ab + b^2` from above (that's why this algorithm works two digits at a time) and subtract from it the `2a + b^2` using the values we've found. To avoid multiple multiplications (;P), we factor it like this: `(2a+b)*b`. This explains why we multiply our whole root found so far (`a`) by 2 (for the decimal algorithm, we also need to multiply by `10` to get another place value, and that's why we multiply by `20` ultimately), and add the lastly found digit (this is our `b`). When we multiply it all by `b` again, we get `2ab + b^2` and subtract it. If there's any remainder, we need to continue (nested binomial formula). But when nothing is left, we're done.
    -- SasQ

    P.S.: Your OpenID login mechanism doesn't seem to show correct usernames. I'm not "pl" but "SasQ".

    ReplyDelete
  2. Thank you for that, SasQ. Interesting explanation. For some of the best of these one has to go back in time...

    ReplyDelete