User:Kbs
I'm interested in simple computing ideas. I made my first edits to the article on Napier's bones a neat, simple aid to doing arithmetic.
Suggestions, brickbats and donations over here at my talk page.
Why Does the Square Root Process Work
[edit]The basic idea behind finding the square root of a number is to find the largest perfect square less than or equal to a prefix of the number. The square root of this perfect square also turns out to be a prefix for the square root of the number. The procedure extends this square root for longer and and longer prefixes of the number until we determine the square root for the entire number, or more accurately, the largest perfect square less than or equal to the number.
For instance, let's start out with some number say 46. The largest perfect square less than or equal to it is 6^{2} = 36. We'll soon see that the largest perfect square less than or equal to any number of the form 46## (that is, 46 followed by two more digits, so this could be any number from 4600 to 4699) must look like 6#^{2}. In other words, the square root also starts with a 6. For example, if we take say 4678, it turns out that 68^{2} is the largest perfect square smaller than it.
We can extend this again in just the same way. The largest perfect square less than or equal a number like 4678## will look like 68#^{2}. So if choose say 467853, we'll discover that 683^{2} is the largest perfect square smaller than it and so on.
So by arranging a number in groups of two and working our way from the left to the right, we can eventually find the largest perfect square less than or equal to the number.
Let's first see why we can extend the square root like this.
Suppose n^{2} is the largest perfect square less than or equal to a given number N. We can state this as:
 n^{2} ≤ N < N+1 ≤ (n+1)^{2}
Multiplying throughout by 100, we get
 100n^{2 ≤ 100N < 100(N+1) ≤ 100(n+1)2}
which we can rewrite as
 (10n)^{2} ≤ 100N < 100N+100 ≤ (10(n+1))^{2}
Now if s is any number of the form N## (that is, N followed by a couple of digits) you can verify that
 100N ≤ s < 100N+100
Combining this with the previous inequality, we can conclude that
 (10n)^{2} ≤ s < (10(n+1))^{2}
Now (10n)^{2} itself is a perfect square smaller than s, so the largest perfect square, say p^{2} ≤ s must also satisfy
 (10n)^{2} ≤ p^{2} ≤ s < (10(n+1))^{2}
which implies
 10n ≤ p < 10(n+1) = 10n+10
In other words, p itself must be of the form n#^{2}.
Notice that s doesn't have to be an integer, so the technique works for numbers with a fractional part as well.
Let's now understand how the method actually finds the largest perfect square less than or equal to our number.
Remember that we're looking at longer and longer prefixes of the number after we've grouped them by twos, and let's work with our earlier example
 46 78 53 99
The first step is really easy to understand. From our earlier analysis, we know that the square root must begin with a 6, because 6^{2} is the largest perfect square smaller than the first group of digits 46.
We've already got a table of perfect squares on the square root bone, and the procedure compares it with the first group of digits 46 to get the first digit of the square root 6, so you can see why this works.
Now we've got to find the largest perfect square less than the first two groups of digits in the number. Let's call the number formed by the first two groups of digits S_{1} (so in our example S_{1} would be 4678.)
Let a be the first digit of the square root we already found (which is 6.) Our goal now is to find the next digit say b, such that <ab>^{2} is the largest perfect square less than or equal to S_{1}. (<ab> is the number formed by the digits a and b, not the product.)
In other words, we want to find the digit b where
 S_{1} = (10a+b)^{2} + k
and k ≥ 0 is as small as possible.
But observe that the next step in the procedure is to find the remainder, and you can verify that our method to find the remainder actually computes
 R_{1} = S_{1}  100a^{2}
where R_{1} is the remainder which is 1078 in our example. Expressing this using the previous equation, we can write the remainder as
 R_{1} = (10a+b)^{2} + k  100a^{2}
 = 10(2a)b + b^{2} + k
where k ≥ 0 is as small as possible.
Now comes the key trick behind Napier's method to extract the square root. We set the value of the second column in the square root bone on the board. But the second column is twice the third column, so we actually set 2a (which is 2*6 = 12 in our example) on the board.
The board now forms a multiplication table for the number 2a. But if you read it in conjunction with first nine squares on the square root bone, you can verify that the board forms a table of numbers of the form
 10(2a)n + n^{2}
for every digit n. So in our example when we place the bones for 2a = 2*6 = 12 on the board, we actually create this table of numbers
1  2  √  

