Functions and algebra: Manipulate and simplify algebraic expressions

# Unit 3: Completing the square

Dylan Busa

### Unit outcomes

By the end of this unit you will be able to:

• Manipulate and simplify algebraic expressions by completing the square.

## What you should know

Before you start this unit, make sure you can:

## Introduction

Completing the square is a powerful technique that has many useful applications. It can be used to:

• simplify algebraic expressions
• solve quadratic equations, especially when the roots are either irrational or non-real
• find the turning point of a quadratic function by converting the quadratic function from standard form $\scriptsize f(x)=a{{x}^{2}}+bx+c$ into the turning point form $\scriptsize f(x)=a{{(x+p)}^{2}}+q$.

The technique was first developed by the great Persian mathematician and ‘Father of Algebra’ Muḥammad ibn Mūsā al-Khwārizmī as a way to solve quadratic equations that did not factorise easily.

The technique is called completing the square because it literally completes the square.

## Completing the square

Suppose we have the quadratic expression $\scriptsize {{x}^{2}}+6x+12$. You will notice that this quadratic does not factorise nicely at all. But we can break it up into its components and represent these visually (see Figure 1).

Now, if we cut the green $\scriptsize 6x$ rectangle in half to make two $\scriptsize 3x$ rectangles, we can lay these pieces as shown in Figure 2.

But we have a missing piece of the square that is a $\scriptsize 3\times 3$ hole in the bottom right-hand corner. We can fill it with nine of the $\scriptsize 1\times 1$ blocks (see Figure 3).

In this way we have ‘completed the square’. But what are the dimensions of this square? Well, they are $\scriptsize (x+3)\times (x+3)$ or $\scriptsize {{(x+3)}^{2}}$.

So, our original expression $\scriptsize {{x}^{2}}+6x+12$ can be written as $\scriptsize {{(x+3)}^{2}}+3$ (don’t forget the three $\scriptsize 1\times 1$ blocks).

Let’s have another look at what we did, but this time algebraically.

Step 1: Identify the coefficient of the $\scriptsize x$ term.
This is $\scriptsize 6$.

Step 2: Halve the coefficient of the $\scriptsize x$ term.
$\scriptsize \displaystyle \frac{6}{2}=3$

Step 3: Square the halved coefficient of the $\scriptsize x$ term.
$\scriptsize {{\left( {\displaystyle \frac{6}{2}} \right)}^{2}}={{3}^{2}}=9$

Step 4: Add this new term to the expression.
$\scriptsize {{x}^{2}}+6x{\color{Red} +9}+12$

Step 5: To keep the value of the expression the same, subtract this new term from the expression as well.
$\scriptsize {{x}^{2}}+6x{\color{Red} +9-9}+12$

Step 6: Factorise the newly created perfect square quadratic expression.
\scriptsize \begin{align*}&{\color{Magenta} {{x}^{2}}+6x+9}{\color{Red} -9}+12\\&={\color{Magenta} (x+3)(x+3)}{\color{Red} -9}+12\\&={\color{Magenta} {{(x+3)}^{2}}}{\color{Red} -9}+12\end{align*}

In general, the constant in the squared binomial (the $\scriptsize 3$ in $\scriptsize {{(x+3)}^{2}}$ in this case) will always be half the coefficient of the $\scriptsize x$ term ($\scriptsize \displaystyle \frac{6}{2}=3$ in this case). You should also expand this squared binomial to make sure you get back to the original quadratic – $\scriptsize {{(x+3)}^{2}}=(x+3)(x+3)={{x}^{2}}+6x+9$.

Step 7: Collect the constants.
\scriptsize \begin{align*}&{\color{Magenta} {{x}^{2}}+6x+9}{\color{Red} -9}+12\\&={\color{Magenta} (x+3)(x+3)}{\color{Red} -9}+12\\&={\color{Magenta} {{(x+3)}^{2}}}{\color{Red} -9}+12\\&={\color{Magenta} {{(x+3)}^{2}}}+3\end{align*}

### Note

If you have an internet connection watch these two excellent videos about the process of completing the square:

### Example 3.1

Complete the square for $\scriptsize {{x}^{2}}+4x+5$.

Solution

Step 1: Identify the coefficient of the $\scriptsize x$ term.
This is $\scriptsize 4$.

