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

Completing the Square

Learning goals

  • Add (b2)2\left(\tfrac{b}{2}\right)^2 to complete the square
  • Factor aa out first, then distribute it back
  • Derive general vertex form and read the vertex
  • Solve from (x+p)2=k(x + p)^2 = k with a ±\pm
  • Prefer it to factoring, since it never fails

The identity that builds a perfect square

Everything here runs on one line of algebra you already know, read in an unfamiliar direction. Squaring a binomial gives

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

Read left to right, this expands a square. Read right to left, it is a recipe for recognizing one. A trinomial x2+2px+p2x^2 + 2px + p^2 is a perfect square, and the number multiplying xx in the middle is exactly twice the number pp that appears in the answer. That single observation tells you what constant a bare x2+bxx^2 + bx is missing.

The one constant that completes a perfect square#

Fix a number bb. We ask which constant dd makes x2+bx+dx^2 + bx + d a perfect square, meaning equal to (x+p)2(x + p)^2 for some pp.

Suppose x2+bx+d=(x+p)2=x2+2px+p2x^2 + bx + d = (x + p)^2 = x^2 + 2px + p^2. Two polynomials are equal only when their matching coefficients agree, so the xx terms give b=2pb = 2p and the constants give d=p2d = p^2. The first equation forces p=b2p = \dfrac{b}{2}, and then the second forces

d=p2=(b2)2.d = p^2 = \left(\frac{b}{2}\right)^2.

Conversely, if d=(b2)2d = \left(\dfrac{b}{2}\right)^2, the identity runs forward: x2+bx+(b2)2=(x+b2)2x^2 + bx + \left(\dfrac{b}{2}\right)^2 = \left(x + \dfrac{b}{2}\right)^2. So the constant that completes the square is not just a choice, it is the only choice, and it equals (b2)2\left(\dfrac{b}{2}\right)^2.

This is why the familiar instruction “take half the coefficient of xx, then square it” is true. It is not a rule to memorize; it is a consequence of matching the middle term 2px=bx2px = bx, which forces p=b2p = \tfrac{b}{2}, and then reading off the constant p2p^2. Notice the added constant (b2)2\left(\tfrac{b}{2}\right)^2 is never negative, whatever the sign of bb, because squaring kills the sign.

The added constant almost never happens to be sitting there already. So we add it and immediately subtract it, changing the expression’s appearance without changing its value:

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

That equation is the engine of the lesson. Every worked example below is this one move, applied and then cleaned up.

Completing the square, literally

The name is not a metaphor. Picture x2+bxx^2 + bx as area. The x2x^2 is a square with side xx. The bxbx is a rectangle with one side xx and the other side bb, so it is bb tall and xx wide, sitting next to the square. Now cut that rectangle down its length into two equal strips, each of width b2\tfrac{b}{2} and length xx. Glue one strip to the right edge of the square and the other to the bottom edge. The two strips fit flush, and what you have built is almost a bigger square of side x+b2x + \tfrac{b}{2}, missing only the little corner where the two strips would meet. That corner is a square of side b2\tfrac{b}{2}, so its area is (b2)2\left(\tfrac{b}{2}\right)^2. Fill it in and the figure is a complete square of side x+b2x + \tfrac{b}{2}.

Area model: x squared plus b x plus (b over 2) squared equals (x plus b over 2) squaredThe x by x square, two strips of width b over 2 glued to its right and bottom, and the small accented corner square of area (b over 2) squared that completes a square of side x plus b over 2.(b/2)x(b/2)x(b/2)²xb/2xb/2x + b/2
Completing the square for x squared plus b x. The large square is x by x. The b by x rectangle has been cut into two strips of width b over 2 and glued to the right and bottom edges. The only piece missing from the full square of side x plus b over 2 is the small accented corner of area (b over 2) squared. Adding that corner turns the shape into a perfect square.

The area bookkeeping is the algebra. The original pieces have total area x2x^2 (the big square) plus 2b2x=bx2 \cdot \tfrac{b}{2} \cdot x = bx (the two strips), which is x2+bxx^2 + bx, our starting expression. Fill in the corner of area (b2)2\left(\tfrac{b}{2}\right)^2 and the whole figure is a square of side x+b2x + \tfrac{b}{2}:

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

That is the identity from the last section, now seen rather than derived. The constant you add is the geometric corner that was missing, and “completing the square” describes precisely what your hand does to the picture.

The algorithm: standard form to a single square

To rewrite a whole quadratic, complete the square on its x2+bxx^2 + bx part and carry the leftover constant along. Start with a monic quadratic, one whose leading coefficient is 11.

Worked example 1 A monic quadratic to vertex form

Rewrite x26x+7x^2 - 6x + 7 as a perfect square plus a constant.

