# Square Roots... Perfect, Irrational, Estimating

#1
14 March, 2016 - 04:08

#### Square Roots... Perfect, Irrational, Estimating

Having been spending an unreasonable amount of time squaring 2 and 3 digit numbers I thought I might be overdue to play with square roots.

https://en.wikipedia.org/wiki/Methods_of_computing_square_roots

https://en.wikipedia.org/wiki/Mental_calculation#Finding_roots

Which one do you like best?

I kind of like the abbreviated Taylor series.

It depends on the need. I'd like a fast way of approximating to 4 decimals or so but using either the linear approximation or derivative is very fast.

Method for calculating perfect roots:

Important facts:

1^2=1

2^2=4

3^2=9

4^2=16

5^2=25

6^2=36

7^2=49

8^2=64

9^2=81

Note: Squares end in 1,4,9,6 and 5.

For 1,4,9,6 there areare two instances each.

1 - 1|9

2 - 2|8

9 - 3|7

6 - 4|6

Notice that they are complements...

Example

sqrt(2916)

If you have already memorized your first few hundred squares this isn't necessary as you already know the answr but it's a very fast confirmation, which in my brain is always a good thing...

The closest square root to 29|## is 5

and the last number ##|#6 will has to be 4 or 6.

Take the 5 and multiple it with itself +1.

5×(5+1) = 30

29 is less than 30 so pick the lower number 4.

sqrt(2916)=54

I will leave it to Kinma to explain the algebra of why this works ;) ... I will post the the linear and derivative approximation methods later this evening.

Linear Approximation Method for Square Roots:

Treat the power curve as if it were a line segment between the two squares

Calculate the slope of line and multiple it to steps needed to reach the point on the segment representing the target root.

$${\sqrt 100} =10 > {\sqrt 84} > {\sqrt 81} = 9.$$

$${\sqrt 84} \approx 9 + (84-81) * (1/100-81).$$

$${\sqrt 84} \approx 9 + 3 * 1/18.$$

$${\sqrt 84} \approx 9.167.$$

$${\sqrt 84} = 9.165.$$

Sure. I'll explain why this works.

Recall Roberts table:

1 - 1|9

2 - 2|8

9 - 3|7

6 - 4|6

These numbers are symmetric with 5 in the middle:

1 - 1|9 => 5-4 | 5+4

2 - 2|8 => 5-3 | 5+3

9 - 3|7 => 5-2 | 5+2

6 - 4|6 => 5-1 | 5+1

If 5 is in the middle, then let's calculate this number.

In Roberts example we are looking for either 54 or 56. Middle then is 55.

We calculate 55^2 as 5*(5+1) | 25 or 3025.

Since we are looking at the first 2 digits, we only look at the 30 from 3025.

For people who are new to squaring numbers that end in 5:

Take the first digit and multiply it with the next one. In this case 5*6 = 30.

Then just append 25: 3025. Done.

Since 29 is lower than 30 the next digit is 4. So answer is 54.

56^2 = 3136. So if the first 2 digits were 31, then the last digit was 6.

It is a great way of finding the root. The first digit is found quickly and the second too.

Let's play with this some more and use

modulo calculation for square roots.In Roberts example of 2916 we could find the first digit easily.

50^2 = 2500 and 60^2 = 3600, so the first digit is a 5.

We can find the second number by using a modulo 27. Why 27? Well, and Willem Bouman explained this to me, there are 2 reasons for this.

1: 27 is big enough to not get entangled with doubles.

2: 27X37 = 999 which makes it easy to take the modulo of big numbers.

The last part needs a bit of explanation. If I take 999 off of 1002 I get 3. Effectively I have now added the thousands to the singles: 1 + 2 = 3.

If I do this with 2916 => 916+2 = 918.

27X3 = 81, so we can easily subtract another 810 from 918 to get 108. subtract another 81 to get 27. Subtract 27 to get 0.

This might look like way too many steps. However; this is how I take the modulo 27 of 2916.

