Solving quadratics by completing the square

For example, solve x²+6x=-2 by manipulating it into (x+3)²=7 and then taking the square root.

What you will learn in this lesson

So far, you've either solved quadratic equations by taking the square root or by factoring. These methods are relatively simple and efficient, when applicable. Unfortunately, they are not always applicable.
In this lesson, you will learn a method for solving any kind of quadratic equation.

Solving quadratic equations by completing the square

Consider the equation x, start superscript, 2, end superscript, plus, 6, x, equals, minus, 2. The square root and factoring methods are not applicable here.
You can't just take the square root of both sides because the equation includes x raised to the first power.
Furthermore, you simply can't factor x, start superscript, 2, end superscript, plus, 6, x, plus, 2 as the product of two neat linear expressions. Try it yourself, it won't work.
But hope is not lost! We can use a method called completing the square. Let's start with the solution and then review it more closely.
\begin{aligned}(1)&&x^2+6x&=-2\\\\ \blueD{(2)}&&\Large\blueD{x^2+6x+9}&\Large\blueD{=7}&&\blueD{\text{Add 9, completing the square.}}\\\\ (3)&&(x+3)^2&=7&&\text{Factor the expression on the left.}\\\\ (4)&&\sqrt{(x+3)^2}&=\pm \sqrt{7}&&\text{Take the square root.}\\\\ (5)&&x+3&=\pm\sqrt{7}\\\\ (6)&&x&=\pm\sqrt{7}-3&&\text{Subtract 3.}\end{aligned}
In conclusion, the solutions are x, equals, square root of, 7, end square root, minus, 3 and x, equals, minus, square root of, 7, end square root, minus, 3.

What happened here?

Adding 9 to x, start superscript, 2, end superscript, plus, 6, x in row start color blueD, left parenthesis, 2, right parenthesis, end color blueD had the fortunate result of making the expression a perfect square that can be factored as left parenthesis, x, plus, 3, right parenthesis, start superscript, 2, end superscript. This allowed us to solve the equation by taking the square root.
This was no coincidence, of course. The number 9 was carefully chosen so the resulting expression would be a perfect square.

How to complete the square

To understand how 9 was chosen, we should ask ourselves the following question: If x, start superscript, 2, end superscript, plus, 6, x is the beginning of a perfect square expression, what should be the constant term?
Let's assume that the expression can be factored as the perfect square left parenthesis, x, plus, a, right parenthesis, start superscript, 2, end superscript where the value of constant a is still unknown. This expression is expanded as x, start superscript, 2, end superscript, plus, 2, a, x, plus, a, start superscript, 2, end superscript, which tells us two things:
1. The coefficient of x, which we know to be 6, should be equal to 2, a. This means that a, equals, 3.
2. The constant number we need to add is equal to a, start superscript, 2, end superscript, which is 3, start superscript, 2, end superscript, equals, 9.
Try to complete a few squares on your own.
What is the missing constant term in the perfect square that starts with x, start superscript, 2, end superscript, plus, 10, x ?

We want to add a constant number to x, start superscript, 2, end superscript, plus, start color tealD, 10, end color tealD, x so it is in the form x, start superscript, 2, end superscript, plus, start color tealD, 2, a, end color tealD, x, plus, a, start superscript, 2, end superscript. In that form, the coefficient of x is start color tealD, 2, a, end color tealD, and in our expression that coefficient is start color tealD, 10, end color tealD. Therefore, start color tealD, 2, a, end color tealD, equals, start color tealD, 10, end color tealD, which means a, equals, 5.
The constant number we need to add to get to that form is a, start superscript, 2, end superscript, which is 5, start superscript, 2, end superscript, equals, 25. This way, the expression will be x, start superscript, 2, end superscript, plus, 10, x, plus, 25 which is factored as left parenthesis, x, plus, 5, right parenthesis, start superscript, 2, end superscript.
In conclusion, the constant we should add is 25.
What is the missing constant term in the perfect square that starts with x, start superscript, 2, end superscript, minus, 2, x ?

