Solving by completing the square

Not every quadratic equation factorises nicely with whole numbers. Try x2−4x+1=0x^2 - 4x + 1 = 0: no pair of integers multiplies to 11 and adds to −4-4, so the cross-multiplication method that worked so well for x2+6x−7=0x^2+6x-7=0 stalls completely. Completing the square is the technique that never stalls — it rewrites any quadratic ax2+bx+c=0ax^2+bx+c=0 as a perfect square equal to a constant, (x+k)2=m(x+k)^2=m, which is then solved by the one operation a perfect square invites: taking a square root. The method matters for a second reason too. Push through the same steps on the general equation ax2+bx+c=0ax^2+bx+c=0, keeping letters instead of numbers, and out falls the quadratic formula itself. Completing the square is not a rival to the formula you will meet next — it is the derivation behind it, the reason −b2a-\dfrac{b}{2a} and b2−4ac\sqrt{b^2-4ac} appear exactly where they do. This article builds on factorisation, the first solving technique in the same chapter, and leads directly into the quadratic formula, the third and final technique. Between them, the three methods give a complete toolkit: try factorisation first for speed, fall back to completing the square (or the formula it produces) whenever factors are not obvious.

The core insight

Adding (b2a)2\left(\dfrac{b}{2a}\right)^2 to both sides of x2+bax=−cax^2+\dfrac{b}{a}x=-\dfrac{c}{a} turns the left side into a perfect square (x+b2a)2\left(x+\dfrac{b}{2a}\right)^2, so the equation can be solved by taking square roots.

The core idea

A perfect square trinomial such as x2+6x+9x^2+6x+9 factors as (x+3)2(x+3)^2 because its constant term, 99, is the square of half the coefficient of xx — here, (62)2=9\left(\frac{6}{2}\right)^2=9. This pattern always holds: expanding (x+p)2(x+p)^2 gives x2+2px+p2x^2+2px+p^2, so the constant term is always the square of half the middle coefficient. Completing the square exploits this pattern in reverse: given x2+6xx^2+6x, add the missing constant 99 to make it a perfect square. Since an equation must stay balanced, whatever is added to the left must also be added to the right — this is the same balancing rule used whenever a term is moved across an equation, applied here to a term that is added rather than simply moved. For the general equation this pattern needs one extra step first. If a≠1a\neq1, every term is divided by aa so the equation starts in the form x2+(something)x=(something)x^2+(\text{something})x=(\text{something}) before the "add half the middle coefficient, squared" trick can be applied:

ax2+bx+c=0    ⟹    x2+bax+(b2a)2=(b2a)2−caax^2+bx+c=0 \;\;\Longrightarrow\;\; x^2+\frac{b}{a}x+\left(\frac{b}{2a}\right)^2=\left(\frac{b}{2a}\right)^2-\frac{c}{a}

where: aa, bb, cc are the coefficients of the quadratic (a≠0a\neq0), and (b2a)2\left(\dfrac{b}{2a}\right)^2 is the term added to both sides — half the coefficient of xx (after dividing by aa), squared. The left side is now guaranteed to be a perfect square, (x+b2a)2\left(x+\dfrac{b}{2a}\right)^2, no matter what aa, bb, cc are. Once the equation reads (x+k)2=m(x+k)^2=m, two cases follow. If m≥0m\geq0, take square roots of both sides — remembering both the positive and negative root — to get x+k=±mx+k=\pm\sqrt{m}, then solve for xx. If m<0m<0, no real number squares to a negative value, so the equation has no real roots; this is stated as a conclusion, not worked around. Carrying the same steps through with letters instead of numbers, as the derivation below shows, produces the quadratic formula met in the next topic — nothing new is introduced there; it is exactly this method, done once in general. The quantity b2−4acb^2-4ac that appears under the root is called the discriminant: it is the same mm that must stay non-negative for real roots to exist.

Figure
A number line showing that a perfect square bracket equals sixteen splits into two roots one and negative seven placed symmetrically around negative three
(x+3)² = 16 splits into two roots around x = -3 -7 -3 1 4 left 4 right center -3, equal distance sqrt16 = 4 on each side
Derivation ACompleting the square on ax squared plus bx plus c equals zero

The goal is to take the general quadratic equation ax2+bx+c=0ax^2+bx+c=0, with a≠0a\neq0 and bb, cc any real numbers, and carry it through exactly the same completing-the-square steps used on number equations above, so that the perfect-square form (x+k)2=m(x+k)^2=m appears with letters in place of numbers and the quadratic formula falls out as its direct consequence.

Step 1. Divide every term of ax2+bx+c=0ax^2+bx+c=0 by aa, which is allowed since a≠0a\neq0, to make the coefficient of x2x^2 equal to 11: x2+bax+ca=0x^2+\dfrac{b}{a}x+\dfrac{c}{a}=0.

Step 2. Move the constant term to the right side by subtracting ca\dfrac{c}{a} from both sides: x2+bax=−cax^2+\dfrac{b}{a}x=-\dfrac{c}{a}.

Step 3. Identify half the coefficient of xx, namely b2a\dfrac{b}{2a}, and add its square, (b2a)2\left(\dfrac{b}{2a}\right)^2, to both sides to complete the square: x2+bax+(b2a)2=(b2a)2−cax^2+\dfrac{b}{a}x+\left(\dfrac{b}{2a}\right)^2=\left(\dfrac{b}{2a}\right)^2-\dfrac{c}{a}.