Each step makes the number smaller and each step is an easy calculation.

Another way is this: 2916 - 2700 = 216

216 = 8 X 27, so a division by 27 has no remainder.

2916 mod 27 = 0.

In other words. 2916 mod 27 = 0

If the square of the number we are looking for modulo 27 is 0, then the number we are looking for is also 0 mod 27.

We have 2 options: 54 and 56.

54 mod 27 = 0 and 56 mod 27 = 2.

So 54 is the right answer.Let's go for bigger numbers: 50,625200^2 = 40,000

300^2 = 90,000

So first digit is a 2.Last digit is a 5. Only numbers that end in 5, squared, have 5 as the last digit.

So now we have 2?5.Let's do a modulo 27 to find the middle digit:

50,625 => 625 + 50 = 675

675 - 540 = 135

135 = 5 X 27, so the modulo 27 is zero.

If the modulo is zero the number is either 0 or 9 modulo 27.

This is because 0^2 = 0 and 9^2 = 81. 81 = 0 mod 27.

Let's find the middle digit by trying all the numbers:

205 mod 27 = 16

215 mod 27 = 26

225 mod 27 = 36 = 9. Bingo. This is our number. For the sake of completion, let's continue.

235 mod 27 = 19

245 mod 27 = 29 = 2

255 mod 27 = 12

265 mod 27 = 22

275 mod 27 = 32 = 5

285 mod 27 = 15

295 mod 27 = 25

So 225 is the root of 50625.It is a lot to write, but if you do it in your mind this goes quickly.

I will have to play with this one over the weekend and see how it feels. I've graduated to "Grade 8" arithmetic and have been trying to improve my mental calculation of roots and division. I think I'm going to need to add basic division facts (single digits) to my collection to smooth the process.

I'm finding the practice of the roots/division are helping my squares/multiplication nicely. Hopefully, I will add on powers then logs in the next month or two. I haven't looked at trig yet and am saving it for a well rested day. Will probably post some more approaches in this thread on the weekend.

Let's make this easier for you. It does not matter a lot which modulo you use.

To show this, let's do the same calculations using mod 9. Mod 9 is easier to calculate than mod 27.

2916 mod 9 = 0

54 mod 9 = 0 and 56 mod 9 = 2, so 54 is the correct answer.

50,625 mod 9 = 0

205 mod 9 = 7

215 mod 9 = 8

225 mod 9 = 0. Bingo.

235 mod 9 = 1, etc.

I’ll give you some more to play with.

Recall the case of 50,625.

200^2 = 40,000

210^2 = 44,100

So an increase of 10 in the number to square results in over 4,000 in the result.

50,625 - 40,000 = 10,625.

This is big enough to contain an increase of 10 and 20, but not 30.

So in this respect the second digit can only be 2.

In short you can integer divide the increment - 10,625 - by 20 times the guess of the first number.

200 X 20 = 4,000 and 10,625 / 4,000 = 2.

Another way of smart guessing is calculating squares by adding.

If we start with 20^2 = 400, then 21^2 = 400 + 20 + 21 = 441.

And 22^2 = 441 + 21 + 22 = 484.

This is a great way of looping through the squares, because you start with a beginning square, add its number then the next number and you have the next square.

Since the squares of the tens and the numbers ending in 5 are easy to calculate, theses are great starting points.

If we need 26^2, we start with 25^2 = 625, then add 25 - 650, then 26 - 676.

26^2 = 676.

Now, how do we apply this to roots?

Well, let's take the square of a 3 digit root: 112,225

30^2 = 90,000

40^2 = 160,000

So first number is 3.

Let's loop through the squares of 30-40 until we find the second digit. We are looking for 1122, the first 4 digits:

30^2 = 900

31^2 = 900 + 30 + 31 = 961

32^2 = 961 + 31 +32 = 1,024

33^2 = 1024 + 32 + 33 = 1,089. Almost there.

