Completing the Square for Quadratic Expressions

Step-by-step guide with 6 worked examples and 4 practice problems

Overview

Completing the square is an algebraic technique that rewrites a quadratic expression \( ax^2 + bx + c \) into vertex form \( a(x - h)^2 + k \). It is used to find the vertex of a parabola, solve quadratic equations (it is the method behind the quadratic formula), and prepare certain expressions for integration in calculus.

The Two Key Formulas

The simplest case uses the identity obtained by halving the middle coefficient, squaring it, and adding/subtracting it:

\[ x^2 + bx = \left(x + \frac{b}{2}\right)^2 - \left(\frac{b}{2}\right)^2 \]

For the general quadratic \( ax^2 + bx + c \) with \( a \ne 0 \), factor out \( a \) from the \(x\)-terms, then complete the square inside the parentheses:

\[ ax^2 + bx + c = a\left(x + \frac{b}{2a}\right)^2 + \left(c - \frac{b^2}{4a}\right) \]
Comparing the two completing-the-square forms
Case Formula
Simple: \(x^2 + bx\) \( x^2 + bx = \left(x + \tfrac{b}{2}\right)^2 - \tfrac{b^2}{4} \)
General: \(ax^2 + bx + c\) \( ax^2 + bx + c = a\left(x + \tfrac{b}{2a}\right)^2 + \left(c - \tfrac{b^2}{4a}\right) \)

Vertex form. The general form above is exactly the vertex form \( a(x - h)^2 + k \) with \( h = -b/(2a) \) and \( k = c - b^2/(4a) \). The vertex of the parabola \( y = ax^2 + bx + c \) is at \( (h, k) = \left(-b/(2a),\, c - b^2/(4a)\right) \).


Step-by-Step Examples

Example 1 — Simple case: \(x^2 + 4x\)

Show solution

Step 1. The coefficient of \(x\) is \(b = 4\). Half of \(b\) is \(2\), and \(2^2 = 4\).

Step 2. Add and subtract \(4\):

\[ \begin{aligned} x^2 + 4x &= \left(x + \frac{4}{2}\right)^2 - \left(\frac{4}{2}\right)^2 \\ &= (x + 2)^2 - 4 \end{aligned} \]

Check: \((x + 2)^2 - 4 = x^2 + 4x + 4 - 4 = x^2 + 4x\) ✓

Example 2 — With a constant term: \(x^2 + 2x + 5\)

Show solution

Step 1. Focus on \(x^2 + 2x\). Here \(b = 2\), half is \(1\), and \(1^2 = 1\).

Step 2. Complete the square on \(x^2 + 2x\), keep the \(+5\) outside:

\[ \begin{aligned} x^2 + 2x + 5 &= \left[\left(x + \frac{2}{2}\right)^2 - \left(\frac{2}{2}\right)^2\right] + 5 \\ &= (x + 1)^2 - 1 + 5 \\ &= (x + 1)^2 + 4 \end{aligned} \]

Vertex: \((-1,\, 4)\).

Example 3 — Leading coefficient \(a > 1\): \(2x^2 - 12x\)

Show solution

Step 1. Factor \(2\) out of the \(x\)-terms:

\[ 2x^2 - 12x = 2(x^2 - 6x) \]

Step 2. Complete the square inside the parentheses. Here \(b = -6\), half is \(-3\), and \((-3)^2 = 9\):

\[ \begin{aligned} 2x^2 - 12x &= 2\left[\left(x - 3\right)^2 - 9\right] \\ &= 2(x - 3)^2 - 18 \end{aligned} \]

Vertex: \((3,\, -18)\).

Example 4 — Leading coefficient \(a = -1\): \(-x^2 - 10x\)

Show solution

Step 1. Factor \(-1\) out of the \(x\)-terms:

\[ -x^2 - 10x = -(x^2 + 10x) \]

Step 2. Complete the square inside. Here \(b = 10\), half is \(5\), and \(5^2 = 25\):

\[ \begin{aligned} -x^2 - 10x &= -\left[(x + 5)^2 - 25\right] \\ &= -(x + 5)^2 + 25 \end{aligned} \]

Vertex: \((-5,\, 25)\).

Example 5 — Fractional coefficients, \(a < -1\): \(-2x^2 - 3x\)

Show solution

Step 1. Factor \(-2\) out of the \(x\)-terms:

\[ -2x^2 - 3x = -2\left(x^2 + \tfrac{3}{2}x\right) \]

Step 2. Complete the square inside. Here \(b = 3/2\), half is \(3/4\), and \((3/4)^2 = 9/16\):

\[ \begin{aligned} -2x^2 - 3x &= -2\left[\left(x + \tfrac{3}{4}\right)^2 - \tfrac{9}{16}\right] \\ &= -2\left(x + \tfrac{3}{4}\right)^2 + 2 \cdot \tfrac{9}{16} \\ &= -2\left(x + \tfrac{3}{4}\right)^2 + \tfrac{9}{8} \end{aligned} \]

