Skip to content

Completing the Square Calculator

Rewrite ax² + bx + c as a(x − h)² + k with exact fractions and solve the equation step by step.

Your details

Must not be 0. Decimals are converted to exact fractions.

Results update as you type

Completed square a(x − h)² + k

(x + 3)² − 5

Vertex (h, k)
(−3, −5)
Minimum / maximum
Minimum −5 at x = −3
Solutions of ax² + bx + c = 0
x = −3 ± √5
Approximate solutions
x₁ ≈ -5.236068 ; x₂ ≈ -0.763932
Type of solutions
Two real solutions
Discriminant b² − 4ac
20

Step-by-step solution
  1. Start from x² + 6x + 4
  2. Take half of the x-coefficient 6: 6 ÷ 2 = 3; square it: 3² = 9
  3. Add and subtract that square inside the bracket: x² + 6x + 9 − 9 + 4
  4. The first three terms form a perfect square: (x + 3)² − 9 + 4
  5. Vertex form: x² + 6x + 4 = (x + 3)² − 5
  6. Vertex (−3, −5); minimum value −5 at x = −3 (a > 0, the parabola opens upward)
  7. Solve ax² + bx + c = 0 with the completed square: (x + 3)² − 5 = 0 ⇒ (x + 3)² = 5
  8. Take the square root of both sides: x + 3 = ±√5
  9. Isolate x: x = −3 ± √5

Completing the square turns a quadratic expression ax2+bx+cax^2 + bx + c into the form a(x−h)2+ka(x - h)^2 + k, where the variable appears only once, inside a square. This calculator does the rewriting for you with exact fractions — no rounded decimals — and shows each step of the method exactly as you would write it on paper: factor out aa, halve the coefficient of xx, square it, add and subtract it, then group the perfect square.

From the completed square you can read three things at once:

  • the vertex (h,k)(h, k) of the parabola y=ax2+bx+cy = ax^2 + bx + c, and therefore its minimum or maximum value;
  • the solutions of ax2+bx+c=0ax^2 + bx + c = 0, obtained by isolating the square and taking a square root — written as integers, fractions, simplified surds such as 4±102\frac{4 \pm \sqrt{10}}{2}, or complex numbers when there is no real solution;
  • the discriminant, since the number on the right-hand side is b2−4ac4a2\frac{b^2 - 4ac}{4a^2}.

Use it to check homework, to convert to vertex form before graphing, or to see where the quadratic formula comes from.

How to use this calculator

  1. Enter the coefficients a, b and c of ax2+bx+cax^2 + bx + c. Use negative numbers for minus signs: for 2x2−8x+32x^2 - 8x + 3, enter 2, −8 and 3. Decimals such as 0.5 are converted to exact fractions.
  2. Read the completed square a(x−h)2+ka(x - h)^2 + k at the top, then the vertex, the minimum or maximum, and the solutions.
  3. Open the steps to follow the method line by line. The last steps solve ax2+bx+c=0ax^2 + bx + c = 0 from the completed square.

The formula

For a≠0a \neq 0, factor aa out of the xx terms, then add and subtract the square of half the new xx-coefficient:

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

So h=−b2ah = -\dfrac{b}{2a} and k=c−b24ak = c - \dfrac{b^2}{4a}. Setting the expression to 0:

(x−h)2=b2−4ac4a2⟹x=−b2a±b2−4ac2a\left(x - h\right)^2 = \frac{b^2 - 4ac}{4a^2} \quad\Longrightarrow\quad x = -\frac{b}{2a} \pm \frac{\sqrt{b^2 - 4ac}}{2a}

which is exactly the quadratic formula. A negative right-hand side means complex solutions; zero means a double root.

Worked example

Complete the square for 2x2−8x+32x^2 - 8x + 3.

  1. Factor 2 out of the xx terms: 2(x2−4x)+32(x^2 - 4x) + 3.
  2. Half of −4-4 is −2-2, and (−2)2=4(-2)^2 = 4.
  3. Add and subtract 4 inside: 2(x2−4x+4−4)+3=2(x−2)2−8+32(x^2 - 4x + 4 - 4) + 3 = 2(x - 2)^2 - 8 + 3.
  4. Result: 2(x − 2)² − 5. The vertex is (2,−5)(2, -5), a minimum because a=2>0a = 2 > 0.

To solve 2x2−8x+3=02x^2 - 8x + 3 = 0: (x−2)2=5/2(x - 2)^2 = 5/2, so x−2=±10/2x - 2 = \pm \sqrt{10}/2 and x=(4±10)/2x = (4 \pm \sqrt{10})/2, that is x≈0.4189x \approx 0.4189 or x≈3.5811x \approx 3.5811.

With x2+2x+5x^2 + 2x + 5 the result is (x+1)2+4(x + 1)^2 + 4: the square would have to equal −4-4, so the solutions are complex, x=−1±2ix = -1 \pm 2i.

Completing the square or the quadratic formula?

Both give the same solutions — the quadratic formula is simply completing the square done once and for all in letters. Completing the square is the better choice when you also need the vertex form (graphing, finding a maximum profit or a minimum cost), when bb is even and a=1a = 1 (the numbers stay small), and in later topics where the formula does not apply: putting the equation of a circle x2+y2+Dx+Ey+F=0x^2 + y^2 + Dx + Ey + F = 0 into centre–radius form, identifying conic sections, or preparing an integral such as ∫dxx2+2x+5\int \frac{dx}{x^2 + 2x + 5}. To study the curve itself (axis, focus, directrix), see the parabola calculator.

Typical mistakes

  • Forgetting to factor out a. The “half the coefficient” rule works only when the coefficient of x2x^2 is 1.
  • Adding without subtracting. Adding (b/2a)2(b/2a)^2 inside the bracket changes the value unless you remove a⋅(b/2a)2a \cdot (b/2a)^2 outside.
  • Sign of h. In a(x−h)2+ka(x - h)^2 + k, (x+3)2(x + 3)^2 means h=−3h = -3.
  • Dropping ±. Taking the square root of both sides gives two values, ±\pm, not one.

Frequently asked questions

What does it mean to complete the square?

It means adding and subtracting the right constant so that part of a quadratic becomes a perfect square trinomial, like x² + 6x + 9 = (x + 3)². The expression is then written as a(x − h)² + k.

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

Factor a out of the x² and x terms first, complete the square inside the bracket using half of b/a, and multiply the subtracted square by a when you move it outside. The calculator shows this case step by step.

How do I get the vertex from the completed square?

In a(x − h)² + k the vertex is (h, k). The square is never negative, so k is the minimum value when a > 0 and the maximum value when a < 0, reached at x = h.

Can completing the square solve every quadratic equation?

Yes. It works for any a ≠ 0, including equations that cannot be factored over the integers. When the isolated square equals a negative number the solutions are complex, and the calculator writes them with i.

Why are the results fractions and not decimals?

Halving b/a usually produces fractions, and exact fractions keep the vertex form exact. Approximate decimal solutions are shown separately.

Sources

Last updated:

More Math calculators

People also use