Saved

Press the star next to a tool's name to save it.

All my tools

Completing the Square Calculator

Use this completing the square calculator to rewrite a quadratic in vertex form a(x − h)² + k, and to find the vertex, the number added and the roots.

Restored your last values ·

Enter the coefficients of ax² + bx + c. Blank values count as 0. The calculator rewrites the expression as a(x − h)² + k, which is called vertex form, and gives the vertex and the roots.

Everything is worked out in your browser. Nothing you type is sent anywhere.

–

–

Enter the coefficients a, b and c, then press Complete the square.

See full result

A completing the square calculator rewrites a quadratic expression ax² + bx + c in the form a(x − h)² + k. Enter the coefficients and you get the vertex form, the vertex of the parabola, the number that is added and subtracted, and the roots. It uses the formulas on Wikipedia's page on completing the square, and it works in your browser. It covers the practice and the working of completing the square.

How to use the completing the square calculator

  1. Enter a, the coefficient of x squared.
  2. Enter b, the coefficient of x, and c, the constant. Leave a box empty for zero.
  3. Press Complete the square.
  4. Read the vertex form, the vertex and the other results.

The method

The Wikipedia page on completing the square explains the idea. For a monic quadratic, one with a equal to 1, x squared plus b x equals x plus b over 2, all squared, minus b squared over 4. So you take half of the coefficient of x, square it, add it to make a perfect square and subtract it to keep the value the same. The expression x squared plus b x plus c is then x plus b over 2, squared, plus c minus b squared over 4. For x squared plus 6x plus 5, half of 6 is 3 and its square is 9, so the expression is x plus 3, squared, minus 4.

The general case

If a is not 1, the page gives the result as a times x minus h, squared, plus k, where h equals minus b over 2a and k equals c minus b squared over 4a. You can see this as factoring a out of the first two terms and then completing the square inside. For 2x squared minus 8x plus 1, h is 2 and k is 1 minus 64 over 8, which is minus 7, so the vertex form is 2 times x minus 2, squared, minus 7. The calculator does the algebra and shows the number b over 2a and the square of it, which is the term that is added and subtracted.

The vertex of the parabola

In vertex form the vertex of the parabola is at the point (h, k). If a is positive, the parabola opens upward and the vertex is the lowest point, so k is the minimum value of the expression. If a is negative, it opens downward and k is the maximum. This is why the method is used to find the greatest or smallest value of a quadratic without calculus. For x squared plus 6x plus 5, the vertex is at (−3, −4), and the minimum value is −4.

Roots from the vertex form

Setting the vertex form to zero gives the roots: x equals h plus or minus the square root of minus k over a. If the discriminant b squared minus 4ac is positive, there are two real roots, and for x squared plus 6x plus 5 they are −5 and −1. If it is negative, the roots are complex. The page's example x squared plus 10x plus 28, which is x plus 5 squared plus 3, has no real roots, and the calculator gives them as minus 5 plus or minus 1.73205i. This is the derivation of the quadratic formula.

Practice and checking

For practice, work out a problem by hand and compare it with the result. A common check is to expand the vertex form: x plus 3, squared, minus 4, becomes x squared plus 6x plus 9 minus 4, which is x squared plus 6x plus 5, the original expression. If you need to complete the square in a circle or an ellipse equation, apply the method to x and to y separately. The circle equation calculator on this site does that for you.

A worked example with a leading coefficient

Take 3x squared plus 12x plus 7. First factor 3 out of the first two terms: 3 times x squared plus 4x, plus 7. Half of 4 is 2, and its square is 4, so the inside becomes x plus 2, squared, minus 4. Multiplying the minus 4 by the factor 3 gives minus 12, so the expression is 3 times x plus 2, squared, minus 12 plus 7, which is 3 times x plus 2, squared, minus 5. The vertex is at (−2, −5), and the calculator gives the same numbers, with h equal to −2 and k equal to −5.

Why the method matters

Completing the square is the basis of the quadratic formula, of the equation of a circle and of the way many curves are put in standard form. It also appears in calculus, in the integration of expressions with a quadratic in the denominator, where the first step is to complete the square. Knowing the method gives you a tool that works in many parts of mathematics, beyond the solution of one equation.

Solving an equation by completing the square

To solve x squared plus 6x plus 5 equals 0, rewrite it as x plus 3, squared, minus 4 equals 0. Then x plus 3, squared, equals 4, so x plus 3 is plus or minus 2, and x is minus 1 or minus 5. This is the same result as with the quadratic formula, and the calculator shows the roots next to the vertex form so that you can compare the two ways.

Common mistakes

  • Forgetting to subtract the number that you add. The value must stay the same.
  • Using b instead of b over 2. You square half of the coefficient.
  • Forgetting to factor out a. Do it before you complete the square.
  • Getting the sign of h wrong. x plus 3 means that h is −3.

What next

Use this often? Add Completing t to your Home screen.

Frequently asked questions

What is a completing the square calculator?

A tool that rewrites a quadratic ax² + bx + c as a(x − h)² + k and gives the vertex, the number added and the roots.

How do you complete the square?

Take half of the coefficient of x, square it, add it and subtract it. x² + 6x + 5 = (x + 3)² − 4.

What are h and k?

h = −b ÷ 2a and k = c − b² ÷ 4a. The vertex of the parabola is (h, k).

What if a is not 1?

Factor a out of the first two terms and then complete the square. 2x² − 8x + 1 = 2(x − 2)² − 7.

What if the roots are not real?

Then the discriminant b² − 4ac is negative and the roots are complex. x² + 10x + 28 = (x + 5)² + 3 has no real roots.

What went wrong?

We only receive the reason you pick, never what you typed into the tool.

Thanks for your feedback.

More Math Tools