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.

Main content

# Completing the square

## Video transcript

In this video, I'm going to show you a technique called completing the square. And what's neat about this is that this will work for any quadratic equation, and it's actually the basis for the quadratic formula. And in the next video or the video after that I'll prove the quadratic formula using completing the square. But before we do that, we need to understand even what it's all about. And it really just builds off of what we did in the last video, where we solved quadratics using perfect squares. So let's say I have the quadratic equation x squared minus 4x is equal to 5. And I put this big space here for a reason. In the last video, we saw that these can be pretty straightforward to solve if the left-hand side is a perfect square. You see, completing the square is all about making the quadratic equation into a perfect square, engineering it, adding and subtracting from both sides so it becomes a perfect square. So how can we do that? Well, in order for this left-hand side to be a perfect square, there has to be some number here. There has to be some number here that if I have my number squared I get that number, and then if I have two times my number I get negative 4. Remember that, and I think it'll become clear with a few examples. I want x squared minus 4x plus something to be equal to x minus a squared. We don't know what a is just yet, but we know a couple of things. When I square things-- so this is going to be x squared minus 2a plus a squared. So if you look at this pattern right here, that has to be-- sorry, x squared minus 2ax-- this right here has to be 2ax. And this right here would have to be a squared. So this number, a is going to be half of negative 4, a has to be negative 2, right? Because 2 times a is going to be negative 4. a is negative 2, and if a is negative 2, what is a squared? Well, then a squared is going to be positive 4. And this might look all complicated to you right now, but I'm showing you the rationale. You literally just look at this coefficient right here, and you say, OK, well what's half of that coefficient? Well, half of that coefficient is negative 2. So we could say a is equal to negative 2-- same idea there-- and then you square it. You square a, you get positive 4. So we add positive 4 here. Add a 4. Now, from the very first equation we ever did, you should know that you can never do something to just one side of the equation. You can't add 4 to just one side of the equation. If x squared minus 4x was equal to 5, then when I add 4 it's not going to be equal to 5 anymore. It's going to be equal to 5 plus 4. We added 4 on the left-hand side because we wanted this to be a perfect square. But if you add something to the left-hand side, you've got to add it to the right-hand side. And now, we've gotten ourselves to a problem that's just like the problems we did in the last video. What is this left-hand side? Let me rewrite the whole thing. We have x squared minus 4x plus 4 is equal to 9 now. All we did is add 4 to both sides of the equation. But we added 4 on purpose so that this left-hand side becomes a perfect square. Now what is this? What number when I multiply it by itself is equal to 4 and when I add it to itself I'm equal to negative 2? Well, we already answered that question. It's negative 2. So we get x minus 2 times x minus 2 is equal to 9. Or we could have skipped this step and written x minus 2 squared is equal to 9. And then you take the square root of both sides, you get x minus 2 is equal to plus or minus 3. Add 2 to both sides, you get x is equal to 2 plus or minus 3. That tells us that x could be equal to 2 plus 3, which is 5. Or x could be equal to 2 minus 3, which is negative 1. And we are done. Now I want to be very clear. You could have done this without completing the square. We could've started off with x squared minus 4x is equal to 5. We could have subtracted 5 from both sides and gotten x squared minus 4x minus 5 is equal to 0. And you could say, hey, if I have a negative 5 times a positive 1, then their product is negative 5 and their sum is negative 4. So I could say this is x minus 5 times x plus 1 is equal to 0. And then we would say that x is equal to 5 or x is equal to negative 1. And in this case, this actually probably would have been a faster way to do the problem. But the neat thing about the completing the square is it will always work. It'll always work no matter what the coefficients are or no matter how crazy the problem is. And let me prove it to you. Let's do one that traditionally would have been a pretty painful problem if we just tried to do it by factoring, especially if we did it using grouping or something like that. Let's say we had 10x squared minus 30x minus 8 is equal to 0. Now, right from the get-go, you could say, hey look, we could maybe divide both sides by 2. That does simplify a little bit. Let's divide both sides by 2. So if you divide everything by 2, what do you get? We get 5x squared minus 15x minus 4 is equal to 0. But once again, now we have this crazy 5 in front of this coefficent and we would have to solve it by grouping which is a reasonably painful process. But we can now go straight to completing the square, and to do that I'm now going to divide by 5 to get a 1 leading coefficient here. And you're going to see why this is different than what we've traditionally done. So if I divide this whole thing by 5, I could have just divided by 10 from the get-go but I wanted to go to this the step first just to show you that this really didn't give us much. Let's divide everything by 5. So if you divide everything by 5, you get x squared minus 3x minus 4/5 is equal to 0. So, you might say, hey, why did we ever do that factoring by grouping? If we can just always divide by this leading coefficient, we can get rid of that. We can always turn this into a 1 or a negative 1 if we divide by the right number. But notice, by doing that we got this crazy 4/5 here. So this is super hard to do just using factoring. You'd have to say, what two numbers when I take the product is equal to negative 4/5? It's a fraction and when I take their sum, is equal to negative 3? This is a hard problem with factoring. This is hard using factoring. So, the best thing to do is to use completing the square. So let's think a little bit about how we can turn this into a perfect square. What I like to do-- and you'll see this done some ways and I'll show you both ways because you'll see teachers do it both ways-- I like to get the 4/5 on the other side. So let's add 4/5 to both sides of this equation. You don't have to do it this way, but I like to get the 4/5 out of the way. And then what do we get if we add 4/5 to both sides of this equation? The left-hand hand side of the equation just becomes x squared minus 3x, no 4/5 there. I'm going to leave a little bit of space. And that's going to be equal to 4/5. Now, just like the last problem, we want to turn this left-hand side into the perfect square of a binomial. How do we do that? Well, we say, well, what number times 2 is equal to negative 3? So some number times 2 is negative 3. Or we essentially just take negative 3 and divide it by 2, which is negative 3/2. And then we square negative 3/2. So in the example, we'll say a is negative 3/2. And if we square negative 3/2, what do we get? We get positive 9/4. I just took half of this coefficient, squared it, got positive 9/4. The whole purpose of doing that is to turn this left-hand side into a perfect square. Now, anything you do to one side of the equation, you've got to do to the other side. So we added a 9/4 here, let's add a 9/4 over there. And what does our equation become? We get x squared minus 3x plus 9/4 is equal to-- let's see if we can get a common denominator. So, 4/5 is the same thing as 16/20. Just multiply the numerator and denominator by 4. Plus over 20. 9/4 is the same thing if you multiply the numerator by 5 as 45/20. And so what is 16 plus 45? You see, this is kind of getting kind of hairy, but that's the fun, I guess, of completing the square sometimes. 16 plus 45. See that's 55, 61. So this is equal to 61/20. So let me just rewrite it. x squared minus 3x plus 9/4 is equal to 61/20. Crazy number. Now this, at least on the left hand side, is a perfect square. This is the same thing as x minus 3/2 squared. And it was by design. Negative 3/2 times negative 3/2 is positive 9/4. Negative 3/2 plus negative 3/2 is equal to negative 3. So this squared is equal to 61/20. We can take the square root of both sides and we get x minus 3/2 is equal to the positive or the negative square root of 61/20. And now, we can add 3/2 to both sides of this equation and you get x is equal to positive 3/2 plus or minus the square root of 61/20. And this is a crazy number and it's hopefully obvious you would not have been able to-- at least I would not have been able to-- get to this number just by factoring. And if you want their actual values, you can get your calculator out. And then let me clear all of this. And 3/2-- let's do the plus version first. So we want to do 3 divided by 2 plus the second square root. We want to pick that little yellow square root. So the square root of 61 divided by 20, which is 3.24. This crazy 3.2464, I'll just write 3.246. So this is approximately equal to 3.246, and that was just the positive version. Let's do the subtraction version. So we can actually put our entry-- if you do second and then entry, that we want that little yellow entry, that's why I pressed the second button. So I press enter, it puts in what we just put, we can just change the positive or the addition to a subtraction and you get negative 0.246. So you get negative 0.246. And you can actually verify that these satisfy our original equation. Our original equation was up here. Let me just verify for one of them. So the second answer on your graphing calculator is the last answer you use. So if you use a variable answer, that's this number right here. So if I have my answer squared-- I'm using answer represents negative 0.24. Answer squared minus 3 times answer minus 4/5-- 4 divided by 5-- it equals--. And this just a little bit of explanation. This doesn't store the entire number, it goes up to some level of precision. It stores some number of digits. So when it calculated it using this stored number right here, it got 1 times 10 to the negative 14. So that is 0.0000. So that's 13 zeroes and then a 1. A decimal, then 13 zeroes and a 1. So this is pretty much 0. Or actually, if you got the exact answer right here, if you went through an infinite level of precision here, or maybe if you kept it in this radical form, you would get that it is indeed equal to 0. So hopefully you found that helpful, this whole notion of completing the square. Now we're going to extend it to the actual quadratic formula that we can use, we can essentially just plug things into to solve any quadratic equation.