1  ^{0}/_{1}  ^{0}/_{2}  ^{0}/_{1} 2 1  10*(2*6)*1 + 1^{2} = 121 
2  ^{0}/_{2}  ^{0}/_{4}  ^{0}/_{4} 4 2  10*(2*6)*2 + 2^{2} = 244 
3  ^{0}/_{3}  ^{0}/_{6}  ^{0}/_{9} 6 3  10*(2*6)*3 + 3^{2} = 369 
4  ^{0}/_{4}  ^{0}/_{8}  ^{1}/_{6} 8 4  10*(2*6)*4 + 4^{2} = 496 
5  ^{0}/_{5}  ^{1}/_{0}  ^{2}/_{5} 10 5  10*(2*6)*5 + 5^{2} = 625 
6  ^{0}/_{6}  ^{1}/_{2}  ^{3}/_{6} 12 6  10*(2*6)*6 + 6^{2} = 756 
7  ^{0}/_{7}  ^{1}/_{4}  ^{4}/_{9} 14 7  10*(2*6)*7 + 7^{2} = 889 
8  ^{0}/_{8}  ^{1}/_{6}  ^{6}/_{4} 16 8  10*(2*6)*8 + 8^{2} = 1024 
9  ^{0}/_{9}  ^{1}/_{8}  ^{8}/_{1} 18 9  10*(2*6)*9 + 9^{2} = 1161 
But we just saw that the remainder R_{1} = 1078 is of the form
 10*(2a)b + b^{2} + k
where k ≥ 0 is as small as possible. So we can easily figure out b by picking the largest entry in the above table which is smaller than the remainder.
In this case, b must be 8 because that's the row which makes k as small as possible without making it negative. So we've figured out that 68^{2} is the largest perfect square smaller than 4678.
Let's continue the process. We now want to find the largest perfect square less than or equal to the first three group of digits. Let's write the number formed by the first three groups of digits as S_{2}, which is 467853 in our example.
As usual, we first compute the remainder R_{2} = 5453, and you can verify that the process actually computes
 the previous remainder R_{1}
 take away the row value 10*(2a)b + b^{2}
 append the next pair of digits S_{2}  100S_{1}
which means we can write
 R_{2} = 100(R_{1}  10*(2a)b  b^{2}) + (S_{2}  100S_{1})
Substitute for R_{1} our previous equation
 R_{1} = S_{1}  100a^{2}
and after some simplification, we get
 R_{2} = S_{2}  100(10a+b)^{2}
Now recall that our goal at this point is to figure out the third digit c of the largest perfect square <abc>^{2} which is less than or equal to our current prefix S_{2}.
In other words, we want to discover c where
 S_{2} = (100a+10b+c)^{2} + k
and k ≥ 0 is as small as possible.
Using this in our equation for the remainder, we can write
 R_{2} = (100a+10b+c)^{2} + k  100(10a+b)^{2}
 = (100*2a + 10*2b)c + c^{2} + k
and k ≥ 0 is as small as possible.
The next step in the procedure is to rearrange the board. We start with the current number on it, which is 2a, and append to it the value in the second column which is 2b. If 2b has two digits, then we first append the first digit to 2a, and you can verify that this procedure just sets the number on the board to 10*2a + 2b.
In our example, a is 6 and b is 8, and we end up with
 10*2*6 + 2*8 = 136
on the board. When we read the board in conjunction with the square root bone, it forms a table of numbers of the form
 10(10*2a + 2b)n + n^{2}
for every digit n. So when we set the number 136 on the board, we're really creating this table of numbers
1  3  6  √  

1  ^{0}/_{1}  ^{0}/_{3}  ^{0}/_{6}  ^{0}/_{1} 2 1  (100*2*6 + 10*2*8)*1 + 1^{2} = 1361 
2  ^{0}/_{2}  ^{0}/_{6}  ^{1}/_{2}  ^{0}/_{4} 4 2  (100*2*6 + 10*2*8)*2 + 2^{2} = 2724 
3  ^{0}/_{3}  ^{0}/_{9}  ^{1}/_{8}  ^{0}/_{9} 6 3  (100*2*6 + 10*2*8)*3 + 3^{2} = 4089 
4  ^{0}/_{4}  ^{1}/_{2}  ^{2}/_{4}  ^{1}/_{6} 8 4  (100*2*6 + 10*2*8)*4 + 4^{2} = 5456 
5  ^{0}/_{5}  ^{1}/_{5}  ^{3}/_{0}  ^{2}/_{5} 10 5  (100*2*6 + 10*2*8)*5 + 5^{2} = 6825 
6  ^{0}/_{6}  ^{1}/_{8}  ^{3}/_{6}  ^{3}/_{6} 12 6  (100*2*6 + 10*2*8)*6 + 6^{2} = 8196 
7  ^{0}/_{7}  ^{2}/_{1}  ^{4}/_{2}  ^{4}/_{9} 14 7  (100*2*6 + 10*2*8)*7 + 7^{2} = 9569 
8  ^{0}/_{8}  ^{2}/_{4}  ^{4}/_{8}  ^{6}/_{4} 16 8  (100*2*6 + 10*2*8)*8 + 8^{2} = 10944 
9  ^{0}/_{9}  ^{2}/_{7}  ^{5}/_{4}  ^{8}/_{1} 18 9  (100*2*6 + 10*2*8)*9 + 9^{2} = 12321 
Once again, picking the largest value from this table smaller than the
remainder gives us our digit c which is 3. At this point,
we've found out that 683^{2} is the largest perfect square
less than or equal to 467853.
You can continue analyzing the technique in this manner and find that the remainder R_{3} in the next step is
 R_{3} = S_{3}  1000(100a+10b+c)^{2}