We want to add a constant number to x, start superscript, 2, end superscript, start color tealD, minus, 2, end color tealD, x so it is in the form x, start superscript, 2, end superscript, plus, start color tealD, 2, a, end color tealD, x, plus, a, start superscript, 2, end superscript. In that form, the coefficient of x is start color tealD, 2, a, end color tealD, and in our expression that coefficient is start color tealD, minus, 2, end color tealD. Therefore, start color tealD, 2, a, end color tealD, equals, start color tealD, minus, 2, end color tealD which means a, equals, minus, 1.
The constant number we need to add to get to that form is a, start superscript, 2, end superscript, which is left parenthesis, minus, 1, right parenthesis, start superscript, 2, end superscript, equals, 1. This way, the expression will be x, start superscript, 2, end superscript, minus, 2, x, plus, 1, which is factored as left parenthesis, x, minus, 1, right parenthesis, start superscript, 2, end superscript.
In conclusion, the constant we should add is 1.
What is the missing constant term in the perfect square that starts with x, start superscript, 2, end superscript, plus, start fraction, 1, divided by, 2, end fraction, x ?

We want to add a constant number to x, start superscript, 2, end superscript, plus, start color tealD, start fraction, 1, divided by, 2, end fraction, end color tealD, x so it is in the form x, start superscript, 2, end superscript, plus, start color tealD, 2, a, end color tealD, x, plus, a, start superscript, 2, end superscript. In that form, the coefficient of x is start color tealD, 2, a, end color tealD, and in our expression that coefficient is start color tealD, start fraction, 1, divided by, 2, end fraction, end color tealD. Therefore, start color tealD, 2, a, end color tealD, equals, start color tealD, start fraction, 1, divided by, 2, end fraction, end color tealD, which means a, equals, start fraction, 1, divided by, 4, end fraction.
The constant number we need to add to get to that form is a, start superscript, 2, end superscript, which is left parenthesis, start fraction, 1, divided by, 4, end fraction, right parenthesis, start superscript, 2, end superscript, equals, start fraction, 1, divided by, 16, end fraction. This way, the expression will be x, start superscript, 2, end superscript, plus, start fraction, 1, divided by, 2, end fraction, x, plus, start fraction, 1, divided by, 16, end fraction, which is factored as left parenthesis, x, plus, start fraction, 1, divided by, 4, end fraction, right parenthesis, start superscript, 2, end superscript.
In conclusion, the constant we should add is start fraction, 1, divided by, 16, end fraction.

Challenge question

What is the missing constant term in the perfect square that starts with x, start superscript, 2, end superscript, plus, b, space, dot, space, space, x?

We want to add a constant number to x, start superscript, 2, end superscript, plus, start color tealD, b, end color tealD, dot, x so it is in the form x, start superscript, 2, end superscript, plus, start color tealD, 2, a, end color tealD, x, plus, a, start superscript, 2, end superscript. In that form, the coefficient of x is start color tealD, 2, a, end color tealD, and in our expression that coefficient is start color tealD, b, end color tealD. Therefore, start color tealD, 2, a, end color tealD, equals, start color tealD, b, end color tealD, which means a, equals, start fraction, b, divided by, 2, end fraction.
The constant number we need to add to get to that form is a, start superscript, 2, end superscript, which is left parenthesis, start fraction, b, divided by, 2, end fraction, right parenthesis, start superscript, 2, end superscript. This way, the expression will be x, start superscript, 2, end superscript, plus, 2, dot, start fraction, b, divided by, 2, end fraction, dot, x, plus, left parenthesis, start fraction, b, divided by, 2, end fraction, right parenthesis, start superscript, 2, end superscript, which is factored as left parenthesis, x, plus, start fraction, b, divided by, 2, end fraction, right parenthesis, start superscript, 2, end superscript.
In conclusion, the constant we should add is left parenthesis, start fraction, b, divided by, 2, end fraction, right parenthesis, start superscript, 2, end superscript.
This challenge question gives us a shortcut to completing the square, for those that like shortcuts and don't mind memorizing things. It shows us that in order to complete x, start superscript, 2, end superscript, plus, b, x into a perfect square, where b is any number, we need to add left parenthesis, start fraction, b, divided by, 2, end fraction, right parenthesis, start superscript, 2, end superscript to it.
For example, in order to complete x, start superscript, 2, end superscript, plus, start color blueD, 6, end color blueD, x into a perfect square, we added left parenthesis, start fraction, start color blueD, 6, end color blueD, divided by, 2, end fraction, right parenthesis, start superscript, 2, end superscript, equals, 9 to it.

Solving equations one more time

