Skip to main content

Complete the Square Calculator

Try an example:

This complete the square calculator rewrites a quadratic as a perfect square plus a number. Type an equation to solve it, or an expression to get its vertex form. Every step is shown, it is free, and it is part of our math solver.

How to Use the Complete the Square Calculator

Enter an Equation or an Expression

With an equals sign, such as x^2+6x+5=0, it solves for xx. Without one, such as 2x^2+8x+3, it gives the vertex form.

Read the Steps

Watch for the line that takes half of the middle number and squares it. That is the key move.

Use the Graph

For an expression, the graph marks the vertex, and a table gives the axis of symmetry and the smallest or largest value.

The Completing the Square Formula

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

In words: x squared plus bx, plus the square of half of b, equals the square of (x plus half of b).

The left side is called a perfect square trinomial. For any quadratic, the full version is:

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}

Complete the square calculator diagram: a square of side x and two strips of width 3 with a missing 3 by 3 corner

The picture shows why. For x2+6xx^2+6x, split 6x6x into two strips of width 3 and place them on two sides of the square. The gap in the corner is 3 by 3, so adding 9 completes it.

How Do You Complete the Square?

Make the number in front of x squared equal to 1. Move the plain number to the other side. Take half of the number in front of x, square it, and add it to both sides. The left side is now a perfect square. Take square roots of both sides and solve.

When a Is 1

Go straight to halving and squaring. For x2+6xx^2+6x, half of 6 is 3, and 32=93^2=9.

When a Is Not 1

In an equation, divide every term by aa first. In an expression you can't divide, so take aa out of the first two terms instead.

When b Is Odd

Use fractions. For x2+3xx^2+3x, half of 3 is 32\frac{3}{2}, and squaring gives 94\frac{9}{4}.

When b Is Zero

There is nothing to complete. x2−9=0x^2-9=0 becomes x2=9x^2=9, so x=±3x=\pm 3.

When should you choose it? Use it to find a vertex or when a problem asks for it. To just find the roots, the quadratic formula calculator is quicker.

Using It as a Vertex Form Calculator

Vertex form is y=a(x−h)2+ky=a(x-h)^2+k. The vertex is the point (h,k)(h,k), and the axis of symmetry is the line x=hx=h. If aa is positive, the vertex is the lowest point. If aa is negative, it is the highest.

For example, a ball's height in feet is −16t2+64t+5-16t^2+64t+5 after tt seconds. In vertex form, that is −16(t−2)2+69-16(t-2)^2+69. So the ball is highest at 2 seconds, at 69 feet.

Worked Examples

Example 1: A Simple Equation

Solve x2+6x+5=0x^2+6x+5=0.

  1. Subtract 5: x2+6x=−5x^2+6x=-5.
  2. Half of 6 is 3. Square it and add 9 to both sides: x2+6x+9=4x^2+6x+9=4.
  3. Write the square: (x+3)2=4(x+3)^2=4.
  4. Take square roots: x+3=±2x+3=\pm 2, so x=−1x=-1 or x=−5x=-5.

Example 2: A Leading Number Other Than 1

Write 2x2+8x+32x^2+8x+3 in vertex form.

  1. Take 2 out of the first two terms: 2(x2+4x)+32(x^2+4x)+3.
  2. Half of 4 is 2, and 22=42^2=4. Add and subtract 4 inside: 2(x2+4x+4−4)+32(x^2+4x+4-4)+3.
  3. Move the −4-4 out, times 2: 2(x+2)2−8+32(x+2)^2-8+3.
  4. The answer is 2(x+2)2−52(x+2)^2-5. The vertex is (−2,−5)(-2,-5).

Example 3: Complex Roots

Solve x2+2x+10=0x^2+2x+10=0.

  1. Subtract 10: x2+2x=−10x^2+2x=-10.
  2. Half of 2 is 1. Add 1 to both sides: (x+1)2=−9(x+1)^2=-9.
  3. Take square roots: x+1=±3ix+1=\pm 3i, so x=−1±3ix=-1\pm 3i.

Common Mistakes to Check

Adding to Only One Side

If you add 9 on the left of an equation, add 9 on the right too.

Forgetting to Factor Out a First

Halving the middle number only works when x2x^2 has 1 in front. In 2x2+8x2x^2+8x, halving 8 would be wrong. Take out the 2 first.

Taking Only the Positive Root

(x+3)2=4(x+3)^2=4 gives x+3=2x+3=2 and x+3=−2x+3=-2. Missing the second one loses an answer.

Practice Problems

  1. Solve x2+8x+7=0x^2+8x+7=0.
  2. Solve x2−4x−5=0x^2-4x-5=0.
  3. Write x2+10x+3x^2+10x+3 in vertex form.
  4. Write 3x2−12x+53x^2-12x+5 in vertex form.
  5. Solve x2+5x+1=0x^2+5x+1=0.
Show the answers
  1. x=−1x=-1 or x=−7x=-7
  2. x=5x=5 or x=−1x=-1
  3. (x+5)2−22(x+5)^2-22
  4. 3(x−2)2−73(x-2)^2-7
  5. x=−52+212x=-\frac{5}{2}+\frac{\sqrt{21}}{2} or x=−52−212x=-\frac{5}{2}-\frac{\sqrt{21}}{2}

Related Calculators

Learn More

FAQ

Why Do You Add Half of b Squared?

Because (x+p)2=x2+2px+p2(x+p)^2=x^2+2px+p^2. The middle number is 2p2p, so pp is half of it, and the missing last number is p2p^2.

When Should You Complete the Square?

When you need the vertex, when you want to prove the quadratic formula, or when you rewrite the equation of a circle.

How Do You Find the Vertex?

Read it from vertex form. In 2(x+2)2−52(x+2)^2-5, the vertex is (−2,−5)(-2,-5).

Why Is the Sign of h Opposite?

Vertex form has a minus sign built in: (x−h)(x-h). So (x+2)(x+2) is (x−(−2))(x-(-2)), and h=−2h=-2.

Does It Work When the Roots Are Not Real?

Yes. A negative number under the square root gives ii. This completing the square calculator shows those steps too.

Is It the Same as the Quadratic Formula?

It is where the formula comes from. Complete the square on ax2+bx+c=0ax^2+bx+c=0 with letters, solve for xx, and you get the formula. If the trinomial factors neatly, the factoring calculator may be faster than both.


Next step: write down half of the middle number, square it, and then check your work with the complete the square calculator above.