Skip to main content

Section 4.7 Completing the Square

Subsection 4.7.1 Solving by Completing the Square

So far, we have considered a few algebraic techniques to solve some kinds of quadratic equations:
However, in fact, many quadratic expressions are not factorable, and not nicely written as a square. In this case, we’ll develop another technique, called completing the square.

Example 4.7.1. Motivation for Completing the Square.

Recall that we have solved quadratic equations of the form \((x - h)^2 = k\) by taking the square root of both sides. For example, to solve \((x-3)^2=5\text{,}\)
\begin{align*} (x - 3)^2 \amp= 5\\ x - 3 \amp= \pm \sqrt{5} \amp\amp\text{by the square root property}\\ x \amp= 3 \pm \sqrt{5} \amp\amp\text{solving for } x \end{align*}
Therefore, if we could convert an equation to this form, we could solve it. To see how to do this, expand the left side first, and write it in standard form,
\begin{align*} (x - 3)^2 \amp= 5\\ x^2 - 6x + 9 \amp= 5\\ x^2 - 6x + 4 \amp= 0 \end{align*}
This means the equations \(x^2 - 6x + 4 = 0\) and \((x - 3)^2 = 5\) are equivalent. The expression \(x^2 - 6x + 4\) can’t be factored nicely (there are no factors of 4 that add up to \(-6\)). However, observe that all of the algebra steps are reversible. That is,
\begin{align*} x^2 - 6x + 4 \amp= 0\\ x^2 - 6x + 9 \amp= 5 \amp\amp\text{subtracting 4 from both sides, then adding 9 to both sides}\\ (x - 3)^2 \amp= 5 \amp\amp\text{rewriting the left-hand side as a square}\\ x - 3 \amp= \pm \sqrt{5} \amp\amp\text{taking the square root of both sides}\\ x \amp= 3 \pm \sqrt{5} \amp\amp\text{solving for } x \text{, by adding 3 to both sides} \end{align*}
This is a strategy to solve the equation. However, how would we know what number to add to the left-hand side? In other words, how would we know that we need \(+9\) so that \(x^2-6x+9\) can be rewritten as \((x-3)^2\text{?}\) We need a number to add to \(x^2-6x\) to make it a perfect square.

Example 4.7.2. Perfect Square Trinomial Pattern.

Recall that a perfect square trinomial is one that can be factored as a square. For example,
\begin{align*} x^2+8x+16 \amp= (x+4)^2\\ x^2-10x+25 \amp= (x-5)^2\\ x^2+12x+36 \amp= (x+6)^2\\ x^2-6x+9 \amp= (x-3)^2 \end{align*}
Observe the pattern of how each left side and right side looks like. To go from the number in front of \(x\) (the β€œ\(b\)” number), to the constant number, you need to divide \(b\) by 2, and square it (multiply it by itself). Also, the number inside the brackets is just the β€œhalf” number (the \(b\) number divided by 2).

Remark 4.7.3.

In general, for a perfect square trinomial of this form, the constant term is \(\frac{1}{2}\) of the coefficient of the \(x\) term, squared. In other words,
\begin{equation*} \boxed{x^2 + bx + \brac{\frac{b}{2}}^2 = \brac{x + \frac{b}{2}}^2} \end{equation*}
This means to get the correct constant term, take the coefficient of \(x\text{,}\)

Exercise Group 4.7.1. Recognizing Perfect Square Trinomials.

Find a number that makes the expression a perfect square of the form \((x+h)^2\text{.}\)

Example 4.7.4. Solve \(x^2 + 8x + 5 = 0\).

The expression \(x^2 + 8x + 5\) is not factorable, so we’ll use this technique. First, move the constant to the other side,
\begin{align*} x^2 + 8x + 5 \amp= 0\\ x^2 + 8x \amp= -5 \end{align*}
Next, we want to add a number to both sides so that the left side becomes a perfect square trinomial. The coefficient of \(x\) is 8. Half of 8 is 4, and \(4^2 = 16\text{.}\) So we add 16 to both sides,
\begin{align*} x^2 + 8x + 16 \amp= -5 + 16\\ x^2 + 8x + 16 \amp= 11 \end{align*}
Now the left side is a perfect square trinomial, which factors as \((x + 4)^2\text{,}\)
\begin{equation*} (x + 4)^2 = 11 \end{equation*}
Now we can use the square root property,
\begin{align*} x + 4 \amp= \pm\sqrt{11}\\ x \amp= -4 \pm \sqrt{11} \end{align*}
Therefore, \(x = -4 + \sqrt{11}\) or \(x = -4 - \sqrt{11}\text{.}\)
This process is called completing the square, because we are literally β€œcompleting” a perfect square by adding a number to it.

