Skip to content
Family Table Math

Completing the Square

Completing the square turns a quadratic like x2+6x+2x^2 + 6x + 2 into vertex form, (x+3)2−7(x + 3)^2 - 7. Vertex form shows the vertex and the maximum or minimum value straight away, which is exactly what you need for optimization problems.

Expanding a squared binomial gives a pattern:

(x+3)2=x2+6x+9(x + 3)^2 = x^2 + 6x + 9

The constant 99 is the square of half the xx-coefficient: (62)2=9\left(\tfrac{6}{2}\right)^2 = 9. In general:

x2+bx+(b2)2=(x+b2)2x^2 + bx + \left(\frac{b}{2}\right)^2 = \left(x + \frac{b}{2}\right)^2

To write x2+bx+cx^2 + bx + c in vertex form:

  1. Take half of bb and square it.
  2. Add and subtract that number right after the xx term (adding and subtracting the same number changes nothing).
  3. Group the first three terms as a perfect square, and combine the constants.
x2+6x+2=x2+6x+9−9+2=(x+3)2−7\begin{aligned} x^2 + 6x + 2 &= x^2 + 6x + 9 - 9 + 2 \\ &= (x + 3)^2 - 7 \end{aligned}

First factor aa out of the x2x^2 and xx terms only. Complete the square inside the bracket, then multiply the subtracted number by aa as you take it out.

f(x)=a(x−h)2+kf(x) = a(x - h)^2 + k has vertex (h,k)(h, k).

  • If a>0a \gt 0, the parabola opens up, so kk is the minimum value.
  • If a<0a \lt 0, it opens down, so kk is the maximum value.

Watch the sign: (x+3)2(x + 3)^2 means h=−3h = -3.

Write f(x)=x2+6x+2f(x) = x^2 + 6x + 2 in vertex form, and give the vertex.

Solution. Half of 66 is 33, and 32=93^2 = 9:

f(x)=x2+6x+9−9+2=(x+3)2−7\begin{aligned} f(x) &= x^2 + 6x + 9 - 9 + 2 \\ &= (x + 3)^2 - 7 \end{aligned}

The vertex is (−3,−7)(-3, -7), and since a=1>0a = 1 \gt 0, the minimum value is −7-7.

Write f(x)=x2−5x+1f(x) = x^2 - 5x + 1 in vertex form.

Solution. Half of −5-5 is −52-\tfrac{5}{2}, and (−52)2=254\left(-\tfrac{5}{2}\right)^2 = \tfrac{25}{4}:

f(x)=x2−5x+254−254+1=(x−52)2−214\begin{aligned} f(x) &= x^2 - 5x + \tfrac{25}{4} - \tfrac{25}{4} + 1 \\ &= \left(x - \tfrac{5}{2}\right)^2 - \tfrac{21}{4} \end{aligned}

The vertex is (52,−214)\left(\tfrac{5}{2}, -\tfrac{21}{4}\right).

Write f(x)=2x2−12x+7f(x) = 2x^2 - 12x + 7 in vertex form, and give the minimum value.

Solution. Factor 22 out of the first two terms only:

f(x)=2(x2−6x)+7=2(x2−6x+9−9)+7=2((x−3)2−9)+7=2(x−3)2−18+7=2(x−3)2−11\begin{aligned} f(x) &= 2(x^2 - 6x) + 7 \\ &= 2(x^2 - 6x + 9 - 9) + 7 \\ &= 2\big((x - 3)^2 - 9\big) + 7 \\ &= 2(x - 3)^2 - 18 + 7 \\ &= 2(x - 3)^2 - 11 \end{aligned}

The vertex is (3,−11)(3, -11). Since a=2>0a = 2 \gt 0, the minimum value is −11-11, when x=3x = 3.

Check by expanding: 2(x2−6x+9)−11=2x2−12x+72(x^2 - 6x + 9) - 11 = 2x^2 - 12x + 7. ✓

Write f(x)=−3x2−12x+1f(x) = -3x^2 - 12x + 1 in vertex form, and give the maximum value.

Solution. Factor −3-3 out of the first two terms:

f(x)=−3(x2+4x)+1=−3(x2+4x+4−4)+1=−3((x+2)2−4)+1=−3(x+2)2+12+1=−3(x+2)2+13\begin{aligned} f(x) &= -3(x^2 + 4x) + 1 \\ &= -3(x^2 + 4x + 4 - 4) + 1 \\ &= -3\big((x + 2)^2 - 4\big) + 1 \\ &= -3(x + 2)^2 + 12 + 1 \\ &= -3(x + 2)^2 + 13 \end{aligned}

The maximum value is 1313, when x=−2x = -2.

Adding the square without subtracting it. x2+6x+2x^2 + 6x + 2 becomes x2+6x+9−9+2x^2 + 6x + 9 - 9 + 2. If you only add 99, you’ve changed the function.

