Al-Ahram Weekly Online   10 - 16 May 2007
Issue No. 844
Published in Cairo by AL-AHRAM established in 1875

Assem Deif

The Ahmes code

The mathematical system in ancient Egypt was application-oriented, devised -- complete with fractions -- to manage practical matters. Assem Deif sums up the old methods

If an ancient Egyptian wanted to divide a loaf of bread among a group of workers or figure out the manpower needed to achieve a certain task, he used addition and doubling instead of the four operations of addition, subtraction, multiplication, and division we use today. It was their script that compelled them to use these operations, since they could double any given number by simply drawing the same symbol next to it. For a similar reason they are only used with unit fractions -- those whose numerator is 1 -- when solving problems about ratios.

Click to view caption
Clockwise from top:A coloured relief featuring the winged god Horus as a symbol of protection; God Ra-Hurakhti;Udjat, the eye of Horus

The interesting arithmetical aspect was multiplication and its inverse, division. For the multiplication they used the method of duplication, reducing it to a problem of addition. This was done by creating two columns in which the numeral 1 always began in the left column. Both columns were doubled to the point where any combination of numbers in the left column could be reckoned to the chosen multiplier. Once checked, the corresponding numbers in the right column were summed up to become the product. To multiply 45x8, and considering the first as the multiplier, we obtain the following:

The marks beside the right column mean those that will be summed up to yield the result. The operation resembles the binary method in concept, with which the computer performs its multiplication -- except that it is performed here half-way since it is the multiplier only which is in binary form. Indeed the Egyptians made a fine observation that any number can be put in a binary form, since in the above example the multiplier 45 is represented in this form. By watching the numbers contributing to it in multiples of 2 the result becomes the sum of the corresponding numbers in the right-hand column.

The Egyptians needed fractions to divide food and supplies according to specific ratios. Fractions were so important that of the 87 problems in the Ahmes Papyrus only six did not involve them. Likewise, of the 25 problems in the Moscow Papyrus 22 involved calculations with fractions. Because the Egyptians performed multiplications and divisions by doubling and halving, it was necessary to double fractions too. Scribes created tables of calculations of fractions along with integers. These tables would be used as references, so that the chief of personnel could carry out the fractional divisions on site. With the exception of the frequently-used fraction 2/3, and the less frequent 3/4, a scribe, being asked to divide an object into a certain number of pieces, would express his fractions as a sum of unit fractions, i.e. limiting them mainly to fractions of the form 1/n where n is a positive integer. Mathematicians call these types of fractions Egyptian Fractions and request, as Ahmes did, that the unit fractions be distinct. A unit fraction is represented in hieroglyphic numerals by placing a mouth, which meant "part", above the number.

Fractions therefore occupy most of the Egyptian mathematical heritage. Mathematical scrolls are overwhelmed with fractions, but it is the first part of the Ahmes Papyrus which carries the most extensive fractional table found in any of the Egyptian papyri that have reached us. It pertains to the division of 2 by any odd number ranging from 3 to 101. Thus, one can conceive the table as composed of 2 columns only, one for the divisors and the others for the unit fractions, as shown. Some are represented in 2 unit fractions and others in three or even four, and this is by no means dependent on the divisor value.

In this table, non-unit fractions are represented as the sum of distinct unit fractions. For example, 2/7 is written as 1/4 +1/28, i.e. not allowed to be factored into 1/7+1/7 -- not that it violated the rules but rather that the latter equal decomposition was impractical (in our view) when it comes to dividing tasks. Executing the task in small portions first will delay the accomplishment, but by letting each worker first perform one eighth of the task, 87.5 per cent of the whole task will be executed at once instead of only 50 per cent first. Besides, it is easier to cut a whole into four equal pieces than seven.

One problem with this system was how to write a fraction as a sum of unit fractions, considering that the expressions are not unique. For example: 7/24=1/6+1/8=1/4+1/24. It is unclear how the Egyptians resolved the problem of preference. To find the unit fraction expansion of a number between zero and one, they perhaps first sought to obtain the largest unit fraction less than the given fraction, then subtracted the former from the given fraction, and repeated it. This is done with the least number of unit fractions -- provided we reach a suitable decomposition. Such an algorithm becomes more and more cumbersome as well as difficult to compute, especially for large divisors. So the scribes made large tables so that, when encountering a remainder, they could look up the answers just as we used to look up logarithms before switching over to electronic calculators.

