Completing the square calculator

Enter the coefficients a, b, c of a quadratic ax² + bx + c. The calculator rewrites it as a(x − h)² + k, shows every algebraic step, identifies the vertex (h, k), and plots the parabola with the vertex highlighted.

Quadratic coefficients

Vertex form
a(x − h)² + k
2(x − 3)² + 2
Vertex (h, k)
(3, 2)
Axis of symmetry
x = 3
Real roots
none
Parabola y = ax² + bx + c

Method

To rewrite ax² + bx + c as a(x − h)² + k:

h = −b / (2a), k = c − b² / (4a)

So the parabola's vertex sits at (h, k). When a > 0 it's a minimum; when a < 0 it's a maximum. The discriminant b² − 4ac determines whether real roots exist.

Worked example

For 2x² − 12x + 20:

  • Factor a from the x-terms: 2(x² − 6x) + 20
  • Half of −6 is −3; square it: 9. Add and subtract: 2(x² − 6x + 9 − 9) + 20
  • Group as a perfect square: 2((x − 3)² − 9) + 20 = 2(x − 3)² − 18 + 20
  • Final: 2(x − 3)² + 2, vertex at (3, 2), no real roots since k/a = 1 > 0.

FAQ

What if a = 0?

It's not a quadratic — it's a linear equation bx + c = 0 (or trivially constant). The calculator returns "—" rather than dividing by zero. Use the linear equation solver instead.

Why is the discriminant useful here?

It's −4a · k after completing the square. So b² − 4ac > 0 means real distinct roots, = 0 means a repeated root at the vertex (which sits on the x-axis), and < 0 means complex roots only.

Related calculators