Completing the square rewrites a quadratic using a squared binomial. It is both a solving method and a way to reveal the vertex and extreme value of a quadratic function.

The key pattern is x 2 +bxx^{2} + bx. Adding ( b 2 ) 2 (\frac{b}{2})^{2} creates the square (x+ b 2 ) 2 (x + \frac{b}{2})^{2}.

On this page (8 sections)

The perfect-square pattern

Expanding (x+r ) 2 (x+r)^2 gives x 2 +2rx+ r 2 x^2+2rx+r^2. To match a middle term bxbx, choose r=b / 2r=b/2. Adding and subtracting the same quantity keeps the expression unchanged.

x 2 +bx= ( x + b 2 ) 2 − ( b 2 ) 2 x^2+bx=\left(x+\frac b2\right)^2-\left(\frac b2\right)^2

The identity holds for real xx and bb. It is not permission to add a new constant without compensation: an expression must keep the same value, and an equation must receive the same addition on both sides.

Rewriting an expression

Rewrite x 2 +6x+5x^2+6x+5

  1. x 2 +6x+5= x 2 +6x+9−9+5x^2+6x+5=x^2+6x+9-9+5

    Half of 6 is 3, and its square is 9. Add and subtract 9.

  2. (x+3 ) 2 −4(x+3)^2-4

    Group the perfect square and combine the constants.

Completing a square with a 3-by-3 corner

xx 33
xx 33
x 2 x^2
3x3x
3x3x
99added corner
Adding the corner gives x 2 +6x+9=(x+3 ) 2 x^2+6x+9=(x+3)^2.
Diagram explained

For positive x, start with an x-by-x square and two strips each of width 3. The unfilled corner is 3 by 3. In an expression, compensate for this added area by subtracting 9; in an equation, add 9 to both sides.

In the area model, xx is a positive length. Adding a 3×33\times3 corner completes a square of side x+3x+3. The algebraic identity remains valid for negative xx as well, even though those values are not side lengths in the model.

Solving by completing the square

Solve x 2 +6x−7=0x^2+6x-7=0

  1. x 2 +6x=7x^2+6x=7

    Add 7 to both sides.

  2. x 2 +6x+9=16x^2+6x+9=16

    Add 9 to both sides, not just the left.

  3. (x+3 ) 2 =16(x+3)^2=16

    Recognize the perfect square.

  4. x+3=±4x+3=\pm4

    Use both signs.

  5. x=−3±4x=-3\pm4

    Subtract 3.

Therefore x=1x=1 or x=−7x=-7. Substituting into the original quadratic gives zero in both cases.

When the leading coefficient is not 1

When the leading coefficient is not 1, factor it from the quadratic and linear terms before completing the square.

2 x 2 +8x+3=2( x 2 +4x)+32x^2+8x+3=2(x^2+4x)+3
=2 ( (x+2 ) 2 −4 ) +3=2\bigl((x+2)^2-4\bigr)+3
=2(x+2 ) 2 −5=2(x+2)^2-5

The compensation −4-4 is inside the factor 22, so it contributes −8-8 to the entire expression. Subtracting only 44 outside would be incorrect.

Expanding checks the result: 2(x+2 ) 2 −5=2 x 2 +8x+8−5=2 x 2 +8x+32(x+2)^2-5=2x^2+8x+8-5=2x^2+8x+3.

Finding a quadratic’s vertex and minimum

For y=2(x+2 ) 2 −5y=2(x+2)^2-5, the non-negative square shows that the minimum output is −5-5, attained at x=−2x=-2. The vertex is (−2,−5)(-2,-5). Completing the square can therefore answer a minimum-value question as well as solve an equation.

Applying the same method to a general quadratic produces the quadratic formula. It also gives the vertex form used when describing transformations of a parabola.

Practice questions

  1. Rewrite x 2 +6x+5x^{2} + 6x + 5 by completing the square.

  2. Solve x 2 +6x−7=0x^{2} + 6x – 7 = 0.

  3. What number completes x 2 +10xx^{2} + 10x to a perfect square?

Check your answers
  1. Add and subtract 9: x 2 +6x+5=(x+3 ) 2 −4x^2+6x+5=(x+3)^2-4.

  2. (x+3 ) 2 =16(x+3)^2=16, so x+3=±4x+3=\pm4 and x=1x=1 or x=−7x=-7.

  3. 2525, because (10 / 2 ) 2 =25(10/2)^2=25 and (x+5 ) 2 = x 2 +10x+25(x+5)^2=x^2+10x+25.

Related topics

Apply the general result in The Quadratic Formula; connect vertex form to Transformations of Functions.

Sources and further reading