The Brief History of Artificial Intelligence
Chapter 2: The Middle Ages

Middle East

14 min read

Illustrations

1 / 5
Al-Khwarizmi and the algorithm

Al-Khwarizmi (780-850): father of algebra and algorithms, founder of computational thinking.

Architects of Mechanical Thought: How the Medieval Middle East Laid the Foundations of Artificial Intelligence

Every technological revolution has its forgotten ancestors. Before the first computer lit up in an American laboratory, before the word "algorithm" became daily vocabulary for twenty-first-century engineers, scholars were already writing by the light of oil lamps the principles that would make all this possible. They lived in Baghdad, Cairo, Córdoba. They spoke Arabic. And while medieval Europe was barely emerging from what some call the Dark Ages, these architects of mechanical thought were building, brick by brick, the conceptual edifice on which artificial intelligence rests today.

This is a story of transmission. Of a heritage that has traveled across centuries and continents. Of ideas born in the palaces of Baghdad that crossed the desert, crossed the Mediterranean, and ended up germinating in European universities before flourishing, a millennium later, in the data centers of Silicon Valley.

Yesterday — The House of Wisdom and the Birth of the Algorithm

Baghdad, Center of the World

In 813, Caliph Al-Ma'mun transformed Baghdad into what Alexandria had been in Antiquity: the intellectual center of the known world. He founded the Bayt al-Hikma—the House of Wisdom—where astronomers, mathematicians, philosophers, and translators from Persia, India, Greece, and China crossed paths.

His father, the legendary Harun al-Rashid, had already begun this work of gathering as early as 786. But Al-Ma'mun, versed in the sciences since his youth, exceeded the ambition of his predecessors. He had a pavilion built for each scientific discipline. The place expanded until it became Dar al-Hikma, offering hospitality to scholars from around the world. Nicknamed "the Sage of Baghdad," Al-Ma'mun made his capital the theater of intense intellectual activity.

Imagine a place where the writings of Aristotle met Indian numerals, where Euclidean geometry conversed with Persian medicine. The first director, a Persian named Salm, supervised translations. The Nestorian Christian Hunayn ibn Ishaq, with the help of his son and nephew, translated about a hundred works from Greek to Syriac, then from Syriac to Arabic. This intellectual crucible would engender something new: a systematic way of solving problems.

Al-Khwarizmi: The Grandfather of Computing

It was there that a man worked whose name still resonates every time a computer program executes. Muhammad ibn Musa al-Khwarizmi, born around 780 in Khiva, near present-day Uzbekistan, wrote a treatise that would change the course of history: the Hisab al-Jabr wa'l-muqabala.

From this title, we derived the word "algebra"—from al-jabr, meaning "restoration" or "completion." From the author's name, Latinized to "Algoritmi" by European monks in the twelfth century, we derived the word "algorithm." Two words that today define our relationship with intelligent machines.

What al-Khwarizmi invented was not just another mathematical formula. It was a method: a series of step-by-step, reproducible instructions that allowed any equation of a certain type to be solved. Before him, mathematicians solved problems case by case, through intuition or trial and error. After him, there existed a universal procedure. It could be taught. It could be repeated. It could—and this is the crucial point—be executed by someone who did not understand what they were doing, provided they followed the instructions.

We have just described the fundamental principle of every computer program.

Al-Khwarizmi did not stop there. Enthused by reading an Indian treatise on positional numeration with ten digits, including zero, he promoted it in the Arab world. His step-by-step explanations of arithmetic calculations for this new decimal system were regularly translated and reproduced around the world. Some historians today call him the "grandfather of computing." The linear algebra he founded is now at the heart of machine learning and modern artificial intelligence.

The Banu Musa Brothers: The First Programmable Machine

Al-Khwarizmi was not alone at the House of Wisdom. Three brothers, Muhammad, Ahmad, and Al-Hasan ibn Musa—the Banu Musa, "sons of Musa"—also worked there. Orphans of an astronomer who was a friend of the caliph, they were taken in by Al-Ma'mun himself and entrusted to the director of the House of Wisdom.