Step 4. Write the left side as a perfect square and simplify the right side over a common denominator 4a24a^2: (x+b2a)2=b2−4ac4a2\left(x+\dfrac{b}{2a}\right)^2=\dfrac{b^2-4ac}{4a^2}.

Step 5. Take the square root of both sides, keeping both signs, and subtract b2a\dfrac{b}{2a} to isolate xx: x+b2a=±b2−4ac2ax+\dfrac{b}{2a}=\pm\dfrac{\sqrt{b^2-4ac}}{2a}, so x=−b±b2−4ac2ax=\dfrac{-b\pm\sqrt{b^2-4ac}}{2a} — the quadratic formula, valid whenever b2−4ac≥0b^2-4ac\geq0.

Worked example

Solve x2+6x−7=0x^2+6x-7=0 by completing the square, and identify the value of kk and mm in (x+k)2=m(x+k)^2=m. This example needs a full walk-through because it must show, in one continuous chain, how moving the constant across, adding the completing term to both sides, and finally taking a signed square root each contribute a necessary piece to reaching both roots correctly — skipping or mishandling any single step below produces a wrong or incomplete answer.

Step 1. The coefficient of x2x^2 is already 11, so no division by aa is needed. Move the constant term to the right side: x2+6x=7x^2+6x=7.

Step 2. Half the coefficient of xx is 62=3\frac{6}{2}=3, so the completing term is 32=93^2=9. Add it to both sides: x2+6x+9=7+9x^2+6x+9=7+9, which simplifies to x2+6x+9=16x^2+6x+9=16.

Step 3. The left side is now the perfect square (x+3)2(x+3)^2, so the equation reads (x+3)2=16(x+3)^2=16 — here k=3k=3 and m=16m=16.

Step 4. Take square roots of both sides, keeping the ±\pm: x+3=±4x+3=\pm4.

Step 5. Solve the two cases separately: x=−3+4=1x=-3+4=1 or x=−3−4=−7x=-3-4=-7.

The roots are x=1x=1 and x=−7x=-7. Checking both in the original equation: 12+6(1)−7=01^2+6(1)-7=0 and (−7)2+6(−7)−7=49−42−7=0(-7)^2+6(-7)-7=49-42-7=0, so both satisfy the equation.

Competitive stretch

For 2x2−8x+3=02x^2-8x+3=0, the coefficient of x2x^2 is 22, not 11, so the division step from Step 1 above is essential this time. Dividing every term by a=2a=2 first gives x2−4x+32=0x^2-4x+\frac{3}{2}=0, so x2−4x=−32x^2-4x=-\frac{3}{2}. Half of −4-4 is −2-2, squared is 44, so x2−4x+4=−32+4=52x^2-4x+4=-\frac{3}{2}+4=\frac{5}{2}, giving (x−2)2=52(x-2)^2=\frac{5}{2}. Taking roots, x=2±2.5x=2\pm\sqrt{2.5} — two irrational roots left exactly in surd form rather than rounded, since 2.52.5 is not a perfect square. Notice that skipping the division and instead adding (−82)2=16\left(\frac{-8}{2}\right)^2=16 directly to 2x2−8x+3=02x^2-8x+3=0 would have produced a wrong, non-perfect-square left side — a direct instance of the first common trap below.

Common traps

  • Adding (b2)2\left(\dfrac{b}{2}\right)^2 instead of (b2a)2\left(\dfrac{b}{2a}\right)^2 when a≠1a\neq1 — the equation must be divided by aa first, or the completing term is wrong.
  • Adding the completing term to only one side. It must go on both sides of the equals sign to keep the equation balanced.
  • Dropping the ±\pm when taking a square root, which silently discards one of the two valid roots.
  • Trying to take the square root of a negative mm. If (x+k)2=m(x+k)^2=m has m<0m<0, the correct conclusion is "no real roots," not an invented answer.
  • Rounding a surd answer too early. When mm is not a perfect square, leave the roots as x=−k±mx=-k\pm\sqrt{m} in exact form unless the question explicitly asks for a decimal approximation.

Ask the tutor: Stuck on which constant to add for a particular equation, or want completing the square worked line by line for one you are practising? Ask the AI tutor to walk through it with you.

Why bother completing the square if factorisation is faster whenever it works?

Factorisation is quicker, but it only works when the quadratic happens to split into nice integer or simple fractional factors — many equations, like x2−4x+1=0x^2-4x+1=0, never do, because no pair of factors of the constant term adds up to the middle coefficient. Completing the square works on every quadratic equation without exception, whether the roots are integers, fractions, surds, or the equation has no real roots at all, so it is the reliable fallback method. It also builds the reasoning behind the quadratic formula, which is why the syllabus places it right before that formula rather than skipping straight to it — understanding this method makes the formula feel derived rather than memorised.

Do I always have to divide by a, even when a is already 1?

No — the division step is only needed when the coefficient of x2x^2 is not already 11. If a=1a=1, as in x2+6x−7=0x^2+6x-7=0, you go straight to moving the constant across and adding the completing term. The division is there purely so the "add half the middle coefficient, squared" trick applies correctly; skipping it when a=1a=1 changes nothing because dividing by 11 does nothing anyway.

My answer came out as a surd like 2 plus root 2.5 — did I make a mistake?

No, that is a perfectly valid final answer. Not every quadratic has whole-number or even rational roots; when mm in (x+k)2=m(x+k)^2=m is not a perfect square, the roots are irrational and should be left in exact surd form, such as x=2±2.5x=2\pm\sqrt{2.5}, rather than rounded to a decimal. Rounding early loses precision and is generally not accepted as the exact answer.

Before this

Where this leads