Completing the square and solving quadratics

AS · P1 · 15 min

A quadratic is any expression ax2+bx+cax^2 + bx + c with a≠0a \neq 0, and it is the most used piece of algebra in Paper 1. Completing the square tells you where the graph turns and what its least or greatest value is; solving tells you where it crosses the xx-axis. Almost every other P1 topic, from ranges of functions to tangents to circles, eventually reduces to one of these two skills, so they need to be automatic.

The language of quadratics

Definition

A quadratic polynomial in xx is an expression ax2+bx+cax^2 + bx + c where aa, bb, cc are constants and a≠0a \neq 0. The numbers aa, bb, cc are its coefficients (cc is also called the constant term). A quadratic equation is ax2+bx+c=0ax^2 + bx + c = 0, and its solutions are called its roots.

Two roots that happen to be equal form a repeated root. For example x2−6x+9=(x−3)2=0x^2 - 6x + 9 = (x - 3)^2 = 0 has the repeated root x=3x = 3: the graph touches the xx-axis at one point instead of crossing it twice. Which of these happens is decided by the discriminant.

Completing the square

Why it works

Expand a perfect square:

(x+p)2=x2+2px+p2(x + p)^2 = x^2 + 2px + p^2

The coefficient of xx is 2p2p, so pp is half the coefficient of xx. That means any x2+bxx^2 + bx can be rebuilt from a square:

x2+bx=(x+b2)2−(b2)2x^2 + bx = \left(x + \tfrac{b}{2}\right)^2 - \left(\tfrac{b}{2}\right)^2

You subtract (b2)2\left(\tfrac{b}{2}\right)^2 because squaring the bracket creates that number, and it was not in the original expression. For example x2+6x=(x+3)2−9x^2 + 6x = (x + 3)^2 - 9, because (x+3)2=x2+6x+9(x + 3)^2 = x^2 + 6x + 9 has a 99 too many.

Why it is useful

In (x+3)2−7(x + 3)^2 - 7 the bracket is a square, so it is never negative, and it equals 00 only when x=−3x = -3. So the whole expression is at least −7-7, with the least value −7-7 reached at x=−3x = -3. Completing the square turns a quadratic into a form where its smallest (or largest) value, and where that happens, can simply be read off.

Key result
a(x+p)2+qa(x + p)^2 + q
  • The vertex (turning point) of y=a(x+p)2+qy = a(x + p)^2 + q is (−p, q)(-p,\ q).
  • The line of symmetry is x=−px = -p.
  • If a>0a > 0 the graph is ∪\cup-shaped and qq is the minimum value.
  • If a<0a < 0 the graph is ∩\cap-shaped and qq is the maximum value.

The general result, for reference:

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

Watch the sign: (x−3)2+5(x - 3)^2 + 5 has vertex (3,5)(3, 5), not (−3,5)(-3, 5). The xx-coordinate of the vertex is the value that makes the bracket zero.

Completing the square
  1. If a≠1a \neq 1, take aa out of the x2x^2 and xx terms only: ax2+bx+c=a(x2+bax)+cax^2 + bx + c = a\left(x^2 + \tfrac{b}{a}x\right) + c.
  2. Inside the bracket, halve the coefficient of xx. Write (x+half)2−half2\left(x + \text{half}\right)^2 - \text{half}^2.
  3. Multiply the subtracted number by aa as you remove the outer bracket.
  4. Collect the constants.
  5. Check by expanding mentally: the x2x^2 and xx coefficients must match the original.
y = 2(x - 3)^2 - 11 x = 3 (3, -11) (0, 7)

The graph above is y=2x2−12x+7=2(x−3)2−11y = 2x^2 - 12x + 7 = 2(x - 3)^2 - 11: vertex (3,−11)(3, -11), line of symmetry x=3x = 3, yy-intercept (0,7)(0, 7).

Completing the square when a = 1

Express x2−8x+21x^2 - 8x + 21 in the form (x+a)2+b(x + a)^2 + b, and hence state the coordinates of the vertex of y=x2−8x+21y = x^2 - 8x + 21.

