If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# 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, squared, plus, 6, x, equals, minus, 2. The square root and factoring methods are not applicable here.
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, squared, plus, 6, x in row start color #11accd, left parenthesis, 2, right parenthesis, end color #11accd had the fortunate result of making the expression a perfect square that can be factored as left parenthesis, x, plus, 3, right parenthesis, squared. 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, squared, 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, squared where the value of constant a is still unknown. This expression is expanded as x, squared, plus, 2, a, x, plus, a, squared, 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, squared, which is 3, squared, equals, 9.
Try to complete a few squares on your own.
Problem 1
What is the missing constant term in the perfect square that starts with x, squared, plus, 10, x ?

Problem 2
What is the missing constant term in the perfect square that starts with x, squared, minus, 2, x ?

Problem 3
What is the missing constant term in the perfect square that starts with x, squared, plus, start fraction, 1, divided by, 2, end fraction, x ?

Challenge problem
What is the missing constant term in the perfect square that starts with x, squared, plus, b, dot, x?

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, squared, 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, squared to it.
For example, in order to complete x, squared, plus, start color #11accd, 6, end color #11accd, x into a perfect square, we added left parenthesis, start fraction, start color #11accd, 6, end color #11accd, divided by, 2, end fraction, right parenthesis, squared, 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, squared, 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, squared, minus, 10, x a perfect square, we added 25 in row start color #11accd, left parenthesis, 2, right parenthesis, end color #11accd. 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.
Problem 4
Solve x, squared, minus, 8, x, equals, 5.

Problem 5
Solve x, squared, plus, 3, x, equals, minus, start fraction, 1, divided by, 4, 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, squared, 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 #01a995, left parenthesis, 2, right parenthesis, end color #01a995, placing all the variable terms on the left-hand side.
Furthermore, to complete x, squared, 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 #aa87ff, left parenthesis, 3, right parenthesis, end color #aa87ff, leaving x, squared, plus, 4, x on its own.

### Rule 2: Make sure the coefficient of $x^2$x, squared is equal to $1$1.

This is how the solution of the equation 3, x, squared, 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, squared is 1.
This is why in row start color #ca337c, left parenthesis, 2, right parenthesis, end color #ca337c we divided by the coefficient of x, squared, which is 3.
Sometimes, dividing by the coefficient of x, squared 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.
Now it's your turn to solve an equation like this.
Problem 6
Solve 4, x, squared, plus, 20, x, minus, 3, equals, 0.

## Want to join the conversation?

• how did you get 25/4 and how did you equal it to 7
• The 25/4 and 7 is the result of completing the square method.

To factor the equation, you need to first follow this equation: x^​2​ + 2ax + a^2.
In x^2 +5x = 3/4, The a^2 is missing.

To figure out the a, you need to take the 5 and divide it by 2 (because 2ax), which becomes 5/2. a=5/2.
Then you need to square it, (because a^2) which becomes 5^2/2^2.
5x5 is 25, and 2x2 is 4, so the a^2 is 25/4.
When you add 25/4 on the left side, you have to add 25/4 on the right side as well.
Remember, the 3/4 is still there, so add them: x^2 + 5x + 25/4 = 25/4 + 3/4
25/4 + 3/4 = 28/4. 28 divided by 4 is 7.

Hope this helps! :3
• How was 7 added at the 6 paragraph? Where it shows the steps on how to complete the square?
• When Sal adds 9 to the left side, he must also add 9 to the right side. The right side was "-2".
So, when he add the 9, he gets: "- 2 + 9 = 7"
Hope this helps.
(1 vote)
• what does what does it mean when there is a letter i In the solution of the equation?
• An "i" means the answer is the square root of a negative number. Since that doesn't work in the normal everyday world - but does have uses elsewhere - the "i" is used to make it easier to simplify the answers (and confuse the people ~_^). "i" is defined as the square root of negative 1, and can be factored out. Like an "x" or other variable, terms with "i" can only be added to or subtracted from other terms containing "i". However, "i" squared = -1. It becomes a regular number and can be added to regular numbers. This is important to remember when checking your answers.
• Does each quadratic equation always have a square and those missing parts of the square; or is it (this method) just for the perfect square equations?
• Not every quadratic equation always has a square. It may have a square, missing parts for a square, or even both, in which case you could use the completing the square method. But no, for the most part, each quadratic function won't necessarily have squares or missing parts. It's possible, but not common. But since every number is a square and has a square root, you can still do it, though it would be much more painful.
(1 vote)
• How do you solve 5x^2 -10x =23
• I'm going to assume you want to solve by completing the square.
1) Divide the entire equation by 5: x^2 - 2x = 23/5
2) Complete the square: -2/2 = -1. (-1)^2 = +1. Add +1 to both sides: x^2 - 2x + 1 = 23/5 + 1
3) Rewrite the left side as a binomial squared, and add the fractions on the right: (x-1)^2 = 28/5
4) Take square root of both sides: sqrt(x-1)^2 = +/- sqrt(28/5)
x-1 = +/- sqrt(4*7/5)
x-1 = +/- 2 sqrt(7/5) * sqrt(5/5)
x-1 = +/- 2 sqrt(35) / 5
6) Add 1 to both sides:
x = 1 +/- 2 sqrt(35) / 5
x = 5/5 +/- 2 sqrt(35) / 5
x = [5 +/- 2 sqrt(35)] / 5

