Lelifi·tools

Completing the Square Calculator

Completing the square rewrites x^2 + 6x + 5 as (x + 3)^2 - 4 and exposes the vertex at (-3, -4). Enter a, b and c below to get the same form, the square root step and both roots for any quadratic.

Type in a, b and c to rewrite the quadratic in completed square form and read off the vertex and both roots.

By the Lelifi editors ·

Key takeaways

Completing the square in one linex^2 + bx + c = (x + b/2)^2 + c - (b/2)^2Example: x^2 + 6x + 5 = (x + 3)^2 - 4Half of 6 is 3, and 3^2 = 9, so the constant becomes 5 - 9 = -4Vertex (-3, -4), square root step (x + 3)^2 = 4The vertex is visible as soon as the square is written down, no graph needed.
Half of b, squared, is the whole trick behind completing the square.
The parabola x^2 + 6x + 5 with its vertex markedx = -3vertex (-3, -4)root x = -5root x = -1xy
The vertex sits where the square vanishes, at x = -3 with a value of -4, and the two roots fall on the x axis.
On this page
  1. What completing the square does
  2. The formula behind the method
  3. Worked example: x^2 + 6x + 5 = 0
  4. Worked example: 2x^2 - 8x + 3 = 0
  5. Vertex form and what the graph does
  6. Completing the square against the quadratic formula
  7. What the calculator returns

What completing the square does

Completing the square rewrites a quadratic in standard form into an equation that contains a perfect square, so the turning point of the graph can be read straight off the algebra. OpenStax College Algebra works through the same rewrite, and Khan Academy's quadratic unit presents it as a way to solve an equation without reaching for the quadratic formula.

Watch what happens to x^2 + 6x + 5 when the 6 is split into two 3s, giving x^2 + 3x + 3x + 5. Add 9 and subtract 9 so the first two terms can group as x(x + 3) and 3(x + 3). Those two groups share the binomial x + 3, so together they factor to (x + 3)(x + 3), and the leftover 9 - 9 + 5 is a net -4. The equation now reads (x + 3)^2 - 4.

That -4 is not decoration. It is the vertical shift of the parabola, which is why the completed square form hands you the vertex with no extra calculation.

The formula behind the method

Every quadratic can be written as a square plus a remainder. For x^2 + bx + c the recipe is: take half of b, square it, then add and subtract that square so the equality survives.

Half of b is b/2, and the square of that is (b/2)^2. Expanding (x + n)^2 = x^2 + 2nx + n^2 shows why n has to equal half of b, because the middle term 2nx has to reproduce bx. So x^2 + bx + c = (x + b/2)^2 + c - (b/2)^2.

StepGeneral ruleFor x^2 + 6x + 5
Take half of bb / 23
Square it(b/2)^23^2 = 9
Write the square(x + b/2)^2(x + 3)^2
Constant left overc - (b/2)^25 - 9 = -4

When the leading coefficient is not 1 the same recipe still works, but every term is divided by a first. For ax^2 + bx + c the finished form is a(x + b/2a)^2 + c - b^2/4a, and the turning point sits at -b/2a along the x axis. MIT OpenCourseWare's single variable calculus course describes that same point as the place where a quadratic stops falling and starts rising, which is the geometric meaning of the completed square.

Worked example: x^2 + 6x + 5 = 0

Start with x^2 + 6x + 5 = 0 and move the constant to the right, leaving x^2 + 6x = -5. Half of 6 is 3, and 3^2 = 9, so add 9 to both sides. The left side now contains the square and the right side is 4.

StepWorkResult
1. Move the constantx^2 + 6x = -5one square term left
2. Half of b6 / 23
3. Square it3^29
4. Add and subtract9 - 54
5. Write the square(x + 3)^2 = 4one square
6. Square rootsqrt(4)2
7. Two rootsx = -3 + 2 and x = -3 - 2x = -1 and x = -5

