Prayer Times & Quran PlusMuslim Adhan, Qibla, Ramadan
Coming to the App Store

Muslim Adhan, Qibla, Ramadan

History of science

Al-Khwarizmi and where the word algorithm comes from

A Baghdad scholar of the ninth century gave his name to algorithm and his book's title to algebra. What the manuscripts, translations and historians say.

Every search, every route a phone plans and every prayer time this site prints is worked out by an algorithm: a fixed list of steps that turns a question into an answer. The word is the name of a man. Muhammad ibn Musa al-Khwarizmi worked in Baghdad in the ninth century, and two of his books, one on reckoning with Indian numerals and one on solving equations, carried his name and his method into Latin Europe. The first gave us algorithm; the title of the second gave us algebra (Karpinski, pp. 15 to 16; MacTutor).

Who he was

Very little is known of his life. Modern reference works give his dates as about 780 to about 850 (Brentjes; MacTutor). Neither his birth nor his death is dated in any surviving source, and the edition of his algebra published in 1915 already placed his working life by the one firm link it had: he worked in the library of the caliph al-Mamun, who reigned from 813 to 833 (Karpinski, p. 14). By the tabular Hijri count those years fall in 197 to 198 and 217 to 218 AH (calculated).

That link comes from the Fihrist, a catalogue of learned men and their books completed around 987 by Ibn al-Nadim, which says he was born in Khwarizm, the region south of the Aral Sea, and that astronomers relied on his tables (Karpinski, pp. 13 to 14). The historian al-Tabari gives him two other names, al-Qutrabbuli, pointing to a town near Baghdad, and al-Majusi, a word for a Zoroastrian (Brentjes).

Historians read those names in different ways. G. J. Toomer took them to mean that his family came from Khwarizm and had Zoroastrian forebears. Roshdi Rashed argued that al-Tabari’s text names two different men, and that a single small word meaning “and” dropped out of an early copy, so that the two were run together (MacTutor). The question is open.

The House of Wisdom question

Popular accounts place him in the House of Wisdom, and one standard biography says al-Mamun founded it and that al-Khwarizmi worked there alongside the Banu Musa brothers (MacTutor). A more cautious entry, written for an encyclopedia of astronomers, notes only that Ibn al-Nadim attached him to the caliph’s library, says it is unclear what that meant, and records that modern scholars still debate whether the House of Wisdom was simply a library or also a place of translation and research (Brentjes). Both accounts agree that he worked in Baghdad, close to the court, and that he dedicated books to al-Mamun.

What he wrote

The works known under his name cover most of the mathematical sciences of his day (Brentjes):

  • Astronomical tables. A set of tables known as the Sindhind, dedicated to al-Mamun. No Arabic copy survives; it is known from later works and from a Latin version of a revision made in Muslim Spain, translated in the 12th century, presumably by Adelard of Bath.
  • A geography. A book on the shape of the Earth that survives, combining much of Ptolemy’s Geography with coordinates and place names that are not Ptolemy’s. One count gives coordinates for 2,402 places (MacTutor).
  • Shorter works on the sundial and the astrolabe, a treatise on the Jewish calendar written no earlier than 823 or 824, and a history that is lost. The surviving fragments on the astrolabe may or may not be his.

Brentjes also notes that his part in an expedition sent to measure the Earth, once taken for granted, has been questioned.

The algebra

The book that made him famous survives in Arabic in a single manuscript in the Bodleian Library in Oxford, which Frederic Rosen edited and translated into English in 1831 (Karpinski, p. 13, note 2). In its preface the author says the caliph’s support for scholars encouraged him to write a short book on calculating by completion and reduction, limited to what people most often need: dividing inheritances and legacies, lawsuits and trade, measuring land and digging canals (Rosen, pp. 3 to 4). The Arabic words for completion and reduction are al-jabr and al-muqabala (MacTutor), and the first of them, used in the title, became the word algebra (Karpinski, p. 16).

Its date is not certain. A recent university article places it around 830 (Passey); the 1915 edition reasoned from the order of his books that his most productive years were about 825 (Karpinski, p. 14).

Six cases and a rule for each

The book works only with three kinds of quantity: the root (the unknown), the square (the root multiplied by itself) and the plain number. From these it builds exactly six kinds of equation, three simple and three compound, and gives a rule and worked examples for each (Rosen, pp. 5 to 13). Nothing is written in symbols. Every problem is stated in words, the numbers often counted in dirhems, and every rule is a short list of steps.

The best known example is a square and ten of its roots equal to thirty nine. The rule is to halve the number of roots, giving 5; multiply that by itself, giving 25; add it to thirty nine, giving 64; take the root, 8; and take away the half, which leaves 3. The unknown root is 3 and the square is 9 (Rosen, p. 8).

What makes the book more than a list of recipes is that it then proves the rule with a drawing. The square is drawn as a square, the ten roots as strips along its sides, and the number that has to be added is the missing corner that makes the whole figure a larger square (Rosen, pp. 13 to 16). The drawing below is that second figure, redrawn to scale.

Completing the square for a square and ten roots equal to thirty nineA square of side x is drawn with two strips, each 5 long and x wide, along two of its sides; together they are the ten roots. The square and the strips make 39. The empty corner, 5 by 5, is 25. Adding it makes a larger square of 64, whose side is 8. Taking away 5 leaves x = 3.x² + 10x = 39, drawn to scalex²5x5x5 × 5= 25, addedx5x5side of the larger square: √64 = 8
  1. Halve the ten roots: 5.
  2. Multiply the half by itself: 5 × 5 = 25, the missing corner.
  3. Add it to the thirty nine: 25 + 39 = 64, the larger square.
  4. Take its root: 8, the larger square's side.
  5. Take away the half: 8 − 5 = 3. The square sought is 9.
