Math Core

Lesson 9.5 · Quadratic Functions and Equations

Completing the square

Square roots solve (x+3)2=16(x + 3)^2 = 16 in two lines. But most quadratics, like x2+6x−7=0x^2 + 6x - 7 = 0, don't arrive as a perfect square. Completing the square is a way to rewrite any quadratic so that it does, which means you can then solve it with square roots, even when it won't factor. The same move also converts standard form into vertex form.

Perfect square trinomials

In the special products lesson you saw that squaring a binomial follows a pattern:

(x+p)2=x2+2px+p2.(x + p)^2 = x^2 + 2px + p^2.

Look at the relationship between the middle coefficient 2p2p and the constant p2p^2: the constant is half the middle coefficient, squared.

trinomialhalf of bb(b2)2\left(\frac{b}{2}\right)^2as a square
x2+6x+9x^2 + 6x + 93399(x+3)2(x + 3)^2
x2−10x+25x^2 - 10x + 25−5-52525(x−5)2(x - 5)^2
x2+3x+94x^2 + 3x + \frac{9}{4}32\frac{3}{2}94\frac{9}{4}(x+32)2\left(x + \frac{3}{2}\right)^2

A picture explains the name. Think of x2+6xx^2 + 6x as an xx-by-xx square plus a strip of area 6x6x. Cut the strip in half and attach one 33-by-xx piece to the right side and one to the bottom. The shape is almost a big square with side x+3x + 3, but a 33-by-33 corner is missing. Adding that corner, 99, completes the square.

Completing the square

To make x2+bxx^2 + bx into a perfect square, add (b2)2\left(\dfrac{b}{2}\right)^2:

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

This works when the coefficient of x2x^2 is 11.

Worked example: Finding the missing constant

What number completes the square? Write the result as a binomial squared.

  1. x2−14xx^2 - 14x
  2. x2+5xx^2 + 5x

Solutions.

  1. Half of −14-14 is −7-7, and (−7)2=49(-7)^2 = 49. So x2−14x+49=(x−7)2x^2 - 14x + 49 = (x - 7)^2.
  2. Half of 55 is 52\dfrac{5}{2}, and (52)2=254\left(\dfrac{5}{2}\right)^2 = \dfrac{25}{4}. So x2+5x+254=(x+52)2x^2 + 5x + \dfrac{25}{4} = \left(x + \dfrac{5}{2}\right)^2.

Solving by completing the square

  1. Move the constant term to the right side.
  2. If the coefficient of x2x^2 isn't 11, divide every term by it.
  3. Add (b2)2\left(\dfrac{b}{2}\right)^2 to both sides.
  4. Write the left side as a binomial squared.
  5. Take square roots (with ±\pm) and solve.

Worked example: A first example

Solve x2+6x−7=0x^2 + 6x - 7 = 0 by completing the square.

x2+6x=7move the constantx2+6x+9=7+9add (62)2=9 to both sides(x+3)2=16x+3=±4x=1orx=−7\begin{aligned} x^2 + 6x &= 7 && \text{move the constant} \\ x^2 + 6x + 9 &= 7 + 9 && \text{add } \left(\tfrac{6}{2}\right)^2 = 9 \text{ to both sides} \\ (x + 3)^2 &= 16 \\ x + 3 &= \pm 4 \\ x = 1 \quad &\text{or} \quad x = -7 \end{aligned}

This one also factors as (x+7)(x−1)=0(x + 7)(x - 1) = 0, which confirms the answers.

Common mistake

Whatever you add to the left side, you must add to the right side too. Writing x2+6x+9=7x^2 + 6x + 9 = 7 changes the equation and gives wrong answers. Think of it as a balance: +9+9 on one side needs +9+9 on the other.

Worked example: An irrational answer

Solve x2−4x−3=0x^2 - 4x - 3 = 0.

This doesn't factor over the integers, but completing the square still works:

x2−4x=3x2−4x+4=3+4(−42)2=4(x−2)2=7x−2=±7x=2±7\begin{aligned} x^2 - 4x &= 3 \\ x^2 - 4x + 4 &= 3 + 4 && \left(\tfrac{-4}{2}\right)^2 = 4 \\ (x - 2)^2 &= 7 \\ x - 2 &= \pm\sqrt{7} \\ x &= 2 \pm \sqrt{7} \end{aligned}

