This site is a work in progress. New lessons are added regularly. Contact us

Completing the Square

Learning goals

  • Add the square of half the linear coefficient
  • Rewrite a quadratic in completed-square form
  • Take the square root of both sides with a ±\pm
  • Sort the roots by the sign of DD
  • Divide by aa first when the leading coefficient is not one

The constant that completes a square

You already know from the squares-of-binomials chapter that squaring a sum produces a three-term pattern:

(x+p)2=x2+2px+p2.(x + p)^2 = x^2 + 2px + p^2.

Read this from right to left and it says something useful. Any expression shaped like x2+(something)x+(something)x^2 + (\text{something})x + (\text{something}) might be a squared binomial. Such an expression is a squared binomial only when its three pieces line up with x2x^2, 2px2px, and p2p^2 for a single value of pp. That matching is the whole idea of completing the square, so look closely at what it forces.

Start with just the first two terms, x2+bxx^2 + bx. Compare the middle term bxbx with the pattern’s middle term 2px2px. For them to be the same, the coefficients must match, so 2p=b2p = b, which means p=b2p = \tfrac{b}{2}. Half of the linear coefficient is the only value of pp that works. And once pp is pinned down, the pattern also tells you the missing last term: it must be p2=(b2)2p^2 = \left(\tfrac{b}{2}\right)^2.

Why adding (b2)2\left(\tfrac{b}{2}\right)^2 turns x2+bxx^2 + bx into a perfect square#

Take the two terms x2+bxx^2 + bx and add the specific constant (b2)2\left(\tfrac{b}{2}\right)^2 to them. The claim is that the result is exactly the square of x+b2x + \tfrac{b}{2}. To check it, expand that square with the pattern (x+p)2=x2+2px+p2(x + p)^2 = x^2 + 2px + p^2, using p=b2p = \tfrac{b}{2}:

(x+b2)2=x2+2xb2+(b2)2.\left(x + \frac{b}{2}\right)^2 = x^2 + 2\cdot x\cdot\frac{b}{2} + \left(\frac{b}{2}\right)^2.

The middle term simplifies, because 2b2=b2\cdot\tfrac{b}{2} = b, leaving

(x+b2)2=x2+bx+(b2)2.\left(x + \frac{b}{2}\right)^2 = x^2 + bx + \left(\frac{b}{2}\right)^2.

So x2+bx+(b2)2x^2 + bx + \left(\tfrac{b}{2}\right)^2 is a genuine perfect square, and the constant that made it one is (b2)2\left(\tfrac{b}{2}\right)^2, the square of half the linear coefficient. The reason it has to be half of bb, and not bb itself, is that squaring x+b2x + \tfrac{b}{2} doubles the b2\tfrac{b}{2} in the middle term. That doubling must land back on the coefficient bb.

So the recipe for the missing constant is short: take the coefficient of xx, halve it, and square the result. For x2+10xx^2 + 10x the half is 55 and the constant is 2525, giving x2+10x+25=(x+5)2x^2 + 10x + 25 = (x + 5)^2. For x26xx^2 - 6x the half is 3-3 and the constant is 99, giving x26x+9=(x3)2x^2 - 6x + 9 = (x - 3)^2. The sign inside the binomial follows the sign of bb, because p=b2p = \tfrac{b}{2} carries that sign along.

Rewriting a quadratic in completed-square form

A full quadratic x2+bx+cx^2 + bx + c usually does not come with the constant (b2)2\left(\tfrac{b}{2}\right)^2 already in place; it comes with some other constant cc. The trick is to conjure the constant you want without changing the expression, by adding it and subtracting it in the same breath. Adding and subtracting the same number changes nothing, since the two moves cancel, but it lets you regroup:

x2+bx+c=x2+bx+(b2)2perfect square(b2)2+c.x^2 + bx + c = \underbrace{x^2 + bx + \left(\frac{b}{2}\right)^2}_{\text{perfect square}} - \left(\frac{b}{2}\right)^2 + c.

The braced part collapses to (x+b2)2\left(x + \tfrac{b}{2}\right)^2, and whatever is left over stays outside as a plain constant:

x2+bx+c=(x+b2)2+(c(b2)2).x^2 + bx + c = \left(x + \frac{b}{2}\right)^2 + \left(c - \left(\frac{b}{2}\right)^2\right).

