Quadratics

Completing the Square: Method, Formula and Worked Examples

To complete the square on x2+bxx^2+bx, add (b2)2\left(\frac b2\right)^2, which turns it into the perfect square (x+b2)2\left(x+\frac b2\right)^2.

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

Try it with your numbers

Show every step

Then undo the square with a square root. The same move solves quadratics, rewrites them in vertex form, and produces the quadratic formula.

What Is Completing the Square and Why Does It Work?

Area model showing x² plus two strips of 3x and a missing corner of 9 completing a square
Cutting the 6x rectangle into two strips of width 3 leaves a 3 by 3 corner, area 9, that completes the square.

Picture x2+bxx^2+bx as area. A square with side xx has area x2x^2, and a rectangle xx by bb has area bxbx. Cut that rectangle lengthwise into two strips, each b2\frac b2 wide, and glue one strip to the right side of the square and one to the bottom. The shape is a big square with a small corner missing, and that corner is a square of side b2\frac b2. Its area, b24\frac{b^2}{4}, is the number you add. That is the whole idea behind the name.

The algebra says the same thing. Expanding any squared binomial gives (x+p)2=x2+2px+p2(x+p)^2=x^2+2px+p^2. The middle coefficient is 2p2p, so pp must be half of bb, and the constant must be p2p^2:

x2+bx+(b2)2=(x+b2)2x^2+bx+\left(\frac b2\right)^2=\left(x+\frac b2\right)^2

This is why “half, then square” works for every case. Nothing is memorized, only matched: the middle term of a perfect square is always twice the number inside the bracket.

The method starts from the standard form of a quadratic, ax2+bx+cax^2+bx+c, and its goal is to leave only one copy of xx. Once xx appears only inside a square, everything else is one-step algebra.

Quick check

What number completes x2+14xx^2+14x to a perfect square trinomial?

How Do You Solve an Equation by Completing the Square?

When a=1a=1, the process takes five moves:

  1. Move the constant to the right side.
  2. Halve the coefficient of xx and square it.
  3. Add that number to both sides.
  4. Write the left side as a squared binomial.
  5. Take the square root of both sides (with ±\pm) and solve for xx.

Example 1. Solve x2−10x+18=0x^2-10x+18=0.

x2−10x=−18x^2-10x=-18

Half of −10-10 is −5-5, and (−5)2=25(-5)^2=25. Add 25 to both sides:

x2−10x+25=−18+25x^2-10x+25=-18+25 (x−5)2=7(x-5)^2=7 x−5=±7x-5=\pm\sqrt7 x=5±7x=5\pm\sqrt7

The two solutions are about 7.657.65 and 2.352.35. Notice that 1818 has no pair of factors adding to 1010, so solving by factoring fails here, while completing the square does not care.

The last two lines are exactly the square root method. Completing the square is a way of forcing any quadratic into the shape where that method applies.

Try this: Solve x2+4x−21=0x^2+4x-21=0 by completing the square. Then add your two answers: they should total −4-4, the negative of the xx coefficient.

Completing the Square When the Leading Coefficient Is Not 1

The method needs x2x^2 to have coefficient 1, because only then does “half of bb” match the middle term of a perfect square. If a≠1a\neq1, divide every term by aa first, including the right side.

Example 2. Solve 3x2+12x−5=03x^2+12x-5=0.

x2+4x−53=0x^2+4x-\frac53=0 x2+4x=53x^2+4x=\frac53

Half of 4 is 2, and 22=42^2=4, so add 4 to both sides:

(x+2)2=53+4=173(x+2)^2=\frac53+4=\frac{17}{3} x=−2±173=−2±513x=-2\pm\sqrt{\frac{17}{3}}=-2\pm\frac{\sqrt{51}}{3}

The factor-out trap

When you factor aa out of an expression such as 2x2−8x+32x^2-8x+3, the number you add and subtract inside the bracket is multiplied by aa on the way out. Adding 4 inside 2(x2−4x+… )2(x^2-4x+\dots) really adds 8, so 8 must be taken back.

There is also a faster route that avoids fractions: multiply by aa instead of dividing. Here, 9x2+36x=159x^2+36x=15 makes the left side (3x)2+2⋅3x⋅6(3x)^2+2\cdot3x\cdot6, so add 62=366^2=36 to get (3x+6)2=51(3x+6)^2=51. That gives x=−6±513x=\frac{-6\pm\sqrt{51}}{3}, which equals the answer above.

Completing the Square With Negatives, Odd Numbers and Fractions

Signs and odd coefficients are where most arithmetic slips happen. The bracket always takes the sign of the half-coefficient, and the number you add is always positive because it is a square.

