History of Math

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.

6 minLevel 2/3The interactive stage stays ad-free.
b6c16Half of b3Added corner area9.00Completed side5.000Positive root x2.000
x²1.50x1.50x1.50x1.50x1.501.501.501.50completed side = x + b/2 = 5.000

(x + b/2)² = c + b²/4 = 16 + 9.00 = 25.00 · x = √(c + b²/4) − b/2 = 2.0000

Geometric identityx² + b·x + b²/4 = (x + b/2)². The four rectangles supply b·x; the four corner squares supply b²/4. Only the positive root is shown, because the historical problem is a length.
Al-Khwarizmi, 9th centuryIn his algebra treatise, al-Khwarizmi solved x² + bx = c by completing the square. His method was rhetorical: it described the construction in words and used numbers, without symbolic notation. The modern formula above is a compact restatement of his procedure.

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

1

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.

2

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.

3

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.