34^2 = 1,089 + 33 + 34 = 1,156. Too high, so 33 is the number we are looking for.

Since it ends in 25 we know the last digit is a 5.

The square root of 112,225 is 335.Now we have taken the root by merely adding numbers.

Thanks... I've picked up a McJob while I look for real work so I'm spending a fair amount of time practicing calculation on the bus. Net new is going to be a weekend task for the next little while. I'm doing about 1.5 hour of remedial math and about 2 hours of calculation a day right now and am seeing my familiarity/reading skills improving. I'm hoping that extending my range will help with width and flexibility a bit over the next while. Based on the reading I've been doing and the youpoop videos I have watched Roots have so many different forms of attack. I suspect I will be able to have fun with them for quite a while. Should roll nicely into powers and logs. Modulo Arithmetic is definitely a nice addition to thinking about numbers. If we assume numbers can be congruent to each other then - infinity = +infinity doesn't seem quite so unreasonable.... Or maybe it's a sphere or some kind of hypersphere that allows for complex numbers or imaginary-imaginary numbers...... Things start getting a bit odd if you change the rules a bit.

For training, here is a 2 digit square number generator.

And 3 digit.

At last a productive use for Wolfram Alpha ;)

I bought the android app a couple of months ago and have barely touched it yet.

I suspect I will use it more once my remedial math moves along a little further.

Let's do another: 180,625.

Roughly 18 X 10,000, so answer is more than 400.

400 X 400 = 160,000, so the difference with 180,625 is about 20,000.

