[ELI5]: How do calculators find out the square root of a number?

679 views

[ELI5]: How do calculators find out the square root of a number?

In: Mathematics

4 Answers

Anonymous 0 Comments

Even though Wikipedia has a gift for explaining it in a way nobody but mathematicians can understand it, many of the methods are really simple:

1. Make a guess
2. Repeatedly adjust the guess until you come closer.

You can easily check if you’re above or below the correct number by squaring (multiplying your guess with itself).

Let’s say I want to calculate the square root of 99. I guess that it’s 1. That’s off by a lot, but that doesn’t matter.

1 * 1 = 1. That’s less than 99, so 1 is too small. Let’s double it.

2 * 2 = 4. Ok, 2 is still too small, let’s double it.

4 * 4 = 16. Still too small.

8 * 8 = 64. Still too small.

16 * 16 = 256. AHA! This is now bigger than 99. That means the square root is between 8 and 16.

Let’s try something in the middle.

12 * 12 = 144

Ok, so the square root is smaller than 12, but bigger than 8. Let’s try something in the middle.

10 * 10 = 100

Ok, so it’s between 8 and 10.

9 * 9 = 81

Ok, between 9 and 10.

9.5 * 9.5 = 90.25

9.75 * 9.75 = 95.0625

9.875 * 9.875 = 97.51

9.9375 * 9.9375 = 98.75

We now know it’s between 9.9375 and 10. The middle between that is 9.96875.

9.96875 * 9.96875 = 99.37

So it’s somewhere between 9.9375 and 9.96875, and if you want to know more exactly, you repeat this a couple dozen more times and you’ll have an answer that’s precise enough for the number of digits your calculator can display. As you can see, we got a pretty good answer with a few steps that I could do manually

This is called a binary search, and works for many other problems too.

The actual algorithm uses a smarter way than “halve the difference”, I’ll write up an example once I’m out of bed and have a real computer and keyboard instead of a phone.

You are viewing 1 out of 4 answers, click here to view all answers.