A recent question reminded me that we haven’t yet covered completing the square, a technique important for solving quadratic equations, and also in several other applications. We’ll see the traditional method, and a modified method that avoids fractions, including a nice alternative to the quadratic formula.
A simple example
We’ll start with a basic question from 2002:
Rule for Completing the Square Which of the following expressions should be placed in each set of parentheses below in order to solve the equation by completing the square? x^2+6x+(?)=15+(?) A.3/2 B.3 C.6 D.9 I have no clue to answer this question. Thanks.
As we’ll see, this turns out to be the easiest possible example.
Doctor Rick answered:
Hi, Irina. The idea is that you have the equation x^2 + 6x = 15 and you want to solve it by the method of completing the square. This means that you want to make the left side into the square of a binomial, which you can do by adding the correct constant to it; and of course, to keep the equation equivalent to the original, you must add the same constant to the right side as well.
So the two “(?)’s” will be the same number, added to both sides.
The key idea is that when you square a binomial like \((a+b)\), you get this: $$(a+b)^2=(a+b)(a+b)=a^2+ab+ab+b^2=a^2+2ab+b^2$$ This is worth memorizing.
How do you tell what constant to add? We want to end up with something like (x + C)^2 Expand this: x^2 + 2Cx + C^2 Compare with what you have: x^2 + 6x + ___ The coefficient of x, 2C, should be equal to 6: 2C = 6 C = 6/2 = 3 Then what goes in the blank? It's C^2, and since C = 3, it's 3^2 = 9 that goes in the blank. x^2 + 6x + (9) = 15 + (9)
Rather than solve an equation for C, we can just remember that the constant will always be half of the coefficient of x, squared.
That’s what was asked for (so we choose “D. 9”). But there’s a reason for doing all this: Our equation $$x^2+6x{\color{Green}{+9}}=15{\color{Green}{+9}}$$ can be rewritten as $$(x{\color{Red}{+3}})^2=24.$$
Then we can solve the problem: (x + 3)^2 = 24 x + 3 = sqrt(24) or -sqrt(24) x = -3+sqrt(24) or -3-sqrt(24) You can simplify the square root of 24, but that's another topic.
(We’d rewrite it as \(\sqrt{24}=\sqrt{4\cdot6}=\sqrt{4}\sqrt{6}=2\sqrt{6}\).)
Now that we've worked one problem out in detail, we can see a simple rule for completing the square - at least if the coefficient of x^2 is 1, as in this example. Just take half the coefficient of x, and square it. (6/2)^2 = 9 If you have any problems in which the coefficient of x is not 1, then work it out in the same way I did this example, and see if you can find the rule for this more general case.
The usual approach is to divide the equation by that coefficient, changing it to 1 so that we can do what we did here! We’ll see that, and another way, below.
Irina responded,
Thanks a lot; that information was very helpful. Irina
A visual explanation
This is also from 2002:
Completing the Square: a Diagram Can you use a diagram to show completing the square? Something like x^2+3x. Thanks.
In the first problem, we were given an equation, with a constant on the right; here we are just given the left-hand side.
Doctor Rick answered again:
Hi, Kelvon.
Are you talking about a diagram like this for x^2+3x?
+----------------+-----+
3/2 | (3/2)x | |
| | |
+----------------+-----+
| | |
| | |
| | |
x | x^2 | 3 |
| | - x |
| | 2 |
| | |
| | |
+----------------+-----+
x 3/2
I divided the 3x into two equal rectangles, 3/2 by x, and stuck them on the sides of the x-by-x square. To complete a large square, x+3/2 on a side, we need to add the little square with sides 3/2.
x^2 + 2(3/2)x + (3/2)^2 = (x + 3/2)^2
That is, the expression given, \(x^2+3x\), is the area of this figure, with the second term split into two halves:

By adding a little square to obtain \(x^2+3x+{\color{Green}{\frac{9}{4}}}\), we get the complete square with area \(\left(x+{\color{Red}{\frac{3}{2}}}\right)^2\):

