The square root of 2 on YBC 7289: Babylonian base 60 and a square root algorithm, in Python
YBC 7289 gives the square root of 2 as 1;24,51,10 in base 60. How the tablet works, the square root algorithm called the Babylonian method, and tested Python.
1;24,51,10 is the square root of 2 in base 60, as a scribe wrote it on YBC 7289, a clay school tablet from the Old Babylonian period, c. 1900 to 1600 BCE. In decimal that is 1.41421296, too small by 6.0 × 10^-7. The rule we call the Babylonian method, "average your guess with 2 divided by your guess", reaches the same digits in 3 steps from a first guess of 1. The tablet does not say how its value was found, and scholars have proposed at least 4 different routes to it.
I read the published readings of the tablet and the papers that argue about its method, then checked every number below in Python (babylonian_sqrt.py). The post is part of Ancient algorithms, implemented.
What is on YBC 7289
The tablet shows a square with both diagonals drawn. There are 3 numbers on it, as cataloged by the Cuneiform Digital Library Initiative (CDLI, entry P255048):
- 30 along the upper left side;
- 1 24 51 10 along the horizontal diagonal;
- 42 25 35 below it.
The scribe wrote no point between whole numbers and fractions, and no zero. The spaces between the groups above are mine. In the modern notation that Assyriologists use, a semicolon marks the units place and commas separate the base-60 places, so the numbers read as 30, 1;24,51,10 and 42;25,35.
Multiply them out:
So the drawing records 1 calculation: the diagonal of a square with side 30 is the side times a constant, and the constant is close to the square root of 2. Where that constant came from is the open question.
How sexagesimal numbers work
Sexagesimal means base 60. Old Babylonian scribes wrote each base-60 digit, from 1 to 59, with 2 signs: 1 sign for 1 and another for 10, repeated as needed. A digit such as 51 is 5 tens-signs and 1 ones-sign. The digits are written in a row, largest place first, the way we write decimal digits, so position gives each digit its weight.
The value of 1;24,51,10 is:
2 things are missing from the written number:
- A mark for the units place. Nothing on the tablet says where whole numbers stop and fractions begin. Robson (2001) notes that the system has no way to show "the boundary between integers and fractions". The reader supplies it from context.
- A zero. In the Old Babylonian period an empty place was left blank or not marked at all (Mansfield and Wildberger, 2017).
The result is a floating-point notation without an exponent. The digits 30 can mean 30, or 30/60 = 1/2, or 30 × 60 = 1,800. The scribe knew which from the problem; a modern reader infers it from the arithmetic.
The reason base 60 is convenient is division. 60 has 12 divisors, so 1/2, 1/3, 1/4, 1/5, 1/6, 1/10, 1/12, 1/15, 1/20 and 1/30 are all 1-digit fractions in base 60. Numbers whose only prime factors are 2, 3 and 5 are called regular. Their reciprocals end after finitely many base-60 digits, and scribes divided by multiplying with reciprocals from a table. Division by 7, 11 or 17 has no exact base-60 reciprocal.
Who wrote YBC 7289, and when
- Where it is. The Yale Babylonian Collection, New Haven, museum number YBC 7289. The 2010 exhibition Before Pythagoras at NYU's Institute for the Study of the Ancient World says it was in the collection by 1944.
- Where it came from. Unknown. The tablet reached the collection without a recorded find-spot. CDLI lists the provenience as uncertain, and the exhibition gives "Southern Mesopotamia" with a question mark.
- When. The Old Babylonian period. CDLI dates it to c. 1900 to 1600 BCE and the exhibition to the 19th to 17th centuries BCE. Neither says what the date rests on. With no find-spot, it cannot rest on an excavated layer.
- First published. Otto Neugebauer and Abraham Sachs, Mathematical Cuneiform Texts (1945), pages 42 and 43.
- Who wrote it. A student, most likely. Mansfield (2023) calls it a student exercise and says the student would have copied the constant from a table of constants such as YBC 7243, another Yale tablet, which lists
1;24,51,10as the factor for "the diagonal of a square" (Neugebauer and Sachs 1945, p. 136; Fowler and Robson 1998, p. 370).
The name "Babylonian" refers to the period. Old Babylonian mathematical tablets come from Larsa, Ur, Nippur, Sippar and other sites, and none of the known ones comes from the city of Babylon itself.1
The tablet, transcribed and translated
There are no words on the obverse, only numbers and the drawing. Here is the face of the tablet as CDLI transcribes it, with my reading:
| On the tablet | Modern notation | Value | My reading |
|---|---|---|---|
| 30 | 30 | 30 | the side of the square |
| 1 24 51 10 | 1;24,51,10 | 30547/21600 | the diagonal of a square of side 1 |
| 42 25 35 | 42;25,35 | 30547/720 | the diagonal of this square, side 30 |
CDLI's catalog adds that the reverse may carry an erased exercise with a right triangle.
The words come from the companion tablet. YBC 7243 is a list of constants, and it gives 1;24,51,10 as the factor for "the diagonal of a square". Another list of constants, TMS 3 from Susa (Robson 2001, note 17), gives 1;25 for the same diagonal (Mansfield 2023, citing Fowler and Robson 1998, p. 374). So Old Babylonian scribes had at least 2 values for the square root of 2.
2 readings of the same digits
Because the tablet has no point, the side 30 has 2 natural readings, and each gives the diagonal a different meaning.
Reading 1: the side is 30. Then the diagonal is 30 × 1;24,51,10 = 42;25,35, about 42.43. This is the reading in the first section.
Reading 2: the side is 0;30, which is 1/2. Then the diagonal is 0;30 × 1;24,51,10 = 0;42,25,35, about 0.7071. That is close to 1/√2, the diagonal of a square with side 1/2. Cut off after 3 places, 1/√2 is 0;42,25,35, the same digits.
Under the second reading, 1;24,51,10 and 0;42,25,35 are close to being reciprocals of each other, since √2 × (1/√2) = 1. Their product is 0;59,59,59,49,00,50, 1 minus about 8.5 × 10^-7. Old Babylonian division worked through reciprocal pairs. The digits on the tablet fit both, and the tablet gives no way to choose.
What the tablet leaves open
The tablet records values. It leaves 3 things unsaid:
- How
1;24,51,10was computed. No Old Babylonian tablet known to me states a procedure that ends in this number. - Who computed it. If the student copied it from a list like YBC 7243, then the method belongs to whoever made the list, earlier.
- Which reading the student meant. Side 30 or side 0;30. The arithmetic is the same either way.
So "the Babylonian method", as the name of the averaging iteration, is a modern label. The iteration reaches the tablet's value, and no tablet records which method the scribe used.
The candidate methods, worked
An Old Babylonian problem text shows how scribes approximated a diagonal. BM 96957 + VAT 6598, a tablet of problems from Sippar, asks in problem 18 for the diagonal of a gate 0;40 high and 0;10 wide (in the length unit nindan, about 6 meters). My paraphrase of the procedure, following the translation Mansfield (2023) gives from Fowler and Robson (1998, pp. 371 to 372):
- Square the width:
0;10² = 0;01,40. - Multiply by the reciprocal of the height:
0;01,40 × 1;30 = 0;02,30. - Halve it:
0;01,15. - Add it to the height:
0;40 + 0;01,15 = 0;41,15. That is the diagonal.
In modern terms this is d ≈ h + w²/(2h). The true diagonal is 0;41,13,51,..., so the rule overshoots by about 3.2 × 10^-4. It is 1 step of the averaging iteration: a rectangle with sides 0;40 and 0;42,30 has the same area as the 2 squares, and the scribe takes the average of its sides.
Now apply the same idea to a square of side 1, whose diagonal squared is 2. Start with a rectangle of area 2 and sides 2 and 1, and replace each side pair a, b with the average (a + b)/2 and 2 divided by that average.
| Step | Average | In base 60 | Error |
|---|---|---|---|
| 0 | 2 | 2 | +0.586 |
| 1 | 3/2 | 1;30 | +0.0858 |
| 2 | 17/12 | 1;25 | +0.00245 |
| 3 | 577/408 | 1;24,51,10,35,17,38,... | +2.1 × 10^-6 |
Step 2 gives 1;25, the value on TMS 3. Step 3 gives a number whose first 3 places are the tablet's 1;24,51,10. The difficulty is at step 3. It needs 2 ÷ 1;25, and 1;25 = 17/12 is irregular: 17 has no reciprocal in base 60. Old Babylonian school problems were set up in advance to avoid irregular divisors (Mansfield 2023, citing Sachs 1952 and Høyrup 2002). The 4 proposals below differ in how they get past this one division.
1. Averaging with an approximate reciprocal. Neugebauer and Sachs (1945, p. 43) proposed repeated averaging. Mansfield (2023) supplies the missing division. 2 Old Babylonian tables do list approximate reciprocals of irregular numbers, M10 and YBC 10529, and Mansfield compares his value to the 3-place values on YBC 10529. Take 1/1;25 ≈ 0;42,21,10, which is the true reciprocal cut off after 3 places. Then:
The result is the tablet's value exactly, with no rounding at the end. The approximate reciprocal is a conjecture: Sachs noted in 1946 that no Old Babylonian problem text uses an approximate reciprocal explicitly, and Mansfield says this is still true.
2. A completed square with a regular number. Fowler and Robson (1998) read problem 18 geometrically: you start with a square and add or remove a thin L-shaped border, a gnomon, to reach the target area. Algebraically this is the same rule. To avoid dividing by 1;25, they replace it with a nearby regular number such as 1;25,20 (= 64/45) (Fowler and Robson 1998, p. 375, as reported by Mansfield 2023). One step from 1;25,20 gives 1;24,51,15. That is close, and it misses the last digit by 5.
3. A regular number, then a check by squaring. Buckle (2023) starts from the regular number 1;24,22,30 and also gets 1;24,51,15. He then has the scribe square candidates: 1;24,51² is 1;59,59,31,21, below 2, and 1;24,51,15² is 2;00,00,13,46,33,45, above 2. So the last digit lies between 0 and 15, and trying the values in that range picks out 10.
4. Side and diagonal numbers. Høyrup (2002) suggested the pairs that the Greek writer Theon of Smyrna describes: start with side 1 and diagonal 1, and replace (s, d) with (s + d, 2s + d). The 8th pair is 408 and 577, and 577/408 is the step-3 value above. Mansfield points out that dividing by 408 meets the same irregular divisor, since 408 = 8 × 3 × 17.
All 4 routes reach 1;24,51,10 or come within 1 digit of it. The evidence on the tablets does not decide between them.
Why the square root algorithm works
Think of the square root of N as the side of a square with area N. If x is too large, then N/x is too small, and the rectangle with sides x and N/x has area N. The true side lies between them, so their average is a better guess.
How much better follows from 1 line of algebra. Let m = (x + N/x)/2. Then:
The new square overshoots the target area by exactly the square of half the difference of the old sides. In the geometric picture, that is the small corner square left over when you rebuild the rectangle as an L shape: it is the same identity behind the gnomon in Fowler and Robson's reading, and behind the reciprocal pairs on Plimpton 322.
Writing x = √N + e for a guess with error e, the new error is
so each step squares the error. The table above shows it: errors of 0.0858, 0.00245, 2.1 × 10^-6, then 1.6 × 10^-12 at step 4. The number of correct digits roughly doubles each time.
The Python
This version uses exact fractions, so it never rounds. It formats numbers in base 60 and runs the averaging iteration.
from fractions import Fraction
def to_base60(x: Fraction, places: int) -> str:
"""x cut off after `places` base-60 digits, written like 1;24,51,10."""
whole = x.numerator // x.denominator
rest = x - whole
digits = []
for _ in range(places):
rest *= 60
digit = rest.numerator // rest.denominator
digits.append(f"{digit:02d}")
rest -= digit
return f"{whole};" + ",".join(digits)
def averaging(n: int, guess: Fraction, steps: int) -> list[Fraction]:
"""Guesses for the square root of n, each the average of x and n/x."""
xs = [guess]
for _ in range(steps):
x = xs[-1]
xs.append((x + n / x) / 2)
return xs
for x in averaging(2, Fraction(1), 3):
print(x, to_base60(x, 3))
# 1 1;00,00,00
# 3/2 1;30,00,00
# 17/12 1;25,00,00
# 577/408 1;24,51,10
tablet = Fraction(1) + Fraction(24, 60) + Fraction(51, 60**2) + Fraction(10, 60**3)
print(tablet, tablet * 30, to_base60(tablet * 30, 2))
# 30547/21600 30547/720 42;25,35
The repo version has the same pieces as to_sexagesimal, parse_sexagesimal and heron_steps, and the tests check:
30 × 1;24,51,10 = 42;25,35exactly;1;24,51,10is the square root of 2 cut off after 3 base-60 places: its square is below 2, and adding 1 in the third place takes the square above 2;0;42,25,35is1/√2cut off after 3 places, which is the second reading;- 2 averaging steps from
3/2give577/408, which cuts off to1;24,51,10.
Against the modern method
The averaging iteration is Newton's method applied to f(x) = x² - N. Newton's step is x - f(x)/f'(x) = x - (x² - N)/(2x) = (x + N/x)/2, the same formula.
For whole numbers, Python has math.isqrt, which returns the largest integer whose square does not exceed its argument. That gives a direct check on the tablet. Cutting the square root of 2 off after 3 base-60 places is the same as taking the integer square root of 2 × 60^6 and dividing by 60^3:
>>> from fractions import Fraction
>>> from math import isqrt
>>> isqrt(2 * 60**6)
305470
>>> Fraction(305470, 60**3)
Fraction(30547, 21600)
30547/21600 is 1;24,51,10, digit for digit. One more place, isqrt(2 * 60**8), gives 1;24,51,10,07. The 4th digit the tablet leaves out is 7.
What the modern routine has that a scribe lacked is cheap division by any number. Every proposal in the section above is a way of handling 1 division by an irregular number. With division available, 3 averaging steps from 1 are enough, and a 4th step brings the error down to 1.6 × 10^-12.
Parallels and lineage
- Heron of Alexandria, Metrica (1st century CE). Gives 1 step of the averaging rule in a worked example, its Proposition 8 according to Mansfield (2023), which is why the rule is also called Heron's method. The Heron's method post in this series covers it.
- Theon of Smyrna. Side and diagonal numbers, which produce the same fractions 17/12 and 577/408 by a different rule (Høyrup 2002, as cited by Mansfield 2023).
- Newton and Raphson (17th century). The general method for roots of equations, which gives the averaging rule for
x² - N.
The sources I read do not document a route from Old Babylonian practice to Heron. The rule is natural enough to find more than once, and I treat these as parallels.
What is debated
- The method behind
1;24,51,10. Averaging with an approximate reciprocal (Neugebauer and Sachs 1945; Mansfield 2023), a gnomon with a regular stand-in (Fowler and Robson 1998), a regular stand-in followed by squaring (Buckle 2023), or side and diagonal numbers (Høyrup 2002). Each reaches the value or comes within 1 digit. - Whether scribes divided by irregular numbers. 2 tables of approximate reciprocals survive. No known problem text uses one.
- Which reading of the side the student meant. 30 or 0;30. Both are consistent with the digits.
- The date range. CDLI and the 2010 exhibition give c. 1900 to 1600 BCE. Some secondary sources give c. 1800 to 1600 BCE.
Key takeaways
- YBC 7289 (Yale Babylonian Collection, Old Babylonian, c. 1900 to 1600 BCE) writes the square root of 2 as
1;24,51,10, which is the true value cut off after 3 base-60 places, too small by6.0 × 10^-7. - Base 60 on clay has no zero and no point, so the side 30 can be read as 30 or as 1/2, and both readings fit the digits.
- The averaging iteration
x -> (x + 2/x)/2gives 3/2, 17/12 and 577/408 from a first guess of 1. The third value cuts off to the tablet's digits, and the second,1;25, is another attested value. - The tablet does not say how its value was found. The hard step for a scribe is dividing by the irregular number
1;25, and 4 published proposals handle it in different ways. - The code and tests are in ancient-algorithms. Next in the series: Plimpton 322, a table of right triangles from the same period.
Sources
- O. Neugebauer and A. Sachs, Mathematical Cuneiform Texts. American Oriental Series 29, American Oriental Society, 1945. YBC 7289 on pp. 42 to 43.
- D. Fowler and E. Robson, "Square root approximations in Old Babylonian mathematics: YBC 7289 in context". Historia Mathematica 25(4), 1998, 366 to 378. doi:10.1006/hmat.1998.2209.
- D. F. Mansfield, "Mesopotamian square root approximation by a sequence of rectangles". British Journal for the History of Mathematics 38(3), 2023, 175 to 188. Open access.
- D. Buckle, "How the estimate of √2 on YBC 7289 may have been calculated". Historia Mathematica 62, 2023, 3 to 18.
- J. Høyrup, Lengths, Widths, Surfaces: A Portrait of Old Babylonian Algebra and Its Kin. Springer, 2002.
- E. Robson, "Neither Sherlock Holmes nor Babylon: a reassessment of Plimpton 322". Historia Mathematica 28, 2001, 167 to 206.
- D. F. Mansfield and N. J. Wildberger, "Plimpton 322 is Babylonian exact sexagesimal trigonometry". Historia Mathematica 44, 2017, 395 to 419. Open access.
- Cuneiform Digital Library Initiative, YBC 7289, P255048, with a CC0 photograph from the Yale Peabody Museum.
- Institute for the Study of the Ancient World, NYU, Before Pythagoras: YBC 7289, 2010.
Footnotes
-
Robson (2001, p. 171) notes that no Old Babylonian mathematics is known from the site of Babylon, whose lower layers lie below the water table. ↩
Common questions
What is YBC 7289?↓
YBC 7289 is a clay tablet in the Yale Babylonian Collection from the Old Babylonian period (c. 1900 to 1600 BCE), place of origin unknown. It shows a square with 30 written on one side and 2 numbers along the diagonal, 1;24,51,10 and 42;25,35, in base 60. The first is the square root of 2 to 3 base-60 places, and the second is 30 times the first. Neugebauer and Sachs published it in 1945.
How do you find a square root using the Babylonian method?↓
Guess a value x for the square root of N, then replace x with the average of x and N/x, and repeat. For N = 2 and a first guess of 1, the steps give 3/2, 17/12 and 577/408. The last one is 1;24,51,10,35 in base 60, which cut off after 3 places is the value on YBC 7289. Each step roughly doubles the number of correct digits.
What is the Babylonian method?↓
It is the modern name for the averaging iteration x -> (x + N/x) / 2 for the square root of N, the same iteration as Newton's method applied to x^2 - N. It is also called Heron's method, after a worked step in Heron of Alexandria's Metrica (1st century CE). An Old Babylonian problem text, BM 96957 + VAT 6598, uses 1 step of the same rule to estimate a diagonal, but no surviving tablet says how the value on YBC 7289 was computed.
How accurate is the Babylonian square root of 2?↓
1;24,51,10 equals 30547/21600, or 1.41421296 in decimal. The square root of 2 is 1.41421356, so the tablet's value is too small by 6.0 x 10^-7. Its 3 base-60 digits after the point are the first 3 digits of the true value; the next true digit is 7.