Their contribution took an even more tangible form than al-Khwarizmi's. In 850, they published the Kitab al-Hiyal, the Book of Ingenious Devices. Among the hundred machines described and illustrated, several are particularly noteworthy.

The most remarkable is an automatic flute capable of playing different melodies according to the configuration of interchangeable cylinders. The sound was produced by hot steam, and the user could adjust the device to obtain different musical patterns. A method similar to punched cards. A thousand years before the first computers, these three brothers in Baghdad had built the first programmable machine in history.

They also invented the conical valve, the first automatic controller used "in-line" in flow systems—a crucial innovation for future automation. Their hydraulic organ worked with interchangeable cylinders, foreshadowing the music boxes and barrel organs that would appear centuries later in Europe.

What distinguishes the Banu Musa from their Greek predecessors—Hero of Alexandria, Philo of Byzantium—is their concern for automatic controls. They did not merely create mechanical marvels; they invented systems that regulated themselves. This obsession with machine autonomy resonates strangely with the concerns of contemporary artificial intelligence.

Today — From Automata to Methods: Mechanizing Reality and Formalizing Thought

Al-Jazari: The Father of Robotics

Two and a half centuries later, in Diyarbakır in Anatolia, an engineer named Ismail al-Jazari pushed this logic even further. Born in 1136, he served as royal engineer at the Artuqid palace during the peak of the Islamic Golden Age. In 1206, he published his masterpiece: the Book of Knowledge of Ingenious Mechanical Devices.

Al-Jazari describes automata of stunning sophistication. One is a boat carrying four mechanical musicians—two tambourine players, a harpist, and a flutist. The boat actually moves on water, alternating between navigation moments and moments when the orchestra plays, all controlled by the flow of water. The drums can play different rhythms according to the position of adjustable pegs: mechanical programs, in essence. Many historians consider this boat the first programmable "robot" in history.

Another automaton, a waitress, appears through an automatic door to offer a drink exactly seven minutes after it is requested. The mechanism is ingenious: the drink is stored in a reservoir from which it flows drop by drop into a bucket, then into a cup, before the waitress automatically emerges to serve it.

The elephant clock, twenty-two feet tall, is perhaps his most famous creation. The mechanism is hidden inside the elephant. Every half hour, a bowl with a small hole collects enough water to trigger a series of movements: a humanoid automaton strikes a cymbal, a mechanical bird sings. It is the first clock in history where automata react at regular intervals.

Al-Jazari preceded Leonardo da Vinci by two hundred fifty years. As one specialist noted: "The idea of making robots work—or simply automating—was developed by al-Jazari 250 years before Leonardo da Vinci, with excellent examples." His cams, pegs, and automatic control systems foreshadow what we call robotics today. The word "robot" did not yet exist—it would not be invented until 1920 by Czech playwright Karel Čapek—but the thing itself had already taken shape in the workshops of the medieval Middle East.

Historian Donald Hill emphasized: "The impact of al-Jazari's inventions can still be felt in modern mechanical engineering."

Ibn al-Haytham: The Invention of the Scientific Method

This mechanics, however, would not have sufficed without another revolution, quieter but equally fundamental. In Basra and then Cairo, between 965 and 1040, a physicist named Ibn al-Haytham—known in the West as Alhazen—invented something we take for granted today: the experimental scientific method.

Before him, tradition held that the eye emitted rays that went out to touch objects in order to see them. This emission theory, inherited from the Greeks, seemed obvious. Ibn al-Haytham demonstrated the opposite: light enters the eye, which is merely a passive receptor. The eye does not illuminate objects; it receives the light they reflect.

But more important than this discovery itself is the way he arrived at it. In his Kitab al-Manazir, the Treatise on Optics—seven revolutionary volumes—he set out a rigorous method he called i'tibar: observe, formulate a hypothesis, design an experiment to test it, verify the results.

"To search for truth," he wrote, "one must first have recourse to observation, induction, and the formulation of hypotheses that can be verified experimentally." He himself carried out numerous observations and experiments that he described in detail, making them reproducible by anyone wishing to verify his theses.

