Algebra

Completing the Square

Last updated: March 2026 · Intermediate
Before you start

You should be comfortable with:

Real-world applications
📐
Carpentry

Measurements, material estimation, cutting calculations

🌡️
HVAC

Refrigerant charging, airflow, system sizing

Completing the square is a technique that transforms any quadratic expression into a perfect square trinomial — an expression you can write as a single squared binomial. This lets you solve quadratic equations using the square root method (which you already know) and converts quadratics into vertex form, which reveals the highest or lowest point of the parabola.

Completing the square is also the method used to derive the quadratic formula, so understanding it gives you insight into where that formula comes from.

What Is a Perfect Square Trinomial?

A perfect square trinomial is a trinomial that factors as a binomial squared:

x2+6x+9=(x+3)2x^2 + 6x + 9 = (x + 3)^2

x210x+25=(x5)2x^2 - 10x + 25 = (x - 5)^2

Notice the pattern. In x2+bx+cx^2 + bx + c, the trinomial is a perfect square when cc equals (b2)2\left(\dfrac{b}{2}\right)^2:

  • x2+6x+?x^2 + 6x + \mathord{?}: half of 6 is 3, and 32=93^2 = 9. The missing term is 9.
  • x210x+?x^2 - 10x + \mathord{?}: half of 10-10 is 5-5, and (5)2=25(-5)^2 = 25. The missing term is 25.

The completing the square process adds exactly the right constant to create this pattern.

The Method: Step by Step

To solve ax2+bx+c=0ax^2 + bx + c = 0 by completing the square:

  1. Move the constant term to the right side of the equation.
  2. If a1a \neq 1, divide every term by aa so the leading coefficient is 1.
  3. Take half of the coefficient of xx and square it.
  4. Add that value to both sides of the equation.
  5. Factor the left side as a perfect square binomial.
  6. Solve using the square root method (±\pm).

Examples with Leading Coefficient 1

Example 1: x2+8x+7=0x^2 + 8x + 7 = 0

Step 1 — Move the constant to the right:

x2+8x=7x^2 + 8x = -7

Step 2 — Take half of 8 and square it:

(82)2=42=16\left(\frac{8}{2}\right)^2 = 4^2 = 16

Step 3 — Add 16 to both sides:

x2+8x+16=7+16x^2 + 8x + 16 = -7 + 16

x2+8x+16=9x^2 + 8x + 16 = 9

Step 4 — Factor the left side as a perfect square:

(x+4)2=9(x + 4)^2 = 9

Step 5 — Take the square root of both sides:

x+4=±3x + 4 = \pm 3

Step 6 — Solve both cases:

x=4+3=1orx=43=7x = -4 + 3 = -1 \quad \text{or} \quad x = -4 - 3 = -7

Check x=1x = -1: (1)2+8(1)+7=18+7=0(-1)^2 + 8(-1) + 7 = 1 - 8 + 7 = 0 . Correct.

Check x=7x = -7: (7)2+8(7)+7=4956+7=0(-7)^2 + 8(-7) + 7 = 49 - 56 + 7 = 0 . Correct.

Answer: x=1x = -1 or x=7x = -7

Example 2: x26x+2=0x^2 - 6x + 2 = 0

Step 1 — Move the constant:

x26x=2x^2 - 6x = -2

Step 2 — Half of 6-6 is 3-3; square it: (3)2=9(-3)^2 = 9.

Step 3 — Add 9 to both sides:

x26x+9=2+9=7x^2 - 6x + 9 = -2 + 9 = 7

Step 4 — Factor:

(x3)2=7(x - 3)^2 = 7

Step 5 — Square root:

x3=±7x - 3 = \pm\sqrt{7}

x=3±7x = 3 \pm \sqrt{7}

As decimals: x3+2.646=5.646x \approx 3 + 2.646 = 5.646 or x32.646=0.354x \approx 3 - 2.646 = 0.354.

Answer: x=3+7x = 3 + \sqrt{7} or x=37x = 3 - \sqrt{7}

Notice that this equation does not factor neatly — the solutions are irrational. Completing the square handles these cases perfectly.

Example 3: x2+5x6=0x^2 + 5x - 6 = 0

Step 1 — Move the constant:

x2+5x=6x^2 + 5x = 6

Step 2 — Half of 5 is 52\dfrac{5}{2}; square it: (52)2=254\left(\dfrac{5}{2}\right)^2 = \dfrac{25}{4}.

Step 3 — Add 254\dfrac{25}{4} to both sides:

x2+5x+254=6+254=244+254=494x^2 + 5x + \frac{25}{4} = 6 + \frac{25}{4} = \frac{24}{4} + \frac{25}{4} = \frac{49}{4}

Step 4 — Factor:

(x+52)2=494\left(x + \frac{5}{2}\right)^2 = \frac{49}{4}

Step 5 — Square root:

x+52=±72x + \frac{5}{2} = \pm\frac{7}{2}

Step 6 — Solve:

x=52+72=22=1x = -\frac{5}{2} + \frac{7}{2} = \frac{2}{2} = 1