And, for example, if we knew the value of \(x^2+3x\), we could use this to find what x is.
Comparing this to the first example above, we see that the coefficient of x is odd, so dividing it by 2 results in a fraction. In our first example, with an even coefficient, we needed only whole numbers.
But we can make it a little harder to visualize. What if we had, say, \(x^2{\color{Red}{-}}3x\)?
Now, how can we make a figure when the coefficient of x is negative? We can work backwards - the x-by-x square is the BIG one, and we SUBTRACT two rectangles:
+----------------+-----+
|3/2/////////////|XXXXX|
|////////////////|XXXXX|
+----------------+-----+
| |\\\\\|
| |\\\\\|
x | |\\\\\|
|x-3/2 |\\\\\|
| |\\\\\|
| |\\\\\|
| |\\\\\|
| x-3/2 |\3/2\|
+----------------+-----+
x
We subtract two rectangles, 3/2 by x, from the x-by-x square. In doing so, we remove that little square with the X's TWICE; it's part of both rectangles. Therefore, we must add it back once, if we want to be left with just the (x-3/2) by (x-3/2) square:
x^2 - 2(3/2)x + (3/2)^2 = (x - 3/2)^2
Again, the expression given, \(x^2-3x\), is represented by this figure:

Here we have removed two long (red) rectangles from the big square, so we removed the little square twice. By adding the little (green) square back in to obtain \(x^2-3x+{\color{Green}{\frac{9}{4}}}\), we get the remaining square (lower left) with area \(\left(x{\color{Red}{-\frac{3}{2}}}\right)^2\):

