Location arithmetic |
In his treatise Rabdology, John Napier described a technique to do binary arithmetic using a chessboard-like grid. He termed his technique Location arithmetic (Latin arithmeticæ localis ) from the way that positions of counters on the board represented numbers.
Using simple moves of counters on the board, Napier showed ways to multiply, divide and even find the square roots of binary numbers. He was so pleased by his discovery that he said in his preface
: ... it might be well described as more of a lark than a labor, for it carries out addition, subtraction, multiplication, division and the extraction of square roots purely by moving counters from place to place.
=Location numerals=
Binary notation had not yet been standardized, and Napier used what he called location numerals to represent binary numbers. Roughly speaking, it used alphabets to stand for various powers of two.
He used a to represent 1, b for 2, c for 4, d for 8, e for 16 and so on. To represent a number as a location numeral, express it as a sum of powers of two and replace the powers by the alphabets. For example
: 87 = 1 + 2 + 4 + 16 + 64 = abceg
A location numeral can similarly be converted back into standard notation:
: abdgkl = 1 + 2 + 8 + 64 + 512 + 1024 = 1611
He permitted letters to repeat, and so there could be multiple ways to represent the same number. For example
: abbc = acc = ad = 9
Notice that since each alphabet is twice the value of the previous alphabet, you can replace two occurrences of the same alphabet with one of the next alphabet without changing the value of the number. Thus you can always remove all repeated alphabets from a location numeral, and Napier called this the abbreviated form of a number. If on the other hand a location numeral has repeated alphabets, it is the extended form of the number.
Napier showed ways to convert numbers into and out of abbreviated form which are identical to modern techniques to convert numbers into the binary numeral system and we will not repeat them here.
Location numerals provide a simple way to do addition, just write two numbers in abbreviated form together and abbreviate the result. For example to add 157 ( acdeh ) to 230 ( bcfgh ) just write them together
: acdeh + bcfgh = abccdefghh
and abbreviate the result
: abccdefghh → abddefghh → abeefghh → abffghh → abgghh → abhhh → abhi
and abhi = 387 = 157 + 230 as expected.
Subtraction is only a little more complicated. To subtract say bcfgh from abhi , first change abhi into its extended equivalent abccdefghh and just remove the letters bcfgh
: abccdefghh - bcfgh = acdeh
to get the result acdeh .
Napier used his non-standard representation of binary numbers to explain his techniques to do arithmetic. However, we ll rephrase his ideas using the more modern binary notation, and won t refer to location numerals any further.
=The grid=
Location arithmetic uses a square grid where each square on the grid represents a value. Two sides of the grid are marked with increasing powers of two. Any inner square can be identified by two numbers on these two sides, one being vertically below the inner square and the other to its far right. The value of the square is the product of these two numbers.
For instance, the square in this example grid represents 32 as it is the product of 4 on the right column and 8 from the bottom row. The grid itself can be any size, and larger grids simply permit us to handle larger numbers.
Notice that if you move to the left of (or directly above) a square, the value doubles. This property can be used to perform binary addition using just a single row of the grid.
==Addition==
First, lay out a binary number on a row using counters to represent the 1s in the number. Take say 29 (= 11101 in binary) and place it on the board like this.
The number 29 is clearly the sum of the values of the squares on which there are counters. Now overlay the second number on this row. Say we place 9 (= 1001 in binary) on it like this.
Now the sum of these two numbers is just the total value represented by the counters on the board, except we can t directly read off the counters as a binary value since some of the squares have more than one counter.
Recall however, that moving to the left of a square doubles its value. So we can replace two counters on a square with one counter to its left without changing the total value on the board. Note that this is the same idea used to abbreviate location numerals. Lets start by replacing the rightmost pair of counters with a counter to its left, giving
We still have another square with two counters on it, so let s do it again.
But replacing this pair created another square with two counters on it, so let s repeat it again.
Now each square has just one counter, and we just read off the result in binary 100110 (= 38) to get the result.
==Subtraction==
Subtracting is not much more complicated than addition. Instead of adding counters on the board we remove them. To borrow a value, we replace a counter on a square with two to its right.
Let s see how we might subtract 12 from 38. First place 38 (= 100110 in binary) on a row, and then place 12 (= 1100 in binary) under it.
For every counter on the lower row that has a counter above it, remove both counters. We can remove one such pair on the board, resulting in
Now we need to borrow counters to get rid of the remaining counter on the bottom. First replace the leftmost counter on the top row with two to its right.
Now replace one of the two counters with two more to its right, giving
We can now take away one of the counters on the top row with the remaining counter on the bottom row
and read off the final result 26.
==Some properties of the grid==
Unlike addition or subtraction, the entire grid is used to multiply, divide or extract square roots. The grid has some useful properties utilized in these operations. First, notice that all the squares on any diagonal going from the bottom left to the top right have the same value.
You can verify that these two diagonals on the grid all have the same value. A diagonal move can be broken down into a move to the right (which halves the value) followed by a move up (which doubles the value) so you can see why the value of the square stays the same.
Recall that the value of an inner square is the product of two squares on the bottom and right sides of the grid. In conjunction with the diagonal property we just talked about, there s a quick way to divide the numbers along on the bottom and right edges of the grid.
Locate the dividend 32 along the right side and the divisor 8 on the bottom edge of the grid. Extend a diagonal from the dividend and locate the square where it intersects a vertical line from the divisor. The quotient lies at the right end of the grid from this square, which for our example is 4.
Why does this work Moving along the diagonal doesn t change the value of the divisor. So the value of the square on the intersection is still the divisor. But we also know it is the product of the squares along the bottom and right edge. Since the square on the bottom edge is the divisor, the square on the right edge is the quotient. Napier extends this idea to divide two arbitrary numbers.
XXX square root
Let s now find out how to multiply, divide and extract square roots with the grid.
=Multiplication=
To multiply a pair of binary numbers, first mark the two numbers on the bottom and the right side of the grid. Say we want to multiply 22 (= 10110) by 9 (= 1001).
Now place counters at every intersection of vertical and horizontal rows of the 1s in each number.
Notice that each row of counters on the grid is just 22 multiplied by some power of two. In fact, the total value of the counters is the sum of two rows : 22*8 + 22*1 = 22*(8+1) = 22*9 So the counters on the board actually represent the product of the two numbers, except it isn t possible to read off the answer just yet.
Recall that moving counters diagonally doesn t change the value, so move all the counters on inner squares diagonally until they hit either the bottom row or the left column.
Now we make the same moves we did for addition. Replace two counters on a square with one to its left. If the square is on the left column, replace two counters with one above it. Recall that the value of a square doubles if you move up, so this doesn t change the value on the grid.
Let s first replace the two counters on the second square at the bottom with one to its left which leaves two counters at the corner.
Finally, replace the two counters on the corner with one above it and read off the binary number in an L-shaped fashion, starting from the top left down to the bottom left corner, and then over to the bottom right.
Read the counters along the L but don t double count the corner square. You will read the binary result 11000110 = 198 which is indeed 22*9.
Why can we read the binary number in this L-shaped fashion The bottom row is of course just the first six powers of two, but notice that the leftmost column has the next five powers of two. So we can directly read off an 11 digit binary number from the L-shaped set of 11 squares that lie along the left and bottom sides of the grid.
Our small 6x6 grid can only multiply numbers each upto 63, and in general an n x n grid can multiply two numbers each upto 2 n +1-1. This scales very fast, so a 20 sided board for instance can multiply numbers each upto a little over two million.
=Division=
Martin Gardner presented a slightly easier to understand version of Napiers division method, which is what is shown here.
Division works pretty much the reverse of multiplication. Say we want to divide 485 by 13. First place counters for 485 (= 111100101) along the bottom edge and mark 13 (= 1101) along the right edge. To save space, we ll just look at a rectangular portion of the board because thats all we actually use.
Starting from the left, the game is to move counters diagonally into columns of divisors (that is, with one counter on each row marked with a 1 from the divisor.) Let s demonstrate this with the leftmost block of counters.
Now the next block of counters we might try would begin with the leftmost counter on the bottom, and we might attempt something like
except that we don t have any counters that we can move diagonally from the bottom edge into squares that would form the rest of the column of divisors.
In such cases, we instead double down the counter on the bottom row and form a column one over to the right. As you will soon see, it will always be possible to form a column this way. So first replace the counter on the bottom with two to its right.
and then move one diagonally to the top of the column, and move another counter located on the edge of the board into its spot.
It looks like we still don t have a counter on the bottom edge to move diagonally into the remaining square, but notice that we can instead double down the leftmost counter again and then move it into the desired square.
and now move one counter diagonally to where we want it.
Let s proceed to build the next column. Once again, notice that moving the leftmost counter to the top of the column doesn t leave enough counters at the bottom to fill in the remaining squares.
So we double down the counter and move one diagonally into the next column over. Let s also move the rightmost counter into the column, and here s how it looks after these steps.
We still have a missing square, but we just double down again and move the counter into this spot and end up with
At this point, the counter on the bottom edge is so far to the right that it cannot go diagonally to the top of any column, which signals that we are done.
The result is read off the columns -- each column with counters is treated as a 1 and empty columns are 0. So the result is 100101 (= 37) and the remainder is the binary value of any counters still left along the bottom edge. There is one counter on the third column from the right, so we read it as 100 (= 4) and we get 485 ÷ 13 = 37 with a remainder 4.
=References=
#John Napier; translated by William Frank Richardson; introduction by Robin E. Rider (1990). Rabdology . MIT Press. ISBN 0-262-14046-2. #Martin Gardner (1986). Knotted doughnuts and other mathematical entertainments . W. H. Freeman and Company. ISBN 0-7167-1794-8.
=External links=
|
|