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

Worked example: Rewriting & solving equations by completing the square

Sal solves x²-2x-8=0 by rewriting the equation as (x-1)²-9=0 (which is done by completing the square!).

Video transcript

- [Voiceover] So let's see if we can solve this quadratic equation right over here: x squared minus two x minus eight is equal to zero. And actually, they're cutting down some trees outside, so my apologies if you hear some chopping of trees. I'll try to ignore it myself. All right. So back to the problem at hand, and there's actually several ways that you could attack this problem. We could just try to factor the left-hand side and go that way, but the way we're going to tackle it is by completing the square. Now what does that mean? Well that means that I wanna write, I wanna write the left-hand side of this equation into the form x plus a squared plus b, and we'll see if we can write the left-hand in this form that we can actually solve it in a pretty straightforward way. So let's see if we could do that. Well let's just remind ourselves how we need to rearrange the left-hand side in order to get to this form. If I were to expand out x plus a squared, let me do that in a different color. So if I were to expand out x plus a squared, that is x squared plus two a x, I'll make that plus sign you can see, plus two a x, plus a squared, and of course you still have that plus b there, plus b. So let's see if we can write this in that form. So, what I'm going to do, this is what you typically do when you try to complete the square. All right. The x squared minus two x. Now I'm gonna have a little bit of a gap and I'm gonna have minus eight, and I have another a little bit of a gap and I'm gonna say equals zero. So I just rewrote this equation, but I gave myself some space so I can add or subtract some things that might make it a little bit easier to get into this form. So, if we just match our terms, x squared, x squared, two a x, negative two x. So, if this is two a x, that means that two a is negative two, two a is equal to negative two or a is equal to negative one. Another way to think about it, your a is going to be half of your first degree coefficient or the coefficient on the x term. So the coefficient of the x term is a negative two, half of that is a negative one. And then we wanna have, and then we want to have an a squared. So if a is negative one, a squared would be plus one. So let's throw a plus one there. But like we've done and said before, we can't just willy-nilly add something on one side of equation without adding it to the other or without subtracting it again on that same side. Otherwise, you're fundamentally changing the truth of the equation. So if I add one on that side, I even have to add one on the, if I add one of the left side, I even have to add one on the right side to make the equation still hold true or I could add one and subtract one from the left-hand side, so I'm not really changing the value of the left-hand side. All I've done is added one and subtracted one from the left-hand side. Now why did I do this again? Well now, I've been able, I haven't changed its value. I just added and subtracted the same thing, but this part of the left-hand side now matches this pattern right over here, x squared plus two a x, where a is negative one, so it's minus two x, plus a squared, plus negative one squared and then this, this part right over here is the plus b. So we already know that b is equal to negative nine. Negative eight minus one is negative nine, and so that's going to be our b right over there. And so we can rewrite this as, what I squared off in green, that's gonna be x plus a squared. So we could write it as x plus and I could write a is negative one. Actually, let me, I could write it like that first. x plus a squared or x plus negative one. Well, let's just x minus one, so I'm just gonna write it as x minus negative one squared and then we have minus nine, minus nine is equal to zero, is equal to zero. And then I can add nine to both side, so I just have this squared expression on the left-hand side, so let's do that. Let me add nine to both sides. And what I am going to be left with, so let me just, on the left-hand side, those cancel out. That's why added the nine. I'm just gonna be left with the x minus one squared. It's going to be equal to, on this side, zero plus nine is nine. So if x minus one, let me do that in blue color. So, it's gonna be nine. And so if x minus one squared is nine, if I have something square is equal to nine, that means that that something is either going to be the positive or the negative square root of nine. So it's either gonna be positive or negative three. So we can say x minus one is equal to positive three or x minus one is equal to negative three and you could see that here. If x minus one is three, three squared is nine. If x minus one is negative three, negative three squared is nine. And so here, we can just add one to both sides of this equation, add one to both sides of this equation, and you get x is equal to four or x is, if we add one to both sides of this equation, we get, my digital ink is acting up, I don't know. All right. Then we get x is equal to negative three plus one is negative two. So, x could be equal to four or x could be equal to negative two, and we're done. Now, some of you might be saying, "Well, why did we go through the trouble "of completing the square? "I might have been able to just factor this "and then solve it that way." And you could have, actually, for this particular problem. Completing the square is very powerful because you could actually always apply this, and in the future, what you will learn in the quadratic formula and the quadratic formula actually comes directly out of completing the square. In fact, when you're applying he quadratic formula, you're essentially applying the result of completing the square. So hopefully you found that fun.