Two quick checks confirm the pair. The sum of the roots should equal -b / a = -6 / 1 = -6, and -1 + (-5) = -6. The product should equal c / a = 5 / 1 = 5, and -1 x (-5) = 5. If either check fails, the arithmetic slipped somewhere in steps 2 through 4.

The vertex comes out of the same work. The square (x + 3)^2 is zero at x = -3, and there the whole expression sits at -4, so the vertex is (-3, -4) and the parabola opens upward with a minimum of -4.

Worked example: 2x^2 - 8x + 3 = 0

A leading coefficient that is not 1 adds one step at the front. Divide every term by 2 to get x^2 - 4x + 1.5 = 0, and from there the method is identical. Half of -4 is -2, and squaring -2 gives 4.

StepWorkResult
1. Divide by a3 / 21.5
2. Move the constantx^2 - 4x = -1.5one square term left
3. Half of b, squared(0 - 4) / 2 = -2, then (-2)^24
4. Add and subtract4 - 1.52.5
5. Write the square(x - 2)^2 = 2.5one square
6. Square rootsqrt(2.5)about 1.5811
7. Two rootsx = 2 + 1.5811 and x = 2 - 1.5811x = 3.5811 and x = 0.4189

The rounded roots satisfy the equation to within a rounding error, which is the expected behavior at four decimal places. The vertex now sits at (2, -5), because the square (x - 2)^2 vanishes at x = 2 and the leftover constant there is -5. A quick check on the sum of the roots: 3.5811 + 0.4189 = 4, and -b / a = 8 / 2 = 4.

Multiplying the finished form back by 2 gives the vertex form 2(x - 2)^2 - 5, which is the shape you would hand to a graphing tool or a spreadsheet.

Vertex form and what the graph does

Vertex form is a(x - h)^2 + k, where the vertex sits at (h, k). The completed square puts an equation into that shape, so the graph needs no plotting. If a is positive the parabola opens upward and k is the minimum value of the function. If a is negative it opens downward and k is the maximum.

OriginalCompleted square formVertexLowest or highest point
x^2 + 6x + 5(x + 3)^2 - 4(-3, -4)minimum of -4
2x^2 - 8x + 32(x - 2)^2 - 5(2, -5)minimum of -5
x^2 - 4x(x - 2)^2 - 4(2, -4)minimum of -4

The vertex coordinates also come from the original coefficients without doing the rewrite. The x coordinate is -b/2a, so for x^2 + 6x + 5 it is -6 / 2 = -3, and the y coordinate is c - b^2/4a, which is 5 - 36 / 4 = 5 - 9 = -4. For 2x^2 - 8x + 3 the same pair reads 8 / 4 = 2 and 3 - 64 / 8 = 3 - 8 = -5.

This is where completing the square earns its keep. A school assignment that asks for the vertex, the minimum value or the range of a quadratic can be answered with the formula, while the quadratic formula would give the roots and leave the graph work still ahead.

Completing the square against the quadratic formula

The two methods agree on the roots, because the quadratic formula is nothing more than the completed square rearranged. Starting from (x + b/2a)^2 = (b^2 - 4ac)/4a^2 and taking square roots on both sides leaves x = -b/2a +/- sqrt(b^2 - 4ac)/2a, which is the familiar formula in a different costume.

QuestionCompleting the squareQuadratic formula
Rootssame two rootssame two roots
Vertexread off the finished formneeds one extra step
Number of stepsfour or fiveone
Working conditionsa is not 0a is not 0
Shows the shape of the graphyesno

Reach for factoring first when the numbers cooperate, since x^2 + 6x + 5 factors as (x + 1)(x + 5) and finishes in seconds. Reach for completing the square when factoring stalls, when a vertex is needed, or when a task asks for standard form, vertex form or a graph. Reach for the quadratic formula when speed matters and only the roots are wanted, for example x^2 + 6x + 3, which does not factor over the integers and gives x = -3 +/- sqrt(6), roughly -0.5505 and -5.4495.