Calculated and drawn to scale, one unit to one grid step. The shape follows the second of the two figures al-Khwarizmi gives for this example, in which the ten roots are halved and laid along two sides of the square (Rosen's translation, pages 15 to 16); the five steps are his rule for this kind of equation, in plain words.

The six cases, each with one of his own examples calculated

CaseHis exampleModern formRoot
1Squares equal rootsA square equals five of its rootsRosen, p. 6x² = 5x5
2Squares equal numbersFive squares equal eightyRosen, p. 75x² = 804
3Roots equal numbersFour roots equal twentyRosen, p. 74x = 205
4Squares and roots equal numbersA square and ten roots equal thirty nineRosen, p. 8x² + 10x = 393
5Squares and numbers equal rootsA square and twenty one equal ten rootsRosen, p. 11x² + 21 = 10x3 or 7
6Roots and numbers equal squaresThree roots and four equal a squareRosen, p. 12 to 133x + 4 = x²4

Roots worked out by this site's code from each example and checked in its tests against the answers printed in the book. The book states every example in words, not symbols; the modern form is added here for the reader. As in the book, only positive roots are given, and the fifth case has two.

The fifth case, a square and twenty one equal to ten roots, is the one where the rule can give two answers, three or seven, and the book says so. It also warns that when half the roots multiplied by itself is smaller than the number, the problem has no solution (Rosen, pp. 11 to 12).

How a name became a word

Al-Khwarizmi’s book on reckoning with the Indian numerals, the nine figures and a zero written by place value, is lost in Arabic. It survives only in Latin, in one copy kept at Cambridge University Library, published in Rome in 1857 by Baldassarre Boncompagni (Karpinski, p. 15). The Latin version is thought to have been changed a good deal from the original (MacTutor).

The Latin text opens with the words “Dixit algoritmi”, meaning “al-Khwarizmi says”. From that use of his name came the medieval word algorism, and its old English form augrim used by Chaucer, for the new way of reckoning with Indian numerals; until the 18th century algorism was the usual name for arithmetic done with them (Karpinski, pp. 15 to 16). The arithmetic books that spread the numerals most widely in Europe were not his own but works that leaned on it: a verse Algorism by Alexander de Villa Dei, about 1220, and the Algorismus of John of Halifax, known as Sacrobosco, about 1250, which was still printed for university teaching in the 15th and 16th centuries.

The word kept moving. The general sense used today, a procedure that solves a problem in a finite number of steps, only settled in the early 20th century (Passey).

The algebra in Latin

The algebra crossed into Latin separately. Robert of Chester translated it while living in Segovia, in the year 1183 of the Spanish era, which is 1145 CE (Karpinski, p. 13), or 539 to 540 AH by the tabular count (calculated). Karpinski’s edition notes that the preface praising the caliph, which Rosen translated from the Arabic, is missing from the Latin versions that survive. A second Latin version, made at about the same time, was attributed by the historian A. A. Bjornbo to Gerard of Cremona, an attribution Karpinski thought probable but complicated by a looser adaptation that also carries Gerard’s name (Karpinski, introduction). The encyclopedia entry is more cautious, saying only that at least two translators turned the algebra into Latin (Brentjes).

Where historians disagree

  • How original he was. Rashed has written that the originality of the algebra can hardly be overstated; Toomer called his achievements at best mediocre, and J. N. Crossley suggested he may not have been very original (MacTutor).
  • Father of algebra. Solomon Gandz argued that he has a better claim to the title than the Greek mathematician Diophantus, because he taught algebra in an elementary way and for its own sake, while Diophantus was mostly concerned with the theory of numbers (MacTutor). The title is a later label, not something the sources settle.
  • Whether he knew Euclid. Toomer and Rashed thought he knew Euclid’s Elements; Gandz thought he did not, and the MacTutor authors suggest other geometrical works were the influence (MacTutor).
  • His origins and the House of Wisdom, as set out above.

What is not in doubt is the method he wrote down: name the kind of problem, apply a fixed series of steps, and show why the steps work. That is still what an algorithm is.

Sources

Each source below is listed with the date it was read. Links in the text go to the page that supports the sentence. Figures marked calculated are worked out by this site's own code each time the site is built, from the rules the sources give.

  1. Muhammad ibn Musa al-Khwarizmi, The Algebra of Mohammed ben Musa, Arabic text edited and translated by Frederic Rosen (London: Oriental Translation Fund, 1831), pp. 1 to 16. Internet Archive scan, University of Toronto copy Read 3 December 2026.
  2. Louis Charles Karpinski, Robert of Chester's Latin Translation of the Algebra of al-Khowarizmi (New York: Macmillan, 1915), introduction, pp. 13 to 16. Internet Archive scan Read 3 December 2026.
  3. Sonja Brentjes, "Khwarizmi", in Thomas Hockey et al. (eds.), The Biographical Encyclopedia of Astronomers (Springer, 2007), pp. 631 to 633. Online at McGill University's Institute of Islamic Studies Read 3 December 2026.
  4. J. J. O'Connor and E. F. Robertson, "Abu Ja'far Muhammad ibn Musa Al-Khwarizmi", MacTutor History of Mathematics, University of St Andrews Read 3 December 2026.
  5. Debbie Passey, "Why are algorithms called algorithms? A brief history of the Persian polymath you've likely never heard of", The Conversation, 8 May 2024, republished by the University of Melbourne Read 3 December 2026.

This article is history, drawn from the academic and historical record and published by the makers of Prayer Times & Quran Plus. It is not religious guidance, and it does not rule between schools or traditions. Corrections are welcome at support.

Read next