Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem

Complete the Square Calculator

Enter a quadratic expression or equation to rewrite it in vertex form a(x−h)2+ka(x - h)^2 + k, read off the vertex, and solve it exactly by completing the square.

Enter ax² + bx + c to get vertex form, or an equation such as x^2 - 4x - 1 = 0 to solve it.

Examples

About the Complete the Square Calculator

Completing the square turns a quadratic like 2x2−8x+32x^2 - 8x + 3 into the form 2(x−2)2−52(x - 2)^2 - 5. That second form is far more informative: it shows at a glance that the parabola's lowest point is at (2,−5)(2, -5), that it opens upwards, and how far it is stretched. The same manipulation is how the quadratic formula is derived and how circles and ellipses are put into standard form.

This calculator handles any leading coefficient, including fractions and decimals such as 0.5x2+3x−10.5x^2 + 3x - 1. Give it an expression and it returns the vertex form and vertex; give it an equation ending in =0= 0 or another value and it continues to the exact solutions, or explains why there are no real ones when the parabola does not cross the axis.

What is completing the square?

A perfect-square trinomial is one that equals the square of a binomial, such as x2+6x+9=(x+3)2x^2 + 6x + 9 = (x + 3)^2. Its constant term is always the square of half the coefficient of xx. Completing the square means adding and subtracting exactly that number so that part of the expression becomes a perfect square.

The result is vertex form, a(x−h)2+ka(x - h)^2 + k. Because a square is never negative, the expression's minimum (for a>0a > 0) or maximum (for a<0a < 0) value is kk, reached when x=hx = h.

How to use the Complete the Square Calculator

  1. Type a quadratic expression such as 2x^2 - 8x + 3, or an equation such as x^2 - 4x - 1 = 0.
  2. Coefficients may be integers, fractions or decimals.
  3. Press Complete the square. The calculator identifies a, b and c, factors a out of the x-terms, and adds and subtracts the square of half the linear coefficient.
  4. Read the vertex form and the vertex. For an equation, continue through the square-root step to the exact solutions.

Formulas

Perfect square

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

General vertex form

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}

Vertex

(h,k)=(−b2a, c−b24a)(h, k) = \left(-\frac{b}{2a},\ c - \frac{b^2}{4a}\right)

Worked example: 2x² − 8x + 3

The example completes the square for 2x2−8x+32x^2 - 8x + 3. Since a=2a = 2, the engine first factors 2 out of the xx-terms: 2(x2−4x)+32(x^2 - 4x) + 3. Half of −4-4 is −2-2 and its square is 4.

Adding and subtracting 4 inside the bracket gives 2(x2−4x+4−4)+3=2(x−2)2−8+32(x^2 - 4x + 4 - 4) + 3 = 2(x - 2)^2 - 8 + 3, so the vertex form is 2(x−2)2−52(x - 2)^2 - 5 and the vertex is (2,−5)(2, -5).

The solution below is generated by the same engine that powers the calculator above.

Final answer

2(x−2)2−52(x - 2)^{2} - 5

How we read your problem

Rewrite the quadratic in vertex form by completing the square.

Step-by-step solution

  1. Identify a, b and c

    a = 2, b = -8, c = 3

    2x2−8x+32x^{2} - 8x + 3
  2. Factor a = 2 out of the x-terms

    2(x2−4x)+32\left(x^2 - 4x\right) + 3
  3. Take half of the linear coefficient and square it

    Half of -4 is -2; its square is 4.

    (−42)2=4\left(\frac{-4}{2}\right)^2 = 4
  4. Add and subtract that square inside the bracket

    Adding 4 creates a perfect square trinomial; subtracting it keeps the value unchanged (the subtracted part is multiplied by a = 2 when it leaves the bracket).

    2(x2−4x+4)−8+32\left(x^2 -4x + 4\right) - 8 + 3
  5. Write the perfect square and combine constants

    2(x−2)2−52(x - 2)^{2} - 5
  6. Read the vertex

    In a(x − h)² + k the vertex is (h, k) = (2, -5); the axis of symmetry is x = 2. Since a > 0 the parabola opens upward and k is the minimum value.

Formulas used

  • Completing the square

    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}
  • Vertex

    h=−b2a,k=c−b24ah = -\frac{b}{2a},\quad k = c - \frac{b^2}{4a}

Vertex form: 2(x - 2)^2 - 5. Vertex (2, -5).

