# Solving Quadratic Equations by Completing the Square

**Completing the square** is a method for **solving quadratic equation.**

Before we into the method itself, let's start from a simple example.

**Example 1.** Solve equation $$${{\left({x}-{3}\right)}}^{{2}}={16}$$$.

We already saw something similar in the incomplete quadratic equations note.

Indeed, what number, when squared, will give $$${16}$$$?

Actually, two numbers: $$${4}$$$ and $$$-{4}$$$ (take square root of $$${16}$$$ and don't forget about plus/minus)

Thus, we have two linear equations:

- $$${x}-{3}={4}$$$. Its root is $$${x}={7}$$$.
- $$${x}-{3}=-{4}$$$. Its root is $$${x}=-{1}$$$.

Therefore, original equation has two roots: $$${7}$$$ and $$$-{1}$$$.

**Answer**: $$${x}={7}$$$ and $$${x}=-{1}$$$.

We can generalize result of this example.

**Fact**: quadratic equation $$${{\left({m}{x}-{b}\right)}}^{{2}}={c}$$$ has two roots: $$$\frac{{{b}+\sqrt{{{c}}}}}{{m}}$$$ and $$$\frac{{{b}-\sqrt{{{c}}}}}{{m}}$$$.

If $$${c}$$$ is negative, that above equation has no real roots (square of any real number can't give negative number)

Alas, not all quadratic equations are given in the above form.

Luckily, we can transform any quadratic equation to the above form.

This transformation is called **completing of square.**

We will need formula for square of sum/difference: $$${{\left({m}\pm{n}\right)}}^{{2}}={{m}}^{{2}}\pm{2}{m}{n}+{{n}}^{{2}}$$$.

**Example 2.** Solve $$${{x}}^{{2}}+{4}{x}-{21}={0}$$$ by completing the square.

First step is to move constant to the right (don't forget to change the sign) to get equivalent equation $$${{x}}^{{2}}+{4}{x}={21}$$$.

Now, let's take square of sum formula and plug $$${x}$$$ instead of $$${m}$$$:

$$${{\left({x}+{n}\right)}}^{{2}}={{x}}^{{2}}+{\color{red}{{{2}{n}}}}{x}+{{n}}^{{2}}$$$.

Right hand side is very similar to $$${{x}}^{{2}}+{\color{red}{{{4}}}}{x}$$$, except the different coefficient near $$${x}$$$.

But we can find such value of $$${n}$$$, that coefficients near $$${x}$$$ will be the same!

For this, solve equation $$${\color{red}{{{2}{n}={4}}}}$$$. This is linear equation: solution is $$${n}={2}$$$.

Now, plug $$${2}$$$ instead of $$${n}$$$: $$${{\left({x}+{2}\right)}}^{{2}}={{x}}^{{2}}+{4}{x}+{{2}}^{{2}}={\color{green}{{{{x}}^{{2}}+{4}{x}}}}+{4}$$$.

This is even closer to $$${\color{green}{{{{x}}^{{2}}+{4}{x}}}}$$$, except the constant.

No problem! We can add any constants to the equation to leave it unchanged:

$$${{x}}^{{2}}+{4}{x}={21}$$$

$$${{x}}^{{2}}+{4}{x}+{\color{purple}{{{4}}}}={21}+{\color{purple}{{{4}}}}$$$ (we need to add 4 to get square on the left hand side)

$$${{\left({x}+{2}\right)}}^{{2}}=25$$$ $$$\left({{x}}^{{2}}+{4}{x}+{4}={{\left({x}+{2}\right)}}^{{2}}\right)$$$

We've got the equation very similar to equation in first example.

It has two solutions: $$${x}=\sqrt{{{25}}}-{2}={3}$$$ and $$${x}=-\sqrt{{{25}}}-{2}=-{7}$$$.

**Answer**: $$${x}={3}$$$ and $$${x}=-{7}$$$.

Next example explains how to handle cases, when coefficient near $$${{x}}^{{2}}$$$ is not $$${1}$$$.

**Example 3.** Solve $$${3}{{x}}^{{2}}={5}{x}+{2}$$$.

First of all, write equation in standard form by moving everything (except constant) to the left (don't forget to change the sign): $$${3}{{x}}^{{2}}-{5}{x}={2}$$$.

Coefficient near $$${{x}}^{{2}}$$$ is $$${3}$$$, and it is more convenient, when coeffcient near $$${{x}}^{{2}}$$$ is $$${1}$$$.

That's not a problem, because we can divide both sides of equation by $$${3}$$$: $$${{x}}^{{2}}-{\color{red}{{\frac{{5}}{{3}}}}}{x}=\frac{{2}}{{3}}$$$.

Now, we take fomula for square of difference: $$${{\left({x}-{n}\right)}}^{{2}}={{x}}^{{2}}-{\color{red}{{{2}{n}}}}{x}-{{n}}^{{2}}$$$.

Again, notice, that we want to find such value of $$${n}$$$, that $$${\color{red}{{{2}{n}=\frac{{5}}{{3}}}}}$$$ or $$${n}=\frac{{5}}{{6}}$$$.

Thus, $$${{\left({x}-\frac{{5}}{{6}}\right)}}^{{2}}={{x}}^{{2}}-\frac{{5}}{{3}}{x}+{{\left(\frac{{5}}{{6}}\right)}}^{{2}}$$$.

Return to our equation:

$$${{x}}^{{2}}-\frac{{5}}{{3}}{x}=\frac{{2}}{{3}}$$$

$$${{x}}^{{2}}-\frac{{5}}{{3}}{x}+{{\left(\frac{{5}}{{6}}\right)}}^{{2}}=\frac{{2}}{{3}}+{{\left(\frac{{5}}{{6}}\right)}}^{{2}}$$$ (add $$${{\left(\frac{{5}}{{6}}\right)}}^{{2}}$$$ to get square on the left hand side)

$$${{\left({x}-\frac{{5}}{{6}}\right)}}^{{2}}=\frac{{2}}{{3}}+\frac{{25}}{{36}}$$$ $$$\left({{x}}^{{2}}-\frac{{5}}{{3}}{x}+{{\left(\frac{{5}}{{6}}\right)}}^{{2}}={{\left({x}-\frac{{5}}{{6}}\right)}}^{{2}}\right)$$$

$$${{\left({x}-\frac{{5}}{{6}}\right)}}^{{2}}=\frac{{49}}{{36}}$$$ (simplify)

Here we have two possibilities:

- $$${x}-\frac{{5}}{{6}}=\sqrt{{\frac{{49}}{{36}}}}=\frac{{7}}{{6}}$$$,which has solution $$${x}={2}$$$.
- $$${x}-\frac{{5}}{{6}}=-\sqrt{{\frac{{49}}{{36}}}}=-\frac{{7}}{{6}}$$$, which has solution $$${x}=-\frac{{1}}{{3}}$$$.

**Answer**: $$${x}={2}$$$ and $$${x}=-\frac{{1}}{{3}}$$$.

Above two examples showed, that we can write steps for completing the square.

**Steps for completing the square**:

- Start with the equation $$${a}{{x}}^{{2}}+{b}{x}+{c}={0}$$$.
- Divide both sides of the equation by $$${a}$$$ (if $$${a}\ne{1}$$$): $$${{x}}^{{2}}+\frac{{b}}{{a}}{x}+\frac{{c}}{{a}}={0}$$$.
- Move constant to the right: $$${{x}}^{{2}}+\frac{{b}}{{a}}{x}=-\frac{{c}}{{a}}$$$.
- Find number $$${n}$$$, such that $$${n}=\frac{{b}}{{{2}{a}}}$$$.
- Add $$${{n}}^{{2}}$$$ to both sides of equation: $$${{x}}^{{2}}+\frac{{b}}{{a}}{x}+{{\left(\frac{{b}}{{{2}{a}}}\right)}}^{{2}}=-\frac{{c}}{{a}}+{{\left(\frac{{b}}{{{2}{a}}}\right)}}^{{2}}$$$.
- Rewrite left hand side: $$${{\left({x}+\frac{{b}}{{{2}{a}}}\right)}}^{{2}}=-\frac{{c}}{{a}}+{{\left(\frac{{b}}{{{2}{a}}}\right)}}^{{2}}$$$.
- Solve the equation.

Let's try to apply these steps in the next example.

**Example 3.** Solve equation $$$-{{x}}^{{2}}+{5}{x}-{21}={0}$$$.

- Start with equation: $$$-{{x}}^{{2}}+{5}{x}-{21}={0}$$$.
- Divide both sides of the equation by $$$-{1}$$$: $$${{x}}^{{2}}-{5}{x}+{21}={0}$$$.
- Move constant to the right: $$${{x}}^{{2}}-{5}{x}=-{21}$$$.
- Number $$${n}$$$ is $$${n}=-\frac{{5}}{{2}}$$$.
- Add $$${{\left(-\frac{{5}}{{2}}\right)}}^{{2}}=\frac{{25}}{{4}}$$$ to both sides of the equation: $$${{x}}^{{2}}-{5}{x}+\frac{{25}}{{4}}=-{21}+\frac{{25}}{{4}}$$$.
- Rewrite and simplify: $$${{\left({x}-\frac{{5}}{{2}}\right)}}^{{2}}=-\frac{{59}}{{4}}$$$.
- This equation has no roots, because there is no real number, such that, when squared, will give negative number.

**Answer**: no real roots.

Now, it is time to exercise.

**Exercise 1.** Solve the following equation: $$${{\left({2}{x}+{5}\right)}}^{{2}}={49}$$$.

**Answer**: $$${1}$$$ and $$$-{6}$$$.

**Exercise 2.** Solve equation $$${{\left(-{3}{x}+{1}\right)}}^{{2}}={5}$$$.

**Answer**: $$$\frac{{{1}-\sqrt{{{5}}}}}{{3}}$$$ and $$$\frac{{{1}+\sqrt{{{5}}}}}{{3}}$$$.

**Exercise 3.** Solve equation $$${{\left(-{2}{x}+\frac{{3}}{{4}}\right)}}^{{2}}={0}$$$.

**Answer**: $$$\frac{{3}}{{8}}$$$. Hint: the only number, that, when squared, will give 0 is 0 itself.

**Exercise 4.** Solve equation $$${{\left({x}-{3}\right)}}^{{2}}=-{7}$$$.

**Answer**: no real roots.

**Exercise 5.** Solve equation by completing the square $$${{x}}^{{2}}+{9}{x}+{14}={0}$$$.

**Answer**: $$$-{2}$$$ and $$$-{7}$$$.

**Exercise 6.** Solve the following equation: $$${6}{x}={9}{{x}}^{{2}}+{1}$$$.

**Answer**: $$$\frac{{1}}{{3}}$$$.

**Exercise 7.** Solve equation $$$-\frac{{1}}{{3}}{{x}}^{{2}}={3}{x}+{15}$$$.

**Answer**: no real roots.