Solution

Half of −8-8 is −4-4, and (x−4)2=x2−8x+16(x - 4)^2 = x^2 - 8x + 16:

x2−8x+21=(x−4)2−16+21=(x−4)2+5x^2 - 8x + 21 = (x - 4)^2 - 16 + 21 = (x - 4)^2 + 5

So a=−4a = -4, b=5b = 5. The bracket is zero when x=4x = 4, so the vertex is (4,5)(4, 5). Because 5>05 > 0 and the graph is ∪\cup-shaped, this also shows x2−8x+21>0x^2 - 8x + 21 > 0 for every real xx.

Completing the square when a is not 1

Express 2x2−12x+72x^2 - 12x + 7 in the form a(x+b)2+ca(x + b)^2 + c, and state the minimum value of 2x2−12x+72x^2 - 12x + 7.

Solution

Take out 22 from the first two terms only:

2x2−12x+7=2(x2−6x)+7=2[(x−3)2−9]+7=2(x−3)2−18+7=2(x−3)2−11\begin{aligned} 2x^2 - 12x + 7 &= 2\left(x^2 - 6x\right) + 7 \\ &= 2\left[(x - 3)^2 - 9\right] + 7 \\ &= 2(x - 3)^2 - 18 + 7 \\ &= 2(x - 3)^2 - 11 \end{aligned}

So a=2a = 2, b=−3b = -3, c=−11c = -11. The minimum value is −11-11, when x=3x = 3.

Check: 2(x−3)2=2x2−12x+182(x - 3)^2 = 2x^2 - 12x + 18, and 18−11=718 - 11 = 7. Correct.

A negative x-squared term

Express 16−6x−x216 - 6x - x^2 in the form a−(x+b)2a - (x + b)^2. Hence state the greatest value of 16−6x−x216 - 6x - x^2 and the value of xx at which it occurs.

Solution

Take out −1-1 from the xx terms:

16−6x−x2=16−(x2+6x)=16−[(x+3)2−9]=25−(x+3)2\begin{aligned} 16 - 6x - x^2 &= 16 - \left(x^2 + 6x\right) \\ &= 16 - \left[(x + 3)^2 - 9\right] \\ &= 25 - (x + 3)^2 \end{aligned}

So a=25a = 25, b=3b = 3. Since (x+3)2≥0(x + 3)^2 \ge 0, the expression is at most 2525. The greatest value is 2525, when x=−3x = -3.

Using a completed square to find a greatest value

(a) Express 2x2−12x+232x^2 - 12x + 23 in the form a(x+b)2+ca(x + b)^2 + c.

(b) Hence find the greatest value of 12x2−12x+23\dfrac{1}{2x^2 - 12x + 23} and the value of xx at which it occurs.

Solution

(a)

2x2−12x+23=2[(x−3)2−9]+23=2(x−3)2+52x^2 - 12x + 23 = 2\left[(x - 3)^2 - 9\right] + 23 = 2(x - 3)^2 + 5

(b) The denominator 2(x−3)2+52(x - 3)^2 + 5 is always at least 55, with least value 55 when x=3x = 3. A fraction with numerator 11 and positive denominator is largest when the denominator is smallest. So the greatest value is

15,when x=3\frac{1}{5}, \quad \text{when } x = 3

The word hence is the clue: the examiner wants the completed square from (a), not calculus.

Watch out

Taking aa out of the constant too. 2x2−12x+7=2(x2−6x+7)2x^2 - 12x + 7 = 2(x^2 - 6x + 7) is wrong, because it doubles the 77. Factor aa out of the x2x^2 and xx terms only, or, if you do factor it out of everything, write 2(x2−6x+72)2\left(x^2 - 6x + \tfrac{7}{2}\right).

Forgetting to multiply the subtracted square by aa. In 2[(x−3)2−9]+72\left[(x - 3)^2 - 9\right] + 7 the −9-9 becomes −18-18, not −9-9.

