Completing the square is one of those techniques that shows up everywhere once you know it. It is the engine behind the quadratic formula, the reason we can sketch parabolas quickly, the trick that solves certain integrals in calculus, and a useful shortcut in optimization problems. Here is how it works, why it works, and when to use it.

The core idea

An expression like x² + 8x is almost a perfect square. A perfect square looks like (x + n)² = x² + 2nx + n². If we could just add the right constant to x² + 8x, it would factor into (x + something)².

In x² + 8x, the coefficient of x is 8. Half of 8 is 4. Square that: 16. So:

x² + 8x + 16 = (x + 4)²

We “completed the square” by adding 16. Of course, you cannot just add 16 to one side of an equation without balancing — which is why in equation form, we add 16 to both sides.

The technique step by step

To complete the square of ax² + bx + c (most often when a = 1):

  1. Take the coefficient of x.
  2. Divide it by 2.
  3. Square it.
  4. Add that number to complete the square, and subtract it to keep the expression equivalent.
  5. Factor the completed square and clean up.

Worked example 1: rewriting a quadratic

Rewrite f(x) = x² + 6x + 11 in vertex form.

Half of 6 is 3. Square it: 9. So we need +9 inside the quadratic expression.

f(x) = (x² + 6x + 9) + (11 − 9) = (x + 3)² + 2

Now it is in vertex form. The vertex of the parabola is at (−3, 2). The minimum value of f is 2, occurring at x = −3.

Any quadratic f(x) = x² + bx + c can be rewritten as (x + b/2)² + (c − b²/4). The vertex is at (−b/2, c − b²/4).

Worked example 2: solving a quadratic

Solve x² − 10x + 16 = 0.

Half of −10 is −5. Square it: 25.

x² − 10x + 25 = −16 + 25 (moving 16 to the right, then adding 25 to both sides)

(x − 5)² = 9

x − 5 = ±3

x = 8 or x = 2.

Completing the square solves every quadratic — exactly what the quadratic formula does, but from first principles.

When a ≠ 1

If the coefficient of x² is not 1, factor it out first (or divide through by it).

Example: 3x² + 12x + 7 = 0.

Divide by 3: x² + 4x + 7/3 = 0.

Half of 4 is 2. Square it: 4.

x² + 4x + 4 = −7/3 + 4 = 5/3

(x + 2)² = 5/3

x + 2 = ±√(5/3)

x = −2 ± √(5/3)

Why it works geometrically

The name “completing the square” comes from an ancient geometric argument. Imagine x² as an actual square with sides x. Then 8x can be thought of as a rectangle of height x and width 8, or split into two rectangles of height x and width 4, attached to two sides of the original square.

This gives you an L-shaped figure (called a gnomon). To make it a complete square, you need to add a small 4-by-4 square in the corner — area 16. Adding that 16 “completes” the figure into a full (x + 4)-by-(x + 4) square.

The technique was used by ancient Babylonian, Indian, and Greek mathematicians long before abstract algebra existed. It is literally about completing a visual square.

Applications beyond solving quadratics

Finding vertex of a parabola

Graphing f(x) = x² − 4x + 7? Complete the square: f(x) = (x − 2)² + 3. Vertex at (2, 3). Now sketching is trivial.

Integration

In calculus, integrals of the form ∫ 1/(x² + bx + c) dx are solved by completing the square in the denominator. This converts the expression into a form where standard arctan or logarithm formulas apply.

Example: ∫ 1/(x² − 4x + 13) dx. Complete the square in the denominator: x² − 4x + 13 = (x − 2)² + 9. Now use the formula ∫ 1/((x − a)² + b²) dx = (1/b) arctan((x − a)/b) + C. Result: (1/3) arctan((x − 2)/3) + C.

Conic sections

Circles, ellipses, hyperbolas — their equations are typically rearranged using completing the square so that the center and axes are visible. “x² + y² − 6x + 8y = 0” becomes “(x − 3)² + (y + 4)² = 25” — a circle with center (3, −4) and radius 5.

Optimization

Finding the max or min of a quadratic function is exactly finding its vertex — which completing the square gives directly. “What is the maximum of −x² + 6x − 5?” Complete: −(x² − 6x + 5) = −((x − 3)² − 4) = −(x − 3)² + 4. Max is 4, at x = 3. No calculus needed.

Deriving the quadratic formula

As shown in the companion article, completing the square on the generic quadratic ax² + bx + c = 0 produces the quadratic formula. The formula is literally a named application of this one technique.

Common mistakes

  • Forgetting to subtract what you added. x² + 6x becomes (x + 3)² − 9, not (x + 3)². Adding 9 inside requires subtracting 9 outside to keep the expression equivalent.
  • Completing with half of the x² coefficient instead of half of the x coefficient. Always use the x coefficient.
  • Not factoring out a ≠ 1 first. When the x² coefficient is not 1, factor it out before taking half of the x coefficient.
  • Sign errors. Half of −8 is −4; squared is +16. Signs drop out when you square, but you need to keep the sign inside the (x + b/2) form.

Practice it

Try these on your own:

  1. Rewrite x² + 10x + 7 in vertex form. (Answer: (x + 5)² − 18)
  2. Solve x² − 4x − 12 = 0. (Answer: x = 6 or x = −2)
  3. Find the vertex of y = x² − 8x + 20. (Answer: (4, 4))
  4. Convert 2x² + 4x + 5 to completed-square form. (Answer: 2(x + 1)² + 3)

With a handful of practice problems, completing the square becomes second nature. It saves time everywhere in algebra and calculus, and it is one of those techniques that genuinely feels like a secret code once you understand it.

Solve any quadratic

For quick answers, our quadratic equation calculator returns the roots of any ax² + bx + c = 0 in one step. But the understanding of how to get there — by hand, via completing the square — is worth more than the click. The technique is the engine behind half of algebra. Learn it once, recognize it everywhere.