6 min read
O02

Origins · No. 18

The Man Inside Every Algorithm

Every app on your phone carries the name of a ninth-century Baghdad scholar most people have never heard of.

· · 6 min · 1,455 words

In short

  • The word algorithm comes from the Latinised name of al-Khwarizmi, a scholar who worked in Baghdad in the ninth century.
  • The word algebra comes from al-jabr, a term in the title of his book on solving equations.
  • His real breakthrough was method, turning problem solving into general procedures that work for any numbers.
  • The House of Wisdom shows what happens when a society treats knowledge from everywhere as worth gathering, translating and improving.
  • Every piece of software today is a direct descendant of the idea that a careful sequence of steps can stand in for genius.

Open any app on your phone. The feed that decides what you see, the map that finds you a route, the keyboard that guesses your next word. Behind every one of them is something we call an algorithm.

Almost nobody who says that word knows they are saying a man's name.

It belongs to Muhammad ibn Musa al-Khwarizmi, a scholar who lived roughly twelve centuries ago and worked in Baghdad. His name, bent and reshaped by centuries of Latin scribes, became the word for a precise sequence of steps that solves a problem. Every line of code ever written sits downstream of the idea he made famous.

A city built for knowledge

To understand al-Khwarizmi, you have to picture Baghdad in the early ninth century.

The city had been founded only about two generations earlier by the Abbasid caliph al-Mansur, laid out as a great round city on the Tigris. It quickly became one of the largest and richest cities in the world, a meeting point for traders, travellers and ideas moving between Persia, India, the Mediterranean and beyond.

Under the caliph al-Ma'mun, Baghdad became home to what is remembered as the House of Wisdom, Bayt al-Hikma. Historians still debate exactly what it was: a library, a translation bureau, a gathering place for scholars, probably some mixture of all three. What is not in doubt is what it did. Scholars there translated works of Greek, Persian and Indian learning into Arabic, studied them, argued with them and built on them.

Think about how unusual that attitude was. The knowledge of rival civilisations was treated not as a threat but as raw material. Euclid's geometry, Ptolemy's astronomy, Indian mathematics: all of it was gathered, carefully translated and put to work.

Al-Khwarizmi was one of the scholars who did that work. He likely had family roots in Khwarazm, a region of Central Asia south of the Aral Sea, which is where his name comes from. "Al-Khwarizmi" simply means "the one from Khwarazm".

The book that named a field

His most famous work has a long title that is usually shortened to Al-Kitab al-Mukhtasar fi Hisab al-Jabr wal-Muqabala. In English, roughly: The Compendious Book on Calculation by Restoring and Balancing.

Those two words in the middle are the heart of it.

Al-jabr means restoring or completing. If a quantity has been subtracted on one side of an equation, you restore it by adding it to both sides. Al-muqabala means balancing: cancelling equal terms that appear on both sides. Anyone who has moved an x from one side of an equation to the other in school has done al-jabr, whether they knew it or not.

When the book was translated into Latin in the twelfth century, the word al-jabr came along with it and became algebra. A whole branch of mathematics is named after a single operation in the title of a book written in Baghdad.

There is a lovely side note here. In medieval Spain, the same Arabic word also travelled into everyday language in a different sense. An algebrista was a bone-setter, someone who restored broken bones to their proper place. Restoring an equation and restoring an arm: same root, same idea.

What surprises people is what the book does not contain. There are no x's and y's. Al-Khwarizmi wrote everything in words. Problems were described in sentences, and solutions were justified with geometry, by drawing squares and rectangles and literally completing them. The symbolic algebra you learned in school came centuries later.

He also wrote with practical problems in mind. A large part of the book deals with calculations people actually needed to make, including the division of inheritances under Islamic law, which could become genuinely complicated with several heirs. Algebra, in other words, was born partly as a tool for fairness.

How a name became a word

The word algorithm took a stranger road.

Al-Khwarizmi also wrote a book on arithmetic using the Indian system of numerals, the nine digits plus zero that let you write any number using place value. The Arabic original is lost. What survives are Latin versions, and some of them begin with a phrase along the lines of "Dixit Algorizmi": thus spoke Algorizmi.