What if the leading coefficient is not 1?
A question from 2017 explores a harder case:
Completing the Square, Coping with Complicated Coefficients The question asks to solve this quadratic equation by completing the square: 2x^2 - 7x + 4 = 0 I'm okay with solving this using the quadratic equation; but completing the square is somehow complicated. Can you help me solve this?
If you try the method we used above (just dividing \(-7\) by \(2\) and squaring it), it won’t work, because of the 2.
I answered:
Hi, Timothy. The hard part of this problem is that the coefficient of x^2 is not 1. There are two main ways to handle this. The usual is to divide the entire equation by 2: 2x^2 - 7x + 4 = 0 2x^2/2 - 7x/2 + 4/2 = 0 x^2 - 7/2 x + 2 = 0 Then we typically move the constant to the right side, by subtracting 2: x^2 - 7/2 x = -2
This makes the problem look just like our first problem – except that we have a fraction, which makes the work a little harder.
Now I worked an example like our first two, without a fraction:
So that you can learn by solving your own problem, I will just give you an example of the rest of the process, using a different equation.
Suppose we have
x^2 - 5x + 1 = 0
Our goal is to make it look like
(x + __)^2 = __
In that form, we could solve the equation by taking a square root. This is what we mean by "completing the square"! We are turning the left side into a complete, perfect square of a binomial. So we look at what it will take to make it look like that.
In the method I teach, we will keep this goal highly visible.
First, we want the constant to be on the right, so we put it there by subtracting:
x^2 - 5x = -1
(I leave a space in which to put the extra term I'll be adding next.)
We’ll be going back and forth between this line and the next.
Now we recall that (x + a)^2 = x^2 + 2ax + a^2. We want to find a constant a that will work; since 2ax has to be -5x, a has to be half of 5. So our goal now becomes
(x + 5/2)^2 = __
(I actually write this below the line above, so I can look ahead at the goal right on my paper, and fill in the details as I find them.)
Note that our first example above had an even number for the coefficient of x, so dividing it by 2 was easy. Here, like our second example, it is odd, so dividing by 2 makes it a fraction.
If we expand that, we get not only x^2 + 5x, but also the constant term (5/2)^2, which is 25/4. We have to have that also on the left side, so we add that to BOTH sides (in order not to change the truth of the equation): x^2 - 5x + 25/4 = -1 + 25/4 Almost there!
Adding a whole number and a fraction, on the right, amounts to the same thing as changing a mixed number to an improper fraction: we’ll multiply the \(-1\) by 4, and add 25, to get 21 in the numerator. More generally, we would use 4 as a common denominator.
In many presentations I’ve seen, you are told just to divide by 2 and square to get the 25/4 to add, and then “factor” the resulting trinomial, in essence rediscovering the 5/2 as if you hadn’t already seen it. By writing that number in its proper place first, we save that step. We squared 5/2 because that was going to be the number on the next line.
On the right side, I just add a whole number and a fraction (by using a common denominator); and factor the left as a perfect square, already knowing that this particular factoring is exactly what I have been working toward from the start: (x + 5/2)^2 = 21/4 Now I can go ahead and solve with a square root.
We already had the left-hand side written, so we just add the right-hand side.
To solve the equation, we just have to take the square root of each side (remembering that there are two square roots, and then subtract the \(5/2\): $$\sqrt{\left(x+\frac{5}{2}\right)^2}=\pm\sqrt\frac{21}{4}\\x+\frac{5}{2}=\pm\frac{\sqrt{21}}{2}\\x=-\frac{5}{2}\pm\frac{\sqrt{21}}{2}$$
Your particular problem follows the same procedure, but involves more fractions. Here is an alternative method that avoids fractions entirely, by starting differently:
Completing the Square: Alternate Method
http://mathforum.org/library/drmath/view/53107.html
I could help you much more if you showed me your work, so I could focus specifically where you need it. There are several points where you could be making mistakes, and I would like to do my best for you, so please write back.
We’ll look at that link momentarily.
Let’s solve Timothy’s own problem this way first:
We have \(2x^2-7x+4=0\). Dividing by 2 and proceeding, we get $$x^2-\frac{7}{2}x+2=0\\x^2-\frac{7}{2}x=-2\\x^2-\frac{7}{2}x{\color{Green}{+\frac{49}{16}}}=-2{\color{Green}{+\frac{49}{16}}}\\\left(x{\color{Red}{-\frac{7}{4}}}\right)^2=\frac{17}{16}\\x-\frac{7}{4}=\pm\sqrt{\frac{17}{16}}\\x=\frac{7}{4}\pm\frac{\sqrt{17}}{4}$$
There are four cases to consider in dividing the coefficient of x by 2:
- Even integer: divide it by 2: \(6\rightarrow3\)
- Odd integer: put it over 2: \(5\rightarrow\frac{5}{2}\)
- Fraction with even numerator: divide numerator by 2: \(\frac{8}{3}\rightarrow\frac{4}{3}\)
- Fraction with odd numerator: multiply denominator by 2: \(\frac{5}{3}\rightarrow\frac{5}{6}\)
But we can avoid fractions until the end, if you like …
Avoiding fractions
We’ll go back to 1998 for a different approach to the general problem:
Completing the Square: Alternate Method I have come up with a new method for solving quadratic equations by completing the square. Instead of dividing by the coefficient of the quadratic term (and getting complicated fractions), I multiply the equation to get a perfect square coefficient for the quadratic term. I want some feedback. I am sure there are some exceptions to this method. Otherwise schools would teach this, right? Thanks, Hanhan Wang
For example, to solve \(2x^2-6x+5=0\), Hanhan would evidently do this, multiplying everything by 2 to turn the leading coefficient into 4, a square: $$2x^2-6x+5=0\\4x^2-12x+10=0\\4x^2-12x=-10\\4x^2-12x{\color{Green}{+9}}=-10{\color{Green}{+9}}\\(2x{\color{Red}{-3}})^2=-1$$ because the middle term, \(-12x\) has to be 2 times the first term of the binomial, \(2x\), times the second term of the binomial, which is therefore \(\frac{-12x}{2\cdot2x}=-3\). It’s a good idea. But that isn’t always enough; we can go a little further.
Doctor Rob answered:
This is a valid, alternate method, which is taught in some schools. It works as-is if the linear term has an even coefficient. To make this method fraction-free, if the coefficient of the linear term is odd, you should multiply not by the coefficient of the quadratic term, but by four times it. That will insure that the linear term has an even coefficient, which is necessary to avoid fractions further. In fact, if you always use four times the coefficient of the quadratic term, you will always avoid fractions. Example:
3x^2 - 7x - 20 = 0,
9x^2 - 21x - 60 = 0,
(3x - 7/2)^2 = 60 + 49/4 = 289/4 = (17/2)^2
See that fractions are still present.
The second term of the binomial here is \(\frac{-21}{2\cdot3}=-\frac{7}{2}\), and we square that to get the constant to add.
So this didn’t accomplish the goal. But …
If instead of multiplying by 3, we multiply by 4*3, we will still get a perfect square coefficient of the quadratic term:
36x^2 - 84x - 240 = 0,
(6x - 7)^2 = 240 + 49 = 289 = 17^2,
and you can finish the solution
6x - 7 = 17 or -17,
6x = 24 or -10,
x = 4 or -5/3.
The second term of the binomial this time is \(\frac{-84}{2\cdot6}=-7\).
Note that since we multiplied everything by \(4a=4(3)=12\), the \(-84\) is \(4ab\), and the 6 we divided by here is \(\sqrt{4a^2}=2a\), so the second term is \(\frac{4ab}{2(2a)}=b\). So in general, the binomial we write down will always be \(2ax+b\) from the original quadratic. We’ll see this again later.
Symbolically,
ax^2 + bx + c = 0,
4a^2x^2 + 4abx + 4ac = 0,
(2ax + b)^2 = b^2 - 4ac
and so on. You see, if b is even, then a 4 can be divided out of the last equation, but if it is odd, you can't do that without introducing fractions.
Did you notice that, conveniently, the second term of the binomial is just the original linear coefficient, b? That makes this even nicer: we can just write down \(2ax+b\) in the last line and expand it to check that it matches the previous line when we add the necessary constant.
The disadvantage of using this method is that the integers involved can get fairly large. You may be faced with taking the square root of a four- or five-digit number. The advantage, as you point out, is that you avoid working with fractions.
For this example, our solution involved the square root of 289, which luckily turned out to be a whole number. By the other method, though, we would have had to do this: $$3x^2-7x-20=0\\x^2-\frac{7}{3}x=\frac{20}{3}\\x^2-\frac{7}{3}x{\color{Green}{+\frac{49}{36}}}=\frac{20}{3}{\color{Green}{+\frac{49}{36}}}\\\left(x{\color{Red}{-\frac{7}{6}}}\right)^2=\frac{289}{36}\\x-\frac{7}{6}=\pm\frac{17}{6}\\x=\frac{7\pm17}{6}=4,-\frac{5}{3}$$
That certainly doesn’t involve any larger numbers!
The alternate method, restated and extended
A question later the same year evoked the same approach:
Completing the Square to Solve Quadratic Equations My textbook is attempting to tell me (I am homeschooled) the two ways to solve quadratic equations. We start with: x^2 + x - 2 = 0 I already know how to factor it out to: (x + 2)(x - 1) = 0 x = -2 OR x = 1 What I don't know is how they turned it into the form: (x - 2)^2 = 3 I have an idea how they got there, something like b = sqrt(a^2 +c) all divided by 2b,) but looking back I can't find it anywhere. I don't even know where to begin to solve this.
The second answer is either copied wrong, or for a different problem (which would be \(x^2-4x+1=0\)); we’ll be solving the given problem both ways. Note that the coefficient of x is odd, so we’ll have a fraction in our answer.
The formula suggested at the end is probably a distorted version of the quadratic formula, which we’ll see at the end.
Doctor Rob answered with the method we just saw:
Thanks for writing to Ask Dr. Math! The procedure is called, "Completing the Square." It begins with knowing that (r+s)^2 = r^2 + 2rs + s^2. Starting with x^2 + x - 2 = 0 we want to build a square on the left-hand side by using the x^2 and x terms. To do this we start by adding 2 to both sides to isolate these terms on the left: x^2 + x = 2
So far, all methods agree.
Then we multiply by 4 times the coefficient of x^2, which is 4*1 = 4 in this case: 4x^2 + 4x = 8 Now set the first two terms of the square of r + s equal to the two terms on the left-hand side: r^2 = 4x^2 and 2rs = 4x. Then r = 2x and s = 1 works. (It is also true that r = -2*x and s = -1 works. You can use either pair.) Now add s^2 = 1^2 = 1 to both sides: 4x^2 + 4x + 1 = 8 + 1 = 9
Here he’s supposing that you are inventing the method without previous knowledge, so you need to figure out how to get the given expression \(4x^2+4x+?\) to match up with the desired form, \(r^2+2rs+s^2\). We can see easily that \(r^2=4x^2\) and \(2rs=4x\) when \(r=2x\) and \(s=1\). In other words, the first term of our binomial is the square root of \(4x^2\), and the second term is 4 divided by that.
Now the left side is a perfect square, since it equals r^2 + 2rs + s^2, which equals (r+s)^2, or (2x+1)^2. This is so because we carefully arranged for it to be so. Also the right-hand side 9 is a square, namely the square of 3: (2x + 1)^2 = 3^2.
Of course, the RHS will not always be a square.
This is what should have been written in place of \((x-2)^2=3\) in the question.
This is the corrected equation that you mentioned above as the one "they turned it into." Now take the square root of both sides, remembering that either of them could be negative: 2x + 1 = 3 or 2x + 1 = -3, 2x = 2 or 2x = -4, x = 1 or x = -2. That is how to use "Completing the Square" to solve this quadratic equation.
This is the same answer obtained by factoring; it didn’t require any guessing, as factoring requires. And not all quadratics can be factored; that’s why completing the square is a better method in general. (But when factoring is easy, it’s the quickest way!)
Deriving the quadratic formula
We can use the same process to obtain a general formula:
If you start with the general quadratic equation,
ax^2 + bx + c = 0
where a, b, and c are any expressions with a not zero, the same steps are followed, and you get the following equations in turn:
ax^2 + bx = -c,
4a^2x^2 + 4abx = -4ac,
r^2 = 4a^2x^2, 2rs = 4abx,
r = 2ax, s = b, s^2 = b^2,
4a^2x^2 + 4abx + b^2 = b^2 - 4ac,
(2ax + b)^2 = b^2 - 4ac,
2ax + b = sqrt(b^2-4ac) or
-sqrt(b^2-4ac),
2ax = -b + sqrt(b^2-4ac) or
-b - sqrt(b^2-4ac),
x = (-b+sqrt[b^2-4ac])/(2a) or
x = (-b-sqrt[b^2-4ac])/(2a)
The last two lines are called the "Quadratic Formula." It is useful to memorize this.
I’ve usually seen this formula derived by the standard method involving fractions; this is much more pleasant.
Many students prefer the quadratic formula to completing the square, because a formula seems simpler; its disadvantage is that there’s no quick check if you make, say, a sign error (which is very common). When you complete the square, you can check what you write on each line against the line above, and catch any error you make. And with the alternative method, just writing \((2ax+b)^2\) on the left, and adding \(b^2\) to both sides, you’re practically using a formula, providing the best of both worlds.
Let’s do this with Timothy’s problem from above:
$$2x^2{\color{Red}{-7}}x+4=0\\8(2x^2-7x+4)=0\\16x^2-56x+32=0\\16x^2-56x=-32\\16x^2-56x{\color{Green}{+49}}=-32{\color{Green}{+49}}\\(4x{\color{Red}{-7}})^2=17\\4x-7=\pm\sqrt{17}\\x=\frac{7\pm\sqrt{17}}{4}$$
Here, when we wrote \((4x-7)^2\), we just had to double \(a=2\) for the coefficient of x, and copy \(b=-7\), then check that this really agrees with the line above (where we added \((-7)^2=49\) to each side), rather than figuring it out from all the large numbers.
Using the quadratic formula itself, we do this:
In \(2x^2-7x+4=0\), we have \(a=2\), \(b=-7\), and \(c=4\). So $$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}=\frac{-(-7)\pm\sqrt{(-7)^2-4(2)(4)}}{2(2)}\\=\frac{7\pm\sqrt{49-32}}{4}=\frac{7\pm\sqrt{17}}{4}$$
If I forgot a negative sign or picked the wrong number somewhere, how would I ever notice it?
