What if a quadratic does not factor nicely, like $x^2 + 6x - 7 = 0$? We can rewrite it so the $x$ terms form a perfect square, then take square roots. The trick reverses the square of a sum, and it also produces vertex form.
Why it works
Picture $x^2 + 6x$ as area: an $x$-by-$x$ square and a strip $x$ by $6$. Cut the strip in half lengthwise and put one half on the right of the square and one below it. Now you almost have a bigger square, side $x + 3$, but the corner is missing: a $3$-by-$3$ square of area $9$. Adding $9$ completes it: $x^2 + 6x + 9 = (x + 3)^2$. The missing corner is always $\left(\frac{b}{2}\right)^2$, half the $x$ coefficient, squared.
Key idea
To solve $x^2 + bx + c = 0$: move $c$ to the right, add $\left(\frac{b}{2}\right)^2$ to both sides, write the left side as $\left(x + \frac{b}{2}\right)^2$, and take square roots. If $a \ne 1$, divide every term by $a$ first.
Worked examples
Worked example: Solve by completing the square
Solve $x^2 + 6x - 7 = 0$.
- Move the constant: $x^2 + 6x = 7$.
- Half of $6$ is $3$, and $3^2 = 9$. Add $9$ to both sides: $x^2 + 6x + 9 = 16$.
- The left side is a perfect square: $(x + 3)^2 = 16$.
- $x + 3 = \pm 4$, so $x = 1$ or $x = -7$.
Answer: $x = 1$ or $x = -7$
Worked example: Irrational answers, and a leading coefficient
Solve $2x^2 - 8x - 2 = 0$.
- Divide every term by $2$: $x^2 - 4x - 1 = 0$.
- Move the constant: $x^2 - 4x = 1$. Half of $-4$ is $-2$, squared is $4$: $x^2 - 4x + 4 = 5$.
- $(x - 2)^2 = 5$, so $x = 2 \pm \sqrt{5}$.
Answer: $x = 2 \pm \sqrt{5}$
Worked example: Vertex form
Write $y = x^2 + 10x + 21$ in vertex form.
- Half of $10$ is $5$; $5^2 = 25$. Add and subtract $25$: $y = (x^2 + 10x + 25) + 21 - 25$.
- $y = (x + 5)^2 - 4$, so the vertex is $(-5, -4)$.
Answer: $y = (x + 5)^2 - 4$
Common mistake
Adding $\left(\frac{b}{2}\right)^2$ to one side only, or forgetting to divide by $a$ first. Adding $9$ to the left of $x^2 + 6x = 7$ without adding it on the right breaks the balance and gives wrong answers. And in $2x^2 - 8x = 2$, the square to complete is for $x^2 - 4x$, after dividing by $2$. Check your solutions in the original equation.