Sub topic 10
Completing the Square When \(a\) Is Not 1
Prerequisites
Assume you can expand binomials, solve linear equations, work with fractions and square roots, and recognize a quadratic equation in standard form:
\[ ax^2+bx+c=0,\qquad a\ne0 \]
When \(a\) is not 1, first make the coefficient of \(x^2\) equal to 1. Then complete the square.
The General Process
For
\[ ax^2+bx+c=0 \]
use these steps:
- Divide every term by \(a\).
- Move the constant term to the other side.
- Add the square of half the coefficient of \(x\) to both sides.
- Rewrite the left side as a perfect square.
- Apply the square root method.
- Solve for \(x\).
After dividing by \(a\), the equation becomes
\[ x^2+\frac ba x+\frac ca=0 \]
Move the constant:
\[ x^2+\frac ba x=-\frac ca \]
The number to add is half of \(\frac ba\), squared:
\[ \left(\frac{b}{2a}\right)^2 \]
Therefore,
\[ x^2+\frac ba x+\left(\frac{b}{2a}\right)^2 = \left(\frac{b}{2a}\right)^2-\frac ca \]
The left side is
\[ \left(x+\frac{b}{2a}\right)^2 \]
Worked Example
Solve:
\[ 2x^2+8x-10=0 \]
The leading coefficient is \(a=2\). Divide every term by 2:
\[ x^2+4x-5=0 \]
Move the constant:
\[ x^2+4x=5 \]
Half of 4 is 2, and \(2^2=4\). Add 4 to both sides:
\[ x^2+4x+4=9 \]
Rewrite the left side:
\[ (x+2)^2=9 \]
Take both square roots:
\[ x+2=\pm3 \]
Solve the two resulting equations:
\[ x+2=3 \quad\Rightarrow\quad x=1 \]
\[ x+2=-3 \quad\Rightarrow\quad x=-5 \]
The solutions are \(x=1\) and \(x=-5\).
Common Errors
- Dividing only the \(x^2\) term instead of every term.
- Adding \(\frac{b}{2a}\) instead of \(\left(\frac{b}{2a}\right)^2\).
- Adding a value to one side but not the other.
- Forgetting the \(\pm\) when taking square roots.
- Losing a negative sign while moving the constant.
A quick check is to substitute each solution into the original equation:
\[ 2(1)^2+8(1)-10=0 \]
\[ 2(-5)^2+8(-5)-10=0 \]
Both values work.
import math
def solve_by_completing_square(a, b, c):
"""Return the real solutions of a*x^2 + b*x + c = 0."""
if a == 0:
raise ValueError("a must not be zero")
h = b / (2 * a)
rhs = h * h - c / a
if rhs < 0:
return ()
root = math.sqrt(rhs)
return tuple(sorted({-h - root, -h + root}))
print(solve_by_completing_square(2, 8, -10)) # (-5.0, 1.0)Exercise
Solve 3x² + 12x - 15 = 0 by completing the square.
Show answer
Divide by 3: x² + 4x - 5 = 0. Move the constant: x² + 4x = 5. Add 4: (x + 2)² = 9. Thus x = 1 or x = -5.