AL5 - Completing the square

AL5 - Completing the square

Completing the square rewrites a quadratic as one squared bracket plus a constant. You will learn why the method works, handle positive and negative leading coefficients, and read off a quadratic's greatest or least value. The new form reveals information that is hard to see in an expanded expression.

Building a complete square

How can you know that x2−10x+37x^2-10x+37 never falls below 1212, without trying lots of values of xx? The expanded expression hides that lower limit. A squared bracket will make it visible.

You already know

Expanding a squared bracket gives (x+p)2=x2+2px+p2(x+p)^2=x^2+2px+p^2. The middle term appears twice in the multiplication. A square of a real number is never negative.

Start with x2+6xx^2+6x. For positive xx, think of a square of side xx and two strips, each of width 33. Together they almost make a larger square of side x+3x+3, but its corner of area 99 is missing. Adding 99 completes that square.

[DIAGRAM: asset_name: Completing a square with two strips; asset_slug: completing-square-area; caption: Two strips of area 3x leave a corner of area 9 to complete a square; description: A square with total side length x plus 3 is partitioned into a blue x by x square labelled x squared, two sage rectangles each labelled 3x, and a clay 3 by 3 corner labelled 9. Side labels show x and 3 along the bottom and left. A sentence below states that x squared plus 6x plus 9 equals x plus 3 all squared, for positive x in the area picture.]
Two strips of area 3x leave a corner of area 9 to complete a square

The picture uses positive lengths, but expansion gives the identity x2+6x+9≡(x+3)2x^2+6x+9\equiv(x+3)^2 for every real xx. If the expression starts with x2+6x+2x^2+6x+2, adding 99 would change it. Instead, put in the square and subtract the extra 99: x2+6x+2≡(x+3)2−9+2x^2+6x+2\equiv(x+3)^2-9+2.

Completing the square

Completing the square means rewriting a quadratic polynomial as a(x+p)2+qa(x+p)^2+q, with the same value for every real xx. For example, x2+6x+2≡(x+3)2−7x^2+6x+2\equiv(x+3)^2-7. The expression (x+6)2+2(x+6)^2+2 is not equivalent: its linear term would be 12x12x.

The coefficient of xx tells you the number inside the bracket: halve it, because expansion doubles that number in the middle term.

Completing a monic quadratic

x2+bx+c≡(x+b2)2+c−(b2)2x^2+bx+c\equiv\left(x+\frac b2\right)^2+c-\left(\frac b2\right)^2

Here bb and cc are real constants. A monic quadratic has coefficient 11 on x2x^2. Halve bb, square that half, and compensate for the constant introduced.
Not on the formulae sheet: learn it.

Use that compensation explicitly before collecting the constant terms.

Worked example 1: a positive middle term

Question. Write x2+6x+2x^2+6x+2 in the form (x+p)2+q(x+p)^2+q.

Plan. Halve 66 to obtain the bracket number, then subtract the square introduced.

x2+6x+2=(x+3)2−9+2the square adds 9=(x+3)2−7compensate and collect\begin{aligned} x^2+6x+2&=(x+3)^2-9+2 && \text{the square adds }9\\ &=(x+3)^2-7 && \text{compensate and collect} \end{aligned}

Why subtract 99? The bracket already contains it when expanded; subtracting 99 prevents adding anything to the original expression.

Answer. (x+3)2−7(x+3)^2-7, so p=3p=3 and q=−7q=-7.

Check. (x+3)2−7=x2+6x+9−7=x2+6x+2(x+3)^2-7=x^2+6x+9-7=x^2+6x+2.

Now change only the sign of the middle term. The bracket number changes sign, but its square remains positive.

Worked example 2: a negative middle term

Question. Write x2−6x+2x^2-6x+2 in the form (x+p)2+q(x+p)^2+q.

Plan. Halve −6-6 to get −3-3, then compensate for (−3)2(-3)^2.

x2−6x+2=(x−3)2−9+2the bracket still adds 9=(x−3)2−7collect the constants\begin{aligned} x^2-6x+2&=(x-3)^2-9+2 && \text{the bracket still adds }9\\ &=(x-3)^2-7 && \text{collect the constants} \end{aligned}

Why is the correction still −9-9? Both 323^2 and (−3)2(-3)^2 equal 99. The sign changes the linear term, not the squared constant.

Answer. (x−3)2−7(x-3)^2-7, so p=−3p=-3 and q=−7q=-7.

Check. Expanding gives x2−6x+9−7=x2−6x+2x^2-6x+9-7=x^2-6x+2.

You can check every completed square by expanding it back; this catches both a wrong bracket and a wrong constant.

Watch out