All right! Now that you're a certified square-completer, let's go back to the process of solving equations using our method.
Let's look at a new example, the equation x, start superscript, 2, end superscript, minus, 10, x, equals, minus, 12.
\begin{aligned}(1)&&x^2-10x&=-12\\\\ \blueD{(2)}&&\Large\blueD{x^2-10x+25}&\Large\blueD{=13}&&\blueD{\text{Add 25, completing the square.}}\\\\ (3)&&(x-5)^2&=13&&\text{Factor the expression on the left.}\\\\ (4)&&\sqrt{(x-5)^2}&=\pm \sqrt{13}&&\text{Take the square root.}\\\\ (5)&&x-5&=\pm\sqrt{13}\\\\ (6)&&x&=\pm\sqrt{13}+5&&\text{Add 5.}\end{aligned}
In order to make the original left-hand expression x, start superscript, 2, end superscript, minus, 10, x a perfect square, we added 25 in row start color blueD, left parenthesis, 2, right parenthesis, end color blueD. As always with equations, we did the same for the right-hand side, which made it increase from minus, 12 to 13.
In general, the choice of the number to add in order to complete the square doesn't depend on the right-hand side, but we should always add the number to both sides.
Now it's your turn to solve some equations.
Solve x, start superscript, 2, end superscript, minus, 8, x, equals, 5.

\begin{aligned}x^2-8x&=5\\\\ x^2-8x+16&=21&&\text{Add 16, completing the square.)}\\\\ (x-4)^2&=21&&\text{Factor}\\\\ \sqrt{(x-4)^2}&=\pm\sqrt{21}&&\text{Take the square root.}\\\\ x-4&=\pm\sqrt{21}\\\\ x&=\pm\sqrt{21}+4&&\text{Add 4.}\end{aligned}
In conclusion, the solutions are x, equals, square root of, 21, end square root, plus, 4 and minus, square root of, 21, end square root, plus, 4.
Solve x, start superscript, 2, end superscript, plus, 3, x, equals, minus, start fraction, 1, divided by, 4, end fraction.

\begin{aligned}x^2+3x&=-\dfrac{1}{4}\\\\ x^2+3x+\dfrac{9}{4}&=2&&\text{Add }\dfrac{9}{4}\text{, completing the square.}\\\\\\ \left(x+\dfrac{3}{2}\right)^2&=2&&\text{Factor.}\\\\\\ \sqrt{\left(x+\dfrac{3}{2}\right)^2}&=\pm\sqrt{2}&&\text{Take the square root.}\\\\\\ x+\dfrac{3}{2}&=\pm\sqrt{2}\\\\ x&=\pm\sqrt{2}-\dfrac{3}{2}&&\text{Subtract }\dfrac{3}{2}\text{.}\end{aligned}
In conclusion, the solutions are x, equals, square root of, 2, end square root, minus, start fraction, 3, divided by, 2, end fraction and minus, square root of, 2, end square root, minus, start fraction, 3, divided by, 2, end fraction.

Arranging the equation before completing the square

Rule 1: Separate the variable terms from the constant term

This is how the solution of the equation x, start superscript, 2, end superscript, plus, 5, x, minus, 6, equals, x, plus, 1 goes:
\begin{aligned}(1)&&x^2+5x-6&=x+1\\\\ \tealD{(2)}&&\tealD{x^2+4x-6}&\tealD{=1}&&\tealD{\text{Subtract }x.}\\\\ \purpleC{(3)}&&\purpleC{x^2+4x}&\purpleC{=7}&&\purpleC{\text{Add 6.}}\\\\ (4)&&x^2+4x+4&=11&&\text{Add 4, completing the square.}\\\\ (5)&&(x+2)^2&=11&&\text{Factor.}\\\\ (6)&&\sqrt{(x+2)^2}&=\pm\sqrt{11}&&\text{Take the square root.}\\\\ (7)&&x+2&=\pm\sqrt{11}\\\\ (8)&&x&=\pm\sqrt{11}-2&&\text{Subtract 2.}\end{aligned}
Completing the square on one of the equation's sides is not helpful if we have an x-term on the other side. This is why we subtracted x in row start color tealD, left parenthesis, 2, right parenthesis, end color tealD, placing all the variable terms on the left-hand side.
Furthermore, to complete x, start superscript, 2, end superscript, plus, 4, x into a perfect square, we need to add 4 to it. But before we do that, we need to make sure that all the constant terms are on the other side of the equation. This is why we added 6 in row start color purpleC, left parenthesis, 3, right parenthesis, end color purpleC, leaving x, start superscript, 2, end superscript, plus, 4, x on its own.