The variable part is x26xx^2 - 6x, so here b=6b = -6 and half of it is 3-3. The completing constant is (3)2=9(-3)^2 = 9. Add it and subtract it so the value is untouched:

x26x+7=(x26x+9)9+7.x^2 - 6x + 7 = \big(x^2 - 6x + 9\big) - 9 + 7.

The bracketed trinomial is the perfect square (x3)2(x - 3)^2, and the loose constants combine to 9+7=2-9 + 7 = -2:

x26x+7=(x3)22.x^2 - 6x + 7 = (x - 3)^2 - 2.

This is vertex form a(xh)2+ka(x - h)^2 + k with a=1a = 1, h=3h = 3, k=2k = -2. No factoring, no guessing, and it worked on the very quadratic that had no rational factorization.

When the leading coefficient is not 11, the square you are completing lives inside a factor of aa, so pull aa out of the x2x^2 and xx terms first. This is the step most often botched, because the aa has to come back out at the end.

Worked example 2 A leading coefficient, and reading the vertex

Write f(x)=2x2+12x+7f(x) = 2x^2 + 12x + 7 in vertex form, then read off its vertex, its minimum value, and its range.

Factor 22 out of the first two terms only. The constant 77 stays outside, because it has no xx in it:

2x2+12x+7=2(x2+6x)+7.2x^2 + 12x + 7 = 2\big(x^2 + 6x\big) + 7.

Complete the square inside the parentheses. There b=6b = 6, half is 33, and 32=93^2 = 9, so add and subtract 99 inside:

2(x2+6x+99)+7=2((x+3)29)+7.2\big(x^2 + 6x + 9 - 9\big) + 7 = 2\big((x + 3)^2 - 9\big) + 7.

Now distribute the 22 back across both pieces, the trap being to distribute it only to the square. The 9-9 is inside the parentheses, so it is multiplied by 22 as well:

2(x+3)218+7=2(x+3)211.2(x + 3)^2 - 18 + 7 = 2(x + 3)^2 - 11.

In vertex form f(x)=2(x+3)211f(x) = 2(x + 3)^2 - 11, so the vertex is (3,11)(-3, -11). Because a=2>0a = 2 > 0 the parabola opens upward, the vertex is the lowest point, the minimum value is 11-11, and the range is y11y \ge -11.

Check your understanding

Written in vertex form, x2+8x+3x^2 + 8x + 3 equals which of these?

Answer choices

Two payoffs from one computation

Here is the point of the chapter. The three forms of a quadratic each answer a different question for free, and completing the square is the bridge from standard form to vertex form. But the very same finished expression answers two different questions depending on what you do with it next. Convert and read, and you get the vertex. Convert and solve, and you get the roots. One computation, two payoffs.

Payoff one: the vertex, the extremum, and the range

Run the algorithm on a completely general quadratic and the vertex appears in closed form.

Completing the square gives the vertex of every parabola#

Take f(x)=ax2+bx+cf(x) = ax^2 + bx + c with a0a \ne 0. Factor aa from the first two terms:

f(x)=a(x2+bax)+c.f(x) = a\left(x^2 + \frac{b}{a}x\right) + c.

Inside, the coefficient of xx is ba\tfrac{b}{a}, so half of it is b2a\tfrac{b}{2a} and the completing constant is (b2a)2=b24a2\left(\tfrac{b}{2a}\right)^2 = \tfrac{b^2}{4a^2}. Add and subtract it inside:

f(x)=a(x2+bax+b24a2b24a2)+c=a((x+b2a)2b24a2)+c.f(x) = a\left(x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} - \frac{b^2}{4a^2}\right) + c = a\left(\left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a^2}\right) + c.

Distribute aa across both terms in the outer parentheses. The second term becomes ab24a2=b24aa \cdot \tfrac{b^2}{4a^2} = \tfrac{b^2}{4a}:

f(x)=a(x+b2a)2b24a+c.f(x) = a\left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a} + c.

This is vertex form a(xh)2+ka(x - h)^2 + k with h=b2ah = -\dfrac{b}{2a} and k=cb24ak = c - \dfrac{b^2}{4a}, so the vertex is

(b2a, cb24a).\left(-\frac{b}{2a},\ \, c - \frac{b^2}{4a}\right).

Look at the xx-coordinate: b2a-\dfrac{b}{2a} is exactly the axis of symmetry the chapter derived earlier from the parabola’s mirror symmetry. That lesson could locate the axis but not the height of the vertex. Completing the square supplies the missing yy-coordinate, cb24ac - \dfrac{b^2}{4a}, which is just f ⁣(b2a)f\!\left(-\tfrac{b}{2a}\right) evaluated once and for all. From the vertex form the extremum and range follow with no extra work: when a>0a > 0 the vertex is the minimum and the range is yky \ge k. When a<0a < 0 the vertex is instead the maximum and the range is yky \le k. That is the whole reason vertex form is worth reaching, and completing the square always reaches it.

