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 completing the square and what's neat about this is that this will work for any for any quadratic equation and it's actually the basis for the quadratic formula either 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 and the last video we saw that these can be pretty straightforward to solve if the left hand side is a perfect square so how can we make you see the 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 2 times my number I get negative 4 remember that I think it'll become clear with a few examples I want this to be 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 my x squared minus 2 a plus a squared so if you look at this pattern right here this over here that has to be sorry x squared minus 2ax this right here has to be 2a X and this right here would have to be a squared so this number a is going to be 1/2 of negative 4 a has to be negative 2 right because 2 times a is going to be negative 4 negative two and if a is negative two what is a squared well then a squared is going to be positive four 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 okay well what's half of that coefficient well half of that coefficient is negative two so we could say a is equal to negative two same idea there and then you square it and 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 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 all right 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 just we could have even skipped the 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 one and we are done now I want to be very clear you could have done this without completing the square we could have started off with x squared minus 4x is equal to five 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 let's see if I have a negative 5 times a positive 1 they 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 completing the square is it will always work it'll always work no matter you know what the coefficients are 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 try to do it by factoring especially if we did it you know maybe maybe if we did it using grouping or something like that let's say we had 10 x squared 10 x squared minus 30x minus 8 is equal to 0 now right from the get-go you could say look you know we can maybe divide both sides by 2 yea that means that does simplify a little bit let's divide both sides by 2 so if you divide everything by 2 you divide everything by 2 what do you get we get 5x squared minus 15 X minus 4 is equal to 0 but once again now we have this crazy 5 in front of this coefficient we would have to solve it by grouping which is not the the it's it's it's a reasonably painful process but we can now go straight to completing the square and to do that I'm going to now divide by 5 to get a 1 leading coefficient here and you're gonna see why this is different than what we've traditionally done so if I knew if I divide this whole thing by 5 I could have just have it divided by 10 from the get-go but I wanted to go to this step first just to say show you that this rate and give us much let's divide everything by five so if you divide everything by five everything by five you get x squared minus 3x minus 4/5 is equal to zero so you might said hey you know why did we ever do that factoring by grouping if we could just always divide by this leading coefficient well we can get rid of that we can always turn this into a one or a negative one 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 gee 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 three this is a hard problem with factoring this is hard using user 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 and 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 we add 4/5 to both sides equation the left-hand side of the equation just becomes x squared minus 3x no 4/5 there I'm gonna 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 halves and then we square negative 3 halves so in the in the example we'll say a is negative 3 halves and if we square negative 3 halves what do we get we get plus we get positive 9 over 4 took half of this coefficient squared it got positive nine over four 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 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 over 4 is equal to let's creating a common denominator so 4/5 is the same thing as 16 over 20 right just multiply the numerator denominator by 4 plus over 29 over 4 is the same thing if you multiply the numerator by 5 as 45 over 20 and so what's 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 you see that's 55 61 so this is equal to 61 over 20 so we get we could well let me just rewrite it x squared minus 3x plus 9 over 4 is equal to 61 over 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 halves squared and we by design 3 halves negative 3 halves times negative 3 halves it's positive 9 4 it's negative 3 halves plus negative 3 halves is equal to negative 3 so this squared is equal to 61 over 20 we can take the square root of both sides and we get X minus 3 halves is equal to the positive or the negative square root of 61 over 20 and now we can add 3 halves to both sides of this equation and you get X is equal to positive 3 halves plus or minus the square root of 61 over 20 and this is a crazy number 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 get the calculator out and then let me clear all of this let me exit from here maybe gonna clear the air and three-halves let's do the Plus version first so we want to do 3/2 plus the second square root we want to pick that little yellow square root so square root of 61 divided by 20 61 divided by 20 which is 3.2 for this crazy three point two four six four I'll just write three point two four six so this is approximately approximately equal to three point two four six and or or that was just a positive version let's do the 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 when I press the second button so I press ENTER it typed it puts in what we just put we could just change it could we could just change that positive or that addition to a subtraction and you get negative point two four six so you get negative zero point two four six and you can actually verify that these satisfy our original equation our original equation was up here let me just verify it for one of them so let's say let's say we have so the second answer and your graphing calculator is the last answer you you use so if you use the variable answer that's this number right here so if I have my answer squared I'm using answer represents negative point two for answer squared minus three times answer minus four-fifths or divided by five it equals it equals this little eight you know because they just 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 didn't it calculated it using this stored number right here it got one times 10 to the negative 14 so that is zero point zero zero zero zero so that's 13 zeroes and then a 1 a decimal than 1300 one so this is pretty much zero or actually if you got the exact answer right here if you went through an infinite level of precision here if you maybe if you kept it in this radical form you would get that it is indeed equal to zero 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