This approach, which seems obvious to us today, was revolutionary at the time. Ibn al-Haytham systematically combined physics and mathematics, using geometry to model optical phenomena. This mathematical and physical methodology of experimental science underlies most of the propositions in his treatise.

When his works were translated into Latin from the twelfth century, they transformed European thought. Robert Grosseteste, Roger Bacon, John Peckham, Witelo, William of Ockham, Leonardo da Vinci, Francis Bacon, René Descartes, Johannes Kepler, Galileo, Isaac Newton—all read and were influenced by the Treatise on Optics. The modern scientific method, which today allows artificial intelligence systems to be developed and validated, finds here one of its most ancient sources.

Al-Kindi: The Ancestor of Data Processing

Al-Kindi, meanwhile, worked on another front. This philosopher, whom his contemporaries nicknamed "the Philosopher of the Arabs"—author of two hundred ninety works in mathematics, astronomy, medicine, and logic—was interested in secret messages.

In 750, a major shift had occurred in the Islamic world. At the Battle of the Zab, the Abbasids had triumphed over the Umayyads, marking the end of a caliphate that refused all secular intellectual movements. The new caliphs encouraged research. It was in this context that al-Kindi developed cryptanalysis.

In his treatise Risalah fi Istikhraj al-Mu'amma—the first cryptanalysis treatise in history, found only in 1987 in the Ottoman archives of Istanbul—he developed a technique that would not be rediscovered in the West until nine centuries later by Charles Babbage: frequency analysis.

The principle is simple but powerful. Al-Kindi noticed that in a given language, certain letters appear more often than others. In Arabic, for example, the letter alif is the most frequent. By counting how many times each symbol appears in an encrypted message, and comparing these frequencies to those of the Arabic language, one can reconstruct the original message, letter by letter.

This method makes it possible to break any monoalphabetic substitution cipher—the type of encryption used since Antiquity. The origin of this discovery may be linked to the study of the Quran: Arab lexicographers, like Al-Khalil, were already practicing phonological analysis with arrangements and combinations of letters to study the chronology of Quranic revelations. Combinatorial analysis brought linguists and algebraists together.

We have just described the first automated information processing, the ancestor of what modern engineers call pattern recognition. Al-Kindi's work in logic influenced what we today call expert systems and automated reasoning: the application of logical and mathematical reasoning to real problems.

Beyond — Philosophers of Mind and Transmission to Europe

Avicenna: Mapping the Architecture of the Mind

One final brick remained to be laid: understanding how the mind itself works.

Avicenna—Ibn Sina by his Persian name—was born in 980 in Afshana, near Bukhara. Physician, logician, metaphysician, he wrote more than four hundred fifty works, including the famous Book of Healing. His influence on medieval medicine was immense, but it is another aspect of his work that interests us here.

Avicenna hypothesized that different mental operations—perception, memory, reasoning—were localized in distinct regions of the brain. He imagined a network of brain localizations where mental operations took place. This proposition, considered audacious and speculative at the time, would be confirmed by twentieth-century neuroscience.

In a sense, Avicenna was already sketching what we today call cognitive architecture: a functional map of the mind, a model of how different mental faculties articulate and interact. His investigations of perception, memory, and reasoning resonate with contemporary research on cognitive architectures—those systems designed to simulate human thought.

Avicenna also played a crucial role in transmitting Aristotelian ideas, which he adapted and integrated into the Islamic context. He was an important commentator on Aristotle, modifying his thought in original ways, particularly in logic. This Aristotelian logic, refined by Arab philosophers, would become the foundation of formal reasoning in the West.

Averroes: The Theory of Concepts

Averroes—Ibn Rushd—worked a century later in Córdoba, in Muslim Spain. An accomplished polymath, he excelled in philosophy, theology, law, medicine, astronomy, and mathematics. But it was as a commentator on Aristotle that he marked history.

