Square Roots

Don’t ask—these posts don’t (yet) have any thread connecting them. Maybe one day I’ll get there.

So I was trying to figure out the square root of 10005, and trying to be a bit more accurate than “slightly over 100”. Problem is, the algorithm I learned seems to be, let’s say, unwieldy, or not quite how I remembered it, when the initial number has lots of zeroes in it. Turns out there’s a slightly easier solution, at least in terms of how many steps you have to remember, and how complicated the math can begin.

Step 1, guess. Your guess doesn’t matter a whole lot, but your guess can’t be zero. 100 is a great guess for 10005.

Step 2, divide the initial number by your guess. 100.05 in this case

Step 3, take the average of your guess and the result of step 2. This is your new guess. 100.025 in this case. Repeat steps 2 and 3 until you’re satisfied with the accuracy of your result.

How accurate does the next iteration get in this particular case, though?

10005/100.025=400200/4001=100+100/4001=100.02499375156210947263184203949… (the first 500 decimal places repeat themselves). Then, average this number with 100.025 for our next approximation: 32016001/320080=100.02499687578105473631592101974…

Considering our initial guess of 100 is 0.02% off of reality, differing by less than 0.025, it doesn’t take much to get even more accurate.

Here’s a table, adding a different guess of 1, rather than 100, to show how this method converges:

01003-nines1not good
1100.0257-nines5003actually worse
2100.02499…15-nines2502.49990…slightly better, but still very bad
3100.02499…30-nines1253.24895…moving in the right direction
5100.02499…124-nines323.24077…and closer
6177.09646…almost there…
7116.79555…almost there…
8101.22903…huzzah! 98% accurate!

You roughly double the accuracy, percentage-wise, for each iteration, so the better the initial guess, the more quickly you get to a reasonable answer. Though no matter where you start, you’ll eventually get there.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.