Introduction
"Completing the square" sounds like a phrase from a textbook. In al-Khwarizmi's 9th-century algebra, it describes something you can draw: a square with a corner missing, and the piece that fills it. This worked example solves his best-known problem with his picture, step by step, and then translates each step into modern symbols, so you can see that the algebra and the geometry are the same argument.
The Problem
In Frederic Rosen's 1831 translation, al-Khwarizmi states the problem as "one square, and ten roots of the same, amount to thirty-nine dirhems" (al-Khwarizmi 1831, 8). A "root" is the unknown number, and the "square" is that number multiplied by itself. The dirhems, a unit of currency, here just count units.
In modern notation, with x standing for the unknown number, the problem is
x^2 + 10x = 39
You're asked to find the positive number x that makes this true. Al-Khwarizmi gives a rule in words and then two geometric demonstrations of why it works. The steps below follow his second demonstration, which he introduces with "The same may also be explained by another figure" (al-Khwarizmi 1831, 10).
Working It Through
Step 1: Draw a square for the unknown
Draw a square whose side is the unknown length x. Its area is x times x, which is x^2. This square stands for the "square" in the problem. You don't know how big it is yet; that's the point of the problem.
Al-Khwarizmi's figures work this way throughout. Numbers become lengths and areas, and an equation becomes a statement that two areas are equal.
Step 2: Attach the ten roots as two rectangles
The ten roots, 10x, also need to be drawn as an area. A rectangle that is 10 long and x wide has area 10x. Al-Khwarizmi splits it in half: two rectangles, each 5 long and x wide, so each has area 5x. He attaches one along the right side of the square and one along the bottom (al-Khwarizmi 1831, 10).
The square and the two rectangles together make an L-shaped figure. Its area is x^2 + 5x + 5x, which is x^2 + 10x. The problem says that this total is 39.
Figure: A square of side x, with a 5 \times x rectangle attached along its right side and another along its bottom, forming an L shape; the missing 5 \times 5 corner square at the bottom right is shaded and labeled 25, and the whole completed square is marked with side x + 5. Alt text: A square labeled x squared, with two rectangles labeled 5x on two sides and a shaded 5-by-5 corner square completing a larger square of side x plus 5.
Step 3: Find the missing corner
Look at the L shape. It is almost a square, but the corner where the two rectangles would meet is empty. That gap is a square whose sides are both 5 long, because it is bounded by the 5-long ends of the two rectangles. Its area is 5 \times 5 = 25. In Rosen's translation, "there wants only a square of five multiplied by five, or twenty-five" (al-Khwarizmi 1831, 10–11).
Notice where the 5 came from: it is half the number of roots. That is why al-Khwarizmi's rule in words begins "halve the number of the roots."
Step 4: Complete the square
Fill in the corner. The L shape had area 39, and the corner adds 25, so the completed large square has area 39 + 25 = 64.
You now know the area of a square, so you can find its side. The side of a square of area 64 is 8, because 8 \times 8 = 64. On the figure, that side is made of the unknown length x plus the 5 that the rectangle added.
Step 5: Remove what you added, and check
The side of the large square is x + 5, and it equals 8. So x = 8 - 5 = 3.
Check it in the original problem. The square is 3 \times 3 = 9. Ten roots are 10 \times 3 = 30. Together they make 9 + 30 = 39, as required. Al-Khwarizmi reaches the same result: the root is three, and the square itself is nine (al-Khwarizmi 1831, 11).
Step 6: Translate each step into modern algebra
Every move on the figure is a balancing move on the equation. Attaching the two rectangles means writing 10x as 5x + 5x. Filling the corner means adding 25 to both sides:
x^2 + 10x + 25 = 39 + 25 = 64
The left side is now the area of the completed square, whose side is x + 5. So the equation becomes
(x + 5)^2 = 64
Here (x + 5)^2 means x + 5 multiplied by itself. Taking the positive square root of both sides gives x + 5 = 8, and subtracting 5 from both sides gives x = 3.
Key Considerations
The negative solution. The modern equation has a second solution. If (x + 5)^2 = 64, then x + 5 could also be -8, which gives x = -13. You can check it: (-13)^2 is 169, ten times -13 is -130, and 169 - 130 = 39. Al-Khwarizmi didn't count this solution. In his figure, x is the side of a square, and a length can't be negative. His algebra worked with positive quantities only, which is also why he needed six separate types of equation rather than one.
Why halve the roots. The rule's first instruction, halve the ten roots, can look arbitrary in words. In the figure it is forced: you split the rectangle in two so that the pieces fit on two sides of the square and leave a square-shaped gap. Split it any other way and the gap isn't a square.
The common mistake: treating completing the square as a symbolic trick. Many people meet "add the square of half the coefficient to both sides" as a rule to memorize. That misses where the rule came from. It began as a literal completion: an L-shaped region with a missing corner, filled in to make a square whose side you can find. The symbols record the picture. Knowing that makes the rule easier to reconstruct when you've forgotten it, and it explains the name.
The method's reach. The same figure works for any problem of the form "a square and some roots equal a number," as long as the number of roots and the number are positive. With 6 roots instead of 10, you'd attach two rectangles of width 3 and fill a corner of 3 \times 3 = 9. That generality is what makes the picture a method rather than a single answer.
Summary
Al-Khwarizmi solved "a square and ten roots equal thirty-nine" by drawing it: a square, two rectangles, and a missing corner of 25 that completes a square of area 64. Each geometric step matches one line of modern algebra.
| Geometric step | Modern algebraic line |
|---|
| Square of side x | x^2 |
| Two rectangles, each 5 by x, attached to two sides | x^2 + 5x + 5x = x^2 + 10x = 39 |
| Missing corner, 5 by 5 | 25 |
| Completed square has area 39 + 25 | x^2 + 10x + 25 = 64 |
| Side of completed square is 8 | (x + 5)^2 = 64, so x + 5 = 8 |
| Remove the added 5 | x = 3 |
Solution: x = 3. Check: 3^2 + 10 \times 3 = 9 + 30 = 39.
- The table's rows follow al-Khwarizmi's second figure in order.
- The check uses the original problem, not a rearranged version, so it catches any slip along the way.
- The modern equation also allows x = -13, which al-Khwarizmi's geometry excludes.
References
- al-Khwarizmi, Muhammad ibn Musa. 1831. The Algebra of Mohammed ben Musa. Edited and translated by Frederic Rosen. London: Oriental Translation Fund.