His contribution is of a different order than Avicenna's. Averroes developed a rationalist approach seeking to reconcile faith and reason. Against al-Ghazali, who had attacked philosophy in his Incoherence of the Philosophers, Averroes wrote The Incoherence of the Incoherence, defending the place of reason in the quest for truth.

Above all, he developed a theory of "intelligibles," those abstract concepts by which we understand the world. The intelligibles foreshadow what modern formal logic calls propositions, and what artificial intelligence calls representations. Syllogistic practice—reasoning through syllogisms—became for him the model of all true knowledge.

Averroes recommended the study of logic and physics to scholars, in addition to medicine. He did not oppose the rational and the revealed, but sought their articulation. This insistence on reason as a universal tool of knowledge would have an immense impact on Western thought.

The Routes of Transmission

His commentaries on Aristotle, translated into Latin and Hebrew, profoundly influenced Thomas Aquinas and all of European scholasticism. Averroes's positions sparked intense debate among medieval Christian and Jewish thinkers. Albertus Magnus, Thomas Aquinas—all confronted "the Commentator," as he was simply called in the West.

For that is perhaps the greatest legacy of these medieval scholars: transmission. According to the Stanford Encyclopedia of Philosophy, the translation of philosophical texts from Arabic to Latin "led to the transformation of almost all philosophical disciplines in the medieval Latin world."

When Toledo was reconquered by Alfonso VI in 1085, its libraries were full of Arabic manuscripts. Archbishop Raymond of Toledo organized a systematic translation effort. Gerard of Cremona, born in 1114, would translate more than eighty works of Arabic learning into Latin there: Ptolemy's Almagest, Euclid's Elements, Aristotle's De Caelo, and of course al-Khwarizmi's treatises.

The process often happened in three stages: from Arabic to vernacular Romance, then from Romance to Latin. The transmission points were multiple: Toledo, certainly, but also Sicily, the Holy Land, southern Italy. From the eleventh to the thirteenth century, a wave of translations washed over Europe. These translations—of al-Khwarizmi, Ibn al-Haytham, Avicenna, Averroes—would become the textbooks of emerging European universities in medicine, mathematics, and astronomy. Without them, no Renaissance. Without the Renaissance, no scientific revolution. Without the scientific revolution, no computers.

The influence of Islamic philosophers in Europe was particularly strong in natural philosophy, psychology, and metaphysics, but also touched the study of logic and ethics. Muslim scholars had translated Aristotle, Plato, and other Greek authors as early as the eighth and ninth centuries. Aristotle's writings had become central to Islamic thought. Muslim philosophers used his logic to pose great questions about God, existence, and knowledge. This logical tradition, enriched and developed, then passed to Europe.

The End and the Beginning

In 1258, the Mongols took Baghdad. The House of Wisdom was destroyed, its manuscripts thrown into the Tigris to the point, it is said, of blackening its waters for days. A civilization was extinguished. The sack of Baghdad symbolically marks the end of the Islamic Golden Age.

But the ideas had already traveled. They waited, in libraries in Toledo, Palermo, Paris, for the moment to germinate anew. By preserving and enriching the knowledge of earlier civilizations, the scholars of the House of Wisdom had laid the foundations for future developments. The work done in Baghdad fueled the European Renaissance.

We who speak of algorithms every day, we who build machines capable of learning, recognizing patterns, reasoning—we are the heirs of these forgotten architects. The intelligence we call artificial carries within it the memory of men who wrote by the light of oil lamps, in cities whose names we have sometimes forgotten.

The foundations are older than we believe. And perhaps that is the real lesson: intelligence has never been the affair of a single era or a single people. It is a common heritage, a patient construction, an edifice that each generation enlarges without ever completing. Al-Khwarizmi's algorithm, al-Jazari's automaton, Ibn al-Haytham's method, al-Kindi's decryption, Avicenna's cognitive architecture, Averroes's logic—all these stones, laid more than a thousand years ago, still support the digital cathedrals we build today.

Artificial intelligence was not born in a twentieth-century American laboratory. It began in Baghdad, in the ninth century, when a Persian mathematician had the idea of describing a procedure so clear, so universal, that it could be executed by anyone—or anything.