Reading the vertex sign wrongly. (x+3)2−7(x + 3)^2 - 7 has vertex (−3,−7)(-3, -7).

Solving quadratic equations

There are three methods. All three give the same roots; choose the quickest.

MethodUse it when
Factorisingthe roots are whole numbers or simple fractions
Completing the squarethe question has just asked you to complete the square, or says hence
The quadratic formulaanything else, especially when exact (surd) answers are asked for

Factorising

Rewrite ax2+bx+cax^2 + bx + c as a product of two linear factors, then use the fact that if a product is zero, one of the factors is zero.

When a≠1a \neq 1, find two numbers that multiply to acac and add to bb, split the middle term with them, and factorise in pairs. For 6x2−x−126x^2 - x - 12: ac=−72ac = -72, and −9+8=−1-9 + 8 = -1, so

6x2−9x+8x−12=3x(2x−3)+4(2x−3)=(3x+4)(2x−3)6x^2 - 9x + 8x - 12 = 3x(2x - 3) + 4(2x - 3) = (3x + 4)(2x - 3)

Completing the square

Once the equation is in completed square form, isolate the square and take square roots, remembering both signs.

The quadratic formula

Key result

The roots of ax2+bx+c=0ax^2 + bx + c = 0 are

x=−b±b2−4ac2ax = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}

This formula is printed in the list of formulae (MF19), but you should know it.

The formula is just completing the square done once and for all.

Deriving the formula

Divide by aa and complete the square:

x2+bax+ca=0(x+b2a)2−b24a2+ca=0(x+b2a)2=b2−4ac4a2x+b2a=±b2−4ac2ax=−b±b2−4ac2a\begin{aligned} x^2 + \frac{b}{a}x + \frac{c}{a} &= 0 \\ \left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a^2} + \frac{c}{a} &= 0 \\ \left(x + \frac{b}{2a}\right)^2 &= \frac{b^2 - 4ac}{4a^2} \\ x + \frac{b}{2a} &= \pm\frac{\sqrt{b^2 - 4ac}}{2a} \\ x &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \end{aligned}

Exact answers and surds

"Exact" or "in surd form" means leave the square root in and simplify it. Use ab=ab\sqrt{ab} = \sqrt{a}\sqrt{b} to pull out square factors: 40=410=210\sqrt{40} = \sqrt{4}\sqrt{10} = 2\sqrt{10}. Then cancel any common factor across the whole numerator and the denominator.

Factorising with a not equal to 1

Solve 6x2−x−12=06x^2 - x - 12 = 0.

Solution

ac=6×(−12)=−72ac = 6 \times (-12) = -72. Two numbers with product −72-72 and sum −1-1 are −9-9 and 88.

6x2−9x+8x−12=03x(2x−3)+4(2x−3)=0(3x+4)(2x−3)=0\begin{aligned} 6x^2 - 9x + 8x - 12 &= 0 \\ 3x(2x - 3) + 4(2x - 3) &= 0 \\ (3x + 4)(2x - 3) &= 0 \end{aligned}

So x=−43x = -\dfrac{4}{3} or x=32x = \dfrac{3}{2}.

Exact roots from the formula

Solve 3x2+4x−2=03x^2 + 4x - 2 = 0, giving your answers in the form p±qr\dfrac{p \pm \sqrt{q}}{r}.

Solution

a=3a = 3, b=4b = 4, c=−2c = -2, so b2−4ac=16+24=40b^2 - 4ac = 16 + 24 = 40.

x=−4±406=−4±2106=−2±103x = \frac{-4 \pm \sqrt{40}}{6} = \frac{-4 \pm 2\sqrt{10}}{6} = \frac{-2 \pm \sqrt{10}}{3}

Every term in the numerator was divisible by 22, so the 22 cancels with the 66.

Solving by completing the square

(a) Express x2−8x+3x^2 - 8x + 3 in the form (x−a)2−b(x - a)^2 - b.