20,000 / 8,000 = 2 (integer division, don't care about the remainder).

With this knowledge we can refine the answer to 420+.

Last number needs to be 5 of course, so the answer is 425.

One for which we need modular calculation:

474,721

600^2 = 360,000, so first digit is 6.

Difference is 114,000.

114,000 / 12,000 = 8 (integer division)

Answer this far: 68?

Last digit is either 1 or 9.

Modulo 11:

474,721 mod 11 = 5(47 mod 11= 3, 47 mod 11= 3, 21 mod 11 = -1. 3+3-1 = 5)681 mod 11 = 6 +4 = 10 = -1. -1^2 = 1.

689 mod 11 = 7. 7^2 = 49. 49 mod 11 = 5. Bingo.

So square root of 474,721 = 689.

At the end you do mod 11, is the 11 picked with a reason or randomly? And how come the 21 mod 11 is -1? I might have forgotten something, but I believed mod always had to end up as a positive number. Not that it is too much of a difference in the end. 10+3+3=16, and 16 mod 11 is 5, so you end up with 5 anyway.

In theory you can use any modulo. Mod 9 is often used. However; this sometimes leads to mistakes if you switch numbers. 36 mod 9 = 0 and 63 mod 9 is also zero.

To prevent this, mod 11 is also used.

36 mod 11 = 3 and 63 mod 11 = 8.

So if you switch numbers in your answers a mod-9 will overlook it, where a mod-11 will spot it.

If you read earlier posts in this thread you see a modulo 27 or 37 can also be used.

They are better for bigger calculations and if you multiply 27X37 you might see why it is easy to take the modulo 27 of 37 of a big number.

Also a mod-27 or 37 has less doubles.

3, 6 and 9 squared are all 0 in modulo 9.

4 and 5 squared both are 7 mod 9.

However; all numbers 0-9, squared, have a single mapping in mod 27 and 37.

A mod-11 is easier to calculate - mentally - than a mod 37.

Especially if you are new to this.

A modulo indeed needs to end positive. However; using negative modulo's makes things easier.

In my example I even converted a positive mod 11 (10) to a negative one (-1).

Squaring -1 in modulo 11 is easier than squaring 10.

I could have used 10, squared it to get 100 and then take mod 11 to get 1.

If I take -1 as the modulo and square it I immediately see 1 as the answer. It is just one step less.

And if you do mental calculation, then everything that saves a step is valuable.

However; there is more to using negative modulo's.

Let’s say I need the root of 108,241. The modulo 11 is 1.

For people new to this, take the modulo 11 of 41 (8) + 82 (5) + 10 (10).

8+5+10=23 and 23 mod 11 = 1.

If the mod 11 of 108,241 is 1 then the root is either 1 or -1 in mod-11.

To me, this looks ‘cleaner' than saying the root is either 1 or 10 in mod-11.

You’ll remember that modulo’s are cyclic. So -1 = 10 in mod-11.

Calculating im-perfect square roots with precision.....

sqrt(200)

1 4. 1 4 2

2 00.00 00 00 00 00 00

1 1

-----

2*1

2_ 1 00

96

-----

4 00

2*14

28_(1) 2 81

-----

1 19 00

2*14.1

282_(4) 1 12 96

---------

6 04 00

2*14.14

2828_(2) 5 65 64

---------

38 36 00

2*14.142

28284_(1) 28 28 41

-----------

10 07 59

.....

I use this really simple algorithm to calculate im-perfect square roots.

For odd numbers.

sqrt(200) =14.1421356237

(1) (200 - 14²)/2 = 2/1 = 1 r:1

(2) 10 - 4 = 6/1 = 4 r:2

(3) 20 - 0.5 - 16 = 3.5/1 = 2 r:1.5

(4) 15 - 4 - 8 = 3/1 = 1 r:2

(5) 20 - 8 - 2 - 4 = 6/1 = 3 r:3

(6) 30 - 8 - 1 - 12 = 9/1 = 5 r:4

(7) 40 - 2 - 4 - 3 - 20 = 11/1 = 6 r:5

(8) 50 - 2 - 12 - 5 - 24 = 7/1 = 2 r:5

(9) 50 - 0.5 - 6 - 20 - 6 - 8 = 9.5/1 = 3 r:6.5

(10) 65 - 3 - 10 - 24 - 2 - 12 = 14/1 = 7 r:7

...

For even numbers.

sqrt(5,557,869,889.964783689) = 74,551.1226606600719

(1) (55 - 7²)*5 + 2.5 = 32.5/7 = 4 r:4.5

(2) 45 + 3.5 - 8 = 40.5/7 = 5 r:5.5

(3) 55 + 4 - 20 = 39/7 = 5 r:4

(4) 40 + 3 - 12.5 - 20 = 10.5/7 = 1 r:3.5

(5) 35 + 4.5 - 25 - 4 = 10.5/7 = 1 r:3.5

(6) 35 + 4 - 12.5 - 5 - 4 = 17.5/7 = 2 r:3.5

(7) 35 + 4 - 5 - 5 - 8 = 21/7 = 2 r:7

(8) 70 + 4.5 - 0.5 - 5 - 10 - 8 = 51/7 = 6 r:9

(9) 90 + 4.5 - 1 - 10 - 10 - 24 = 49.5/7 = 6 r:7.5

(10) 75 + 3 - 0.5 - 2 - 10 - 30 - 24 = 11.5/7 = 0 r:11.5

(11) 115 + 2 - 2 - 2 - 30 - 30 = 53/7 = 6 r:11

(12) 110 + 3.5 - 2 - 2 - 6 - 30 - 24 = 49.5/7 = 6 r:7.5

(13) 75 + 4 - 4 - 6 - 6 - 30 - 24 = 9/7 = 0 r:9

(14) 90 + 1.5 - 2 - 12 - 6 - 30 - 30 = 11.5/7 = 0 r:11.5

(15) 115 + 3 - 12 - 12 - 6 - 30 = 58/7 = 7 r: 9

(16) 90 + 4 - 18 - 12 - 6 - 6 - 28 = 24/7 = 2 r:10

(17) 100 + 4.5 - 36 - 12 - 6 - 35 - 8 = 8.5/7 lower then I expected ==> (16) "revision" ==> 1 ==> (8.5+70+4)/7 = 9 r: 19.5

...