Wrong: x2−8x+1=(x−8)2−63x^2-8x+1=(x-8)^2-63. This doubles the required linear coefficient to −16-16. Right: halve −8-8, giving (x−4)2−16+1=(x−4)2−15(x-4)^2-16+1=(x-4)^2-15.

Keep the coefficient and the bracket number separate in the next calculation.

Leading coefficients and fractional shifts

When the coefficient of x2x^2 is not 11, first factor it out of the two variable terms so that you complete a monic quadratic inside the bracket.

In 2x2+12x+52x^2+12x+5, write 2(x2+6x)+52(x^2+6x)+5. The number to halve is now 66, not 1212. Any correction made inside the bracket is also multiplied by 22 outside it.

Completing any quadratic

ax2+bx+c≡a(x+b2a)2+c−b24aax^2+bx+c\equiv a\left(x+\frac{b}{2a}\right)^2+c-\frac{b^2}{4a}

Here a≠0a\ne0, and aa, bb and cc are real constants. Factoring out aa leaves linear coefficient ba\frac ba; half of that is b2a\frac{b}{2a}.
Not on the formulae sheet: learn it.

The general identity describes the result, but the short bracket-by-bracket method keeps the correction visible.

Worked example 3: a leading coefficient of two

Question. Write 2x2+12x+52x^2+12x+5 in the form a(x+p)2+qa(x+p)^2+q.

Plan. Factor 22 from the variable terms, complete the inner square and multiply the correction by 22.

2x2+12x+5=2(x2+6x)+5factor the variable terms=2((x+3)2−9)+5complete inside the bracket=2(x+3)2−18+5multiply the correction too=2(x+3)2−13collect the constants\begin{aligned} 2x^2+12x+5&=2(x^2+6x)+5 && \text{factor the variable terms}\\ &=2\bigl((x+3)^2-9\bigr)+5 && \text{complete inside the bracket}\\ &=2(x+3)^2-18+5 && \text{multiply the correction too}\\ &=2(x+3)^2-13 && \text{collect the constants} \end{aligned}

Why is the correction −18-18, rather than −9-9? The completed square sits inside a bracket multiplied by 22, so its compensation does too.

Answer. 2(x+3)2−132(x+3)^2-13.

Check. 2(x2+6x+9)−13=2x2+12x+52(x^2+6x+9)-13=2x^2+12x+5.

Now change only the linear coefficient, from 1212 to 1010. After factoring out 22, the inner coefficient is odd, so halving it produces a fraction. Keep that fraction exact.

Worked example 4: a fractional bracket number

Question. Write 2x2+10x+52x^2+10x+5 in the form a(x+p)2+qa(x+p)^2+q.

Plan. Factor 22, halve the inner coefficient 55, then square the fraction before simplifying the constant.

2x2+10x+5=2(x2+5x)+5factor out 2=2((x+52)2−254)+5half of 5 is 52=2(x+52)2−252+5multiply by 2=2(x+52)2−152collect exact fractions\begin{aligned} 2x^2+10x+5&=2(x^2+5x)+5 && \text{factor out }2\\ &=2\left(\left(x+\frac52\right)^2-\frac{25}{4}\right)+5 && \text{half of }5\text{ is }\frac52\\ &=2\left(x+\frac52\right)^2-\frac{25}{2}+5 && \text{multiply by }2\\ &=2\left(x+\frac52\right)^2-\frac{15}{2} && \text{collect exact fractions} \end{aligned}

Why keep 52\frac52 instead of rounding? Its square is exactly 254\frac{25}{4}, so every later step stays exact. There is no need for a decimal approximation.

Answer. 2(x+52)2−1522(x+\frac52)^2-\frac{15}{2}.

Check. The constant after expansion is 2×254−152=52\times\frac{25}{4}-\frac{15}{2}=5, and the linear term is 2×5x=10x2\times5x=10x.

Fractions are also behind a neat numerical fact. The product of two consecutive integers is exactly 14\frac14 below the square of their halfway point: 20×21=42020\times21=420, while 20.52=420.2520.5^2=420.25. Algebra explains every such case:

n(n+1)=n2+n≡(n+12)2−14n(n+1)=n^2+n\equiv\left(n+\frac12\right)^2-\frac14

The identity is not on the formulae sheet: it is another completed square, with b=1b=1 and c=0c=0.

Watch out

Wrong: 3(x2+4x)+1=3(x+2)2−4+13(x^2+4x)+1=3(x+2)^2-4+1. The −4-4 correction belongs inside the bracket. Right: 3((x+2)2−4)+1=3(x+2)2−113\bigl((x+2)^2-4\bigr)+1=3(x+2)^2-11.