Step 2: Halve the coefficient of the $\scriptsize x$ term.
$\scriptsize \displaystyle \frac{4}{2}=2$

Step 3: Square the halved coefficient of the $\scriptsize x$ term.
$\scriptsize {{\left( {\displaystyle \frac{4}{2}} \right)}^{2}}={{2}^{2}}=4$

Step 4: Add this new term to the expression and, to keep the value of the expression the same, subtract this new term from the expression as well.
$\scriptsize {{x}^{2}}+4x{\color{Red}+4-4}+5$

Step 5: Factorise the newly created perfect square quadratic expression.
\scriptsize \begin{align*}&{\color{Magenta} {{x}^{2}}+4x+4}{\color{Red} -4}+5\\&={\color{Magenta} (x+2)(x+2)}{\color{Red} -4}+5\\&={\color{Magenta} {{(x+2)}^{2}}}{\color{Red} -4}+5\end{align*}

Step 6: Collect the constants.
\scriptsize \begin{align*}&{\color{Magenta} {{(x+2)}^{2}}}{\color{Red} -4}+5\\&={\color{Magenta} {{(x+2)}^{2}}}+1\end{align*}

### Example 3.2

Complete the square for $\scriptsize {{x}^{2}}-4x+5$.

Solution

Step 1: Identify the coefficient of the $\scriptsize x$ term.
This is $\scriptsize -4$.

Step 2: Halve the coefficient of the $\scriptsize x$ term.
$\scriptsize \displaystyle \frac{{-4}}{2}=-2$

Step 3: Square the halved coefficient of the $\scriptsize x$ term.
$\scriptsize {{\left( {\displaystyle \frac{{-4}}{2}} \right)}^{2}}={{(-2)}^{2}}=4$

Step 4: Add this new term to the expression and, to keep the value of the expression the same, subtract this new term from the expression as well.
$\scriptsize {{x}^{2}}-4x{\color{Red} +4-4}+5$

Step 5: Factorise the newly created perfect square quadratic expression.
\scriptsize \begin{align*}&{\color{Magenta} {{x}^{2}}-4x+4}{\color{Red} -4}+5\\&={\color{Magenta} (x-2)(x-2)}{\color{Red} -4}+5\quad \text{Note how the perfect square quadratic factorises}\\&={\color{Magenta} {{(x-2)}^{2}}}{\color{Red} -4}+5\end{align*}

Step 6: Collect the constants.
\scriptsize \begin{align*}&{\color{Magenta} {{(x-2)}^{2}}}{\color{Red} -4}+5\\&={\color{Magenta} {{(x-2)}^{2}}}+1\end{align*}

### Example 3.3

Complete the square for $\scriptsize {{x}^{2}}-3x-5$.

Solution

Step 1: Identify the coefficient of the $\scriptsize x$ term.
This is $\scriptsize -3$.

Step 2: Halve the coefficient of the $\scriptsize x$ term.
$\scriptsize \displaystyle \frac{{-3}}{2}$

Step 3: Square the halved coefficient of the $\scriptsize x$ term.
$\scriptsize {{\left( {\displaystyle \frac{{-3}}{2}} \right)}^{2}}=\displaystyle \frac{9}{4}$

Step 4: Add this new term to the expression and, to keep the value of the expression the same, subtract this new term from the expression as well.
$\scriptsize {{x}^{2}}-3x{\color{Red} +\displaystyle \frac{9}{4}-\displaystyle \frac{9}{4}}-5$

Step 5: Factorise the newly created perfect square quadratic expression.
\scriptsize \begin{align*} {\color{Green}{x^2-3x+ \displaystyle \frac{9}{4}}}- {\color{Red}{\displaystyle \frac{9}{4}}}-5&= {\color{Green}{\left(x- \displaystyle \frac{3}{2} \right)\left(x- \displaystyle \frac{3}{2} \right)}} -{\color{Red}{\displaystyle \frac{9}{4}}}-5&& \text{Note how the perfect square quadratic factorises}\\ &= {\color{Green}{\left( x- \displaystyle \frac{3}{2} \right)^2}} {\color{Red}{-\displaystyle \frac{9}{4}}}-5\end{align*}