x=5272=122=6x = -\frac{5}{2} - \frac{7}{2} = \frac{-12}{2} = -6

Answer: x=1x = 1 or x=6x = -6

Odd coefficients of xx produce fractions — that is normal and expected.

Examples with Leading Coefficient Other Than 1

Example 4: 2x2+12x+10=02x^2 + 12x + 10 = 0

Step 1 — Divide every term by 2:

x2+6x+5=0x^2 + 6x + 5 = 0

Step 2 — Move the constant:

x2+6x=5x^2 + 6x = -5

Step 3 — Half of 6 is 3; 32=93^2 = 9. Add 9 to both sides:

x2+6x+9=5+9=4x^2 + 6x + 9 = -5 + 9 = 4

Step 4 — Factor:

(x+3)2=4(x + 3)^2 = 4

Step 5 — Solve:

x+3=±2x + 3 = \pm 2

x=3+2=1orx=32=5x = -3 + 2 = -1 \quad \text{or} \quad x = -3 - 2 = -5

Answer: x=1x = -1 or x=5x = -5

Example 5: 3x218x+6=03x^2 - 18x + 6 = 0

Step 1 — Divide by 3:

x26x+2=0x^2 - 6x + 2 = 0

This is the same as Example 2 above: x=3±7x = 3 \pm \sqrt{7}.

Converting to Vertex Form

Completing the square also converts the standard form y=ax2+bx+cy = ax^2 + bx + c into vertex form y=a(xh)2+ky = a(x - h)^2 + k, where (h,k)(h, k) is the vertex (the turning point) of the parabola. This is useful for graphing.

Example 6: Convert y=x24x+7y = x^2 - 4x + 7 to vertex form

Step 1 — Group the xx terms:

y=(x24x)+7y = (x^2 - 4x) + 7

Step 2 — Complete the square inside the parentheses. Half of 4-4 is 2-2; (2)2=4(-2)^2 = 4. Add and subtract 4:

y=(x24x+44)+7y = (x^2 - 4x + 4 - 4) + 7

y=(x24x+4)4+7y = (x^2 - 4x + 4) - 4 + 7

Step 3 — Factor the perfect square trinomial:

y=(x2)2+3y = (x - 2)^2 + 3

Answer: Vertex form is y=(x2)2+3y = (x - 2)^2 + 3. The vertex is at (2,3)(2, 3), and since the coefficient of the squared term is positive, the parabola opens upward. The minimum value of yy is 3.

Real-World Application: HVAC — Optimizing Duct Airflow

An HVAC technician is sizing a rectangular duct where the perimeter of the cross-section must be 40 inches (a constraint based on the available chase space). The technician wants to maximize the cross-sectional area to achieve the best airflow.

Let ww = width. Since the perimeter is 2w+2h=402w + 2h = 40, the height is h=20wh = 20 - w.

The area is:

A=w(20w)=20ww2=w2+20wA = w(20 - w) = 20w - w^2 = -w^2 + 20w

To find the maximum, convert to vertex form by completing the square:

A=(w220w)A = -(w^2 - 20w)

Half of 20-20 is 10-10; (10)2=100(-10)^2 = 100. Add and subtract 100 inside:

A=(w220w+100100)=(w220w+100)+100A = -(w^2 - 20w + 100 - 100) = -(w^2 - 20w + 100) + 100

A=(w10)2+100A = -(w - 10)^2 + 100

The vertex is at (10,100)(10, 100). Maximum area is 100 square inches, achieved when w=10w = 10 inches (making h=10h = 10 inches too — a square duct).

Answer: The technician should specify a 10-inch by 10-inch duct opening. This gives 100 square inches of cross-sectional area, the maximum possible for a 40-inch perimeter. A square cross-section always maximizes area for a given perimeter — a useful principle HVAC techs apply regularly.

A Carpentry Application: Maximizing a Garden Border

A carpenter is building a rectangular raised garden bed against a wall. The homeowner has 24 feet of border material for the three open sides (the wall serves as the fourth side). What dimensions maximize the planting area?

Let ww = the side perpendicular to the wall. The border uses 2w2w for the two sides and 242w24 - 2w for the front.

A=w(242w)=24w2w2=2(w212w)A = w(24 - 2w) = 24w - 2w^2 = -2(w^2 - 12w)

Complete the square: half of 12-12 is 6-6; (6)2=36(-6)^2 = 36.

A=2(w212w+3636)=2(w6)2+72A = -2(w^2 - 12w + 36 - 36) = -2(w - 6)^2 + 72

Maximum area is 72 square feet when w=6w = 6 feet. The front length is 242(6)=1224 - 2(6) = 12 feet.

Answer: The bed should be 6 feet deep by 12 feet wide, yielding 72 square feet of planting area.

