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.
Example grid
|
|
|
|
|
|
| 32
|
|
|
|
|
|
|
| 16
|
|
|
|
|
|
|
| 8
|
|
|
| 32
|
|
|
| 4
|
|
|
|
|
|
|
| 2
|
|
|
|
|
|
|
| 1
|
| 32
| 16
| 8
| 4
| 2
| 1
|
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.
11101 (= 29) on one row
|
|
|
|
|
|
|
| 0
| 1
| 1
| 1
| 0
| 1
|
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.
Overlay 1001 (= 9)
|
|
|
|
|
|
|
| 0
| 0
| 1
| 0
| 0
| 1
|
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.
Result 100110 = 38
|
| ←
|
|
|
|
|
| 1
| 0
| 0
| 1
| 1
| 0
|
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.
|
|
| 256
|
|
|
| 32
|
|
| 256
|
|
|
| 16
| 16
|
| 256
|
|
|
| 16
|
| 8
|
|
|
|
| 16
|
|
| 4
|
|
|
| 16
|
|
|
| 2
|
|
| 16
|
|
|
|
| 1
|
| 32
| 16
| 8
| 4
| 2
| 1
|
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.
32 ÷ 8
|
|
|
|
|
|
| 32
|
|
|
|
|
|
|
| 16
|
|
|
|
|
|
|
| 8
|
|
|
|
| →
| →
| →
| 4
|
|
|
|
|
|
|
| 2
|
|
|
|
|
|
|
| 1
|
| 32
| 16
| 8
| 4
| 2
| 1
|
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).
10110 * 1001
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1
|
|
|
|
|
|
|
| 0
|
|
|
|
|
|
|
| 0
|
|
|
|
|
|
|
| 1
|
|
| 1
| 0
| 1
| 1
| 0
|
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.
Result 11000110
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1
|
|
|
|
|
|
|
| 1
|
|
|
|
|
|
|
|
| ↑
|
|
|
|
|
|
|
| 0
| 0
| 0
| 1
| 1
| 0
|
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.
| 1024
| ↓
|
|
|
|
|
|
| 512
| ↓
|
|
|
|
|
|
| 256
| ↓
|
|
|
|
|
|
| 128
| ↓
|
|
|
|
|
|
| 64
| ↓
|
|
|
|
|
|
|
| →
| →
| →
| →
| →
| →
|
|
| 32
| 16
| 8
| 4
| 2
| 1
|
Our small 6x6 grid can only multiply numbers each upto 63, and in
general an nxn grid can multiply two numbers each upto
2n+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 Javascript simulation of Location arithmetic