Middle term Half of bb Add Becomes
x2+6xx^2+6x 33 99 (x+3)2(x+3)^2
x2−6xx^2-6x −3-3 99 (x−3)2(x-3)^2
x2+5xx^2+5x 52\frac52 254\frac{25}{4} (x+52)2\left(x+\frac52\right)^2
x2−xx^2-x −12-\frac12 14\frac14 (x−12)2\left(x-\frac12\right)^2

Example 3. Solve x2+5x−3=0x^2+5x-3=0.

x2+5x=3x^2+5x=3 x2+5x+254=3+254x^2+5x+\frac{25}{4}=3+\frac{25}{4} (x+52)2=374\left(x+\frac52\right)^2=\frac{37}{4} x+52=±372x+\frac52=\pm\frac{\sqrt{37}}{2} x=−5±372x=\frac{-5\pm\sqrt{37}}{2}

Odd coefficients are not harder, only fractional. Keep the fraction as it is rather than converting to decimals, since 374\frac{37}{4} has an exact square root and 9.259.25 does not look like one.

If the leading coefficient is negative, multiply the whole equation by −1-1 first. For −x2+4x+1=0-x^2+4x+1=0, that gives x2−4x−1=0x^2-4x-1=0, then (x−2)2=5(x-2)^2=5, so x=2±5x=2\pm\sqrt5. Skipping this step and trying to work with a negative aa is a common way to lose a sign.

Quick check

What number must be added to x2−3xx^2-3x to make a perfect square?

How to Rewrite a Quadratic in Vertex Form

Wrong versus right vertex form of 2x² − 8x + 3 showing the factor-out slip
For 2x² − 8x + 3, adding 4 inside the bracket adds 8 overall, giving 2(x − 2)² − 5 instead of the wrong +3.

Solving needs an equation. Rewriting works on an expression, so nothing moves to the other side. Instead you add and subtract the same number, which changes nothing in value. Applying this to ax2+bx+cax^2+bx+c gives:

ax2+bx+c=a(x+b2a)2+c−b24aax^2+bx+c=a\left(x+\frac{b}{2a}\right)^2+c-\frac{b^2}{4a}

That is the vertex form a(x−h)2+ka(x-h)^2+k, with h=−b2ah=-\frac{b}{2a} and k=c−b24ak=c-\frac{b^2}{4a}.

Example 4. Write f(x)=2x2−8x+3f(x)=2x^2-8x+3 in vertex form.

f(x)=2(x2−4x)+3f(x)=2(x^2-4x)+3 =2(x2−4x+4−4)+3=2(x^2-4x+4-4)+3 =2(x−2)2−8+3=2(x-2)^2-8+3 =2(x−2)2−5=2(x-2)^2-5

The −4-4 inside the bracket became −8-8 outside, exactly as the trap above warned. The vertex is (2,−5)(2,-5), and because a=2>0a=2>0, the parabola opens up and −5-5 is the minimum.

Quick check: h=−−82⋅2=2h=-\frac{-8}{2\cdot2}=2 and f(2)=8−16+3=−5f(2)=8-16+3=-5. That is the shortcut behind finding the vertex of a parabola, and it also gives the axis of symmetry, x=2x=2. With the vertex and axis in hand, graphing quadratic functions takes a few seconds.

Real Uses: Maximum Height and Circle Equations

Any “highest point” or “lowest cost” question is a vertex question. Suppose a ball’s height in meters is h(t)=−5t2+20t+1h(t)=-5t^2+20t+1, with tt in seconds.

h(t)=−5(t2−4t)+1=−5(t2−4t+4−4)+1=−5(t−2)2+21h(t)=-5(t^2-4t)+1=-5(t^2-4t+4-4)+1=-5(t-2)^2+21

A square is never negative, and it is multiplied by −5-5, so the largest value occurs when the square is zero. The ball peaks at 21 meters after 2 seconds. To find when it lands, set −5(t−2)2+21=0-5(t-2)^2+21=0, so (t−2)2=215(t-2)^2=\frac{21}{5} and t=2+4.2≈4.05t=2+\sqrt{4.2}\approx4.05 seconds. More of this style appears in quadratic word problems.

Circles use the same skill. The equation x2+y2−6x+4y−12=0x^2+y^2-6x+4y-12=0 hides a center and radius. Group the terms and complete the square in each variable, adding the same amounts to the right side:

(x2−6x+9)+(y2+4y+4)=12+9+4(x^2-6x+9)+(y^2+4y+4)=12+9+4 (x−3)2+(y+2)2=25(x-3)^2+(y+2)^2=25

The center is (3,−2)(3,-2) and the radius is 5. Completing the square twice is the standard way to read a circle from its expanded form.

How the Quadratic Formula Comes From Completing the Square

The quadratic formula is one run of this method on the general equation ax2+bx+c=0ax^2+bx+c=0, with letters in place of numbers. Divide by aa, move the constant, and add (b2a)2=b24a2\left(\frac{b}{2a}\right)^2=\frac{b^2}{4a^2} to both sides:

