This post gives three methods for calculating square roots.

You may have heard that, back in the stone age, we were taught how to calculate square roots by hand, by a method that looks something like long division. It’s true, and I was taught that method as part of Algebra class. So if you’ve wondered how it was done, or if you want to be ready for the Zombie Apocalypse which for some reason might also include the failure of all the calculators, then this section is for you.

But even in those days, probably nobody professional would ever have used that method. Once you got to be an adult engineer or scientist, you no doubt had a slide rule. I had a cheap plastic student slide rule, but never got to the stage of investing in a real one like my Dad’s, because before I graduated college the electronic calculator had been invented. Anyway, this section is for you slide-rule enthusiasts. I know you’re out there.

But what do computers and calculators do? It turns out they use a different method entirely, one that is very fast and very easy to implement. That’s described here.

#### Square roots by hand

We’ll illustrate the method with the number . The first few digits of according to the wonderful online symbolic calculator Wolfram Alpha are . It’s an irrational number, so you could in principle carry on those digits infinitely far without repeating.

But don’t worry, we’re not going to calculate by hand that far. As you’ll see, the hand method gets more and more tedious the more digits you have. I’ll carry the method as many digits as I can stand, till I get tired of formatting the pictures.

The first thing we do is group the digits in pairs starting at the decimal point, going to the left and to the right. Each pair is going to get one digit of the answer written over it. We add some ‘s on the right because we’re going to calculate at least a few digits in that direction. So on the left of the decimal point the is paired and the is alone.

Our first group is the single number . Above that we write the largest integer whose square is less than or equal to that, which is 2. Square that, subtract from and bring down the remainder and the next pair of digits.

What we do on the next step is what we will do on all of the subsequent steps, as many steps as we want to calculate digits. First, we double all the digits of the square root we have so far (which is just so doubling it makes ). We write that followed by a blank.

The next digit of the square root, which we’ll put over the pair , is also going to be put in that blank. Then we’ll multiply that two-digit number by the digit. So if we put a , we’d calculate and if we put a , we’d calculate . It turns out that is the largest digit we can choose without exceeding , so that is the digit we use.

The product we write under the and subtract. Then we bring down the next pair of digits.

And now we repeat the process.

- Double the existing digits () and write the result () next to the bottom line followed by a blank.
- Find the largest digit which, when inserted in the blank and multiplied by the resulting -digit number, does not exceed the value currently on the bottom line.
- Write that product under the bottom line number and subtract
- Bring down the next two digits

That digit turns out to be 8 as , but , too large.

I think you can start to see how this got tedious back in the day, as we were doing all this trial and error multiplication by hand to find the next digit.

Repeating the process, we double our existing digits to get , and find the largest digit such that . As and , too large, our next digit is 3.

And that’s the method! Now you can impress all your friends at parties with your ability to extract square roots by hand, if you don’t mind missing the whole party doing something they can do on their phone with a couple of key clicks.

#### Square roots with slide rule

This is about the simplest thing you can do on a slide rule. There is a row of numbers with an A next to it, the A-scale, and another with a D next to it called the D-scale. Just line them up. The D-scale is the square root of the numbers on the A-scale, so you put the cursor on the desired number on the A-scale and read its square root on the D-scale.

See an illustration like this one to see what I’m talking about.

Slide rules are not meant for high-accuracy calculations. You can really only estimate 2-3 significant digits. Another part about using a slide rule is that you have to work out the powers of on your own.

For our sample problem, you would approximate on the A scale between and , and look down and see the square root on the D scale between and , closer to . That tells you that from which you would know .

#### The Newton-Raphson method

The algorithm used by computers was one originally developed by Isaac Newton, and it is known as Newton’s Method or the Newton-Raphson Method.

It’s an iterative method, meaning you start with one guess, . The algorithm then generates the next, presumably better, guess. You repeat this process until you decide to stop the algorithm, either because the guesses aren’t changing any more, or because you set an upper limit on the number of iterations.

Newton’s Method is not just for square roots. It’s a general method for finding where a function crosses the x-axis, that is, the solution to . You can think of finding a square root of a number as finding the such that . So .

The figure above illustrates the method. We have a guess which is not a zero. We evaluate the slope at , and draw the tangent line there. The place where the tangent line intersects the x-axis is the next guess, which as you can see in the figure is closer to the actual x-intercept.

When the method converges, it converges very quickly, in fact it is one of the fastest-converging iterative algorithms of any kind. It converges quadratically, meaning that if the error (distance between guess and actual zero) is for instance 0.1 on one step, it will be about 0.01 on the next. The number of digits of accuracy roughly doubles at each iteration.

We know from algebra that a line with slope which goes through point has the equation in point-slope form, So if our current guess at step is , the equation of the line with slope going through point is . Thus, , the point where on this line, is given by

This is the general Newton-Raphson update formula. Now let’s see how it applies to square roots. We have , therefore and the update rule is

The new guess for is the average of the old guess and . The only remaining question is what to use for an initial guess . Because the method converges so quickly, does not need to be very close to the actual square root. Using will do for instance.

Let’s see how the method works with the sample problem used in other sections, .

After iterations, the value stops changing, indicating that the value is correct to the limit of accuracy of the computer.

If this iterative method works so well, why didn’t we use it for manual calculations instead of that long grueling “long-division” method? The answer is that this method requires a division at every step. For a CPU, a 16-digit division is not much more difficult than a 16-digit multiplication. But for a human, just one such division would be almost as hard as doing 16 digits of the entire square root algorithm.

If you were aware of the manual method, did you ever wonder why it works? I know I did. But that’s a topic for a future post.

So now you know three methods of finding square roots if you ever find yourself without a square root button on your calculator. Enjoy!

## Leave a Reply