Rule 2: Make sure the coefficient of $x^2$x, start superscript, 2, end superscript is equal to $1$1.

This is how the solution of the equation 3, x, start superscript, 2, end superscript, minus, 36, x, equals, minus, 42 goes:
\begin{aligned}(1)&&3x^2-36x&=-42\\\\ \maroonD{(2)}&&\maroonD{x^2-12x}&\maroonD{=-14}&&\maroonD{\text{Divide by 3.}}\\\\ (3)&&x^2-12x+36&=22&&\text{Add 36,completing the square.}\\\\ (4)&&(x-6)^2&=22&&\text{Factor.}\\\\ (5)&&\sqrt{(x-6)^2}&=\pm\sqrt{22}&&\text{Take the square root.}\\\\ (6)&&x-6&=\pm\sqrt{22}\\\\ (7)&&x&=\pm\sqrt{22}+6&&\text{Add 6.}\end{aligned}
The completing the square method only works if the coefficient of x, start superscript, 2, end superscript is 1.
In the completing the square method, we compare the given expression to the general perfect square left parenthesis, x, plus, a, right parenthesis, start superscript, 2, end superscript, which is expanded as x, start superscript, 2, end superscript, plus, 2, a, x, plus, a, start superscript, 2, end superscript. As you see, in this expression, the coefficient of x, start superscript, 2, end superscript is 1.
If we look at an expression like 3, x, start superscript, 2, end superscript, minus, 36, x as the beginning of a perfect square, it will not be equal to the general perfect square left parenthesis, x, plus, a, right parenthesis, start superscript, 2, end superscript. Instead, it will be equal to the general perfect square left parenthesis, square root of, 3, end square root, dot, x, plus, a, right parenthesis, start superscript, 2, end superscript, which is expanded as 3, x, start superscript, 2, end superscript, plus, 2, a, square root of, 3, end square root, dot, x, plus, a, start superscript, 2, end superscript. Good luck with that!
This is why in row start color maroonD, left parenthesis, 2, right parenthesis, end color maroonD we divided by the coefficient of x, start superscript, 2, end superscript, which is 3.
Sometimes, dividing by the coefficient of x, start superscript, 2, end superscript will result in other coefficients becoming fractions. This doesn't mean you did something wrong, it just means you will have to work with fractions in order to solve.
\begin{aligned}4x^2-4x&=11\\\\ x^2-x&=\dfrac{11}{4}&&\text{Divide by 4.}\\\\\\ x^2-x+\dfrac{1}{4}&=\dfrac{11}{4}+\dfrac{1}{4}&&\text{Add }\dfrac{1}{4}\text{, completing the square.}\\\\\\ \left(x-\dfrac{1}{2}\right)^2&=3&&\text{Factor.}\\\\\\ \sqrt{\left(x-\dfrac{1}{2}\right)^2}&=\pm\sqrt{3}&&\text{Take the square root.}\\\\\\ x-\dfrac{1}{2}&=\pm\sqrt{3}\\\\ x&=\pm\sqrt{3}+\dfrac{1}{2}&&\text{Add }\dfrac{1}{2}\text{.}\end{aligned}
In conclusion, the solutions are x, equals, square root of, 3, end square root, plus, start fraction, 1, divided by, 2, end fraction and minus, square root of, 3, end square root, plus, start fraction, 1, divided by, 2, end fraction.
Now it's your turn to solve an equation like this.
Solve 4, x, start superscript, 2, end superscript, plus, 20, x, minus, 3, equals, 0.
\begin{aligned}4x^2+20x-3&=0\\\\ 4x^2+20x&=3&&\text{Add 3}\\\\ x^2+5x&=\dfrac{3}{4}&&\text{Divide by 4.}\\\\\\ x^2+5x+\dfrac{25}{4}&=7&&\text{Add }\dfrac{25}{4}\text{, completing the square.}\\\\\\ \left(x+\dfrac{5}{2}\right)^2&=7&&\text{Factor.}\\\\\\ \sqrt{\left(x+\dfrac{5}{2}\right)^2}&=\pm\sqrt{7}&&\text{Take the square root.}\\\\\\ x+\dfrac{5}{2}&=\pm\sqrt{7}\\\\ x&=\pm\sqrt{7}-\dfrac{5}{2}&&\text{Subtract }\dfrac{5}{2}\text{.}\end{aligned}