Main content

## Algebra (all content)

### Course: Algebra (all content) > Unit 9

Lesson 6: Completing the square- Completing the square
- Solving quadratics by completing the square
- Worked example: Completing the square (intro)
- Completing the square (intro)
- Worked example: Rewriting expressions by completing the square
- Worked example: Rewriting & solving equations by completing the square
- Completing the square (intermediate)
- Worked example: completing the square (leading coefficient ≠ 1)
- Completing the square
- Solving quadratics by completing the square: no solution
- Completing the square review

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# 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 should be familiar with before taking this lesson

## 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}^{2}+6x=-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.In conclusion, the solutions are $x=\sqrt{7}-3$ and $x=-\sqrt{7}-3$ .

### What happened here?

Adding $9$ to ${x}^{2}+6x$ in row ${(2)}$ had the fortunate result of making the expression a perfect square that can be factored as $(x+3{)}^{2}$ . 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}^{2}+6x$ 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 $(x+a{)}^{2}$ where the value of constant $a$ is still unknown. This expression is expanded as ${x}^{2}+2ax+{a}^{2}$ , which tells us two things:

- The coefficient of
, which we know to be$x$ , should be equal to$6$ . This means that$2a$ .$a=3$ - The constant number we need to add is equal to
, which is${a}^{2}$ .${3}^{2}=9$

Try to complete a few squares on your own.

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}^{2}+bx$ into a perfect square, where $b$ is any number, we need to add ${\left({\displaystyle \frac{b}{2}}\right)}^{2}$ to it.

For example, in order to complete ${x}^{2}+{6}x$ into a perfect square, we added ${\left({\displaystyle \frac{{6}}{2}}\right)}^{2}=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}^{2}-10x=-12$ .

In order to make the original left-hand expression ${x}^{2}-10x$ a perfect square, we added $25$ in row ${(2)}$ . As always with equations, we did the same for the right-hand side, which made it increase from $-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.

## 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}^{2}+5x-6=x+1$ goes:

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 ${(2)}$ , placing all the variable terms on the left-hand side.

Furthermore, to complete ${x}^{2}+4x$ 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 ${(3)}$ , leaving ${x}^{2}+4x$ on its own.

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

This is how the solution of the equation $3{x}^{2}-36x=-42$ goes:

The completing the square method only works if the coefficient of ${x}^{2}$ is $1$ .

This is why in row ${(2)}$ we divided by the coefficient of ${x}^{2}$ , which is $3$ .

Sometimes, dividing by the coefficient of ${x}^{2}$ 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.

## Want to join the conversation?

- how did you get 25/4 and how did you equal it to 7(16 votes)
- 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(42 votes)

- How was 7 added at the 6 paragraph? Where it shows the steps on how to complete the square?(8 votes)
- 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.(24 votes)

- what does what does it mean when there is a letter i In the solution of the equation?(4 votes)
- 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.(9 votes)

- How do you solve 5x^2 -10x =23(3 votes)
- 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)`

5) Simplify both radicals:`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.(7 votes)

- 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?(4 votes)
- 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.(2 votes)

- 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.(1 vote)
- 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`

(7 votes)

- This method is only available if factoring does not help correct?(0 votes)
- No, completing the square can be used to solve any quadratic equation whether or not factoring works.(3 votes)

- 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?(3 votes)- 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(2 votes)

- What if my x^2 value has a coefficient in front. What do I do with it?(2 votes)
- That is covered in a later lesson: https://www.khanacademy.org/math/algebra/quadratics/solving-quadratics-by-completing-the-square/v/completing-the-square-to-solve-quadratic-equations

You can find more examples at this link: https://www.purplemath.com/modules/sqrquad.htm(1 vote)

- 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. :)(3 votes)