Example 4.7.5. Solve \(x^2 + 4x + 7 = 0\).

First, move the constant to the other side,
\begin{align*} x^2 + 4x + 7 \amp= 0\\ x^2 + 4x \amp= -7 \end{align*}
The coefficient of \(x\) is 4. Half of 4 is 2, and \(2^2 = 4\text{.}\) So we add 4 to both sides,
\begin{align*} x^2 + 4x + 4 \amp= -7 + 4\\ x^2 + 4x + 4 \amp= -3\\ (x + 2)^2 \amp= -3 \end{align*}
Now we need to take the square root of both sides. However, there is no real number whose square is \(-3\text{,}\) because the square of any real number is always positive (or 0). Therefore, there is no solution.
This gives a technique for solving quadratic equations:
  1. Isolate the terms involving \(x\text{,}\) by moving the constant to the other side.
  2. Find \(\brac{\frac{b}{2}}^2\text{,}\) and add it to both sides of the equation.
  3. Factor the perfect square trinomial.
  4. Take square roots of both sides (don’t forget \(\pm\))
  5. Isolate for \(x\text{.}\)

Exercise Group 4.7.2. Solve by Completing the Square I.

Solve each equation by completing the square.

Exercise Group 4.7.3. Solve by Completing the Square II.

Example 4.7.6. Solve \(x^2 - 6x + 5 = 0\).

This equation could be solved by factoring, as,
\begin{align*} x^2-6x+5 \amp= 0\\ (x-1)(x-5) \amp= 0\\ x \amp= 1, 5 \end{align*}
However, completing the square also works in this simpler case. First, move the constant to the other side,
\begin{align*} x^2 - 6x + 5 \amp= 0\\ x^2 - 6x \amp= -5 \end{align*}
The coefficient of \(x\) is \(-6\text{.}\) Half of \(-6\) is \(-3\text{,}\) and \((-3)^2 = 9\text{.}\) So we add 9 to both sides,
\begin{align*} x^2 - 6x + 9 \amp= -5 + 9\\ x^2 - 6x + 9 \amp= 4 \end{align*}
Now the left side is a perfect square trinomial, which factors as \((x - 3)^2\text{,}\)
\begin{equation*} (x - 3)^2 = 4 \end{equation*}
Now we can take the square root of both sides,
\begin{align*} x - 3 \amp= \pm 2\\ x \amp= 3 \pm 2 \end{align*}
Therefore, \(x = 3 + 2 = 5\) or \(x = 3 - 2 = 1\text{.}\)

Example 4.7.7. Solve \(2x^2 - 8x + 2 = 0\).

Notice here, the leading coefficient (\(a\)) is not 1 (it is 2). In this case, first divide both sides by that number.
\begin{align*} 2x^2 - 8x + 2 \amp= 0\\ x^2 - 4x + 1 \amp= 0 \amp\amp\text{dividing both sides by 2} \end{align*}
Now, we can complete the square just like before. Move the constant to the other side,
\begin{equation*} x^2 - 4x = -1 \end{equation*}
The coefficient of \(x\) is \(-4\text{.}\) Half of \(-4\) is \(-2\text{,}\) and \((-2)^2 = 4\text{.}\) So we add 4 to both sides,
\begin{align*} x^2 - 4x + 4 \amp= -1 + 4\\ x^2 - 4x + 4 \amp= 3\\ (x - 2)^2 \amp= 3 \amp\amp\text{factoring as a perfect square}\\ x - 2 \amp= \pm\sqrt{3} \amp\amp\text{taking the square root of both sides}\\ x \amp= 2 \pm \sqrt{3} \end{align*}
Therefore, \(x = 2 + \sqrt{3}\) or \(x = 2 - \sqrt{3}\text{.}\)
In general, if the leading coefficient is not 1 (in other words, if \(a \neq 1\)), then first divide by that number on both sides, and continue just like before.

Exercise Group 4.7.4. Solve by Completing the Square III.

