Completing the Square Calculator

This completing the square calculator converts ax² + bx + c into vertex form. Example: x² + 6x + 5 becomes (x + 3)² − 4 with vertex (−3, −4) and roots −5 and −1.

Example: Coefficient a (of x²) 1 · Coefficient b (of x) 6 · Constant c 5 → Result: f(x) = (x + 3)² − 4, vertex (-3 | -4). Source: Wikipedia – Quadratische Ergänzung. Updated: .

Must not be 0.
My ToolboxYour inputs are saved in this browser only.

Result

Result
f(x) = (x + 3)² − 4, vertex (-3 | -4)
All values
QuantityValue
Shift p = b / (2a)3
Constant q = c − b² / (4a)-4
Vertex (−p, q)(-3 | -4)
Discriminant D = b² − 4ac16
Rootsx₁ = -5, x₂ = -1
Calculation steps
  • Starting point: ax² + bx + c = a·(x + b/(2a))² + c − b²/(4a). The terms are p = b/(2a) and q = c − b²/(4a).
  • p = b / (2a) = 6 / (2·1) = 3.
  • q = c − b² / (4a) = 5 − 6² / (4·1) = -4.
  • Vertex form: f(x) = (x + 3)² − 4, the vertex is (-3 | -4).
  • Discriminant D = b² − 4ac = 16 ≥ 0, so x₁ = -5, x₂ = -1.
The parabola opens upward when a > 0 and downward when a < 0. The vertex is its lowest or highest point.

How it is calculated

Completing the square rewrites ax² + bx + c as a(x + p)² + q, the vertex form from which the vertex and the shift of the parabola can be read off directly. The trick is to add the missing term so that a binomial formula appears.

Method

First factor a out of the first two terms: a(x² + (b/a)x) + c. For the binomial (x + p)² the bracket lacks p², where p = b/(2a). You add it and subtract it again outside the bracket, multiplied by a. What remains is q = c − b²/(4a). The calculator gives p and q directly and shows each step.

Two examples

For x² + 6x + 5, p = 3 and q = 5 − 9 = −4, so (x + 3)² − 4. For 2x² − 8x + 3, p = −2 and q = 3 − 8 = −5, so 2(x − 2)² − 5 with vertex (2, −5). The roots come from the discriminant D = b² − 4ac; in the first example D = 16 and the roots are −5 and −1.

Frequently asked questions

What is completing the square used for?

To put a parabola into vertex form, find its vertex, solve quadratic equations without the formula, or rewrite a circle equation in centre form.

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

Factor out a first, complete the bracket with (b/(2a))², and balance the extra term with the factor a. The result is a(x + b/(2a))² + c − b²/(4a).

Why does the vertex form say x + p while the vertex is at −p?

Because (x + p)² is zero exactly when x = −p. The bracket shifts the parabola p units to the left, or to the right when p is negative.

Sources and legal basis

As of: · Editorial policy

Related tools