Category: Algebra Level: 201
x2 + 6x = 16 ⇒ (x + 3)2 = 25 ⇒ x = 2
Draw x² + 6x as a square plus a strip, split the strip in half, and wrap it around the square. One small corner is missing; add it to both sides and you have a perfect square.
An x-by-x square plus an x-by-6 strip. Together they cover 16 square units.
x2 + 6x = 16
Split the 6x strip into two strips of 3x each.
6x = 3x + 3x
Move the right half below the square and turn it. Now the square has a strip on its right and a strip underneath.
x2 + 3x + 3x = 16
The corner is a 3-by-3 hole worth 9. Add 9 to both sides to keep the equation fair.
x2 + 6x + 9 = 16 + 9 = 25
The square has side x + 3 and area 25, so the side is 5 and x = 5 − 3 = 2. Algebra also allows x + 3 = −5, so x = −8, a length no drawing can show.
(x + 3)2 = 25, x + 3 = 5, x = 2 (or x = -8)
cd svg-generator python3 -m svgmath render completing-the-square --out /tmp/completing-the-square
Source: svgmath/diagrams/area_models.py