Solve each equation by completing the square.
Summary of Solving by Completing the Square
In summary, completing the square is a general technique for solving quadratic equations, particularly those which can’t be factored. It also works for equations which can be factored, but it is overkill (because factoring is easier).
Steps Example: Solve \(2x^2 + 12x - 5 = 0\)
1. Move the constant to the other side.
\(2x^2 + 12x = 5\)
2. If \(a \neq 1\text{,}\) divide both sides by \(a\text{.}\)
\(x^2 + 6x = \frac{5}{2}\)
3. Find \(\brac{\frac{b}{2}}^2\text{,}\) add it to both sides.
\(x^2 + 6x + 9 = \frac{23}{2}\)
4. Factor the perfect square trinomial.
\((x + 3)^2 = \frac{23}{2}\)
5. Take square roots (don’t forget \(\pm\)).
\(x + 3 = \pm\sqrt{\frac{23}{2}}\)
6. Isolate \(x\text{.}\)
\(x = -3 \pm \sqrt{\frac{23}{2}}\)

Remark 4.7.8.

You can check your final answers, by plugging them in for \(x\) in the original equation, and seeing if both sides are equal.

Exercise Group 4.7.5. Solve by Completing the Square IV.

Solve each equation by completing the square.

Exercise Group 4.7.6. Solve by Completing the Square V.

Solve each equation by completing the square.
(a)
\(2x^2+7x+\frac{9}{2}=0\)
Answer.
\(x=-\frac{7}{4}\pm\sqrt{\frac{13}{16}}\) (\(x\approx-0.85,-2.65\))
(c)
\(5x^2-4x+\frac{1}{5}=0\)
Answer.
\(x=\frac{2}{5}\pm\sqrt{\frac{3}{25}}\) (\(x\approx0.75,0.05\))
(d)
\(x^2+\frac{3}{2}x-\frac{7}{8}=0\)
Answer.
\(x=-\frac{3}{4}\pm\sqrt{\frac{23}{16}}\) (\(x\approx0.45,-1.95\))
(g)
\(x^2-\frac{7}{2}x+\frac{5}{8}=0\)
Answer.
\(x=\frac{7}{4}\pm\sqrt{\frac{39}{16}}\) (\(x\approx3.31,0.19\))

Subsection 4.7.2 Converting to Vertex Form

Another application of completing the square is to convert a quadratic function from standard form \(f(x) = ax^2 + bx + c\) to vertex form \(f(x) = a(x - h)^2 + k\text{.}\) This allows us to identify the vertex \((h, k)\) of the parabola.

Example 4.7.9. Convert \(f(x) = x^2 + 6x + 5\) to Vertex Form.

The key insight is that we can use the same β€œcompleting the square” technique, but on a function expression rather than an equation. The goal is to rewrite \(x^2 + 6x + 5\) in the form \((x - h)^2 + k\text{.}\)
We need to add a number to \(x^2 + 6x\) to make it a perfect square. Half of 6 is 3, and \(3^2 = 9\text{.}\) But if we add 9, we must also subtract 9 to keep the expression equal:
\begin{align*} f(x) \amp= x^2 + 6x + 5\\ \amp= (x^2 + 6x + 9) - 9 + 5 \amp\amp\text{adding and subtracting 9}\\ \amp= (x + 3)^2 - 4 \amp\amp\text{factoring and simplifying} \end{align*}
The vertex is \((-3, -4)\text{.}\)

Example 4.7.10. Convert \(f(x) = 2x^2 - 12x + 13\) to Vertex Form.

When \(a \neq 1\text{,}\) we first factor out \(a\) from the \(x\) terms:
\begin{align*} f(x) \amp= 2x^2 - 12x + 13\\ \amp= 2(x^2 - 6x) + 13 \amp\amp\text{factoring 2 from first two terms} \end{align*}
Now complete the square inside the parentheses. Half of \(-6\) is \(-3\text{,}\) and \((-3)^2 = 9\text{:}\)
\begin{align*} \amp= 2(x^2 - 6x + 9 - 9) + 13 \amp\amp\text{adding and subtracting 9 inside}\\ \amp= 2(x^2 - 6x + 9) - 2(9) + 13 \amp\amp\text{distributing the 2}\\ \amp= 2(x - 3)^2 - 18 + 13\\ \amp= 2(x - 3)^2 - 5 \end{align*}
The vertex is \((3, -5)\text{.}\)

Example 4.7.11. Convert \(f(x) = -x^2 + 4x + 1\) to Vertex Form.