(b) Hence solve x2−8x+3=0x^2 - 8x + 3 = 0, giving exact answers.

Solution

(a) x2−8x+3=(x−4)2−16+3=(x−4)2−13x^2 - 8x + 3 = (x - 4)^2 - 16 + 3 = (x - 4)^2 - 13.

(b)

(x−4)2=13⇒x−4=±13⇒x=4±13(x - 4)^2 = 13 \quad\Rightarrow\quad x - 4 = \pm\sqrt{13} \quad\Rightarrow\quad x = 4 \pm \sqrt{13}
An equation that has to be rearranged first

Solve 1x+1x+2=34\dfrac{1}{x} + \dfrac{1}{x + 2} = \dfrac{3}{4}.

Solution

Multiply every term by the common denominator 4x(x+2)4x(x + 2), which is non-zero for the solutions we want (x≠0x \neq 0, x≠−2x \neq -2):

4(x+2)+4x=3x(x+2)8x+8=3x2+6x0=3x2−2x−80=(3x+4)(x−2)\begin{aligned} 4(x + 2) + 4x &= 3x(x + 2) \\ 8x + 8 &= 3x^2 + 6x \\ 0 &= 3x^2 - 2x - 8 \\ 0 &= (3x + 4)(x - 2) \end{aligned}

So x=2x = 2 or x=−43x = -\dfrac{4}{3}. Neither makes a denominator zero, so both are valid.

Check x=2x = 2: 12+14=34\tfrac{1}{2} + \tfrac{1}{4} = \tfrac{3}{4}. Correct.

Roots in terms of a constant

Show that the roots of x2+2kx+k2−9=0x^2 + 2kx + k^2 - 9 = 0 differ by 66 for every value of the constant kk.

Solution

The first two terms are the start of (x+k)2=x2+2kx+k2(x + k)^2 = x^2 + 2kx + k^2, so

x2+2kx+k2−9=(x+k)2−9x^2 + 2kx + k^2 - 9 = (x + k)^2 - 9

Setting this to zero, (x+k)2=9(x + k)^2 = 9, so x+k=±3x + k = \pm 3 and

x=−k+3orx=−k−3x = -k + 3 \quad\text{or}\quad x = -k - 3

The difference is (−k+3)−(−k−3)=6(-k + 3) - (-k - 3) = 6, which does not depend on kk.

Watch out

Dividing by xx loses a root. From x2=5xx^2 = 5x, dividing by xx gives only x=5x = 5. Instead write x2−5x=0x^2 - 5x = 0, so x(x−5)=0x(x - 5) = 0, and x=0x = 0 or x=5x = 5.

Forgetting ±\pm. (x−4)2=13(x - 4)^2 = 13 has two solutions, 4+134 + \sqrt{13} and 4−134 - \sqrt{13}.

Cancelling only part of the numerator. −4±2106\dfrac{-4 \pm 2\sqrt{10}}{6} is not −4±103\dfrac{-4 \pm \sqrt{10}}{3}. Divide every term of the numerator by the same number.

Not setting the equation to zero. x(x−3)=10x(x - 3) = 10 does not mean x=10x = 10 or x−3=10x - 3 = 10. Expand and rearrange to x2−3x−10=0x^2 - 3x - 10 = 0 first.

Choosing and checking

A quadratic with integer coefficients factorises nicely exactly when b2−4acb^2 - 4ac is a perfect square. If you cannot see the factors within a few seconds, use the formula: it never fails.

Always check roots by substituting into the original equation, or check that the sum of the roots is −ba-\dfrac{b}{a} and their product is ca\dfrac{c}{a}. For 6x2−x−12=06x^2 - x - 12 = 0: −43+32=16=−−16-\tfrac{4}{3} + \tfrac{3}{2} = \tfrac{1}{6} = -\tfrac{-1}{6} and −43×32=−2=−126-\tfrac{4}{3} \times \tfrac{3}{2} = -2 = \tfrac{-12}{6}. Both agree.