This is the completed-square form. It says the same thing as the original quadratic, but now xx appears only once, safely inside the square. Written more generally, every quadratic can be put in the shape (xh)2+k(x - h)^2 + k for some constants hh and kk, a form we will lean on again later.

Worked example 1 Rewrite x2+8x+3x^2 + 8x + 3 in completed-square form

The linear coefficient is b=8b = 8, so half of it is 44 and the constant that completes the square is 42=164^2 = 16. Add and subtract that 1616:

x2+8x+3=(x2+8x+16)16+3.x^2 + 8x + 3 = \left(x^2 + 8x + 16\right) - 16 + 3.

The parenthesized trinomial is a perfect square, (x+4)2\left(x + 4\right)^2, and the loose constants combine to 16+3=13-16 + 3 = -13:

x2+8x+3=(x+4)213.x^2 + 8x + 3 = (x + 4)^2 - 13.

A quick check expands it back: (x+4)213=x2+8x+1613=x2+8x+3(x + 4)^2 - 13 = x^2 + 8x + 16 - 13 = x^2 + 8x + 3, the original. The constant dropped from 33 to 13-13 precisely because 1616 was borrowed to build the square.

There is a picture behind the name. The two terms x2+bxx^2 + bx tile an L-shape: a square of area x2x^2 and two strips whose areas together make bxbx. That L is missing one corner, and the corner you need to fill it is exactly a b2\tfrac{b}{2} by b2\tfrac{b}{2} square, of area (b2)2\left(\tfrac{b}{2}\right)^2. Adding it literally completes the figure into a full square of side x+b2x + \tfrac{b}{2}.

Area model for completing the square of x squared plus 6xAn x-by-x square, two 3-by-x strips of area 3x, and a 3-by-3 corner of area 9 together tile a large square of side x plus 3, showing x squared plus 6x plus 9 equals the quantity x plus 3, squared.x3x33x3x9
Completing the square, seen as area. The piece of area x squared and the two strips of area 3x each tile an L-shape. Adding the 3-by-3 corner of area 9 fills the notch, making a full square of side x + 3, so x squared plus 6x plus 9 equals (x + 3) squared.

Check your understanding

What constant must you add to x2+12xx^2 + 12x to complete the square?

Answer choices

Solving a quadratic by completing the square

Rewriting is the hard part; solving is what it unlocks. To solve x2+bx+c=0x^2 + bx + c = 0, isolate the square and then take a square root. The steps run in a fixed order.

First move the constant to the right side, so the left holds only the xx terms:

x2+bx=c.x^2 + bx = -c.

Next add (b2)2\left(\tfrac{b}{2}\right)^2 to both sides. Adding it to just the left would change the equation; adding it to both sides keeps the balance while turning the left into a perfect square:

x2+bx+(b2)2=(b2)2c.x^2 + bx + \left(\frac{b}{2}\right)^2 = \left(\frac{b}{2}\right)^2 - c.

The left side is now (x+b2)2\left(x + \tfrac{b}{2}\right)^2. Take the square root of both sides, and here is the step people forget. Since the square root of a positive number splits into two cases, positive and negative, a ±\pm sign appears:

x+b2=±(b2)2c.x + \frac{b}{2} = \pm\sqrt{\left(\frac{b}{2}\right)^2 - c}.

Finally subtract b2\tfrac{b}{2} to isolate xx, which gives the general result

x=b2±(b2)2c.x = -\frac{b}{2} \pm \sqrt{\left(\frac{b}{2}\right)^2 - c}.

You do not need to memorize that line; it is faster and safer to run the four steps each time. What it shows is that completing the square always finishes a quadratic, whatever bb and cc are.

Worked example 2 Solve x26x+4=0x^2 - 6x + 4 = 0

This quadratic has no whole-number factor pair that works, so factoring is a dead end. Complete the square instead. Move the constant across:

x26x=4.x^2 - 6x = -4.

Here b=6b = -6, so b2=3\tfrac{b}{2} = -3 and (b2)2=9\left(\tfrac{b}{2}\right)^2 = 9. Add 99 to both sides:

x26x+9=4+9=5.x^2 - 6x + 9 = -4 + 9 = 5.

The left side is the perfect square (x3)2(x - 3)^2, so take the square root of both sides, keeping both signs:

(x3)2=5x3=±5.(x - 3)^2 = 5 \quad\Rightarrow\quad x - 3 = \pm\sqrt{5}.

Add 33 to finish:

x=3±5.x = 3 \pm \sqrt{5}.