What the calculator returns

The defaults are the first worked example: a = 1, b = 6 and c = 5, which is the equation x^2 + 6x + 5.

OutputValue for the default case
Completed square form(x + 3)^2 - 4 = 0
Square root step(x + 3)^2 = 4
Vertex(-3, -4)
Discriminant16
Rootsx = -1 and x = -5

Type 2, -8 and 3 into the three boxes and the same panel reports 2(x - 2)^2 - 5 = 0, the square root step (x - 2)^2 = 2.5, the vertex (2, -5), a discriminant of 40 and the roots x = 3.5811 and x = 0.4189.

Two edge cases are handled explicitly. A leading coefficient of 0 is not a quadratic, so the tool asks for a different a instead of dividing by zero. A negative discriminant produces complex roots, reported as x = -1 + 2i and x = -1 - 2i for x^2 + 2x + 5, which is the same answer the quadratic formula gives.

All of the arithmetic happens in your browser. Nothing you type leaves the page.

Frequently asked questions

What is completing the square?

It is a rewrite of a quadratic equation into a form that contains a perfect square, such as rewriting x^2 + 6x + 5 as (x + 3)^2 - 4. The rewritten equation shows the vertex of the parabola directly and can be solved by taking one square root.

What is the formula for completing the square?

For x^2 + bx + c, take half of b, square it, and add and subtract that square: x^2 + bx + c = (x + b/2)^2 + c - (b/2)^2. With a leading coefficient, divide every term by a first and the form is a(x + b/2a)^2 + c - b^2/4a.

Why does half of b show up?

A square expands as (x + n)^2 = x^2 + 2nx + n^2, so the middle term is 2nx. To reproduce bx, n has to equal b/2, which is why you take half of b and square it.

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

Divide every term by a first. For 2x^2 - 8x + 3 that gives x^2 - 4x + 1.5 = 0, and the rest of the method is unchanged, ending at (x - 2)^2 = 2.5 with roots x = 3.5811 and x = 0.4189.

How do you solve an equation after completing the square?

Take the square root of both sides and then solve. From (x + 3)^2 = 4 you get x + 3 = 2 or x + 3 = -2, so x = -1 or x = -5.

What does the completed square form tell you about the graph?

The vertex. In the form a(x - h)^2 + k the turning point is (h, k). For x^2 + 6x + 5 the vertex is (-3, -4), and for 2x^2 - 8x + 3 it is (2, -5).

What if the number under the square root is negative?

The equation has no real roots, so the roots are complex. For x^2 + 2x + 5 the completed square form is (x + 1)^2 + 4, and the square root of -4 is 2i, giving x = -1 + 2i and x = -1 - 2i.

When should I use this instead of the quadratic formula?

Use it when you need the vertex, the minimum or maximum value, or when you must convert between standard, vertex and factored form. Use the quadratic formula when you only want the roots and want the shortest path.

Is completing the square the same as factoring?

No, but they solve the same kind of equation. Factoring works when the numbers cooperate, as x^2 + 6x + 5 factors to (x + 1)(x + 5). When they do not, as with x^2 + 6x + 3, completing the square still gives x = -3 +/- sqrt(6).

Does the method work for every quadratic?

It works for every quadratic, meaning any equation where a is not 0. The values of b and c can be anything, including zero. A leading coefficient of 0 turns the equation into a straight line, which is handled by a different method.

How do I get the vertex without rewriting the equation?

Use the coefficient formulas. The x coordinate is -b/2a and the y coordinate is c - b^2/4a. For x^2 + 6x + 5 that is -6 / 2 = -3 and 5 - 36 / 4 = -4.

Does my data leave this page?

No. Every calculation runs in your browser and nothing is uploaded, saved or sent anywhere.

Spotted a wrong number or a broken result?

More Math tools

See all Math tools

Fee schedules, rates and rules change without notice. Always confirm important figures with the official source before you rely on them.