Tip

The sum and product of roots are a quick check, not a P1 topic you will be asked to prove. Use them silently on your calculator work.

Exam tip
  • Command words. "Express in the form" wants the completed square with the constants identified. "Hence" means use the previous part; a different method may score nothing. "Exact" means no decimals.
  • Calculators. Your calculator can solve quadratics, but answers from a calculator with no working may earn no marks. Show the factorisation or the formula with numbers substituted.
  • Marks. For completing the square, a typical 3-mark question awards one mark for each of aa, bb and cc correct. A slip in one constant loses only one mark if the method is visible.
  • Accuracy. If decimals are acceptable, give them to 3 significant figures unless told otherwise.
Summary
  • Completing the square: x2+bx=(x+b2)2−(b2)2x^2 + bx = \left(x + \tfrac{b}{2}\right)^2 - \left(\tfrac{b}{2}\right)^2.
  • For a≠1a \neq 1, factor aa out of the x2x^2 and xx terms only, and multiply the subtracted square by aa.
  • a(x+p)2+qa(x + p)^2 + q has vertex (−p,q)(-p, q), line of symmetry x=−px = -p, and least value qq if a>0a > 0 (greatest if a<0a < 0).
  • Solve by factorising, completing the square, or x=−b±b2−4ac2ax = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}.
  • Rearrange to =0= 0 before factorising; never divide by xx.
  • Exact answers: simplify the surd and cancel across the whole numerator.
  • "Hence" means use the completed square you have just found.

Practice questions

Question
  1. Express x2−10x+30x^2 - 10x + 30 in the form (x+a)2+b(x + a)^2 + b and state the minimum value of x2−10x+30x^2 - 10x + 30.
  2. Express 3x2+12x−13x^2 + 12x - 1 in the form a(x+b)2+ca(x + b)^2 + c and state the coordinates of the vertex of y=3x2+12x−1y = 3x^2 + 12x - 1.
  3. (a) Express 8+2x−x28 + 2x - x^2 in the form a−(x−b)2a - (x - b)^2. (b) Hence solve 8+2x−x2=08 + 2x - x^2 = 0.
  4. Solve 5x2−7x−6=05x^2 - 7x - 6 = 0.
  5. Solve 2x2+6x−3=02x^2 + 6x - 3 = 0, giving your answers in exact form.
  6. Solve x(2x+1)=3(x+4)x(2x + 1) = 3(x + 4).
  7. (a) Express 4x2−12x+134x^2 - 12x + 13 in the form (2x+a)2+b(2x + a)^2 + b. (b) Hence explain why 4x2−12x+13>04x^2 - 12x + 13 > 0 for all xx, and find the greatest value of 64x2−12x+13\dfrac{6}{4x^2 - 12x + 13}.
  8. Solve 2x−1−1x+1=12\dfrac{2}{x - 1} - \dfrac{1}{x + 1} = \dfrac{1}{2}.
  9. A quadratic curve y=ax2+bx+cy = ax^2 + bx + c has its vertex at (2,−3)(2, -3) and passes through (0,5)(0, 5). Find aa, bb and cc.
  10. Show that, for every value of the constant kk, the roots of x2−2kx+k2−4=0x^2 - 2kx + k^2 - 4 = 0 are k+2k + 2 and k−2k - 2. Hence find the value of kk for which one root is three times the other and both are positive.