An algorithm called the Greedy Algorithm, which became known in the 19th century, can simulate the Ahmes scheme by which a given rational number x=a/b between 0 and 1 can be factored into an Egyptian Fraction. In order to convert 19/ 20 into an Egyptian Fraction we take the following steps: 20/ 19=1 together with a remainder. So the first unit fraction is 1/ 2. Subtracting 1/2 from 19/20 gives 9/20. Dividing 20/9 gives 2 along with a remainder. So the next unit fraction is 1/3. Again subtracting 1/3 from 9/20 gives 7/60. Dividing 60/7 gives 8 with a remainder. So the next unit fraction is 1/9. Finally, subtracting the latter from 7/60 yields 1/180. The decomposition becomes: 19/20=1/2+1/3+1/9+1/180.

Unfortunately such an algorithm does not usually yield the shortest series; most of the time it produces long ones that look non-Egyptian. Amazingly, for the same example Ahmes could provide a shorter and rather more attractive series for the same number, that is 19/20=1/2+1/4+1/5. Not that it contained fewer terms, but in larger pieces. So it looks as if the Greedy Algorithm has nothing to do with the Ahmes technique. True, it does work, but does not always work well.

Scientists did not stop elaborating on different ways for the purpose of demystifying the Ahmes code, but no one rule has yet been found that could be applied to all divisors, i.e. nobody had the clue as to what Ahmes really had in mind when constructing his table of unit fractions. However, for the case of composite divisors only, i.e. for the case when n=pq (p and q primes), scientists think Ahmes opted for the decomposition 2/n=(2/p+1) x (1/q+1/pq). For example, 2/21 can be decomposed into 1/14+1/42 by taking p=3, q=7. The above formula generates all the results of the Ahmes table in the case of two terms only, provided that p and q are primes. Unfortunately, three exceptions remain persistent in which the above formula fails to produce Ahmes results, namely the cases 2/35, 2/91 and 2/95. When calculated using the above scheme, 2/35 gave 1/21+1/105 whereas Ahmes provided 1/ 30+1/42 which is by far superior; meaning that we are still far from setting one common rule governing the scribe's choice of his unit fractions. Even for the trivial cases n=3, 5, 7, 11, we have to resort to another rule, e.g. 2/n=2/(n+1)+2/n(n+1), and so on. As for the cases n=13, 17, 19, .... a third scheme had to be introduced, that is 2/n=1/a+(2a-n)/an in which a is chosen in the range n/2 < a < n.

Interestingly, a computer programme was devised in 1967 and run on a KDF-9 machine to calculate all possible unit fractions dividing 2 by odd numbers from 3 to 101 to compare them with the scribe's choice. After five hours of extensive computation, among the 22,295 different decompositions produced, and considering that there was a time span of almost 4,000 years, the computer, according to R J Gillings, did not find a decomposition superior to that given by the scribe. Scientists concluded the Ahmes results were the best in terms of minimality and optimality. Their view was based on defining a set of rules as to when an Egyptian Fraction representing a/b is minimal, using the smallest number of unit fractions possible. It is called optimal if it is minimal and the smallest unit fraction is as large as possible.

Proceeding with Ahmes table, consider the case in which the divisor is 25 say, it is given as 2/25=1/15+1/75. Whereas for divisor 75, the scribe writes 2/75=1/50+1/150. But the scribe could have very well, instead of searching for a new decomposition like he did, minimised his effort by duplicating the first one after dividing by 3, to obtain 2/75=1/ 45+1/225. This he did not do. Not only that his decomposition is superior, but assume that, later on, one needs to factorise -- into unit fractions -- the rational 4/75, sure one favours 4/75=1/25+1/75 instead of 2/45+2/225 which is difficult to attain and needs further decompositions.

There exists therefore a certain logic governing each of the decompositions. For example, the papyrus cites examples of dividing a number of loaves of bread among a group of workers. So, whereas there is no such unique decomposition, it is advisable to make sure that the unit fractions obtained be suitable most of the time for practical or relevant applications. For it is more practical to give a worker a piece equal to 1/ 150 of a loaf of bread, or of a certain task to perform, than to give him 1/225. In fact, for all divisors between 3 and 101, Ahmes Papyrus does not produce a unit fraction smaller than 1/1000.