Step 6: Collect the constants.
\scriptsize \begin{align*}{\color{Green} {{\left( {x-\displaystyle \frac{3}{2}} \right)}^{2}}}{\color{Red} -\displaystyle \frac{9}{4}}-5&={\color{Green} {{\left( {x-\displaystyle \frac{3}{2}} \right)}^{2}}}-\displaystyle \frac{{9-20}}{4}\\&={\color{Green} {{\left( {x-\displaystyle \frac{3}{2}} \right)}^{2}}}-\displaystyle \frac{{29}}{4}\end{align*}

### Example 3.4

Complete the square for $\scriptsize 2{{x}^{2}}-3x+4$.

Solution

Before we can start to complete the square, we need to get the coefficient of $\scriptsize {{x}^{2}}$ to be $\scriptsize 1$. We need to take out a common factor of $\scriptsize 2$ from each term.
\scriptsize \begin{align*}&2{{x}^{2}}-3x+4\\&=2\left( {{{x}^{2}}-\displaystyle \frac{3}{2}x+2} \right)\end{align*}

Step 1: Identify the coefficient of the $\scriptsize x$ term.
This is $\scriptsize -\displaystyle \frac{3}{2}$.

Step 2: Halve the coefficient of the $\scriptsize x$ term.
$\scriptsize \displaystyle \frac{{\displaystyle \frac{{-3}}{2}}}{2}=-\displaystyle \frac{3}{2}\times \displaystyle \frac{1}{2}=-\displaystyle \frac{3}{4}$

Step 3: Square the halved coefficient of the $\scriptsize x$ term.
$\scriptsize {{\left( {\displaystyle \frac{{-3}}{4}} \right)}^{2}}=\displaystyle \frac{9}{{16}}$

Step 4: Add this new term to the expression and, to keep the value of the expression the same, subtract this new term from the expression as well.
$\scriptsize 2\left( {{{x}^{2}}-\displaystyle \frac{3}{2}x{\color{Red} +\displaystyle \frac{9}{{16}}-\displaystyle \frac{9}{{16}}}+2} \right)$

Step 5: Before we factorise the perfect square we have created, we need to take the $\scriptsize -\displaystyle \frac{9}{{16}}$ and $\scriptsize 2$ terms out of the brackets. But when we do so, we need to remember to multiply them by $\scriptsize 2$.
\scriptsize \begin{align*}2\left( {{{x}^{2}}-\displaystyle \frac{3}{2}x{\color{Red} +\displaystyle \frac{9}{{16}}-\displaystyle \frac{9}{{16}}}+2} \right)&=2\left( {{{x}^{2}}-\displaystyle \frac{3}{2}x{\color{Red} +\displaystyle \frac{9}{{16}}}} \right){\color{Red} -\displaystyle \frac{9}{8}}+4\end{align*}

Step 6: Factorise the newly created perfect square quadratic expression.
\scriptsize \begin{align*}2{\color{Green}{\left(x^2-\displaystyle \frac{3}{2}x+\displaystyle \frac{9}{16} \right)}}-{\color{Red}{\displaystyle \frac{9}{8}}}+4&=2{\color{Green}{\left(x-\displaystyle \frac{3}{4} \right) \left(x-\displaystyle \frac{3}{4}\right)}}-{\color{Red}{\displaystyle \frac{9}{8}}}+4&& \text{Note how the perfect square quadratic factorises}\\ &=2{\color{Green}{\left(x-\displaystyle \frac{3}{4}\right)^2}}-{\color{Red}{\displaystyle \frac{9}{8}}}+4\end{align*}

Step 7: Collect the constants.
\scriptsize \begin{align*}2{\color{Green} {{\left( {x-\displaystyle \frac{3}{4}} \right)}^{2}}}{\color{Red} -\displaystyle \frac{9}{8}}+4&=2{\color{Green} {{\left( {x-\displaystyle \frac{3}{2}} \right)}^{2}}}-\displaystyle \frac{{9+32}}{8}\\&=2{\color{Green} {{\left( {x-\displaystyle \frac{3}{2}} \right)}^{2}}}+\displaystyle \frac{{23}}{8}\end{align*}

### Exercise 3.1

Complete the square for the following expressions:

1. $\scriptsize {{x}^{2}}+6x$
2. $\scriptsize {{x}^{2}}+\displaystyle \frac{5}{7}x$
3. $\scriptsize {{x}^{2}}-\displaystyle \frac{5}{7}x-1$
4. $\scriptsize {{x}^{2}}-2x+6$
5. $\scriptsize 5{{x}^{2}}+10x+15$
6. $\scriptsize 9+6x-3{{x}^{2}}$

