Al-Khwarizmi and the Language of Algebra
Algebra & Algorithm Design

Al-Khwarizmi and the Language of Algebra

A 9th-century scholar in Baghdad invented the methods behind every equation you solve and every algorithm your computer runs.

Algebra & Algorithm Design12-Month Curriculum 12h

The Story

The House of Wisdom

In the year 820 CE, in the great city of Baghdad, there stood a place unlike any other on Earth. It was called Bayt al-Hikma — the House of Wisdom. It was not a palace, though caliphs funded it. It was not a mosque, though scholars prayed there. It was a library, a translation centre, a research institute, and a meeting ground for the finest minds in the world, all at once.

The Abbasid Caliph al-Ma’mun had commanded that the collected knowledge of every civilisation — Greek, Indian, Persian, Chinese — be translated into Arabic. Scrolls arrived from Constantinople, manuscripts from the libraries of India, astronomical tables from Persia. Scholars who spoke a dozen languages worked side by side, pouring the world’s learning into a single tongue.

Among them was a quiet, methodical man named Muhammad ibn Musa al-Khwarizmi. He was not the loudest voice in the House of Wisdom, nor the most flamboyant. But he would become the most influential.

The Problem of Inheritance

Al-Khwarizmi was asked to solve a practical problem. Under Islamic law, when a man died, his property had to be divided among his heirs according to precise rules: the wife receives one-eighth, each son receives twice what each daughter gets, debts must be paid first, and a charitable bequest must be honoured. The numbers were different for every family. Judges and lawyers needed a method that worked every time, not just for one particular case.

Al-Khwarizmi realised that the key was to give the unknown a name. He called it al-shay’ — the "thing." If the total estate was unknown, call it shay’. If each daughter’s share was unknown, call it shay’. Once the unknown had a name, the inheritance rules became equations, and equations could be solved.

He described two fundamental operations. The first was al-jabr — "restoration" — the act of moving a subtracted term from one side of an equation to the other, turning it positive. If you have x − 5 = 7, al-jabr restores the 5 by moving it: x = 7 + 5 = 12. The second was al-muqabala — "balancing" — simplifying by combining like terms on each side.

From the first operation, we get the word algebra. From his name, we get the word algorithm.

The Book

Al-Khwarizmi wrote it all down in a book whose title begins with the words Kitab al-Jabr wa al-Muqabala — "The Book of Restoration and Balancing." It was the first systematic treatment of algebra in history.

The book classified every equation into six types based on which terms appeared: things (what we call x), squares (x²), and numbers (constants). For each type, al-Khwarizmi gave a clear, step-by-step method to find the answer. Not a hint. Not a trick for one particular problem. A procedure that would work for any equation of that type, every time, for anyone who followed the steps.

For quadratic equations — those involving x² — he invented a technique so beautiful that mathematicians still teach it today. He called it "completing the square." Imagine you have a square garden of unknown size (x by x) and a rectangular strip added to one side. The total area is known. Al-Khwarizmi showed how to rearrange the pieces into a perfect, larger square, then simply measure its side. The unknown revealed itself through geometry.

He did not use symbols. He wrote everything in words: "Take the thing, multiply by itself, add ten of the thing, the result is thirty-nine." But the logic was flawless. And it was general — the same words, the same steps, worked for every problem of that form.

The Legacy

When Latin scholars translated his work three hundred years later, they could not pronounce his name. Muhammad ibn Musa al-Khwarizmi became Algoritmi in Latin. And when people referred to his step-by-step methods, they called them algorithms.

Today, every line of code on every computer runs an algorithm. Every search engine, every GPS route, every AI model, every encrypted message uses algorithmic thinking. And every time you solve an equation by moving terms from one side to the other, you are performing al-jabr — exactly as al-Khwarizmi described twelve hundred years ago.

He did not invent numbers. He did not discover geometry. What he did was something equally profound: he taught the world that problems can be solved by following precise, step-by-step procedures. Not by intuition. Not by trial and error. By method.

That idea changed everything.

The end.

Try It Yourself

Choose your level. Everyone starts with the story — the code gets deeper as you go.

Story Progress

0%

Ready to Start Coding?

Here is a taste of what Level 1 looks like for this lesson:

Level 1: Explorer — Python
# Al-Khwarizmi's Balance Method
# Solve ax + b = c for any a, b, c

def solve_linear(a, b, c):
    """Al-Jabr: move b, then divide by a."""
    print(f"Equation: {a}x + {b} = {c}")
    print(f"Step 1 (al-Jabr): {a}x = {c} - {b} = {c - b}")
    x = (c - b) / a
    print(f"Step 2 (al-Muqabala): x = {c - b} / {a} = {x}")
    return x

solve_linear(3, 7, 22)
# Output: x = 5
# Check: 3(5) + 7 = 22 ✓

This is just the first of 6 coding exercises in Level 1. By Level 4, you will build: Build an Al-Khwarizmi Equation Solver.

By Level 4, enrolled students build: Build an Al-Khwarizmi Equation Solver

Free

Level 0: Listener

Stories, science concepts, diagrams, quizzes. No coding.

You are here

Enrolled

Levels 1-4

Python, NumPy, Matplotlib, real projects, mentorship.

Sign Up Free

Stay Updated

Join Waitlist

Get notified when enrollment opens for your area.

Notify Me

Level 0 is always free. Coding levels (1-4) are part of our 12-Month Curriculum.