How-to guides · 5 min read

How to Complete the Square Step by Step (With Examples)

How to Complete the Square Step by Step (With Examples) — illustration
In short: Completing the square rewrites x² + bx + c as (x + b/2)² + (c − b²/4). For x² + 6x + 5 = 0, add 9 to both sides to get (x + 3)² = 4, so x = −1 or x = −5.

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
Answer9
Order-of-operations steps 2 steps

Start: (6 ÷ 2)^2

  1. Divide
    6 ÷ 2 = 3→ 3^2
  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
Answer x = 5.316625 or x = −1.316625
  • Discriminant D = 44
  • Vertex: (2, −11)
Step-by-step working 6 steps
  1. 1
    Identify a, b and c
    x² − 4x − 7 = 0
    a = 1,  b = −4,  c = −7
  2. 2
    Calculate the discriminant
    D = b² − 4ac = (−4)² − 4(1)(−7) = 44

    D is positive: two different real roots.

  3. 3
    Apply the quadratic formula
    x = (−b ± √D) / 2a = (4 ± √44) / 2
    √44 ≈ 6.63325
  4. 4
    Solve for both roots
    x₁ = 5.316625
    x₂ = −1.316625
  5. 5
    Check by substitution
    f(5.3166) = 0
    f(−1.3166) = 0

    Both should be 0 (allowing for tiny rounding).

  6. 6
    Vertex 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.

QuadraticVertex formVertexOpens
x² − 8x + 11(x − 4)² − 5(4, −5)up (minimum)
x² + 6x + 5(x + 3)² − 4(−3, −4)up (minimum)
2x² + 12x + 72(x + 3)² − 11(−3, −11)up (minimum)
−x² + 4x + 1−(x − 2)² + 5(2, 5)down (maximum)
3x² − 6x + 23(x − 1)² − 1(1, −1)up (minimum)
−5181420012345678y = x² − 8x + 11x
y = x² − 8x + 11 = (x − 4)² − 5: the lowest point of the curve is the vertex (4, −5).

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.

Written and reviewed by Mateuss M.

Mateuss M. writes and reviews mathematical content for CalcSolver, focusing on online calculators, formulas, equations, and practical math tools. He reviews calculator functionality, calculation methods, formulas, examples, and explanations to help ensure that each tool is clear, useful, and easy to understand.

Keep reading