The full solutions are at the end of the unit.

### Note

For a generalised summary of the process of completing the square of any quadratic expression, watch this animation.

## Summary

In this unit you have learnt the following:

• How to complete the square of any quadratic expression $\scriptsize a{{x}^{2}}+bx+c$.

# Unit 3: Assessment

#### Suggested time to complete: 25 minutes

Complete the square for the following expressions:

1. $\scriptsize {{x}^{2}}+5x-6$
2. $\scriptsize {{x}^{2}}-4x-8$
3. $\scriptsize {{x}^{2}}+6x-4$
4. $\scriptsize 10{{x}^{2}}-7x-12$
5. $\scriptsize 2-12x-3{{x}^{2}}$
6. $\scriptsize a{{x}^{2}}+bx+c$

The full solutions are at the end of the unit.

# Unit 3: Solutions

### Exercise 3.1

1. .
\scriptsize \begin{align*}&{{x}^{2}}+6x && \left [\left ( \displaystyle \frac{b}{2} \right )^2=9 \right ]\\&={{x}^{2}}+6x+9-9\\&={{(x+3)}^{2}}-9\end{align*}
2. .
\scriptsize \begin{align*}&{{x}^{2}}+\displaystyle \frac{5}{7}x && \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{\left( {\displaystyle \frac{5}{{14}}} \right)}}^{2}}=\displaystyle \frac{{25}}{{196}}} \right]\\&={{x}^{2}}+\displaystyle \frac{5}{7}x+\displaystyle \frac{{25}}{{196}}-\displaystyle \frac{{25}}{{196}}\\&={{\left( {x+\displaystyle \frac{5}{{14}}} \right)}^{2}}-\displaystyle \frac{{25}}{{196}}\end{align*}
3. .
\scriptsize \begin{align*}&{{x}^{2}}-\displaystyle \frac{5}{7}x-1 && \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{\left( {-\displaystyle \frac{5}{{14}}} \right)}}^{2}}=\displaystyle \frac{{25}}{{196}}} \right]\\&={{x}^{2}}-\displaystyle \frac{5}{7}x+\displaystyle \frac{{25}}{{196}}-\displaystyle \frac{{25}}{{196}}-1\\&={{\left( {x-\displaystyle \frac{5}{{14}}} \right)}^{2}}-\displaystyle \frac{{25-196}}{{196}}\\&={{\left( {x-\displaystyle \frac{5}{{14}}} \right)}^{2}}-\displaystyle \frac{{221}}{{196}}\end{align*}
4. .
\scriptsize \begin{align*}&{{x}^{2}}-2x+6 && \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{(-1)}}^{2}}=1} \right]\\&={{x}^{2}}-2x+1-1+6\\&={{(x-1)}^{2}}+5\end{align*}
5. .
\scriptsize \begin{align*}&5{{x}^{2}}+10x+15\\&=5({{x}^{2}}+2x+3)&& \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}=1} \right]\\&=5({{x}^{2}}+2x+1-1+3)\\&=5({{x}^{2}}+2x+1)-5+15&&\text{Remember to multiply the constants by the}\\&&&\text{common factor when you take them out of the bracket}\\&=5{{(x+1)}^{2}}+10\end{align*}
6. .
\scriptsize \begin{align*}&9+6x-3{{x}^{2}}\\&=-3(-3-2x+{{x}^{2}})\\&=-3({{x}^{2}}-2x-3)\quad \quad \quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}=1} \right]\\&=-3({{x}^{2}}-2x+1-1-3)\\&=-3({{x}^{2}}-2x+1)+3+9\quad \text{Remember to multiply the constants by }-3\\&=-3{{(x-1)}^{2}}+12\end{align*}

Back to Exercise 3.1

### Unit 3: Assessment

