Al-Khwarizmi Completes the Square
In his 9th-century algebra treatise, al-Khwarizmi solved x² + bx = c by completing the square. This demo draws the square and the four rectangles, adjusts b and c, and shows the completed side, the added area, and the positive root.
(x + b/2)² = c + b²/4 = 16 + 9.00 = 25.00 · x = √(c + b²/4) − b/2 = 2.0000
The green square is x². Four blue rectangles each have area (b/4)·x, adding b·x. Four amber corner squares each have area (b/4)², adding b²/4. Together they form a square of side x + b/2, so (x + b/2)² = c + b²/4. The positive root x = √(c + b²/4) − b/2 is the only one shown.
What you are seeing
Start with a square of side x and area x². Add four rectangles of area (b/4)·x around it to reach total b·x.
Four corner squares of area (b/4)² fill the gaps, adding b²/4. The whole figure is now a square of side x + b/2.
Equating areas gives (x + b/2)² = c + b²/4, so the positive root is x = √(c + b²/4) − b/2. Only that positive length is shown.
Why it matters
Al-Khwarizmi’s treatise helped transmit algebraic methods into Europe, and the word “algebra” comes from its title. Completing the square remains the standard way to derive the quadratic formula.
Complexity & details
Each adjustment recomputes O(1) values. Drawing the blocks is O(1); the method itself is a fixed geometric construction.
Frequently asked questions
Did al-Khwarizmi write formulas like this?+
No. His exposition was rhetorical, describing the construction in words with specific numbers. The symbolic identity (x + b/2)² = c + b²/4 is a modern restatement of his procedure.
Why show only one root?+
The geometric problem asks for a length, so the negative root is discarded. Al-Khwarizmi worked with positive magnitudes; negative roots were not part of his setting.