Try a coefficient that produces a fraction after the first factorisation.

Reading greatest and least values

A completed square isolates the only part that varies, so its sign tells you whether the constant outside is a lower or an upper limit.

For a real input, (x+p)2≥0(x+p)^2\ge0, with equality exactly when x=−px=-p. If a>0a>0, then a(x+p)2+q≥qa(x+p)^2+q\ge q: its least value is qq. If a<0a<0, multiplying by aa reverses the comparison, so a(x+p)2+q≤qa(x+p)^2+q\le q: its greatest value is qq. In both cases that value occurs when the bracket is zero. These facts are not on the formulae sheet: learn them.

The sign inside the bracket is opposite to the input that makes it zero. A form containing (x−2)2(x-2)^2 reaches its limiting value at x=2x=2.

Worked example 5: a least value

Question. By completing the square, determine the least value of 3x2−12x+73x^2-12x+7 and the value of xx at which it occurs.

Plan. Complete the square, then use its non-negativity to identify the least possible output.

3x2−12x+7=3(x2−4x)+7factor out 3=3((x−2)2−4)+7complete the square=3(x−2)2−5collect the constant3(x−2)2−5≥−5a positive multiple of a square\begin{aligned} 3x^2-12x+7&=3(x^2-4x)+7 && \text{factor out }3\\ &=3\bigl((x-2)^2-4\bigr)+7 && \text{complete the square}\\ &=3(x-2)^2-5 && \text{collect the constant}\\ 3(x-2)^2-5&\ge-5 && \text{a positive multiple of a square} \end{aligned}

Why can −5-5 actually be reached? At x=2x=2, the squared bracket is zero. A lower bound is the least value only if some permitted input attains it.

Answer. Least value −5-5, at x=2x=2.

Check. Substitution gives 3(2)2−12(2)+7=12−24+7=−53(2)^2-12(2)+7=12-24+7=-5.

Now reverse the sign of the two variable terms, leaving the constant fixed. The square has a negative multiplier, so the same idea gives a greatest value instead.

Worked example 6: a negative leading coefficient

Question. By completing the square, determine the greatest value of −3x2+12x+7-3x^2+12x+7 and the value of xx at which it occurs.

Plan. Factor −3-3, complete the inner square and use the fact that its negative multiple cannot be positive.

−3x2+12x+7=−3(x2−4x)+7factor out −3=−3((x−2)2−4)+7complete inside=−3(x−2)2+19multiply the correction−3(x−2)2+19≤19a negative multiple of a square\begin{aligned} -3x^2+12x+7&=-3(x^2-4x)+7 && \text{factor out }-3\\ &=-3\bigl((x-2)^2-4\bigr)+7 && \text{complete inside}\\ &=-3(x-2)^2+19 && \text{multiply the correction}\\ -3(x-2)^2+19&\le19 && \text{a negative multiple of a square} \end{aligned}

Why is the correction positive here? Multiplying the inner −4-4 by the outer −3-3 gives +12+12, which is then added to 77.

Answer. Greatest value 1919, at x=2x=2.

Check. Substitution gives −3(2)2+12(2)+7=−12+24+7=19-3(2)^2+12(2)+7=-12+24+7=19.

We can now settle the opening question in one line: x2−10x+37≡(x−5)2+12x^2-10x+37\equiv(x-5)^2+12. The square cannot be negative, so the expression cannot fall below 1212, and it equals 1212 at x=5x=5. Completing the square has turned a claim about infinitely many inputs into a statement about one square.

Watch out

Wrong: −3(x−2)2+19-3(x-2)^2+19 has least value 1919 at x=−2x=-2. The negative multiplier makes 1919 a greatest value, and the bracket is zero at x=2x=2. Right: greatest value 1919, attained at x=2x=2.

Read the sign outside the square to decide greatest or least, then solve the bracket equal to zero to locate it. The two signs do different jobs.

Exam tip

If OCR says “By completing the square”, show that form in your working. Give both the limiting value and where it occurs when both are requested; a different method does not fulfil the instruction to complete the square.

Handle both a negative multiplier and a fractional shift in the final question.

Quick Recap

  • Complete a monic quadratic by halving the linear coefficient, squaring that half, and compensating for the introduced constant.
  • For a non-monic quadratic, factor the leading coefficient from the variable terms first; it multiplies the correction too.
  • Fractions inside the bracket are normal. Keep them exact and check by expanding back.
  • In a(x+p)2+qa(x+p)^2+q, the limiting value is qq, at x=−px=-p: a least value if a>0a>0, a greatest value if a<0a<0.

The opening expression is (x−5)2+12(x-5)^2+12, so its least value is exactly 1212, attained at x=5x=5.