1. .
\scriptsize \begin{align*}&{{x}^{2}}+5x-6\quad \quad \quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{\left( {\displaystyle \frac{5}{2}} \right)}}^{2}}=\displaystyle \frac{{25}}{4}} \right]\\&={{x}^{2}}+5x+\displaystyle \frac{{25}}{4}-\displaystyle \frac{{25}}{4}-6\\&={{\left( {x+\displaystyle \frac{5}{2}} \right)}^{2}}-\displaystyle \frac{{25-24}}{4}\\&={{\left( {x+\displaystyle \frac{5}{2}} \right)}^{2}}-\displaystyle \frac{{49}}{4}\end{align*}
2. .
\scriptsize \begin{align*}&{{x}^{2}}-4x-8\quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{(-2)}}^{2}}=4} \right]\\&={{x}^{2}}-4x+4-4-8\\&={{(x-2)}^{2}}-12\end{align*}
3. .
\scriptsize \begin{align*}&{{x}^{2}}+6x-4\quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}=9} \right]\\&={{x}^{2}}+6x+9-9-4\\&={{(x+3)}^{2}}-13\end{align*}
4. .
\scriptsize \begin{align*}&10{{x}^{2}}-7x-12\\&=10\left( {{{x}^{2}}-\displaystyle \frac{7}{{10}}x} \right)-12\quad \quad \quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{\left( {\displaystyle \frac{7}{{20}}} \right)}}^{2}}=\displaystyle \frac{{49}}{{400}}} \right]\\ &\text{Instead of taking the common factor from }-12\text{ we can leave it outside the bracket}\\ &=10 \left( {x-\displaystyle \frac{7}{{10}}x+\displaystyle \frac{{49}}{{400}}-\displaystyle \frac{{49}}{{400}}} \right)-12\\&=10\left( {x-\displaystyle \frac{7}{{10}}x+\displaystyle \frac{{49}}{{400}}} \right)-\left( {\displaystyle \frac{{49}}{{40\bcancel{0}}}\times \displaystyle \frac{{\bcancel{{10}}}}{1}} \right)-12\\&=10\left( {x-\displaystyle \frac{7}{{10}}x+\displaystyle \frac{{49}}{{400}}} \right)-\displaystyle \frac{{49}}{{10}}-12\\&=10{{\left( {x-\displaystyle \frac{7}{{20}}} \right)}^{2}}-\displaystyle \frac{{49-480}}{{40}}\\&=10{{\left( {x-\displaystyle \frac{7}{{20}}} \right)}^{2}}-\displaystyle \frac{{529}}{{40}}\end{align*}
5. .
\scriptsize \begin{align*}&2-12x-3{{x}^{2}}\quad \text{Take out a common factor of }-3\\&=2-3(4x+{{x}^{2}})\\&=-3({{x}^{2}}+4x)+2\quad \quad \quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}=4} \right]\\&=-3({{x}^{2}}+4x+4-4)+2\\&=-3({{x}^{2}}+4x+4)+12+2\\&=-3{{(x+2)}^{2}}+14\end{align*}
6. .
\scriptsize \begin{align*}&a{{x}^{2}}+bx+c\\&=a\left( {{{x}^{2}}+\displaystyle \frac{b}{a}x} \right)+c\quad \left[ {{{{\left( {\displaystyle \frac{b}{2}} \right)}}^{2}}={{{\left( {\displaystyle \frac{b}{{2a}}} \right)}}^{2}}=\displaystyle \frac{{{{b}^{2}}}}{{4{{a}^{2}}}}} \right]\\&=a\left( {{{x}^{2}}+\displaystyle \frac{b}{a}x+\displaystyle \frac{{{{b}^{2}}}}{{4{{a}^{2}}}}-\displaystyle \frac{{{{b}^{2}}}}{{4{{a}^{2}}}}} \right)+c\\&=a\left( {{{x}^{2}}+\displaystyle \frac{b}{a}x+\displaystyle \frac{{{{b}^{2}}}}{{4{{a}^{2}}}}} \right)-\displaystyle \frac{{{{b}^{2}}}}{{4a}}+c\\&=a{{\left( {x+\displaystyle \frac{b}{{2a}}} \right)}^{2}}+c-\displaystyle \frac{{{{b}^{2}}}}{{4a}}\\&=a{{\left( {x+\displaystyle \frac{b}{{2a}}} \right)}^{2}}+\displaystyle \frac{{4ac-{{b}^{2}}}}{{4a}}\\&=a{{\left( {x+\displaystyle \frac{b}{{2a}}} \right)}^{2}}+\left( {\displaystyle \frac{{-{{b}^{2}}+4ac}}{{4a}}} \right)\end{align*}

Back to Unit 3: Assessment