How-to guides · 5 min read
How to Complete the Square Step by Step (With Examples)

The idea behind completing the square
A perfect square trinomial has the form (x + p)² = x² + 2px + p². Many quadratics are not perfect squares, but you can force one by adding the missing piece. Completing the square means rewriting a quadratic so that it contains a squared bracket, which makes it easy to solve and reveals the shape of its graph.
The key fact is that in x² + bx the missing piece is (b ÷ 2)². Take half the coefficient of x, square it, and add it. For x² + 6x, half of 6 is 3 and 3² = 9, so x² + 6x + 9 = (x + 3)². If you picture x² + 6x as a square with two strips of width 3 attached, the 9 is the small square needed in the corner to complete the larger one.
Five steps when the coefficient of x² is 1
- Move the constant to the other side: x² + 6x = −5.
- Take half the coefficient of x and square it: (6 ÷ 2)² = 9.
- Add that number to both sides: x² + 6x + 9 = −5 + 9 = 4.
- Write the left side as a square: (x + 3)² = 4.
- Take the square root of both sides (both signs) and solve: x + 3 = ±2, so x = −1 or x = −5.
The number to add: (b ÷ 2)² for b = 6
Order-of-operations steps 2 steps
Start: (6 ÷ 2)^2
- Divide
6 ÷ 2 = 3→ 3^2 - Exponent
3^2 = 9→ 9
Check x = −1: 1 − 6 + 5 = 0 ✓. Check x = −5: 25 − 30 + 5 = 0 ✓. If a root has to be left as a surd, the same method still works, as the next example shows.
An example that gives irrational answers
Solve x² − 4x − 7 = 0. Move the 7: x² − 4x = 7. Half of −4 is −2, and (−2)² = 4. Add 4 to both sides: x² − 4x + 4 = 11, so (x − 2)² = 11.
Then x − 2 = ±√11, so x = 2 ± √11. The two roots are 5.3166 and −1.3166. This is the exact form; the decimals are approximations. You can confirm with the live solver.
Live solver: x² − 4x − 7 = 0
- Discriminant D = 44
- Vertex: (2, −11)
Step-by-step working 6 steps
- 1Identify a, b and c
x² − 4x − 7 = 0 a = 1, b = −4, c = −7
- 2Calculate the discriminant
D = b² − 4ac = (−4)² − 4(1)(−7) = 44
D is positive: two different real roots.
- 3Apply the quadratic formula
x = (−b ± √D) / 2a = (4 ± √44) / 2 √44 ≈ 6.63325
- 4Solve for both roots
x₁ = 5.316625 x₂ = −1.316625
- 5Check by substitution
f(5.3166) = 0 f(−1.3166) = 0
Both should be 0 (allowing for tiny rounding).
- 6Vertex of the parabola
x = −b / 2a = 2, y = −11 → vertex (2, −11)
The parabola opens upward, so the vertex is the minimum point.
When the coefficient of x² is not 1
Divide every term by a first, or factor a out of the x terms. Solve 2x² + 12x + 7 = 0. Divide by 2: x² + 6x + 3.5 = 0. Move the constant: x² + 6x = −3.5. Add 9: (x + 3)² = 5.5, so x = −3 ± √5.5.
That gives −0.6548 and −5.3452. Check the first root: 2(−0.6548)² + 12(−0.6548) + 7 = 0, which is zero up to rounding.
Vertex form: reading the graph
Completing the square on y = ax² + bx + c gives y = a(x − h)² + k, where h = −b ÷ 2a and k = c − b² ÷ 4a. The point (h, k) is the vertex: the lowest point if a > 0 and the highest if a < 0.
| Quadratic | Vertex form | Vertex | Opens |
|---|---|---|---|
| x² − 8x + 11 | (x − 4)² − 5 | (4, −5) | up (minimum) |
| x² + 6x + 5 | (x + 3)² − 4 | (−3, −4) | up (minimum) |
| 2x² + 12x + 7 | 2(x + 3)² − 11 | (−3, −11) | up (minimum) |
| −x² + 4x + 1 | −(x − 2)² + 5 | (2, 5) | down (maximum) |
| 3x² − 6x + 2 | 3(x − 1)² − 1 | (1, −1) | up (minimum) |
The vertex form is also the easiest way to read the minimum or maximum value of a quadratic in optimisation problems, without calculus.
How it leads to the quadratic formula
If you complete the square on the general equation ax² + bx + c = 0 you get (x + b/2a)² = (b² − 4ac) ÷ 4a². Taking the square root gives x = (−b ± √(b² − 4ac)) ÷ 2a, the quadratic formula. So the formula is not magic; it is the completed-square method done once for all quadratics. The full derivation is in where the quadratic formula comes from.
In practice, use factoring when the numbers are friendly, the quadratic formula for a quick reliable answer, and completing the square when you need the vertex or an exact surd form.
Common mistakes
- Adding to only one side. Whatever you add on the left must be added to the right.
- Halving the wrong number. Take half of the coefficient of x, not of x².
- Forgetting the second root. The square root gives ± so there are two answers.
- Skipping the divide by a. If a ≠ 1, divide first or the bracket will be wrong.
- Sign slip in vertex form. (x + 3)² has its vertex at x = −3, not +3.
Check any result with the quadratic equation solver, which shows the vertex and factored form, or graph it with the function grapher.
Frequently asked questions
Why do we add (b/2)² when completing the square?
Because (x + b/2)² expands to x² + bx + (b/2)², so adding (b/2)² turns x² + bx into a perfect square.
Does completing the square always work?
Yes, for every quadratic. If the right-hand side becomes negative, the equation has no real solutions.
How do I find the vertex by completing the square?
Rewrite y = ax² + bx + c as y = a(x − h)² + k. The vertex is (h, k).
Is completing the square the same as the quadratic formula?
The quadratic formula is what you get when you complete the square on the general equation.
Keep reading
Quadratic Formula Step by Step: Worked Examples
Use the quadratic formula in five clear steps. Worked examples show two solutions, one repeated solution and no real solutions, with a graph.
How-to guidesHow to Factor Trinomials Step by Step (With Examples)
Factor x² + bx + c and ax² + bx + c with the product-and-sum and AC methods. Worked examples, a check by FOIL and how to spot prime trinomials.
ConceptsThe Quadratic Formula: Where It Comes From
A short derivation of the quadratic formula by completing the square, the meaning of the discriminant, and a worked example you can check with the solver.
ConceptsThe Remainder Theorem and Factor Theorem Explained
When you divide P(x) by (x − a) the remainder is P(a). Worked examples, how the factor theorem finds roots, and a full factorisation check.