and S_{3} is the number formed by the first four groups of digits, which in our case is 46785399, also the entire number.
We want to find the fourth digit d where <abcd>^{2} is the largest perfect square smaller than S_{3}, so we need to discover d where
 S_{3} = (1000a+100b+10c+d)^{2} + k
and k ≥ 0 is as small as possible. Using this in the previous equation, we find
 R_{3} = (1000*2a + 100*2b+10*2c)d + d^{2} + k
and k ≥ 0 is as small as possible.
The number we set on the board is the second column from the square root bone 2c added to ten times the previous number on the board 10*2a+2b, so the new number is
 100*2a + 10*2b + 2c
and in conjunction with the square root bone we get a table of the form
 (1000*2a+100*2b+10*2c)n + n^{2}
for every digit n, and we use this to discover the digit d.
You can use a similar analysis to analyze the method for larger numbers, and show why this produces the integer portion of the square root.
We won't fully show why continuing the process gives the fractional digits of the square root, but one way to understand it is to first observe that since (say) 26^{2} is the largest perfect square smaller than 700, we can write
 26^{2} ≤ 700 < 27^{2}
We can then divide everything by 100 to conclude that
 2.6^{2} ≤ 7 < 2.7^{2}
so we can see that the square root of 7 must be something like 2.6###...
In other words, if we've found the largest perfect square smaller than 100 times our number, we've also found the first fractional digit of our square root.
Similarly, you can check that the largest perfect square smaller than 10000 times our number also gives us the first two fractional digits of our square root, and so on.
When our procedure computes the fractional digits of the square root, we really multiply the number by 100, 10000, 1000000 and so on and find the largest perfect squares smaller than each of them to figure out further fractional digits of the number.
Making this argument more formal will prove why the process generates the fractional digits but we won't elaborate it here.
Extracting Cube Roots
[edit]Extracting the cube root uses an additional bone which has three columns on it. The first column has the first nine cubes 1, 8, 27, ... 512, 729. The second column has the first nine squares 1, 4, 9, ... 64, 81. The third column just has the numbers 1 through nine.
1  2  3  4  5  6  7  8  9  ^{3}√  