The two solutions are x=3+5x = 3 + \sqrt{5} and x=35x = 3 - \sqrt{5}, both perfectly real even though neither is a whole number. This is the kind of answer factoring could never have found.

When bb is odd, half of it is a fraction, and (b2)2\left(\tfrac{b}{2}\right)^2 becomes a fraction with 44 in the denominator. Nothing about the method changes; you just carry the fractions carefully.

Worked example 3 Solve x2+3x+1=0x^2 + 3x + 1 = 0 (an odd middle coefficient)

Move the constant across, then halve the odd coefficient b=3b = 3:

x2+3x=1,b2=32,(32)2=94.x^2 + 3x = -1, \qquad \frac{b}{2} = \frac{3}{2}, \qquad \left(\frac{3}{2}\right)^2 = \frac{9}{4}.

Add 94\tfrac{9}{4} to both sides. On the right, write 1-1 as 44-\tfrac{4}{4} so the fractions combine:

x2+3x+94=1+94=44+94=54.x^2 + 3x + \frac{9}{4} = -1 + \frac{9}{4} = -\frac{4}{4} + \frac{9}{4} = \frac{5}{4}.

The left side is (x+32)2\left(x + \tfrac{3}{2}\right)^2. Take the square root of both sides, remembering that 54=52\sqrt{\tfrac{5}{4}} = \tfrac{\sqrt{5}}{2} since the denominator 44 is a perfect square:

(x+32)2=54x+32=±52.\left(x + \frac{3}{2}\right)^2 = \frac{5}{4} \quad\Rightarrow\quad x + \frac{3}{2} = \pm\frac{\sqrt{5}}{2}.

Subtract 32\tfrac{3}{2} and combine over the common denominator 22:

x=32±52=3±52.x = -\frac{3}{2} \pm \frac{\sqrt{5}}{2} = \frac{-3 \pm \sqrt{5}}{2}.

The single fraction 3±52\dfrac{-3 \pm \sqrt{5}}{2} holds both roots at once, which is the standard way to write them.

Check your understanding

Solve x2+4x+1=0x^2 + 4x + 1 = 0 by completing the square.

Answer choices

Real, repeated, and complex roots

Every solve reaches the same crossroads: after isolating the square you have

(x+b2)2=D,where D=(b2)2c.\left(x + \frac{b}{2}\right)^2 = D, \qquad \text{where } D = \left(\frac{b}{2}\right)^2 - c.

The number DD on the right decides everything, because you are about to take its square root, and there are exactly three cases.

If D>0D > 0, its square root is a nonzero real number, so the ±\pm produces two different real solutions, as in x=3±5x = 3 \pm \sqrt{5} above.

If D=0D = 0, its square root is 00, and ±0\pm 0 is just 00, so the two solutions collapse into one repeated solution x=b2x = -\tfrac{b}{2}. For instance x28x+16=0x^2 - 8x + 16 = 0 becomes (x4)2=0(x - 4)^2 = 0, whose only root is x=4x = 4, met twice.

If D<0D < 0, you are taking the square root of a negative number. Before this chapter that meant no solution, but you now have the imaginary unit ii with i2=1i^2 = -1, and 1=i\sqrt{-1} = i. So the root exists after all, and the ±\pm produces two complex solutions, a conjugate pair x=b2±(something)ix = -\tfrac{b}{2} \pm (\text{something})\,i.

Worked example 4 Solve x2+2x+5=0x^2 + 2x + 5 = 0 (complex roots)

Move the constant across and add (22)2=1\left(\tfrac{2}{2}\right)^2 = 1 to both sides:

x2+2x=5,x2+2x+1=5+1=4.x^2 + 2x = -5, \qquad x^2 + 2x + 1 = -5 + 1 = -4.

The left side is (x+1)2(x + 1)^2, and the right side is negative, which is the signal that the roots are complex:

(x+1)2=4x+1=±4.(x + 1)^2 = -4 \quad\Rightarrow\quad x + 1 = \pm\sqrt{-4}.

Rewrite the square root of the negative using ii, as you learned two lessons ago: 4=i4=2i\sqrt{-4} = i\sqrt{4} = 2i. Then

x+1=±2ix=1±2i.x + 1 = \pm 2i \quad\Rightarrow\quad x = -1 \pm 2i.