Check your understanding

What is the minimum value of f(x)=x210x+30f(x) = x^2 - 10x + 30?

Answer choices

Payoff two: solving by isolating the square

To solve instead of read, do not distribute anything: get the square by itself on one side, then undo it. Undoing a square is where a genuinely important subtlety lives, so state it exactly.

Why the square root carries a plus or minus#

The symbol k\sqrt{k} denotes, by definition, the nonnegative number whose square is kk (this needs k0k \ge 0). So k\sqrt{k} is one specific number, never two. The equation x2=kx^2 = k is a different object: it asks for every xx whose square is kk.

For k>0k > 0, move everything to one side and factor as a difference of squares:

x2=k    x2k=0    (xk)(x+k)=0.x^2 = k \iff x^2 - k = 0 \iff \big(x - \sqrt{k}\big)\big(x + \sqrt{k}\big) = 0.

By the Zero Product Property a product is zero exactly when a factor is zero, so x=kx = \sqrt{k} or x=kx = -\sqrt{k}, which we write together as x=±kx = \pm\sqrt{k}. Both are genuine solutions, and there are no others. For k=0k = 0 the two collapse into the single solution x=0x = 0. For k<0k < 0 there is no real solution at all, because a real square is never negative.

So the ±\pm is not decoration, it is the second root. Writing x=kx = \sqrt{k} by itself silently throws away x=kx = -\sqrt{k}, and that lost solution is one of the most common errors in all of algebra. With that pinned down, solving is mechanical: complete the square, isolate it, and extract the root with a ±\pm.

Worked example 3 Solving the quadratic that would not factor

Solve x26x+7=0x^2 - 6x + 7 = 0, the equation from the opening that had no rational factorization.

From Worked Example 1 the left side is (x3)22(x - 3)^2 - 2, so the equation is

(x3)22=0.(x - 3)^2 - 2 = 0.

Isolate the square by adding 22 to both sides:

(x3)2=2.(x - 3)^2 = 2.

The right side is positive, so take the square root of both sides and attach the ±\pm:

x3=±2.x - 3 = \pm\sqrt{2}.

Finally add 33 to both sides:

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

There are the two roots, x=3+2x = 3 + \sqrt{2} and x=32x = 3 - \sqrt{2}. They are irrational, which is exactly why the integer search of factoring could never have found them, and why a method that does not rely on guessing was needed.

Worked example 4 When the isolated square is negative

Solve x22x+5=0x^2 - 2x + 5 = 0.

Complete the square on x22xx^2 - 2x. Half of 2-2 is 1-1, and (1)2=1(-1)^2 = 1:

x22x+5=(x22x+1)1+5=(x1)2+4.x^2 - 2x + 5 = (x^2 - 2x + 1) - 1 + 5 = (x - 1)^2 + 4.

So the equation is (x1)2+4=0(x - 1)^2 + 4 = 0. Isolate the square:

(x1)2=4.(x - 1)^2 = -4.

The left side is a square, so it is never negative for any real xx, while the right side is 4-4. No real number satisfies this, so the equation has no real solution. Completing the square does not fail here; it succeeds, and what it reveals is that this parabola never touches the xx-axis. (Numbers whose square is negative are the subject of a later chapter, and they will give this equation two solutions of a new kind.)

Check your understanding

How many real solutions does x2+2x+6=0x^2 + 2x + 6 = 0 have?

Answer choices

Do this same isolate-and-extract computation on the fully general ax2+bx+c=0ax^2 + bx + c = 0, carrying the letters instead of numbers, and the answer you get has a name: the quadratic formula. That is the next lesson, and it is why the formula is a theorem you can prove rather than a spell to memorize. You already own its one idea.

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 description of a result. It is an instruction to a hand.

“Complete” carries an older sense than the one you use for homework. It comes from the Latin complere, to fill up. The same root gives us “replete”, and “complement”, the piece that fills a gap. To complete a square is therefore to finish an unfinished one. The figure in this lesson is unfinished in a very literal way. The constant you add is the area of its missing corner, and nothing else.

Around the year 820, in Baghdad, al-Khwarizmi set the method down in the treatise that carried it for the next seven centuries. He had no symbols to argue with. So his geometry was not a picture hung beside a proof. The geometry was the proof, and a reader’s only reason to trust the recipe was that the finished figure was visibly whole.

That is also why the completing constant is forced rather than chosen. A gap of a given shape admits exactly one piece that fills it. Half of bb, then squared, is not one option among several. It is the only quantity that closes the figure. That is precisely what the algebra reported when matching coefficients left a single value for dd.