Ancient Egyptian Binary

A segment of the Rhind Mathematical Papyrus,
A segment of the Rhind Mathematical Papyrus, unknown (c. 2000 B.C), Public domain, via Wikimedia Commons

What are the origins of binary? It is the way of representing numbers (and all other data) that underpins all digital computers which might suggest it is a very modern idea. Binary may be linked to modern technology, but it goes back a long way. Leibniz designed machines based on it hundreds of years ago. he was inspired by its use in I, Ching from thousands of years ago. Even the Ancient Egyptians used a form of binary around 4000 years ago.

A papyrus called the Rhind Mathematical Papyrus found near Luxor is from around 1550 BC makes use of binary. It is actually a copy of a much older, long lost document from about 4000 years ago. It shows how to solve a variety of mathematical problems including through arithmetic, algebra and geometry. It does not introduce binary explicitly but does give a way to do multiplication that uses a binary representation and is the basis of binary multiplication.

Any number can be made up by adding together powers of 2 (ie adding some combination of 1, 2, 4, 8, 16, …). So for example, 6 is just 2+4; 7 is 1+2+4; 11 is 1+2+8; 13 is 1+4+8, and so on. That mathematical fact is the basis for the binary representation of numbers. It means that any number can be represented as binary because binary involves replacing a number by 1s and 0s to indicate which powers of 2 to include in the addition. 13 is 1101 in binary. Each column in the binary number stands for a power of 2.

8 4 2 1
---------
1 1 0 1 = 13 because
(8x1) + (4x1) + (2x0) + (1x1)
= 8 + 4 + 1
= 13

The first 1 in the binary says DO include 8 in the addition, the second 1 says DO include 4 in the addition, the 0 says DO NOT include 2 and the final 1 says DO include 1 in the addition, giving 8+ 4 + 1.

The Egyptians used this idea as the basis of an algorithm to make multiplication easier.

To multiply, say, 13 by 123, you note that 13 is 8 + 4 + 1 (1101 in binary), so 123 x 13 = 123 x (8 + 4 + 1). You therefore do the following series of multiplications, adding the results:

1 x 123 =    123
4 x 123 = 492
8 x 123 = 984
+ -------
1599

The Ancient Egyptians were effectively converting one of the two numbers being multiplied to binary to do the multiplication. This way means you do not need to learn all the different times tables as we all do at school. Hang on though doesn’t it mean you still have to do lots of hardish multiplications like 8 x 123? In fact, all you need to be able to do is double numbers, so know your 2 times table! Why? Because each row can be calculated by doubling the previous number, if you work out all the rows rather than miss out the ones not needed in the final addition. So doing the above again but including 2 x 123 but writing it out of the way so we don’t add it in:

1 x 123 =    123
2 x 123 = 246 (above answer x 2)
4 x 123 = 492 (above answer x 2)
8 x 123 = 984 (above answer x 2)
-----
1599

They used a similar algorithm to do division too, that involved multiplying one number by all the powers of 2 in this way. Perhaps you can work it out.

Doubling in binary is actually very easy, you just shift the number one place, adding a 0 on the end (as we do multiplying by 10 in decimal), which is why this trick of turning all multiplication into doubling is a good thing to have the ALU of a computer do to multiply!

The Ancient Egyptians may not have used binary to explicitly write numbers, and missed the trick of turning both numbers into binary to make doubling easy, but they did use binary and converted numbers to it to make arithmetic easier. That is why if you were an Ancient Egyptian administrator, having a copy of the Rhind Mathematical Papyrus would have helped you pass your exams and then do the job.

More on …

Subscribe to be notified whenever we publish a new post to the CS4FN blog.