1  ^{0}/_{1}  ^{0}/_{2}  ^{0}/_{3}  ^{0}/_{4}  ^{0}/_{5}  ^{0}/_{6}  ^{0}/_{7}  ^{0}/_{8}  ^{0}/_{9}  ^{0}/_{01} 1 1 
2  ^{0}/_{2}  ^{0}/_{4}  ^{0}/_{6}  ^{0}/_{8}  ^{1}/_{0}  ^{1}/_{2}  ^{1}/_{4}  ^{1}/_{6}  ^{1}/_{8}  ^{0}/_{08} 4 2 
3  ^{0}/_{3}  ^{0}/_{6}  ^{0}/_{9}  ^{1}/_{2}  ^{1}/_{5}  ^{1}/_{8}  ^{2}/_{1}  ^{2}/_{4}  ^{2}/_{7}  ^{0}/_{27} 9 3 
4  ^{0}/_{4}  ^{0}/_{8}  ^{1}/_{2}  ^{1}/_{6}  ^{2}/_{0}  ^{2}/_{4}  ^{2}/_{8}  ^{3}/_{2}  ^{3}/_{6}  ^{0}/_{64} 16 4 
5  ^{0}/_{5}  ^{1}/_{0}  ^{1}/_{5}  ^{2}/_{0}  ^{2}/_{5}  ^{3}/_{0}  ^{3}/_{5}  ^{4}/_{0}  ^{4}/_{5}  ^{1}/_{25} 25 5 
6  ^{0}/_{6}  ^{1}/_{2}  ^{1}/_{8}  ^{2}/_{4}  ^{3}/_{0}  ^{3}/_{6}  ^{4}/_{2}  ^{4}/_{8}  ^{5}/_{4}  ^{2}/_{16} 36 6 
7  ^{0}/_{7}  ^{1}/_{4}  ^{2}/_{1}  ^{2}/_{8}  ^{3}/_{5}  ^{4}/_{2}  ^{4}/_{9}  ^{5}/_{6}  ^{6}/_{3}  ^{3}/_{43} 49 7 
8  ^{0}/_{8}  ^{1}/_{6}  ^{2}/_{4}  ^{3}/_{2}  ^{4}/_{0}  ^{4}/_{8}  ^{5}/_{6}  ^{6}/_{4}  ^{7}/_{2}  ^{5}/_{12} 64 8 
9  ^{0}/_{9}  ^{1}/_{8}  ^{2}/_{7}  ^{3}/_{6}  ^{4}/_{5}  ^{5}/_{4}  ^{6}/_{3}  ^{7}/_{2}  ^{8}/_{1}  ^{7}/_{29} 81 9 
Let's find the cube root of 22022635627 with the bones.
First, group its digits in threes starting from the right so it looks like this:
 22 022 635 627
Start with the leftmost group 22. Pick the largest cube on the cube root bone less than or equal to 22, which is 8 from the second row.
Because we picked the second row, the first digit of the solution is 2. Subtract the cube 8 from 22 to get 14, and append the next group of digits 022 to get the current remainder 14022.
Now place three times the current solution
 3*2 = 6
on the leftmost end of the board. Multiply this number once more by the current solution 2 to get
 6*2 = 12
and place 12 on the right side next to the cube root bone. At this point, the board and intermediate calculations should look like this.

______________ 22 022 635 627 = 2 8  14 022 
Ignore the 6 bone (and use just the first column from the cube root bone) and "read" the number in each row. For example, read the sixth row as
 ^{0}/_{6} ^{1}/_{2} ^{2}/_{16 → 7416}
Now find the row with largest number less than the current remainder, 14022. You should find that 11529 from the ninth row is the largest value less than 14022.
We're now working with the ninth row of the cube root bone. Multiply the number in the second column of the cube root bone 81 with the value on the left end of the board 6. Append a 0 to this result, and add it to 11529.
This sounds more complicated than it actually is, as you can do these steps quite conveniently with the bones. First write down the row value from the right side of the board, 11529. Like regular multiplication, we're going to multiply the number on the left side of the board by 81. So write below 11529 the value on row 1 from the left side of the board. Then write below it the value on row 8 and add them all together.
11529 6 ← 1*6 48 ← 8*6  16389
The only point to remember here is to shift the first row by one instead of writing it directly below the number. Everything else is similar to doing long multiplication with the bones.
Now compare the result with our remainder 14022. It's larger than the remainder, so discard this result and repeat the operation with the row above it  the eighth row.
Once more, write down the value of the eighth row 10112. Read the second column of the cube root bone 64 and multiply it by the value at the left end of the board, 6. As before, write down the value of fourth row 24 beneath 10112, and then the value of the sixth row 36 below that, and add them all together. This is how the arithmetic should look.
10112 24 ← 4*6 36 ← 6*6  13952
Now this value is indeed smaller than our remainder, so we've got the second digit of the cube root, 8. Subtract 13952 from our current remainder 14022 to get 70, and append the next group of digits 635 to get the current remainder 70635.
Now place three times the current solution 28
 3*28 = 84
on the left side of the board. Multiply this once more by 28
 84*28 = 2352
and set that number on the right side of the board next to the cube root bone.
As these numbers get bigger you can use the bones themselves to find these values, but we won't demonstrate that process.
At this point, the board and intermediate calculations should look like this.

______________ 22 022 635 627 = 28 8  14 022 13 952  70 635 
Continue by reading the values on the right side of the board to find the largest row smaller than the current remainder 70635.
You'll discover that even the smallest value from the first row 235201 is larger than the remainder. In such cases, append a zero to the solution, append a zero bone to the left side of the board and append two zeros on the right side of the board. Finally append the next group to the remainder, and at this point the board and intermediate calculations should look like this.

______________ 22 022 635 627 = 280 8  14 022 13 952  70 635 627 