In another context, the scribe had in mind to fulfil some sort of equity in the decomposition. For example, to divide 3 loaves of bread between 5 workers, one can give three of the workers each a 3/5 piece from each loaf, while the remaining 2/5 part of each of the three loaves be divided between the remaining 2 workers. The latter would receive each (2/5+1/5) piece. This means that 3 workers will receive each one piece of 3/5 of a loaf, whereas 2 will receive 2 pieces instead. Any person will tell you that the workers did not receive equal shares, yet they did. The scribe instead recommends the decomposition 3/5=1/3+1/5+1/15, such that each worker can be given the same pieces 1/3 of a loaf, 1/5 and 1/15. The reader may argue that various decompositions exist for such case. One can divide, say, each loaf into 2 equal pieces where each of the workers will receive a piece, while the remaining piece is partitioned into 5 sections to be distributed among them. Eventually each of them will receive 2 pieces instead of three and in bigger portions, i.e. to impose the decomposition 3/ 5=1/2+1/10 being minimal and optimal. But without trying hard to defend Ahmes' choice, it may have been wiser -- who knows -- to favour his choice of decomposition on the ground that at least 3 of the workers will have tasted a piece of the three loaves even if small, instead of trying a share from 2 loaves only. So, whereas in this particular example, one may or may not favour a certain decomposition, it may prove more practical in other applications.

Finally, a valid question is: why Ahmes was interested only in the 2/n table and not in the 3/n or 4/n, etc... simply because the latter decompositions can be deduced from the 2/n one, or that the latter is all what you need to produce Egyptian representations of arbitrary rational numbers. For say, one needs an Egyptian fraction of 3/7, we write 3/7=2/7+1/7. From Ahmes table, and substituting for 2/7=1/4+1/28, results in 3/7=1/4+1/7+1/28.

Mathematicians could also prove, in this respect, that any fraction a/b (a, b integers) has an infinite number of Egyptian fraction forms, or like it is said that every rational number is an Egyptian Number. For example



=1/2+1/8+1/12+1/48+1/72+1/144, etc....

The same applies to 1, it can be decomposed into an infinite number of Egyptian fractions. A famous example is

1=1/2+1/4+1/8+1/16+1/32+1/64+ .........

This infinite geometric series which converges in the sum to 1, appeared prior to 2000 BC as some form of binary structure. More fascinating is its relation to what is called in the Egyptian mythology the eye of Horus. The latter is the son of Osiris and Isis and his most common form is that of falcon- headed man. The most popular legend associated with Horus is the one in which he grows to manhood to avenge the death of his father Osiris by battling against his cruel uncle Set. His eye signifies the royal power or the Eye of the Providence. It accompanies the dead in their funerary rites and we find it inside the 12th layer of mummies' bandages, as instructed in the Egyptian Book of the Dead. Whereas on the enumeration side, it denoted an Egyptian Fraction of six leading terms, that is a fractional quantification system to measure parts of a whole. The entire eye measured one, while each of the parts of the eye measured a fraction of it. Shattering Horus's eye into six pieces is an outcome of the Egyptian style of carrying calculations in the form of fractions and vice versa.

The Ancient Egyptians used the six pieces or parts of Horus's eye to represent the six senses together with an arithmetical notation. It is divided as follows: 1/2 represents smell and symbolised by the right side of the eye, 1/4 represents seeing or the sensation of light symbolised by the pupil, 1/8 represents thought symbolised by the eyebrow, 1/16 represents hearing symbolised by the right side of the eye in the form of an arrow pointing towards the ear on the face, 1/ 32 represents taste by the sprouting of the wheat or grain from the planted stalk symbolised by a curved tail and finally 1/64 represents touch symbolised by a leg touching the ground. As we add all fractions together we realise they add up to 63/64, not to 64/64 which is 1. So this small error acknowledged in the Old Kingdom has been attributed to the Ancient Egyptians' belief in not being able to attain perfection in life but in eternity. Also looking at the numbers we can see the pattern of a geometric series, the one discussed above. Since each following step is 1/2 of the one before, then if we continue dividing like this, but also summing up the parts (1/2+1/4+1/8+....) we realise the great truth, namely the way to infinity. True, we come closer and closer to perfection or the all 1, yet we will reach it only in infinity. In other words, absolute perfection is unattainable, one can only aim for it, but we will never achieve it.

An interesting application to the eye of Horus is the division of a quantity of grains between a group of people. The ancient Egyptians had a unit of volume called "hekat" used solely for grains which is a little less than 5 litres. The only fractions of a hekat which were used in the market are 1/2, 1/ 4, 1/8, 1/16, 1/32 and 1/64 of a hekat. For any fraction of a hekat less than 1/64, a smaller quantity called "ro" is used instead. The latter constitutes the smallest named unit for grain and is equal to 1/320 part of the hekat, something like a tablespoon of grain. So 1/16 of a hekat contains 20 ro.

Now suppose we wish to subdivide 65 hekats between 70 persons. Each will receive 65/70 hekats, how did the scribe manage this problem; considering that he weighs in eye of Horus's units only, i.e. in multiples of 1/64 of a hekat and not in 1/70. What he does, is the following:


= (1/64)(59+3/7)

= 59/64+(1/64)(30/70)

= 59/64+(1/320)(15/7)

= (32+16+8+2+1)/64+(1/320)(2+1/7)

= 1/2+1/4+1/8+1/32+1/64+2ro+(1/7)ro.

Note that no approximations were done during the operations to obtain the above result in which the scribe rounded- off in his final stage only; for the last term is negligible being 1/7 of a ro; constituting 0.05 per cent of each one's share. Eventually, each person would then receive by today's units: half a kadah, plus a quarter of it, plus an eighth part of it, plus one in 32 parts of it, plus a 64th of it with an additional 2 tablespoons of grains. This form of remainder arithmetic allows increasingly larger rational number divisors, by creating a first-term quotient easily written as binary series with a small rounding error scaled to 1/320 of a hekat. No doubt that this problem shows the ingenious numerical talent the Egyptian scribes once had.

One of the modern applications of Egyptian fractions is the request of a specific resistance value needed in the design of an electrical circuit, a problem called in the literature the 2- Ohm problem. College students know well from their physics class, that the equivalent resistance R of two parallel resistances and is given from a law very easy to deduce, based on equating the current passing through the fictitious equivalent resistance R with the two currents passing through both resistances while maintaining same potential. One direct application of this, suppose an engineer wishes to incorporate in one of his designs a resistor of so many ohms which the manufacturer does not produce; for it is impossible that the latter displays in the market all possible ohm-values for his resistors. First, the market cannot possibly sustain it, but more important, one cannot feasibly produce resistors with values as elements of a dense subset of the real line, being, as analysis taught us, an uncountable set. Rather, manufacturers display only in the market what they call an "E12 series", i.e. resistors in sets of 12 different values, namely

10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82 ......

100, 120, 150, 180, 220, 270, 330, 390, 470, 560, 680, 820......

1000, 1200.......... Ohms, etc.....

Now suppose an engineer needs in one of his designs a resistor of 7 ohms, then he would resort to a parallel combination from the fraction 1/7=1/10+1/56+1/100+1/120+1/150 in which all the resistors belong to the E12 series, i.e. he will replace his 7 ohms resistor with 5 parallel resistors; this he reaches using a special software (computer programmes exist for such designs, yet the exact solution is by no means trivial). What I did myself instead, is to resort to Ahmes 2/n table and wrote 2/7=1/4+1/28 or that 1/7=1/8+1/56. Decomposing further 1/8 into 1/12+1/24=1/12+1/48+1/48, but then I shall have to use instead of the 48 ohms resistor a resistor of 47 ohms from the E12 table. My final fraction is 1/7=1/12+1/ 47+1/47+1/56, i.e. my resistor of 7 ohms will be simulated by 4 parallel resistors instead of 5 (I am accepting equal fractions). My solution is both minimal and optimal based on Ahmes table. The relative error of my design will not exceed 0.6 per cent, being negligible; especially that any manufactured resistor will itself be subject to some allowed tolerance of the same order.

It is fascinating that after every Egyptian mathematical demonstration, we encounter the phrase "you have found right" or "you have correctly found it". The same phrase quod erat demonstrandum, or in its abbreviated form Q E D, has followed every mathematical proof since Euclid.

Finally, in questioning the rigour of Egyptian-style proofs, debates have continued as to whether ancient Egyptian mathematics showed development of any logical or deductive methods. However we should not forget that the nature of the mathematical proof itself is subject to argument. True, the modern attitude of a logical proof is that it must be symbolic if it is to be regarded as rigorous, and that an example using selected numbers cannot claim to be scientifically sound, but it also true that a non-symbolic argument can be rigorous depending on the way it is stated. Given a particular value of the variable, the conditions for rigour are satisfied if this value of the variable is typical and that a further generalisation using any other value is possible without reservations. All the scribes' treatment follows these rules, i.e. the rigour is implicit in the method or that they viewed formulae as inferred by examples.

Assem Deif is a professor of mathematics at Cairo University and MISR University for Science and Technology.

33% Off -- Al-Ahram Weekly Annual Subscription: $50 Arab Countries, $100 Other. Subscribe Now!
--- Subscribe to Al-Ahram Weekly ---

© Copyright Al-Ahram Weekly. All rights reserved

Issue 844 Front Page
Front Page | Egypt | Region | Interview | International | Economy | Opinion | Press review | Culture | Features | Heritage | Living | Sports | Encounter | Listings | BOOKS | TRAVEL
Current issue | Previous issue | Site map