Common Mistakes to Avoid

  1. Forgetting to add to both sides. When you add (b2)2\left(\dfrac{b}{2}\right)^2 to complete the square, you must add it to both sides of the equation (or add and subtract on the same side if converting to vertex form). Missing this changes the equation entirely.

  2. Not dividing by the leading coefficient first. Completing the square requires the x2x^2 coefficient to be 1. If it is not, divide everything by that coefficient before proceeding.

  3. Sign errors with half the coefficient. If the coefficient of xx is 6-6, then half is 3-3 and the square is +9+9 (positive). The squared result is always positive regardless of the sign of bb.

  4. Forgetting the ±\pm when taking the square root. Just as with the square root method, you need both the positive and negative root.

  5. Arithmetic errors with fractions. When bb is odd (like 5), you get fractions (254\frac{25}{4}). Work carefully and convert constants to the same denominator before adding.

Practice Problems

Test your understanding with these problems. Click to reveal each answer.

Problem 1: Solve x2+10x+21=0x^2 + 10x + 21 = 0 by completing the square

Move constant: x2+10x=21x^2 + 10x = -21

Half of 10 is 5; 52=255^2 = 25. Add to both sides:

x2+10x+25=4x^2 + 10x + 25 = 4

(x+5)2=4(x + 5)^2 = 4

x+5=±2x + 5 = \pm 2

x=3orx=7x = -3 \quad \text{or} \quad x = -7

Answer: x=3x = -3 or x=7x = -7

Problem 2: Solve x22x5=0x^2 - 2x - 5 = 0 by completing the square

Move constant: x22x=5x^2 - 2x = 5

Half of 2-2 is 1-1; (1)2=1(-1)^2 = 1. Add to both sides:

x22x+1=6x^2 - 2x + 1 = 6

(x1)2=6(x - 1)^2 = 6

x=1±6x = 1 \pm \sqrt{6}

Answer: x=1+63.449x = 1 + \sqrt{6} \approx 3.449 or x=161.449x = 1 - \sqrt{6} \approx -1.449

Problem 3: Solve 2x2+8x10=02x^2 + 8x - 10 = 0 by completing the square

Divide by 2: x2+4x5=0x^2 + 4x - 5 = 0

Move constant: x2+4x=5x^2 + 4x = 5

Half of 4 is 2; 22=42^2 = 4. Add to both sides:

x2+4x+4=9x^2 + 4x + 4 = 9

(x+2)2=9(x + 2)^2 = 9

x+2=±3x + 2 = \pm 3

x=1orx=5x = 1 \quad \text{or} \quad x = -5

Answer: x=1x = 1 or x=5x = -5

Problem 4: Convert y=x2+6x+2y = x^2 + 6x + 2 to vertex form

y=(x2+6x)+2y = (x^2 + 6x) + 2

Half of 6 is 3; 32=93^2 = 9. Add and subtract:

y=(x2+6x+9)9+2=(x+3)27y = (x^2 + 6x + 9) - 9 + 2 = (x + 3)^2 - 7

Answer: y=(x+3)27y = (x + 3)^2 - 7. Vertex: (3,7)(-3, -7).

Problem 5: Solve x2+3x2=0x^2 + 3x - 2 = 0 by completing the square

Move constant: x2+3x=2x^2 + 3x = 2

Half of 3 is 32\frac{3}{2}; (32)2=94\left(\frac{3}{2}\right)^2 = \frac{9}{4}. Add to both sides:

x2+3x+94=2+94=84+94=174x^2 + 3x + \frac{9}{4} = 2 + \frac{9}{4} = \frac{8}{4} + \frac{9}{4} = \frac{17}{4}

(x+32)2=174\left(x + \frac{3}{2}\right)^2 = \frac{17}{4}

x+32=±172x + \frac{3}{2} = \pm\frac{\sqrt{17}}{2}

x=3±172x = \frac{-3 \pm \sqrt{17}}{2}

Answer: x=3+1720.56x = \dfrac{-3 + \sqrt{17}}{2} \approx 0.56 or x=31723.56x = \dfrac{-3 - \sqrt{17}}{2} \approx -3.56

Problem 6: An HVAC technician has 60 inches of sheet metal to form the perimeter of a rectangular duct cross-section. What dimensions maximize the cross-sectional area?

Let ww = width. Then height =30w= 30 - w.

A=w(30w)=w2+30w=(w230w)A = w(30 - w) = -w^2 + 30w = -(w^2 - 30w)

Complete the square: half of 30-30 is 15-15; (15)2=225(-15)^2 = 225.

A=(w230w+225225)=(w15)2+225A = -(w^2 - 30w + 225 - 225) = -(w - 15)^2 + 225

Maximum area is 225 square inches when w=15w = 15 inches (height also 15 inches).

Answer: A 15-inch by 15-inch square duct gives the maximum area of 225 square inches.

Key Takeaways

  • Completing the square transforms x2+bxx^2 + bx into a perfect square by adding (b2)2\left(\dfrac{b}{2}\right)^2
  • The leading coefficient must be 1 — divide everything by aa first if it is not
  • Whatever you add to one side of the equation, add to the other side too
  • This method works on every quadratic equation, including ones that do not factor over the integers
  • Completing the square also converts standard form to vertex form y=a(xh)2+ky = a(x - h)^2 + k, revealing the vertex of the parabola
  • Vertex form is essential for optimization problems — the vertex gives the maximum or minimum value

Return to Algebra 1 for more topics in this section.

Last updated: March 29, 2026