x2+bax+b24a2=b24a2−cax^2+\frac bax+\frac{b^2}{4a^2}=\frac{b^2}{4a^2}-\frac ca (x+b2a)2=b2−4ac4a2\left(x+\frac{b}{2a}\right)^2=\frac{b^2-4ac}{4a^2} x=−b±b2−4ac2ax=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

Why the sign of one number decides everything

The denominator 4a24a^2 is always positive, so the right side is negative exactly when b2−4ac<0b^2-4ac<0. That single expression decides whether real solutions exist.

That expression is the discriminant. Seeing it appear naturally, as the right-hand side of a perfect square, explains why it carries so much information. For the full line-by-line version, see deriving the quadratic formula, and for the finished result in use, see the quadratic formula.

Completing the Square vs Factoring vs the Formula

All three methods give the same roots. They differ in speed and in what else they hand you.

  • Factoring is fastest when the roots are rational and small.
  • The quadratic formula is best for a plain solve with awkward numbers.
  • Completing the square is the only one that also produces vertex form, circle centers and the derivation itself.

Completing the square never fails, even when the answers are not real. Take x2+2x+5=0x^2+2x+5=0:

x2+2x=−5x^2+2x=-5 x2+2x+1=−5+1x^2+2x+1=-5+1 (x+1)2=−4(x+1)^2=-4 x+1=±2ix+1=\pm2i x=−1±2ix=-1\pm2i

A negative right side means no real solutions, so the parabola never touches the x-axis. The answers are complex numbers, and they come as a conjugate pair. Some courses also use this method to solve quadratic inequalities boundaries, though a sign chart usually does it faster.

If a problem says “by completing the square,” the method is required even when factoring would be quicker. Show the added number on both sides, because that line is usually what the marks are awarded for.

How Do You Check a Completing the Square Answer?

The fastest check uses the relationship between roots and coefficients. For ax2+bx+c=0ax^2+bx+c=0, the two roots add to −ba-\frac ba and multiply to ca\frac ca. In Example 1, the roots 5±75\pm\sqrt7 add to 1010, which matches −(−10)-(-10), and multiply to 25−7=1825-7=18, which matches the constant. The irrational parts cancel, so the check takes seconds.

Two other checks are worth having. First, expand your squared binomial and confirm it returns the original x2x^2 and xx terms. Second, substitute a root into the original equation. Substitution is slower for irrational roots, so save it for integer answers like 66 and −2-2.

Three habits remove most errors: add to both sides (or add and subtract in an expression), keep the ±\pm when taking the square root, and finish by moving the constant out of the bracket with the correct sign. For more equations to try, the quadratic formula practice problems are a good source, since each answer can be cross-checked against your completed square.

Quick check

A student claims the solutions of x2+4x−1=0x^2+4x-1=0 are x=−2±3x=-2\pm\sqrt3. Is that right?

Practice problems

0 of 5 solved

  1. Solve x2−4x−12=0x^2-4x-12=0 by completing the square.

  2. Rewrite x2+10x+3x^2+10x+3 in the form (x+p)2+q(x+p)^2+q.

  3. Solve x2−7x+3=0x^2-7x+3=0 by completing the square.

  4. Solve 2x2+12x+7=02x^2+12x+7=0 by completing the square.

  5. Write y=−2x2+6x−1y=-2x^2+6x-1 in vertex form and state the vertex.

Common questions

What is completing the square in simple terms?

It is rewriting x2+bx+cx^2+bx+c as a squared binomial plus a leftover number, (x+b2)2+c−b24(x+\frac b2)^2+c-\frac{b^2}{4}. The squared part is easy to undo with a square root, which is why the method solves any quadratic.

How do you complete the square when a is not 1?

Divide the whole equation by aa, or factor aa out of the x2x^2 and xx terms, then complete the square on what is left. When you factor aa out of an expression, the number you add inside the bracket is worth aa times as much outside, so adjust the constant by that amount.

Why do you add (b/2)² to both sides?

Because (x+b2)2\left(x+\frac b2\right)^2 expands to x2+bx+b24x^2+bx+\frac{b^2}{4}, so b24\frac{b^2}{4} is the exact missing piece. Adding it to both sides keeps the equation balanced.

When should you use completing the square instead of the quadratic formula?

Use it when the question asks for vertex form, a circle's center and radius, or when a=1a=1 and bb is even. For a plain solve with messy numbers, the quadratic formula is usually quicker.

Can completing the square give no real solution?

Yes. If the right side of (x+p)2=q(x+p)^2=q is negative, no real number squares to it, and the solutions are complex numbers. For example, (x+1)2=−4(x+1)^2=-4 gives x=−1±2ix=-1\pm2i.

Does completing the square always work?

Yes, for every quadratic with a≠0a\neq0. Factoring only works cleanly when the roots are rational, but completing the square handles irrational and complex roots too.

Up next