The solutions are about 4.654.65 and −0.65-0.65.

Worked example: When a is not 1

Solve 2x2+8x−5=02x^2 + 8x - 5 = 0.

Divide every term by 22 first so the x2x^2 coefficient is 11:

x2+4x−52=0x2+4x=52x2+4x+4=52+4(x+2)2=132x=−2±132\begin{aligned} x^2 + 4x - \tfrac{5}{2} &= 0 \\ x^2 + 4x &= \tfrac{5}{2} \\ x^2 + 4x + 4 &= \tfrac{5}{2} + 4 \\ (x + 2)^2 &= \tfrac{13}{2} \\ x &= -2 \pm \sqrt{\tfrac{13}{2}} \end{aligned}

To tidy the radical, 132=132=262\sqrt{\dfrac{13}{2}} = \dfrac{\sqrt{13}}{\sqrt{2}} = \dfrac{\sqrt{26}}{2}, so x=−2±262x = -2 \pm \dfrac{\sqrt{26}}{2}, about 0.550.55 and −4.55-4.55.

Vertex form by completing the square

Completing the square on an expression instead of an equation turns standard form into vertex form. Since there's no other side to balance, you add (b2)2\left(\frac{b}{2}\right)^2 and immediately subtract it, which adds zero overall.

Rewrite y=x2+8x+10y = x^2 + 8x + 10:

y=(x2+8x+16)−16+10add and subtract (82)2=16=(x+4)2−6\begin{aligned} y &= (x^2 + 8x + 16) - 16 + 10 && \text{add and subtract } \left(\tfrac{8}{2}\right)^2 = 16 \\ &= (x + 4)^2 - 6 \end{aligned}

The vertex is (−4,−6)(-4, -6). Setting y=0y = 0 gives (x+4)2=6(x + 4)^2 = 6, so the x-intercepts are −4±6-4 \pm \sqrt{6}, about −1.55-1.55 and −6.45-6.45.

y = x² + 8x + 10 = (x + 4)² - 6 has vertex (-4, -6) and x-intercepts -4 ± √6.Open in grapher →

When a≠1a \ne 1, factor aa out of the xx-terms first. For y=2x2−12x+13y = 2x^2 - 12x + 13:

y=2(x2−6x)+13=2(x2−6x+9)−18+13the added 9 is really 2⋅9=18=2(x−3)2−5\begin{aligned} y &= 2(x^2 - 6x) + 13 \\ &= 2(x^2 - 6x + 9) - 18 + 13 && \text{the added } 9 \text{ is really } 2 \cdot 9 = 18 \\ &= 2(x - 3)^2 - 5 \end{aligned}

The vertex is (3,−5)(3, -5), which you can confirm with x=−b2a=124=3x = -\dfrac{b}{2a} = \dfrac{12}{4} = 3.

Tip

When a≠1a \ne 1, the number you add inside the parentheses gets multiplied by aa. Subtract a⋅(b2)2a \cdot \left(\frac{b}{2}\right)^2 outside, not just (b2)2\left(\frac{b}{2}\right)^2. Expanding your final answer is a quick check.

Practice

Practice 1

What number must be added to x2+18xx^2 + 18x to make a perfect square trinomial?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 2

Find cc so that x2−3x+cx^2 - 3x + c is a perfect square trinomial.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

Solve x2+10x+16=0x^2 + 10x + 16 = 0 by completing the square.

Separate answers with commas, e.g. 2, -5

Practice 4

Solve x2−8x+3=0x^2 - 8x + 3 = 0 by completing the square. What is the larger solution? Give an exact answer, such as 2 + sqrt(5).

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

Solve x2+2x−5=0x^2 + 2x - 5 = 0.

Practice 6

Complete the square to write y=x2−10x+21y = x^2 - 10x + 21 in vertex form. What is the vertex?

Enter a point like (2, -3)

Practice 7

Complete the square to write y=3x2+6x−2y = 3x^2 + 6x - 2 in the form y=a(x−h)2+ky = a(x - h)^2 + k. What is kk?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 8

Solve 2x2−12x+7=02x^2 - 12x + 7 = 0 by completing the square. What is the larger solution? Give an exact answer.

Enter a number. Fractions like 3/4 and sqrt(2) are OK.