For European readers, "Algorizmi" became shorthand for the method in the book. Doing arithmetic with these new numerals came to be called algorism. Over centuries, under the influence of the Greek word arithmos, meaning number, the spelling drifted toward algorithm. Eventually the word broke free of arithmetic entirely and came to mean any precise, step-by-step procedure.

A man's name became the word for a method, because the method was what people remembered.

That system of numerals itself had an enormous journey. It reached Europe partly through these translations and partly through the work of Fibonacci, whose Liber Abaci in the early thirteenth century argued that merchants should abandon Roman numerals. Try doing long multiplication with Roman numerals and you will understand why he won.

Today we call them Arabic numerals. In much of the Arab world, people call them Indian numerals. Both names are partly right, and the truth is a relay: an Indian invention, refined and spread by scholars writing in Arabic, adopted by Europe, and now printed on every price tag on Earth.

The real idea underneath

It would be easy to treat all this as trivia, a fun fact about word origins. But the deeper legacy is not a word. It is a way of thinking.

Before methods like al-Khwarizmi's, a lot of mathematics worked like a collection of clever tricks. A particular problem had a particular solution, often found by insight. If you were brilliant, you could solve it. If you were not, you were stuck.

His approach was different. He sorted equations into a small number of types and gave a procedure for each type. Follow the steps and you get the answer, for any numbers, every time. You do not need to be a genius. You need to be careful.

That shift sounds modest. It is enormous. It means knowledge can be packaged into a procedure and handed to someone else. It means a method can be checked, taught, repeated and improved. It means the intelligence lives partly in the steps, not only in the person.

That is exactly what a computer program is. A program is a procedure so precise that even a machine with no understanding at all can follow it. When engineers today write code for search, maps, payments or AI models, they are doing what al-Khwarizmi did: breaking a messy problem into general steps that work every time.

Why this matters now

There is a reason this story matters beyond history class.

For one thing, it corrects a picture many people carry without noticing, in which modern science appears from nowhere in Renaissance Europe. The real story is a long chain of hands. Greek and Indian ideas were preserved, translated, combined and advanced in Baghdad, Cairo, Córdoba and other cities across the Islamic world, and then passed on. For several centuries, much of the frontier of mathematics and astronomy was written in Arabic.

For anyone growing up in the Arab world, that history is worth knowing in detail, not as a source of nostalgia, but as a reminder of what this part of the world has done before. The habits that made the House of Wisdom work are not mysterious. Curiosity about what others know. Respect for translation and careful study. Rulers and patrons willing to fund scholars for the long term. A belief that practical problems deserve rigorous answers.

Those habits are available to any society that chooses them. Including ours, now.

There is also a lesson for anyone building with technology today. The most powerful contributions are often not single clever answers but methods: ways of solving a whole class of problems that other people can pick up and use. Al-Khwarizmi did not just solve equations. He showed others how to solve equations, and that is why his name is still everywhere.

The name in your pocket

The House of Wisdom did not survive. When the Mongols sacked Baghdad in 1258, the city's libraries were destroyed along with much else, and the golden age of the city ended in fire.

But ideas that have been written down clearly enough to be taught do not burn so easily. Al-Khwarizmi's methods had already travelled west and east. They were copied, translated, argued over and improved for centuries, until they became so ordinary that nobody remembers they were once new.

Tonight, billions of people will scroll, search, pay, navigate and talk to machines, and every one of those actions will run on step-by-step procedures. Each one is, in a small way, a sentence that begins Dixit Algorizmi.

Thus spoke the man from Khwarazm. We are still listening.

Further reading

  • The House of Wisdom — Jim Al-Khalili
  • Lost Enlightenment — S. Frederick Starr
  • The Universal History of Numbers — Georges Ifrah

More from the shelf

O05 · Origins · 6 minThe Man Who Looked at LightA thousand years ago in Cairo, Ibn al-Haytham sat in a dark room and decided not to believe anything he could not test. O01 · Origins · 8 minFrom Pearls to PortsDubai lost the only industry it had, then built for ships, planes and traders that did not exist yet. M01 · Machines · 7 minIn Defense of FrictionWe spent decades removing effort from everything, and accidentally removed some of the meaning with it.

See the whole library →