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.

# Completing the square

Some quadratic expressions can be factored as perfect squares. For example, x²+6x+9=(x+3)². However, even if an expression isn't a perfect square, we can turn it into one by adding a constant number. For example, x²+6x+5 isn't a perfect square, but if we add 4 we get (x+3)². This, in essence, is the method of *completing the square*. Created by Sal Khan and CK-12 Foundation.

## Want to join the conversation?

• That wasn't very clear, may you please do another video about that?
• You don´t need another video because I´m about to explain it to you! Say you have the equation 3x^2-6x+8=23. To complete the square, first, you want to get the constant (c) on one side of the equation, and the variable(s) on the other side. To do this, you will subtract 8 from both sides to get 3x^2-6x=15. Next, you want to get rid of the coefficient before x^2 (a) because it won´t always be a perfect square. Because there is a 3 in front of x^2, you will divide both sides by 3 to get x^2-2x=5. Next, you want to add a value to the variable side so that when you factor that side, you will have a perfect square. In this case, you will add 1 because it perfectly factors out into (x-1)^2. Because you´re taking this value away from the constant, you will add it to the other side of the equation (this might not make sense at first, but if the constant were on the variable side, you would be subtracting). This will all give you the equation (x-1)^2=16. Next, you want to take the square root from both sides so that x-1 is equal to the positive or negative square root of 16 (positive or negative 4). Finally, you add 1 to both sides, taking into account that 4 could be positive OR negative. Therefore, x = -3 or 5. Situations could vary, but this is the basic idea behind the procedure. I hope this helps! :)
• Can someone please post the link to the "Last video" of which Sal speaks?
• Between to , May i understand why a=-2. i thought it would be 2 instead since were equating -4x to -2ax.
• I think Sal made a mistake. But 2^2 and (-2)^2 are both 4, so the result was correct.
• When would this be more advantageous than using the quadratic formula?
• After studying I have found that completing the square is useful for finding vertex form whereas quadratic formula is useful for finding roots.
• honestly even if this is useful in real life I hope I don't encounter a circumstance where I need this math
• At , I am confused about where the (x-a)^2 came from and why that is equal to x^2-4x=5
Could you explain this?
Now x^2 - 4x = 5
x^2 - 4x + (something) = 5 + something
I want to factorise the left side of the equal sign, so I have to find a value for (something) which would allow me to factorise the left-hand side of the equation.
If (something)=4
x^2 - 4x + 4 = 5 + 4
Notice that now I could factorise the left hand side into (x - 2)^2
(x-2)^2 = 9
x-2 = root of 9 = + or - 3
x = +3+2 or -3+2
x = +5 or -1.
You want x^2 - 4x + (something) to be equal to (x-a)^2.
where a is half the coefficient of x(the number before the x), as long a there is no coefficient of x^2. Here a = 2.
A shorter way to do this is:
x^2 - 4x = 5
(x - (4/2))^2 - (4/2)^2 = 5
(x-2)^2 - 4 = 5 and so on. But remember, you only halve the coefficient of x and put it into the brackets only if there is no number before x^2 (coefficient of x^2). If it is there then you have to divide the whole equation first by the coefficient and then halve the coefficient of x and put it into the brackets.
Sal uses (x - a)^2 simply to tell this is the format of the factorised form of :
x^2 -4x +? = (x - a)^2, where a = 2 (4 divided by two).
Sorry for the large number of words used to answer your question.
• Why did he say that we needed a a number times 2 to equal -3 (it was around )?

• isn't a perfect square trinomial

(ax-b)^2 = (ax)^2+2abx+b^2?

I get a bit confused as to why, when using the completing the square to derive the quadratic formula we only divide by 2, whit out also dividing by a.

but we do, right? we do it at the beginning.

ax^2+bx+c = 0

1/a*(ax^2+bx+c) = (0)1/a

x^2+bx/a + (b/2a)^2 = -x/a - (bx/2a)^2

In that step, we divide the second term by 2a to isolate b, and raise it to a second power.

I'm just trying to confirm things, not sure if I’m wrong
• Just a quick correction.
(ax-b)^2 = (ax)^2 - 2abx + b^2
(ax+b)^2 = (ax)^2 + 2abx + b^2

And I'm not sure where x^2+bx/a + (b/2a)^2 = -x/a - (bx/2a)^2 came from. Step by step though:

Factor out a

a(x^2 + (b/a)x + c/a) = 0
Now we complete the square using the term (b/a)/2 or b/(2a), adding and subtracting it to the one side so we don't change the value. Or we could add it to both sides, but then you would have to take into account the factored out a. Let me know if that doesn't make sense.

a(x^2 + (b/a)x + (b/(2a))^2 - (b/(2a))^2 + c/a)
x^2 + (b/a)x + (b/(2a))^2 = (x + b/(2a))^2 by being a perfect square trinomial [a = 1, b = b/(2a),hope that's not too confusing.]

a((x + b/2a)^2 - (b/(2a))^2 + c/a) = 0
And this will get you into vertex form.

From here you can derive the quadratic formula by solving for x. If you'd like me to walk through that let me know.
• Around , Sal divides the quadratic equation by 5. This process makes the coefficient of x^2 equal to 1. My question is does the coefficient of x^2 need to be 1 to complete the square.
• no it doesn't have to.

for example; 2x^2+18x+16
one can factor this by..
(x+8)(2x+2)

but if you divide everthing by 2,
you can make 2x^2+18x+16 to x^2+9x+8 then you can factor this to
(x+8)(x+1)

you see, this is the same as (x+8)(2x+1) but simpler.

so to answer your question; it doesn't matter, but is's the matter of which one is simpler

hope this helps :)