Everyone knows how to add, subtract, multiply and divide with pencil and paper; but do you know how to find square roots without a calculator? (Incidentally, I highly recommend reading The Feeling of Power by Isaac Asimov, a short story about a future in which humans are so reliant on computers that they have forgotten how to do arithmetic.)
An obvious method is to guess and check while keeping track of lower and upper bounds. For example, if we wanted to find the square root if 7, we might start by guessing that the square root is 2. Computing , we see that 2 is too small. So we try 3: , so 3 is too big! So we know the square root of 7 must be somewhere in between 2 and 3. Let’s try 2.5: . So 2.5 is too small, and the square root of 7 is somewhere between 2.5 and 3. We might try 2.7 next (too big), and so on.
This works, but it is extremely tedious and inefficient! We can cut the search range in half at each step, but this means that on average we only add a single new decimal place every 3.3 steps or so (). Not to mention that at each step we have to compute the square of increasingly long numbers. There are at least two better methods; I’ll share one of them today and one in a future post.
The first method is often called the “Babylonian method” since it was known to the ancient Babylonians. Here’s how it works. Say we are trying to find the square root of N. Just like with the guess and check method, we start out with some guess R. Then we compute a new value for R as follows:
Repeating this process will result in closer and closer approximations to .
Let’s try an example, again using and as our initial guess. We can compute a few iterations of the process according to the above formula:
How close did we get? The true value of , to 15 decimal places, is
(Incidentally, I computed this using Wolfram|Alpha by typing “sqrt 7 to 15 digits”.) Here are our approximations, with the correct decimal places in bold:
Wow! That converges pretty fast. In fact, this method converges quadratically—the number of correct decimal places approximately doubles with every step!
So, why does this work? Well, first of all, note that if (that is, if R is a fixed point of this operation), then
Also, it is not too hard to see that must lie in between and , since ; so taking their average (which is essentially what the Babylonian method does) will necessarily give us a better approximation to at each step.
The Babylonian method is one of the fastest-converging methods for computing square roots, but it can be somewhat inconvenient. You have to choose whether to do all the calculations with fractions and then convert to a decimal representation at the end (as I did above), which means you have to deal with multiplying rather large numbers; or use a decimal representation throughout, which means you have to do some annoying long division. There’s another method which doesn’t converge as quickly but can be much more convenient, since it explicitly uses decimal notation and involves somewhat more manageable operations; I’ll describe this other method in an upcoming post.
For more reading on the Babylonian method and a number of related generalizations, check out this MathPages article.
Nice post. Just wanted to add that this method could also be considered a special case of Newton’s Method applied to the equatiion .
Hi meichenl, excellent point!
Pingback: A semana nos arXivs… « Ars Physica
Pingback: Math Teachers at Play #8 « Let’s Play Math!
Pingback: Square roots with pencil and paper: method 2 « The Math Less Traveled
Pingback: Math Teachers at Play #8 |
If something doubles after each iteration, it is exponential, not quadratic (compute 2^n for a few n if you don’t believe me). If the number of digits doubles after each iteration, it is actually double exponential in the number itself, because each digit is already exponentially valued (i.e., a0/10^0 + a1/10^1 + a2/10^2 + …).
Remember, we are talking about the number of digits after the decimal point, not the number of digits of an integer. You are right that if we had a sequence of integers where the number of digits doubled at each step, the sequence would be growing doubly exponentially. However, for the Babylonian method we are not talking about a rate of growth, but a rate of convergence. The sort of convergence exhibited by the Babylonian method is indeed called quadratic convergence, as you can read about here: http://en.wikipedia.org/wiki/Quadratic_convergence.
Pingback: Square roots with pencil and paper: method 2 | The Math Less Traveled
Pingback: Math Teachers at Play #8 « Let's Play Math!