Quadratics & their graphs · Lesson 4 of 6

Completing the square

Rewrite x² + bx + c as a square plus a number. It solves any quadratic, finds the vertex, and is where the formula comes from.

15 minYou should already know: Linear & simultaneous equations
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6

Not every quadratic factorises neatly. x2+6x+2x^2 + 6x + 2 has no pair of whole numbers that multiply to 2 and add to 6. Completing the square works every time, and the picture below shows why it’s called that.

See it as area

Completing the squareStage 1 of 5

x² + 6x

x²6xxx
A square and a rectangle. x² is a square with sides x. 6x is a rectangle, x long and 6 wide.

Step through the stages, then change the number in front of xx and step through again. The corner is always half the number, squared.

Solving an equation this way

  1. Get the x2x^2 and xx terms on one side and the number on the other.
  2. Add (b2)2\left(\frac b2\right)^2 to both sides, so the left side becomes a perfect square.
  3. Take the square root of both sides, remembering ±\pm.
  4. Solve for xx.

For x2+6x+2=0x^2 + 6x + 2 = 0:

  • Take 2 from both sides: x2+6x=−2{x^2 + 6x = -2}.
  • Half of 6 is 3, so add 32=9{3^2 = 9} to both sides: x2+6x+9=7{x^2 + 6x + 9 = 7}.
  • The left side is now a square: (x+3)2=7{(x + 3)^2 = 7}.
  • Square root both sides, with ±\pm: x+3=±7{x + 3 = \pm\sqrt7}.
  • Take 3 from both sides: x=−3±7{x = -3 \pm \sqrt 7}.

So x≈−0.35x \approx -0.35 or x≈−5.65x \approx -5.65 (to 2 decimal places).

When there’s a number in front of x²

Divide the whole equation by that number first, so the x2x^2 stands alone. You can only do this with an equation (something =0= 0). With an expression on its own, take the number out as a factor of the xx terms instead: dividing would change its value.

For 3y2−5y+2=03y^2 - 5y + 2 = 0:

  • Divide by 3: y2−53y+23=0{y^2 - \frac53 y + \frac23 = 0}.
  • Take 23\frac23 from both sides: y2−53y=−23{y^2 - \frac53 y = -\frac23}.
  • Half of 53\frac53 is 56\frac56, so add (56)2=2536{\left(\frac56\right)^2 = \frac{25}{36}} to both sides: (y−56)2=−2436+2536=136{\left(y - \frac56\right)^2 = -\frac{24}{36} + \frac{25}{36} = \frac{1}{36}}.
  • Square root, with ±\pm: y−56=±16{y - \frac56 = \pm\frac16}.

So y=56+16=1y = \frac56 + \frac16 = 1 or y=56−16=23y = \frac56 - \frac16 = \frac23.

Using the perfect squares

The same picture gives two expansions worth knowing by heart:

(a+b)2=a2+2ab+b2(a−b)2=a2−2ab+b2\begin{aligned} (a + b)^2 &= a^2 + 2ab + b^2 \\ (a - b)^2 &= a^2 - 2ab + b^2 \end{aligned}

An expression is a perfect square when it fits one of these exactly. They also connect a2+b2a^2 + b^2 to a+ba + b and abab. For example, if a+b=5a + b = 5 and ab=4ab = 4:

a2+b2=(a+b)2−2ab=25−8=17\begin{aligned} a^2 + b^2 &= (a + b)^2 - 2ab \\ &= 25 - 8 = 17 \end{aligned}
a²ababb²abab
(a + b)²The square splits into a², two ab rectangles and b²

Finding the vertex, and the least or greatest value

Once yy is written as (x+p)2+q(x + p)^2 + q, the vertex is easy to see. A square is never negative, so the smallest (x+p)2(x + p)^2 can be is 0, when x=−px = -p. At that point y=qy = q.

A past question, step by step

Worked example · WAEC 2022

WAEC 2022 · Paper 1 · Q16

What value of pp will make (x2−4x+p)(x^2 - 4x + p) a perfect square?

  1. What a perfect square looks like

    A perfect square is (x+k)2(x + k)^2 for some number kk. Here the xx term is −4x-4x, so kk is half of −4-4.

    Think first. Half of −4-4 is −2-2. What do you get when you expand (x−2)2(x - 2)^2?

  2. Expand it

    (x−2)2=x2−4x+4(x - 2)^2 = x^2 - 4x + 4

    Comparing with x2−4x+px^2 - 4x + p gives p=4p = 4. The answer is C.

Your turn

JAMB 1997 · UME · Q13

Find the minimum value of x2−3x+2x^2 - 3x + 2 for all real values of xx.

Worked solution (try it first)
  1. Complete the square: half of −3-3 is −32-\frac32, so x2−3x=(x−32)2−94x^2 - 3x = \left(x - \frac32\right)^2 - \frac94.
  2. So x2−3x+2=(x−32)2−94+2x^2 - 3x + 2 = \left(x - \frac32\right)^2 - \frac94 + 2
    =(x−32)2−14= \left(x - \frac32\right)^2 - \frac14.
  3. A square is never negative, so the minimum value is −14-\frac14, option A.

Report a problem with this question

More past questions like this