Completing the Square

Completing the square rewrites \(ax^2+bx+c\) into vertex form \(a(x-h)^2+k\) by manufacturing the missing piece of a perfect-square trinomial — the same move that derives the quadratic formula.

By the end you'll be able to complete the square on any \(ax^2+bx+c\), see why the extra \((b/2)^2\) has to come back out, and use the technique to solve equations — even when the solutions turn out to be complex.

Predict: what constant completes \(x^2 + 8x\) into a perfect square? Set b = 8 on the slider below and check the corner.

This pictures \(x^2+bx\) as a square of area \(x^2\) plus two strips, each b/2 · x. Drag b and watch the missing corner, area \((b/2)^2\), fill in and complete a bigger square of side \(x+b/2\). That corner wasn't part of the original expression, so it has to be subtracted right back out — that's why \(x^2+bx = (x+b/2)^2 - (b/2)^2\). Focus or hover the corner for its exact value.

x² + 6x = (x + 3)² − 9

x² + bx completed into (x + b/2)² − (b/2)²
x² (fixed square) b/2 · x strips (b/2)² missing corner

Completing the square turns \(ax^2+bx+c\) into \(a(x-h)^2+k\) by building — then removing — a perfect square, and it's the one algebraic move behind vertex form, the quadratic formula, and complex solutions alike.

Intuitive

Picture \(x^2+bx\) as an L-shaped region: a square of area \(x^2\) with two strips of area \((b/2)x\) attached to two of its sides — that's the diagram above. The L shape is missing one corner to become a full square of side \(x+b/2\). Draw that corner in — area \((b/2)^2\) — and you've completed the square, but you've also added area that wasn't in the original expression, so the algebra has to subtract it right back out.

Procedural

To rewrite \(ax^2+bx+c\) in vertex form:

  • Factor \(a\) out of the first two terms: \(a(x^2+(b/a)x)+c\).
  • Halve the coefficient inside the parentheses and square it: \((b/2a)^2\).
  • Add and subtract that amount inside the parentheses so nothing changes.
  • Collect the perfect square and simplify the leftover constant.

The result is \(a(x-h)^2+k\) with \(h=-b/(2a)\) and \(k=c-b^2/(4a)\) — the exact coordinates the graph of the parabola uses.

Formal

Apply the same procedure to the general equation \(ax^2+bx+c=0\) with symbols instead of numbers, and the leftover constant becomes \((b^2-4ac)/(4a^2)\). Taking square roots and isolating \(x\) produces the quadratic formula itself — completing the square is its derivation, not a separate trick. When \(b^2-4ac\) is negative, the square root has no real value, and taking it introduces \(i\), giving a pair of complex solutions instead of real ones.

Worked example

Rewrite \(2x^2+12x+5\) in vertex form. Factor 2 from the x-terms: \(2(x^2+6x)+5\). Half of 6 is 3; \(3^2=9\). Add and subtract 9 inside: \(2(x^2+6x+9-9)+5\). Split off the square: \(2((x+3)^2-9)+5 = 2(x+3)^2-18+5\). So \(2x^2+12x+5 = \) \(2(x+3)^2-13\), vertex \((-3,-13)\).

Your turn

Same idea, different numbers: rewrite \(x^2+10x+1\) in vertex form. Half of 10 is 5; \(5^2=25\). Add and subtract 25: \(x^2+10x+25-25+1\). Split off the square: \((x+5)^2 + (1-25) = (x+5)^2 + \) ____

Reveal the answer

\(1 - 25 = \) −24, so \(x^2+10x+1 = (x+5)^2-24\). Set b = 10 on the slider above and check that the corner reads 25 — matching the \((b/2)^2\) you just subtracted.

More info — completing the square to solve equations, real or complex

The same move solves equations directly. For \(x^2+6x+5=0\): move the constant, \(x^2+6x=-5\); add \((6/2)^2=9\) to both sides, \((x+3)^2=4\); take roots, \(x+3=\pm2\); so \(x=-1\) or \(x=-5\) — two real solutions, because the right-hand side stayed positive. But nothing about the procedure requires that: if the right-hand side lands negative instead, taking its square root brings in \(i\), and you get a pair of complex solutions rather than real ones — the same algebra, just a different outcome for the discriminant. See The quadratic formula and Complex numbers for how this connects further.

Check your understanding

Question 1 of 4

Complete the square: rewrite \(x^2 - 14x + 40\) in vertex form.

Question 2 of 4

Rewrite \(3x^2 + 12x + 7\) in vertex form, factoring out the leading coefficient first.

Question 3 of 4

In the area model, \(x^2+6x\) is a square of area \(x^2\) plus two strips of area \((b/2)x\) with \(b=6\). What area completes the big square into \((x+3)^2\), and why is it subtracted in the final vertex-form expression?

Question 4 of 4

Complete the square to solve \(x^2+4x+13=0\). What do you find?

Recap

  • Completing the square rewrites \(ax^2+bx+c\) as \(a(x-h)^2+k\) by building a perfect square trinomial.
  • Factor \(a\) out of the x-terms, halve and square the in-parentheses coefficient (\((b/2a)^2\)), add and subtract it, then collect the square.
  • In the area model, \((b/2)^2\) is the missing corner that completes \(x^2+bx\) into \((x+b/2)^2\) — it must be subtracted back out since it wasn't part of the original expression.
  • Applying the procedure to \(ax^2+bx+c=0\) in general derives the quadratic formula; when the discriminant \(b^2-4ac\) is negative, the square root introduces \(i\) and the solutions are complex.

Dive deeper

Sources

  • Completing the Square