Hope this helps.
• This method is only available if factoring does not help correct?
(1 vote)
• No, completing the square can be used to solve any quadratic equation whether or not factoring works.
• How do I do a quadratic equation using completing the square if a or x^2 have a number in front of it ( ie. 4x^2) because I have tried many things with it and it doesn't add up or subtract out.
• This would be the same as rule 2 (and everything after that) in the article above.
You are correct that you cannot get rid of it by adding or subtracting it out. As shown in rule 2, you have to divide by the value of a (which is 4 in your case). In the example following rule 2 that we were supposed to try, the coefficient of x² is 4. So, we have to divide the x² AND the x terms by 4 to bring the coefficient of x² down to 1. ​
Let's use the example they gave us:
4x² + 20x -3 = 0
move the constant term
4x² + 20x = 3
divide through the x² term and x term by 4 to factor it out
4(4x²/4 + 20x/4 ) = 3

This leaves
4( x² + 5x ) = 3

Or, you can divide EVERY term by 4 to get
x² + 5x = 3/4 → I prefer this way of doing it
Now we complete the square by dividing the x-term by 2 and adding the square of that to both sides of the equation. That is 5/2 which is 25/4 when it is squared
x² + 5x +25/4 = 3/4 + 25/4  → simplify the right side
x² + 5x +25/4 = 28/4  → Hey, that is equal to 7
Now rewrite the perfect square trinomial as the square of the two binomial factors
We especially designed this trinomial to be a perfect square so that this step would work:
x² + 5x +25/4 =  (x + 5/2)²
If you get stuck on the fractions, the right-hand term in the parentheses will be half of the x-term.
 (x + 5/2)²  = 7
Take the square root of both sides, remembering to take both the positive and negative square root of the number on the right
 (x + 5/2)²  = ± √ 7
x + 5/2 = ± √ 7
Isolate the x by subtracting away the constant that is still with it
x = - 5/2 ± √ 7
That gives us our two correct solutions for x
x = - 5/2 + √ 7
x = - 5/2 - √ 7
• Often when coming across quadratics with non-zero leading co-efficients I'm not sure whether to pull out a common factor, or to divide by the leading co-efficient.

For example in the above question in my first attempt I factored out a 4 to get 4(x^2 + 5x)-3=0.

However, when attempting to solve from there, I end up at a dead end, or with a different result to if I'd divided out the leading co-efficient.

Are these 2 methods interchangeable, and I'm just doing something wrong? Or, is there a preferred approach for some reason?
• I wouldn't say that both methods are exactly interchangable; however, it's best to factor out. Factoring it out preserves the equation whilst dividing the equation by, for example it's GCF, removes that aspect of the equation. As a result from that, there might be some loss of solutions.

Your completing the square method is exactly on point with the first half. Just remember when you find (b/2)², you must add that result in the parenthesis, and subtract it out and multiply it by the 4 by the number outside. Less abstractly:

4(x²+5x+(25/4)) - 3(4)(25/4) = 0

And solve by then. Hopefully that gives some insight
• What if my x^2 value has a coefficient in front. What do I do with it?
• It is given this equation: 3x^2 -2x+4=0
in the end of solving i have this:(x-2/6)^2=-44/36
^2 means in power of two. Does this equation has no solution?
(1 vote)
• Yes, I believe you're correct.
But if you want to check the solution, you can always find the discriminant.
So, Δ = b^2 - 4ac
Δ = (-2)^2 - 4 (3) (4)
Δ = 4 - 48
Δ = -44
So it has no solution.

Hope this helped. :)