Calculating A Square Root Without A Calculator

  • Thread starter Thread starter Shannon
  • 5 comments
  • 3,445 views
Messages
15,799
I've always wondered, how does one calculate the square root of a number without a calculator. I mean, finding the square is easy.

ie: 3^2 = 9, or 3+3+3 = 9

But unless you know that 3 is the square root of 9, or you use a calculator, how would you work out the square root of a number?
 
With an abacus? :D
 
This is how a computer finds square roots. Using only multiplication, division, and subtraction.

I'll use an example: sqrt(12345).

First you make a guess that undershoots. Here 100^2 = 10000 so our guess is 100 (but there are other values that would work). Now we know the real answer is going to be a little more than 100 a so lets call the error a variable e.

So we know that (100+e)^2 = 12345 exactly. Expanding, we get

(100+e)^2 = 100^2 + e^2 +2*100*e = 12345

Now here is the tricky part. Since e is the error, we know it is going to be a small number. When you square a small number it gets smaller, so we can ignore e^2 giving us

100^2 + 200e = 12345 or e = 11.725

So now we have a new guess for the answer, 100 + 11.725 = 111.725. Now we repeat.

(111.725 + e)^2 = 12482.5 + e^2 + 223.45e = 12345
or 12382.5 + 223.45e = 12345 or e = -0.615241.

Our next guess is 111.725 - 0.615241 = 111.11. You can see we've gotten a lot closer because 111.11^2 = 12345.4. You can keep going.
 
I do the Newtonian approach. It's an iterative procedure.

E1=E+(N-E*E)/(2E)

Say you want to find the square root of 210. You know it has to be between 14 and 15. (14^2 = 196, 15^2 = 225). ...or if you don't know that, just make a guess - it'll take a little longer to get a converged result but it will work.

Let's make an initial guess of E=14.

E1=14+(210-14*14)/(2*14)
E1=14.5

Then, calculate 14.5*14.5 = 210.25
210.25 > 210
...close, but not quite...

Next we just work on that 0.25...
E2=E1+(N-E1*E1)/(2*E1)

E2=14.5-0.25/29
E2=14.49137931

actual answer: 210^(1/2) = 14.49137675

So, after just two iterations, it's accurate to 5 decimal points. You could do more iterations, but by hand the longdivision and multiplication gets a bit tedious.


There's another method that takes a little longer to get accurate results, but some people prefer it.
E1=((N/E)+E)/2
 
Yes, what I describes is effectively a modified version of Newton's method for solving x^2 - a = 0 (to find Sqrt(a)) but I put it that way so as not to involve differentiation. :sly:

My initial estimate was quite a bit worse than the one you used, but it's interesting to note both ways will converge exactly the same with equally good initial estimates. :)

Your explanation is very good too 👍
 
Right, your's comes from Newton-Raphson, or something like that, doesn't it?
x2 = x1 - f(x)/f'(x)

I'm pretty sure my method comes from that too given that it does have Newton's name on it, but I don't actually know the history behind it and I'm much too lazy to work backwards an try to get the Newton-Raphson equation.

edit: nevermind, it's blatantly obvious that mines comes from it, just by looking at it.
From the same equation you mentioned, 0=x^2-a
then f'(x) = 2x, so there's my equation

x1 = x - (x^2-a)/2x
E1 = E + (N-E*E)/2E
 
Back