Progress can't be saved in this browser, so this lesson's status can't be set.
Learning goals
Add the square of half the linear coefficient
Rewrite a quadratic in completed-square form
Keep both signs when taking a square root of both sides
Sort the roots by the sign of the number under the square root
Divide by a first when the leading coefficient is not one
The constant that completes a square
Take x2+6x. What constant turns it into a perfect square? The picture below shows the answer. The two
terms tile an L-shape for x>0: a square of area x2 and two strips whose areas together make 6x. That L is
missing one corner, and the corner that fills it is 3 by 3, area 9, because each strip already has
length 3. Adding that 9 completes the figure into a full square of side x+3:
x2+6x+9=(x+3)2. Completing the square, seen as area. The piece of area x squared and the two strips of area 3x each tile an L-shape. Adding the 3-by-3 corner of area 9 fills the notch, making a full square of side x + 3, so x squared plus 6x plus 9 equals (x + 3) squared.
The picture uses positive side lengths. The algebraic identity also works for negative values of x
or a negative middle coefficient, even though those do not represent lengths in this drawing.
You already know from the squares-of-binomials lesson that squaring a sum produces a three-term pattern:
(x+p)2=x2+2px+p2.
Read this from right to left. Compare x2+6x with x2+2px+p2: the middle terms agree when
2p=6, so p=3, and the last term must be p2=9, exactly the corner you just added. The same
matching works for any linear coefficient b in place of 6. Compare x2+bx with x2+2px+p2:
the middle terms agree when 2p=b, so p=2b, and the constant that completes the square is
p2=(2b)2, the square of half the linear coefficient.
Check by expansion: the middle term of (x+2b)2 is
2⋅2b⋅x=bx, and the last term is (2b)2.
So the recipe for the missing constant is short: take the coefficient of x, halve it, and square the
result. For x2+10x the half is 5 and the constant is 25, giving x2+10x+25=(x+5)2. For
x2−6x the half is −3 and the constant is 9, giving x2−6x+9=(x−3)2. The sign inside the
binomial follows the sign of b, because p=2b carries that sign along.
Check your understanding
What constant must you add to x2+12x to complete the square?
Halve the coefficient of x, then square the result. Here b=12, so half of it is 6.
(212)2=62=36
Adding 36 gives x2+12x+36=(x+6)2. Adding 6 (the half) or 144 (b2) does not build a square.
Rewriting a quadratic in completed-square form
Worked example 1Rewrite x2+8x+3 in completed-square form
The linear coefficient is b=8, so half of it is 4 and the constant that completes the square is
42=16. Add and subtract that 16:
x2+8x+3=(x2+8x+16)−16+3.
The parenthesized trinomial is a perfect square, (x+4)2, and the loose constants combine
to −16+3=−13:
x2+8x+3=(x+4)2−13.
A quick check expands it back: (x+4)2−13=x2+8x+16−13=x2+8x+3, the original. The
constant dropped from 3 to −13 precisely because 16 was borrowed to build the square.
The example adds and subtracts the same number, so the expression keeps its value. In general,
x2+bx+c needs (2b)2 to build the square. Add that number and subtract it again:
x2+bx+c=perfect squarex2+bx+(2b)2−(2b)2+c.
The braced terms form (x+2b)2. The remaining constants stay outside:
x2+bx+c=(x+2b)2+(c−(2b)2).
This is the completed-square form. It says the same thing as the original quadratic, but now x
appears only once, inside the square. Written more generally, every quadratic with leading coefficient
1 can be put in the shape (x−h)2+k for some constants h and k. This is a form we will lean
on again later.
Check your understanding
Rewrite x2−10x+18 in completed-square form.
Half of b=−10 is −5, and the constant that completes the square is (−5)2=25. Add and subtract it.
x2−10x+18=(x2−10x+25)−25+18=(x−5)2−7
A quick check expands it back: (x−5)2−7=x2−10x+25−7=x2−10x+18, the original.
Solving a quadratic by completing the square
Worked example 2Solve x2−6x+4=0
No whole-number factor pair works here. Completing the square gives the roots without that search. Move the constant across:
x2−6x=−4.
Here b=−6, so 2b=−3 and (2b)2=9. Add 9 to both sides:
x2−6x+9=−4+9=5.
The left side is the perfect square (x−3)2, so take the square root of both sides, keeping both
signs:
(x−3)2=5⇒x−3=±5.
Add 3 to finish:
x=3±5.
The two solutions are x=3+5 and x=3−5, both real and
irrational, so a search for integer factors could not have found them.
The example uses four steps. For x2+bx+c=0 with real b,c, the same steps give a general result.
First move the constant to the right side, so the left holds only the x terms:
x2+bx=−c.
Next add (2b)2 to both sides. Adding it to just the left would change the
equation; adding it to both sides keeps the balance while turning the left into a perfect square:
x2+bx+(2b)2=(2b)2−c.
The left side is now (x+2b)2. Take the square root of both sides, and here is the
step people forget. A positive number is the square of two different numbers, one positive and one
negative, so both must be kept. That is where the ± sign comes from:
x+2b=±(2b)2−c.
Finally subtract 2b to isolate x, which gives the general result
x=−2b±(2b)2−c.
You do not need to memorize this result: use the four steps with the numbers in your equation.
The sign of the number under the square root tells you what kind of answer you get, as the section below shows.
When b is odd, half of it is a fraction, and (2b)2 becomes a fraction with 4 in
the denominator. The method is the same; you just carry the fractions carefully.
Worked example 3Solve x2+3x+1=0 (an odd middle coefficient)
Move the constant across, then halve the odd coefficient b=3:
x2+3x=−1,2b=23,(23)2=49.
Add 49 to both sides. On the right, write −1 as −44 so the fractions combine:
x2+3x+49=−1+49=−44+49=45.
The left side is (x+23)2. Take the square root of both sides, remembering that
45=25 since the denominator 4 is a perfect square:
(x+23)2=45⇒x+23=±25.
Subtract 23 and combine over the common denominator 2:
x=−23±25=2−3±5.
The single fraction 2−3±5 holds both roots at once, which is the standard way to
write them.
Check your understanding
Solve x2+4x+1=0 by completing the square.
Move the constant across, then add (24)2=4 to both sides.
x2+4x+4=−1+4=3
The left side is (x+2)2, so x+2=±3 and x=−2±3. The half of b is 2, giving x+2, so the solution centers on −2, not 2 or −4.
Real, repeated, and complex roots
With real coefficients, completing the square gives
(x+2b)2=R,where R=(2b)2−c.
The sign of R tells us which kind of square root to use.
If R>0, its square root is a nonzero real number, so the ± produces two different real
solutions, as in x=3±5 above.
If R=0, its square root is 0, and ±0 is just 0, so the two solutions collapse into one
repeated solutionx=−2b. For instance x2−8x+16=0 becomes (x−4)2=0, whose
only root is x=4, met twice.
If R<0, there is no real solution, since a real square cannot be negative. To describe the
complex solutions, introduce the imaginary uniti, a number satisfying i2=−1. The usual
rules for multiplying and squaring products still apply, so both 2i and −2i square to −4:
(2i)2=4i2=−4,(−2i)2=4i2=−4.
More generally, for a positive real number k,
(ik)2=i2k=−k,(−ik)2=−k.
We write −k=ik by convention and keep both signs when solving y2=−k.
Thus a negative R gives
x=−2b±i−R. A real number plus a real multiple of i is a complex number.
In −1+2i, −1 is the real part and 2, the coefficient of i, is the imaginary part.
The two answers form a conjugate pair: their real parts match, and their imaginary parts
have opposite signs. These facts are all we need here. The chapter’s first two lessons, Imaginary
Numbers and Arithmetic with Complex Numbers (both Advanced), explore them further.
Worked example 4Solve x2+2x+5=0 (complex roots)
Move the constant across and add (22)2=1 to both sides:
x2+2x=−5,x2+2x+1=−5+1=−4.
The left side is (x+1)2, and the right side is negative, which is the signal that the roots are
complex:
(x+1)2=−4⇒x+1=±−4.
Use the negative-root convention just stated:
−4=i4=2i. Then
x+1=±2i⇒x=−1±2i.
The solutions are x=−1+2i and x=−1−2i, a conjugate pair. Both work because x+1=±2i
and (±2i)2=−4. We can also check the first in the original equation by expanding:
Allowing complex numbers lets the method finish when R<0. Every quadratic with real coefficients
has roots in the complex number system: either two real roots (possibly equal) or a nonreal
conjugate pair.
Check your understanding
Solve x2−2x+10=0 by completing the square.
Move the constant across and add (2−2)2=1 to both sides.
x2−2x+1=−10+1=−9
The left side is (x−1)2=−9, so x−1=±−9=±3i and x=1±3i. The right side is negative, so the roots are complex, not the real 1±3; and −9=3i, not 9i.
When the leading coefficient is not 1
In a quadratic ax2+bx+c=0, a=0, so dividing every term by a preserves the solutions
and leaves the right side equal to 0. When a=1, do this first to make the coefficient of
x2 equal to 1, so our pattern applies. Use the new coefficient of x when deciding what to
halve and square.
Worked example 5Solve 2x2+8x−10=0 and 3x2+6x+9=0
For 2x2+8x−10=0, divide every term by the leading coefficient 2 to make the x2 term stand
alone:
22x2+28x−210=0⇒x2+4x−5=0.
Now complete the square. Move the constant across and add (24)2=4 to both sides:
x2+4x+4=5+4=9⇒(x+2)2=9.
Take the root of both sides, x+2=±3, so x=1 or x=−5, two real solutions.
For 3x2+6x+9=0, divide through by 3 first:
x2+2x+3=0.
Add (22)2=1 to both sides after moving the constant over:
x2+2x+1=−3+1=−2⇒(x+1)2=−2.
The right side is negative, so the roots are complex. Since −2=i2,
x+1=±i2⇒x=−1±i2.
Check your understanding
Solve 2x2+4x+10=0 by completing the square.
Divide the whole equation by the leading coefficient 2 first: x2+2x+5=0. Move the constant across and add (22)2=1 to both sides.
x2+2x+1=−5+1=−4
The left side is (x+1)2=−4, so x+1=±−4=±2i and x=−1±2i. The option x=−2±4i simply doubles both parts of the correct answer; substituting x=−2+4i into the original equation gives −22−16i, not 0; the minus-sign candidate gives −22+16i. Neither is a solution.
Running these same steps on the fully general quadratic ax2+bx+c=0, with letters in place of
numbers, produces a single formula for the roots. That is the subject of the next lesson; completing the
square is the derivation behind it.
Common mistakes
Practice
Multiple Choice Questions (MCQ)
Progressively harder sets of questions. Each opens on its own page.
Practice problems at the level of the course, to be worked out on paper. Hints one at a
time, then the answer or the full worked solution, with your progress kept in this browser.
Completing the square was once a geometric instruction. In ninth-century Baghdad, al-Khwarizmi
explained equations in words and justified his methods with drawings. One example was what we
write as x2+10x=39.
His rule halves 10 to get 5, squares it to get 25, and adds that to 39. The new square has
area 64 and side 8, so subtracting 5 gives x=3. A geometric proof surrounds the original
square with strips and fills the missing corners. The same added area, 25, completes the square.
Our two-strip drawing uses the same idea with a different arrangement of pieces.
The drawing explains why adding a constant works, but it also limits what counts as an answer:
a side length must be positive. Modern algebra gives (x+5)2=64, so x+5=±8 and
x=3 or x=−13. The negative answer satisfies the equation, yet cannot be a side in that drawing.