Vertex: \(\left(-\tfrac{3}{4},\, \tfrac{9}{8}\right)\).

Example 6 — Full quadratic, \(a \ne 1\): \(-3x^2 + 2x + 2\)

Show solution

Step 1. Factor \(-3\) out of the \(x\)-terms, keep \(+2\) outside:

\[ -3x^2 + 2x + 2 = -3\left(x^2 - \tfrac{2}{3}x\right) + 2 \]

Step 2. Complete the square inside. Here \(b = -2/3\), half is \(-1/3\), and \((-1/3)^2 = 1/9\):

\[ \begin{aligned} -3x^2 + 2x + 2 &= -3\left[\left(x - \tfrac{1}{3}\right)^2 - \tfrac{1}{9}\right] + 2 \\ &= -3\left(x - \tfrac{1}{3}\right)^2 + 3 \cdot \tfrac{1}{9} + 2 \\ &= -3\left(x - \tfrac{1}{3}\right)^2 + \tfrac{1}{3} + 2 \\ &= -3\left(x - \tfrac{1}{3}\right)^2 + \tfrac{7}{3} \end{aligned} \]

Vertex: \(\left(\tfrac{1}{3},\, \tfrac{7}{3}\right)\).


Practice Exercises

Try completing the square on each expression, then check your work.

  1. Practice 1. \(x^2 - 6x + 2\)
    Show solution

    Here \(b = -6\), half is \(-3\), square is \(9\).

    \[ \begin{aligned} x^2 - 6x + 2 &= (x - 3)^2 - 9 + 2 \\ &= (x - 3)^2 - 7 \end{aligned} \]
  2. Practice 2. \(x^2 + 6x - 3\)
    Show solution

    Here \(b = 6\), half is \(3\), square is \(9\).

    \[ \begin{aligned} x^2 + 6x - 3 &= (x + 3)^2 - 9 - 3 \\ &= (x + 3)^2 - 12 \end{aligned} \]
  3. Practice 3. \(-x^2 - 4x + 2\)
    Show solution
    \[ \begin{aligned} -x^2 - 4x + 2 &= -(x^2 + 4x) + 2 \\ &= -\left[(x + 2)^2 - 4\right] + 2 \\ &= -(x + 2)^2 + 6 \end{aligned} \]
  4. Practice 4. \(-2x^2 - 5x - 5\)
    Show solution
    \[ \begin{aligned} -2x^2 - 5x - 5 &= -2\left(x^2 + \tfrac{5}{2}x\right) - 5 \\ &= -2\left[\left(x + \tfrac{5}{4}\right)^2 - \tfrac{25}{16}\right] - 5 \\ &= -2\left(x + \tfrac{5}{4}\right)^2 + \tfrac{25}{8} - \tfrac{40}{8} \\ &= -2\left(x + \tfrac{5}{4}\right)^2 - \tfrac{15}{8} \end{aligned} \]

Connection to the Quadratic Formula

Completing the square on the general equation \(ax^2 + bx + c = 0\) is exactly how the quadratic formula is derived:

  1. Divide by \(a\): \(x^2 + \dfrac{b}{a}x + \dfrac{c}{a} = 0\).
  2. Move the constant: \(x^2 + \dfrac{b}{a}x = -\dfrac{c}{a}\).
  3. Complete the square on the left: \(\left(x + \dfrac{b}{2a}\right)^2 = \dfrac{b^2 - 4ac}{4a^2}\).
  4. Take square roots: \(x + \dfrac{b}{2a} = \pm\dfrac{\sqrt{b^2 - 4ac}}{2a}\).
  5. Isolate \(x\): \(x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}\).

Frequently Asked Questions

What is completing the square?

An algebraic technique that rewrites a quadratic \(ax^2 + bx + c\) into vertex form \(a(x - h)^2 + k\) by adding and subtracting the square of half the coefficient of \(x\).

What is the formula for completing the square?

Simple case: \(x^2 + bx = (x + b/2)^2 - (b/2)^2\). General case: \(ax^2 + bx + c = a(x + b/(2a))^2 + (c - b^2/(4a))\).

How do you complete the square when the leading coefficient isn't 1?

First factor \(a\) out of the \(x^2\) and \(x\) terms: \(ax^2 + bx + c = a(x^2 + (b/a)x) + c\). Then complete the square inside the parentheses using \(b/a\) as the new middle coefficient, and distribute the outer factor \(a\) back through the perfect square and the subtracted constant.

How is completing the square used to derive the quadratic formula?

Starting from \(ax^2 + bx + c = 0\) and dividing by \(a\), completing the square on the left gives \((x + b/(2a))^2 = (b^2 - 4ac)/(4a^2)\). Taking square roots and isolating \(x\) yields the quadratic formula.

More Links and Resources on Quadratic Functions

Last updated: October 20, 2026