When \(a\) is negative, we factor out the negative:
\begin{align*} f(x) \amp= -x^2 + 4x + 1\\ \amp= -(x^2 - 4x) + 1 \amp\amp\text{factoring } -1 \text{ from first two terms} \end{align*}
Complete the square inside. Half of \(-4\) is \(-2\text{,}\) and \((-2)^2 = 4\text{:}\)
\begin{align*} \amp= -(x^2 - 4x + 4 - 4) + 1\\ \amp= -(x^2 - 4x + 4) - (-1)(4) + 1 \amp\amp\text{the } -4 \text{ comes out with a sign change}\\ \amp= -(x - 2)^2 + 4 + 1\\ \amp= -(x - 2)^2 + 5 \end{align*}
The vertex is \((2, 5)\text{.}\)
The process is similar to solving equations, with a few key differences:
  • Factor out \(a\) from the first two terms, and leave some space to add and subtract.
  • Complete the square inside the brackets.
  • If you factor out \(a\text{,}\) you must add the constant inside the bracket, but you’re really adding \(a \cdot \text{(that constant)}\) to the expression, so also subtract \(a \cdot \text{(that constant)}\) to maintain equality.
  • The final bracket inherits the sign from \(b\) (if \(b\) is positive, then positive; if \(b\) is negative, then negative).

Exercise Group 4.7.7. Converting to Vertex Form I.

Find the vertex of each quadratic function, by completing the square to convert each to vertex form.
(e)
\(f(x) = x^2 + 3x - 8\)
Answer.
\(f(x) = \brac{x + \frac{3}{2}}^2 - \frac{41}{4}\text{,}\) vertex \(\brac{-\frac{3}{2}, -\frac{41}{4}}\)
(j)
\(f(x) = -3x^2 + 5x - 3\)
Answer.
\(f(x) = -3\brac{x - \frac{5}{6}}^2 - \frac{11}{12}\text{,}\) vertex \(\brac{\frac{5}{6}, -\frac{11}{12}}\)
(k)
\(f(x) = x^2 + 3x - 18\)
Answer.
\(f(x) = \brac{x + \frac{3}{2}}^2 - \frac{81}{4}\text{,}\) vertex \(\brac{-\frac{3}{2}, -\frac{81}{4}}\)

Exercise Group 4.7.8. Converting to Vertex Form II.

Find the vertex of each quadratic function, by completing the square to convert each to vertex form.
(a)
\(f(x) = \frac{1}{2}x^2 - 3x + 4\)
Answer.
\(f(x) = \frac{1}{2}(x-3)^2 - \frac{1}{2}\text{,}\) vertex \(\brac{3, -\frac{1}{2}}\)
(b)
\(f(x) = -x^2 - 3x + 5\)
Answer.
\(f(x) = -\brac{x + \frac{3}{2}}^2 + \frac{29}{4}\text{,}\) vertex \(\brac{-\frac{3}{2}, \frac{29}{4}}\)
(d)
\(f(x) = -\frac{2}{3}x^2 + 4x - 1\)
Answer.
\(f(x) = -\frac{2}{3}(x-3)^2 + 5\text{,}\) vertex \((3, 5)\)
(e)
\(f(x) = 0.6x^2 + 2x - 3\)
Answer.
\(f(x) = \frac{3}{5}\brac{x + \frac{5}{3}}^2 - \frac{14}{3}\text{,}\) vertex \(\brac{-\frac{5}{3}, -\frac{14}{3}}\)
(g)
\(f(x) = -\frac{3}{4}x^2 + \frac{2}{3}x + \frac{1}{2}\)
Answer.
\(f(x) = -\frac{3}{4}\brac{x - \frac{4}{9}}^2 + \frac{35}{54}\text{,}\) vertex \(\brac{\frac{4}{9}, \frac{35}{54}}\)
(h)
\(f(x) = 2x^2 - 7x + 5\)
Answer.
\(f(x) = 2\brac{x - \frac{7}{4}}^2 - \frac{9}{8}\text{,}\) vertex \(\brac{\frac{7}{4}, -\frac{9}{8}}\)
(l)
\(f(x) = -7x^2 + 182x - 70\)
Answer.
\(f(x) = -7(x-13)^2 + 1113\text{,}\) vertex \((13, 1113)\)
Summary of Converting to Vertex Form
Steps Example: \(f(x) = 2x^2 - 12x + 13\)
1. Factor out \(a\) from the first two terms.
\(f(x) = 2(x^2 - 6x) + 13\)
2. Find \(\brac{\frac{b}{2}}^2\) where \(b\) is the coefficient of \(x\) inside.
Half of \(-6\) is \(-3\text{,}\) and \((-3)^2 = 9\)
3. Add and subtract this number inside the parentheses.
\(f(x) = 2(x^2 - 6x + 9 - 9) + 13\)
4. Distribute the \(a\) to the subtracted term.
\(f(x) = 2(x^2 - 6x + 9) - 2(9) + 13\)
5. Factor the perfect square and simplify.
\(f(x) = 2(x - 3)^2 - 5\)
6. Read off the vertex \((h, k)\text{.}\)
Vertex: \((3, -5)\)