Completing the Square Calculator

Rewrite ax² + bx + c as a completed square and see its vertex.

The coefficient of x², not 0.

The coefficient of x.

The constant term.

Try

Result

You entered1x2+−4x+41x^2 + -4x + 4

(x−2)2\displaystyle (x - 2)^2

Vertex

(2,0)\displaystyle \left(2, 0\right)

Roots

x=2(doubleroot)\displaystyle x = 2 (double root)
Show the work
  1. Vertex form of a quadratic

    Completing the square rewrites the quadratic so that the vertex (h,k)(h, k) can be read off. Here a=1a = 1, b=−4b = -4 and c=4c = 4.

    Using ax2+bx+c=a(x−h)2+kax^2 + bx + c = a\left(x - h\right)^2 + k

  2. x-coordinate of the vertex

    Expanding a(x−h)2a(x - h)^2 gives an xx term of −2ah-2ah, which must equal bb; solving for hh gives the vertex position.

    h=−b2a=−(−4)2×1=−(−4)2=2\begin{aligned} h &= -\frac{b}{2a} \\ &= -\frac{\left(-4\right)}{2 \times 1} \\ &= -\frac{\left(-4\right)}{2} \\ &= 2 \end{aligned}
  3. y-coordinate of the vertex

    Expanding a(x−h)2+ka(x - h)^2 + k gives a constant of ah2+kah^2 + k, which must equal cc; solving for kk gives the height of the vertex. Here h=2h = 2.

    k=c−ah2=4−1×22=4−4=0\begin{aligned} k &= c - ah^2 \\ &= 4 - 1 \times 2^2 \\ &= 4 - 4 \\ &= 0 \end{aligned}
  4. Write in vertex form

    Put a=1a = 1, h=2h = 2 and k=0k = 0 into the vertex form. Subtracting a negative hh adds, so the bracket reads (x+∣h∣)(x + |h|), and a kk of 0 is left out.

    Using a(x−h)2+ka\left(x - h\right)^2 + k

    1(x−2)2+0=(x−2)21\left(x - 2\right)^2 + 0 = \left(x - 2\right)^2
  5. Result

    So the quadratic is (x−2)2\left(x - 2\right)^2, with its vertex at (2,0)\left(2, 0\right).

Worked examples