Forgetting to multiply by aa. In Example 3, the −9-9 inside the bracket becomes −18-18 when it comes out, because it’s multiplied by 22.

Using bb instead of half of bb. For x2+6xx^2 + 6x, you add 32=93^2 = 9, not 62=366^2 = 36.

Factoring aa out of the constant too. Only the x2x^2 and xx terms go in the bracket. The constant waits outside.

Getting the vertex sign wrong. (x+3)2−7(x + 3)^2 - 7 has vertex (−3,−7)(-3, -7), not (3,−7)(3, -7).

1. (Warm-up) What number should be added to x2+10xx^2 + 10x to make a perfect square? Write the result as a squared binomial.

Solution

(102)2=25\left(\tfrac{10}{2}\right)^2 = 25, and x2+10x+25=(x+5)2x^2 + 10x + 25 = (x + 5)^2.

2. (Warm-up) Write x2−8x+3x^2 - 8x + 3 in vertex form.

Solutionx2−8x+16−16+3=(x−4)2−13x^2 - 8x + 16 - 16 + 3 = (x - 4)^2 - 13

3. (Warm-up) Write x2+2x−5x^2 + 2x - 5 in vertex form, and give the vertex.

Solutionx2+2x+1−1−5=(x+1)2−6x^2 + 2x + 1 - 1 - 5 = (x + 1)^2 - 6

The vertex is (−1,−6)(-1, -6).

4. (Core) Write x2+3x−1x^2 + 3x - 1 in vertex form.

Solution

Half of 33 is 32\tfrac{3}{2}, and (32)2=94\left(\tfrac{3}{2}\right)^2 = \tfrac{9}{4}:

x2+3x+94−94−1=(x+32)2−134x^2 + 3x + \tfrac{9}{4} - \tfrac{9}{4} - 1 = \left(x + \tfrac{3}{2}\right)^2 - \tfrac{13}{4}

5. (Core) Write 3x2+18x+203x^2 + 18x + 20 in vertex form, and give the minimum value.

Solution3(x2+6x)+20=3(x2+6x+9−9)+20=3(x+3)2−27+20=3(x+3)2−7\begin{aligned} 3(x^2 + 6x) + 20 &= 3(x^2 + 6x + 9 - 9) + 20 \\ &= 3(x + 3)^2 - 27 + 20 \\ &= 3(x + 3)^2 - 7 \end{aligned}

The minimum value is −7-7, when x=−3x = -3.

6. (Core) Write −2x2+8x−3-2x^2 + 8x - 3 in vertex form, and give the maximum value.

Solution−2(x2−4x)−3=−2(x2−4x+4−4)−3=−2(x−2)2+8−3=−2(x−2)2+5\begin{aligned} -2(x^2 - 4x) - 3 &= -2(x^2 - 4x + 4 - 4) - 3 \\ &= -2(x - 2)^2 + 8 - 3 \\ &= -2(x - 2)^2 + 5 \end{aligned}

The maximum value is 55, when x=2x = 2.

7. (Core) Write 0.5x2−3x+40.5x^2 - 3x + 4 in vertex form.

Solution0.5(x2−6x)+4=0.5(x2−6x+9−9)+4=0.5(x−3)2−4.5+4=0.5(x−3)2−0.5\begin{aligned} 0.5(x^2 - 6x) + 4 &= 0.5(x^2 - 6x + 9 - 9) + 4 \\ &= 0.5(x - 3)^2 - 4.5 + 4 \\ &= 0.5(x - 3)^2 - 0.5 \end{aligned}

8. (Challenge) Solve x2+6x−3=0x^2 + 6x - 3 = 0 by completing the square. Give exact answers.

Solutionx2+6x+9−9−3=0(x+3)2=12x+3=±12=±23x=−3±23\begin{aligned} x^2 + 6x + 9 - 9 - 3 &= 0 \\ (x + 3)^2 &= 12 \\ x + 3 &= \pm\sqrt{12} = \pm 2\sqrt{3} \\ x &= -3 \pm 2\sqrt{3} \end{aligned}

9. (Challenge) Complete the square on f(x)=ax2+bx+cf(x) = ax^2 + bx + c to show that the vertex has xx-coordinate −b2a-\dfrac{b}{2a}.

Solutionf(x)=a(x2+bax)+c=a(x2+bax+b24a2−b24a2)+c=a(x+b2a)2−b24a+c\begin{aligned} f(x) &= a\left(x^2 + \frac{b}{a}x\right) + c \\ &= a\left(x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} - \frac{b^2}{4a^2}\right) + c \\ &= a\left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a} + c \end{aligned}

This is vertex form with h=−b2ah = -\dfrac{b}{2a}, so the vertex is at x=−b2ax = -\dfrac{b}{2a}.