Sub topic 9
Completing the Square When a = 1
This chapter assumes you can expand binomials such as (x + 3)², solve linear equations, work with fractions, and use the square root method from the previous chapter. The square root method solves equations like (x + h)² = k. Completing the square rewrites any equation x² + bx + c = 0 into that form.
The core idea
Expanding a perfect square gives a pattern:
(x + h)² = x² + 2hx + h²
Compare it with the left side of x² + bx + c = 0. The x-term matches when 2h = b, so h = b/2. A perfect square also needs a constant term of h² = (b/2)². Usually the equation does not have that constant. Completing the square means adding it, and adding the same amount to both sides keeps the equation balanced.
The name comes from geometry. Picture a square with side x, plus two rectangles of size x by h attached to two of its sides. The area so far is x² + 2hx. A missing corner of size h by h would make the whole figure a larger square with side x + h. The missing corner has area h² = (b/2)².
The procedure
For an equation x² + bx + c = 0 with leading coefficient 1:
- Move the constant to the right side: x² + bx = −c.
- Take half of b, then square it. This gives (b/2)².
- Add (b/2)² to both sides.
- Factor the left side as (x + b/2)². Its sign matches the sign of b.
- Simplify the right side to a single number k.
- Apply the square root method: x + b/2 = ±√k, so x = −b/2 ± √k.
Worked example: an integer result
Solve x² + 6x + 5 = 0.
- Move the constant: x² + 6x = −5.
- Half of 6 is 3, and 3² = 9.
- Add 9 to both sides: x² + 6x + 9 = −5 + 9.
- Factor and simplify: (x + 3)² = 4.
- Take roots: x + 3 = 2 or x + 3 = −2.
- So x = −1 or x = −5.
Check x = −5: 25 − 30 + 5 = 0. Check x = −1: 1 − 6 + 5 = 0. Both work.
This equation also factors as (x + 1)(x + 5). Completing the square gives the same answer, but it also works when the equation does not factor over the integers.
Worked example: an odd b and irrational roots
Solve x² − 5x + 1 = 0.
- Move the constant: x² − 5x = −1.
- Half of −5 is −5/2, and (−5/2)² = 25/4.
- Add 25/4 to both sides: x² − 5x + 25/4 = −1 + 25/4.
- Factor the left side. The sign inside the parentheses follows b, which is negative: (x − 5/2)².
- Simplify the right side: −4/4 + 25/4 = 21/4. So (x − 5/2)² = 21/4.
- Take roots: x − 5/2 = ±√21/2.
- Solve: x = (5 ± √21)/2.
A quick check uses the sum and product of the roots. The sum is 5/2 + 5/2 = 5, which equals −b. The product is (25 − 21)/4 = 1, which equals c. Both match.
Keep the fractions exact. Switching to decimals early loses precision and makes the final check harder.
The three outcomes
The value k = (b/2)² − c decides everything.
| Value of k | Square root step | Result | Example |
|---|---|---|---|
| k > 0 | ±√k gives two different numbers | Two real roots | x² + 6x + 5 = 0 gives (x + 3)² = 4 |
| k = 0 | ±0 gives one number | One repeated root | x² + 2x + 1 = 0 gives (x + 1)² = 0, so x = −1 |
| k < 0 | A square cannot be negative | No real roots | x² − 4x + 7 = 0 gives (x − 2)² = −3 |
For the last row, the steps are x² − 4x = −7, then add 4 to get (x − 2)² = −3. No real number squared equals −3, so the equation has no real solutions. Write "no real solutions" and stop. Do not write a number for √(−3).
Doing it in code
The function below follows the steps exactly. It uses Fraction so that h = b/2 and k stay exact until the final square root.
from fractions import Fraction
import math
def complete_square_monic(b, c):
"""For x^2 + b*x + c = 0, return (h, k) with (x + h)^2 = k."""
h = Fraction(b) / 2
k = h * h - Fraction(c)
return h, k
def solve_monic(b, c):
"""Real solutions of x^2 + b*x + c = 0 as a sorted tuple."""
h, k = complete_square_monic(b, c)
if k < 0:
return ()
root = math.sqrt(k)
return tuple(sorted({-float(h) - root, -float(h) + root}))
print(complete_square_monic(6, 5)) # (Fraction(3, 1), Fraction(4, 1))
print(solve_monic(6, 5)) # (-5.0, -1.0)
print(solve_monic(2, 1)) # (-1.0,)
print(solve_monic(0, 4)) # ()
print([round(x, 4) for x in solve_monic(-5, 1)]) # [0.2087, 4.7913]The set {-h - root, -h + root} collapses to one value when k = 0. That is how the repeated root shows up as a single solution.
Common errors
| Error | What goes wrong | Fix |
|---|---|---|
| Adding (b/2)² to one side only | The new equation is not equivalent to the old one | Add the same number to both sides |
| Using b² or b instead of (b/2)² | The left side is not a perfect square | Halve first, then square |
| Wrong sign in (x + h)² | For x² − 6x the factor is (x − 3)², not (x + 3)² | The sign inside matches the sign of b |
| Skipping the "move c" step | The constant c gets mixed into the square | Isolate x² + bx on the left first |
| Keeping only the positive root | One solution is lost | Always write ±√k |
| Taking the square root of a negative k | There is no real answer | Report "no real solutions" |
| Forgetting to add back h at the end | x + h = ±√k is left unsolved for x | Subtract h: x = −h ± √k |
Edge cases
- b = 0. Then h = 0 and no completion is needed. The equation x² + c = 0 is already in square root form: x² = −c.
- Odd b. The number h is a fraction, such as 5/2. This is normal. Work with fractions rather than rounding.
- Equation not in standard form. For x² + 4x = 12, the constant is already on the right. Add 4 to both sides to get (x + 2)² = 16, so x = 2 or x = −6. For x² = 6x − 8, first rewrite as x² − 6x = −8.
- Leading coefficient not 1. This chapter covers only a = 1. If an equation has a ≠ 1, the next chapter divides through by a first.
Check your understanding
Exercise
Solve x² + 8x + 7 = 0 by completing the square. Show the number you add to both sides and the factored form.
Show answer
Move the constant: x² + 8x = −7. Half of 8 is 4, and 4² = 16. Add 16 to both sides: x² + 8x + 16 = 9, so (x + 4)² = 9. Then x + 4 = ±3, so x = −1 or x = −7. Check x = −1: 1 − 8 + 7 = 0. Check x = −7: 49 − 56 + 7 = 0.
Exercise
Solve x² − 3x − 1 = 0 by completing the square. Give exact answers.
Show answer
Move the constant: x² − 3x = 1. Half of −3 is −3/2, and (−3/2)² = 9/4. Add 9/4 to both sides: (x − 3/2)² = 1 + 9/4 = 13/4. Then x − 3/2 = ±√13/2, so x = (3 ± √13)/2. The sum of the roots is 3, which equals −b, and the product is (9 − 13)/4 = −1, which equals c.
Exercise
Without solving fully, decide how many real solutions x² + 10x + 30 = 0 has.
Show answer
Compute k = (b/2)² − c = 25 − 30 = −5. Since k is negative, (x + 5)² = −5 has no real solution, so the equation has no real roots.