Skip to content
FiftyCalc Free calculators for all 50 states

Completing the Square Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter the coefficients a, b and c of ax² + bx + c to get the completed-square form a(x − h)² + k and the solutions of ax² + bx + c = 0.

Result

Sample figures

h in a(x − h)² + k, h = −b ÷ 2a—

k in a(x − h)² + k, k = c − b² ÷ 4a —

  • Term added and subtracted inside the parentheses, (b ÷ 2a)²—
  • Solution x₁ = h + √(−k ÷ a) (— if not real)—
  • Solution x₂ = h − √(−k ÷ a) (— if not real)—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Completing the Square Calculator

a (coefficient of x², not 0): enter a number. Prefilled example: 1.

b (coefficient of x): enter a number. Prefilled example: 6.

c (constant term): enter a number. Prefilled example: 5.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. a (coefficient of x², not 0): enter a number.
  2. b (coefficient of x): enter a number.
  3. c (constant term): enter a number.
  4. Read the result: h in a(x − h)² + k, h = −b ÷ 2a; the panel also shows Term added and subtracted inside the parentheses, (b ÷ 2a)², k in a(x − h)² + k, k = c − b² ÷ 4a, Solution x₁ = h + √(−k ÷ a) (— if not real) and Solution x₂ = h − √(−k ÷ a) (— if not real).

How this calculator works

Completing the square: factor a out of the x terms, a(x² + (b/a)x) + c, then add and subtract (b ÷ 2a)² inside the parentheses. The first three terms form the perfect square (x + b/2a)², which gives a(x − h)² + k with h = −b ÷ 2a and k = c − b² ÷ 4a.

(h, k) is the vertex of the parabola y = ax² + bx + c. Setting a(x − h)² + k = 0 gives (x − h)² = −k ÷ a, so x = h ± √(−k ÷ a); when −k ÷ a is negative the equation has no real solution (its roots are complex).

The formula

  1. H=−b2×a+0
Symbols used in the formula
SymbolMeaning
aa (coefficient of x², not 0)
bb (coefficient of x)
Hh in a(x − h)² + k, h = −b ÷ 2a

Worked example

a (coefficient of x², not 0)1
b (coefficient of x)6
c (constant term)5
Term added and subtracted inside the parentheses, (b ÷ 2a)²9
k in a(x − h)² + k, k = c − b² ÷ 4a-4
Solution x₁ = h + √(−k ÷ a) (— if not real)-1
Solution x₂ = h − √(−k ÷ a) (— if not real)-5
  1. H=−62×1+0=−3

h in a(x − h)² + k, h = −b ÷ 2a -3

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

How do you complete the square for x² + 6x + 5?

Half of 6 is 3 and 3² = 9: x² + 6x + 9 − 9 + 5 = (x + 3)² − 4. So h = −3, k = −4 and the solutions are x = −1 and x = −5.

What if a is not 1?

Factor a out first. 2x² − 8x + 3 = 2(x² − 4x) + 3 = 2(x − 2)² − 5, so h = 2 and k = −5.

Related calculators