Answers
  1. x2−10x+30=(x−5)2−25+30=(x−5)2+5x^2 - 10x + 30 = (x - 5)^2 - 25 + 30 = (x - 5)^2 + 5. So a=−5a = -5, b=5b = 5, and the minimum value is 55 (at x=5x = 5).

  2. 3x2+12x−1=3(x2+4x)−1=3[(x+2)2−4]−1=3(x+2)2−133x^2 + 12x - 1 = 3\left(x^2 + 4x\right) - 1 = 3\left[(x + 2)^2 - 4\right] - 1 = 3(x + 2)^2 - 13. Vertex (−2,−13)(-2, -13).

  3. (a) 8+2x−x2=8−(x2−2x)=8−[(x−1)2−1]=9−(x−1)28 + 2x - x^2 = 8 - \left(x^2 - 2x\right) = 8 - \left[(x - 1)^2 - 1\right] = 9 - (x - 1)^2, so a=9a = 9, b=1b = 1. (b) (x−1)2=9(x - 1)^2 = 9, so x−1=±3x - 1 = \pm 3, giving x=4x = 4 or x=−2x = -2.

  4. ac=−30ac = -30; −10+3=−7-10 + 3 = -7. 5x2−10x+3x−6=5x(x−2)+3(x−2)=(5x+3)(x−2)=05x^2 - 10x + 3x - 6 = 5x(x - 2) + 3(x - 2) = (5x + 3)(x - 2) = 0. So x=2x = 2 or x=−35x = -\tfrac{3}{5}.

  5. b2−4ac=36+24=60b^2 - 4ac = 36 + 24 = 60. x=−6±604=−6±2154=−3±152x = \dfrac{-6 \pm \sqrt{60}}{4} = \dfrac{-6 \pm 2\sqrt{15}}{4} = \dfrac{-3 \pm \sqrt{15}}{2}.

  6. 2x2+x=3x+122x^2 + x = 3x + 12, so 2x2−2x−12=02x^2 - 2x - 12 = 0, i.e. x2−x−6=0x^2 - x - 6 = 0, (x−3)(x+2)=0(x - 3)(x + 2) = 0. So x=3x = 3 or x=−2x = -2.

  7. (a) (2x−3)2=4x2−12x+9(2x - 3)^2 = 4x^2 - 12x + 9, so 4x2−12x+13=(2x−3)2+44x^2 - 12x + 13 = (2x - 3)^2 + 4. a=−3a = -3, b=4b = 4. (b) (2x−3)2≥0(2x - 3)^2 \ge 0, so 4x2−12x+13≥4>04x^2 - 12x + 13 \ge 4 > 0. The least value of the denominator is 44 (at x=32x = \tfrac{3}{2}), so the greatest value of the fraction is 64=32\tfrac{6}{4} = \tfrac{3}{2}.

  8. Multiply by 2(x−1)(x+1)2(x - 1)(x + 1): 4(x+1)−2(x−1)=(x−1)(x+1)4(x + 1) - 2(x - 1) = (x - 1)(x + 1), so 2x+6=x2−12x + 6 = x^2 - 1, giving x2−2x−7=0x^2 - 2x - 7 = 0. Then x=2±4+282=2±422=1±22x = \dfrac{2 \pm \sqrt{4 + 28}}{2} = \dfrac{2 \pm 4\sqrt{2}}{2} = 1 \pm 2\sqrt{2}. Neither is ±1\pm 1, so both are valid.

  9. Vertex (2,−3)(2, -3) gives y=a(x−2)2−3y = a(x - 2)^2 - 3. At (0,5)(0, 5): 5=4a−35 = 4a - 3, so a=2a = 2. Then y=2(x−2)2−3=2x2−8x+5y = 2(x - 2)^2 - 3 = 2x^2 - 8x + 5. So a=2a = 2, b=−8b = -8, c=5c = 5.

  10. x2−2kx+k2−4=(x−k)2−4x^2 - 2kx + k^2 - 4 = (x - k)^2 - 4. Setting this to zero, x−k=±2x - k = \pm 2, so the roots are k+2k + 2 and k−2k - 2. The larger root is k+2k + 2, so we need k+2=3(k−2)k + 2 = 3(k - 2), giving k+2=3k−6k + 2 = 3k - 6 and k=4k = 4. The roots are then 66 and 22, both positive. (The other ordering, k−2=3(k+2)k - 2 = 3(k + 2), gives k=−4k = -4 and roots −2-2 and −6-6, which are not positive.)

How well do you know this?

Where this leads

Console

Search notes, courses and tools, or run an action