Verification

  • Expanding 2(x - 2)^2 - 5 gives back 2x^2 - 8x + 3.

Detailed explanation

Why half the coefficient, squared?

Expanding (x+p)2(x + p)^2 gives x2+2px+p2x^2 + 2px + p^2. Comparing with x2+bxx^2 + bx, the middle terms match when 2p=b2p = b, so p=b/2p = b/2, and the missing constant is p2=(b/2)2p^2 = (b/2)^2. Geometrically, x2+bxx^2 + bx is a square of side xx plus two rectangles of size x×b/2x \times b/2; the small corner square of area (b/2)2(b/2)^2 is what completes the big square.

When the leading coefficient is not 1

Factor aa out of the x2x^2 and xx terms only, leaving the constant outside. Complete the square inside the bracket, then multiply the subtracted square by aa when moving it out. Forgetting that multiplication is the most frequent error: in the example, the −4-4 inside the bracket becomes −8-8 outside.

If aa is negative, the parabola opens downwards and the vertex is a maximum. The calculator factors out the negative coefficient the same way, so signs inside the bracket flip.

Solving equations by completing the square

For x2−4x−1=0x^2 - 4x - 1 = 0, completing the square gives (x−2)2=5(x - 2)^2 = 5. Taking square roots of both sides, with both signs, gives x−2=±5x - 2 = \pm\sqrt5, so x=2±5x = 2 \pm \sqrt5. Doing the same steps with letters instead of numbers produces the quadratic formula.

When the right-hand side is negative, as in (x+3)2=−4(x + 3)^2 = -4 from x2+6x+13=0x^2 + 6x + 13 = 0, there is no real solution. The calculator reports that, and also states the complex pair −3±2i-3 \pm 2i that you would get by allowing −4=2i\sqrt{-4} = 2i.

Reading the graph from vertex form

Vertex form describes the parabola as a transformation of y=x2y = x^2. The value hh shifts the graph right (or left when hh is negative), kk shifts it up or down, and aa stretches it vertically and flips it when negative. The axis of symmetry is the vertical line x=hx = h, so points at equal distances on either side of hh have equal heights.

This makes sketching quick. For 2(x−2)2−52(x - 2)^2 - 5, plot the vertex (2,−5)(2, -5), then step one unit either side: the height rises by a⋅12=2a \cdot 1^2 = 2, giving (1,−3)(1, -3) and (3,−3)(3, -3). The range follows immediately as y≥−5y \ge -5, which is why vertex form is the natural starting point for domain and range questions.

Common mistakes

  • Adding (b/2)2(b/2)^2 without subtracting it again, which changes the expression.
  • Squaring bb instead of b/2b/2.
  • Forgetting to multiply the subtracted square by aa when a≠1a \ne 1.
  • Taking only the positive square root when solving an equation.
  • Reading the vertex of a(x+3)2+ka(x + 3)^2 + k as x=3x = 3; the vertex is at x=−3x = -3.

Tips

  • Write x−hx - h explicitly: (x+3)2=(x−(−3))2(x + 3)^2 = (x - (-3))^2, so h=−3h = -3.
  • Check vertex form by expanding it back to standard form.
  • Use fractions rather than decimals when bb is odd; half of 5 is 52\tfrac52.
  • Compare your vertex with h=−b/(2a)h = -b/(2a) as a quick check.

Frequently asked questions

What is vertex form?

A quadratic written as a times (x minus h) squared plus k. The point (h, k) is the vertex of the parabola and a controls its direction and width.

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

Factor a out of the x squared and x terms, complete the square inside the bracket, then multiply the subtracted constant by a as you move it outside.

Is completing the square better than the quadratic formula?

Both give the same roots. Completing the square also gives the vertex form, which is useful for graphing, and it is the method used to derive the formula itself.

What if the coefficient of x is odd?

Work with fractions. For x squared plus 5x, add and subtract 25/4 to get (x plus 5/2) squared minus 25/4.

Can completing the square give complex solutions?

Yes. If the square ends up equal to a negative number, there are no real solutions. The calculator says so and also lists the complex conjugate pair in a plus or minus bi form.

How is completing the square used for circles?

Completing the square separately in x and y turns an equation such as x squared plus y squared minus 4x plus 6y equals 3 into the standard form of a circle, revealing its centre and radius.

Find the vertex form

Enter your quadratic above to complete the square and see the vertex and solutions step by step.

More math calculators