The solutions are the conjugate pair x=1+2ix = -1 + 2i and x=12ix = -1 - 2i. A quick check confirms the first: (1+2i)2+2(1+2i)+5=(14i+4i2)+(2+4i)+5=(14i4)2+4i+5=0(-1 + 2i)^2 + 2(-1 + 2i) + 5 = (1 - 4i + 4i^2) + (-2 + 4i) + 5 = (1 - 4i - 4) - 2 + 4i + 5 = 0.

This is the payoff the chapter was built for. Back when you only had real numbers, a quadratic with D<0D < 0 simply had no answer, and you had to stop. Now that ii is available, the square root of a negative number is an ordinary complex number, so every quadratic has solutions, whether real or complex. That is exactly why this chapter introduced the imaginary unit before turning to quadratics: completing the square would otherwise dead-end on any equation with D<0D < 0.

Check your understanding

Solve x22x+10=0x^2 - 2x + 10 = 0 by completing the square.

Answer choices

When the leading coefficient is not 1

Everything so far assumed the x2x^2 term stood alone, with coefficient 11. When a quadratic starts with ax2ax^2 for some a1a \ne 1, the pattern x2+bx+(b2)2x^2 + bx + \left(\tfrac{b}{2}\right)^2 no longer matches directly. The fix is to make the leading coefficient 11 first. For an equation, the cleanest way is to divide every term by aa; because the right side is 00, dividing does not disturb it. Then complete the square on the result as usual.

Worked example 5 Solve 2x2+8x10=02x^2 + 8x - 10 = 0 and 3x2+6x+9=03x^2 + 6x + 9 = 0

For 2x2+8x10=02x^2 + 8x - 10 = 0, divide every term by the leading coefficient 22 to make the x2x^2 term stand alone:

2x22+8x2102=0x2+4x5=0.\frac{2x^2}{2} + \frac{8x}{2} - \frac{10}{2} = 0 \quad\Rightarrow\quad x^2 + 4x - 5 = 0.

Now complete the square. Move the constant across and add (42)2=4\left(\tfrac{4}{2}\right)^2 = 4 to both sides:

x2+4x+4=5+4=9(x+2)2=9.x^2 + 4x + 4 = 5 + 4 = 9 \quad\Rightarrow\quad (x + 2)^2 = 9.

Take the root of both sides, x+2=±3x + 2 = \pm 3, so x=1x = 1 or x=5x = -5, two real solutions.

For 3x2+6x+9=03x^2 + 6x + 9 = 0, divide through by 33 first:

x2+2x+3=0.x^2 + 2x + 3 = 0.

Add (22)2=1\left(\tfrac{2}{2}\right)^2 = 1 to both sides after moving the constant over:

x2+2x+1=3+1=2(x+1)2=2.x^2 + 2x + 1 = -3 + 1 = -2 \quad\Rightarrow\quad (x + 1)^2 = -2.

The right side is negative, so the roots are complex. Since 2=i2\sqrt{-2} = i\sqrt{2},

x+1=±i2x=1±i2.x + 1 = \pm i\sqrt{2} \quad\Rightarrow\quad x = -1 \pm i\sqrt{2}.

Dividing by aa at the very start is what kept both problems inside the method you already know.

Running these same steps on the fully general quadratic ax2+bx+c=0ax^2 + bx + c = 0, with letters in place of numbers, produces a single formula for the roots. That is the subject of the next lesson; completing the square is the derivation behind it.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

The name of this method is not a figure of speech. It began as an instruction to finish a drawing.

Around the year 820, in Baghdad, a scholar called al-Khwarizmi wrote a book on solving equations. He had no symbol for xx and no way to write an exponent, so he argued with pictures. For the problem we would write as x2+10x=39x^2 + 10x = 39, he drew a square of side xx and laid strips along two of its sides. The figure was one corner short of a larger square. He filled the corner in and read the answer off the finished side. That corner is the constant you added in this lesson.

The picture carried a hidden cost, and the cost outlasted the picture. A drawn square cannot have a negative side. So the method returned one root, and the other root was simply not there to be found.

Europe kept the habit for centuries after the diagrams were gone. Negative roots were called false, absurd, and fictitious. A square root of a negative was refused outright. That is why a quadratic with D<0D < 0 was reported as having no solution at all, rather than as having two.

Nothing in the method ever changed. What changed was which numbers people would accept as answers. Once negatives were admitted, and then complex numbers after them, the same four steps you ran here began returning both roots of every quadratic. The ±\pm you were careful not to drop is the part the drawing could never show you.