4  Quadratic equations

A quadratic equation is something which looks like

\[3x^2+2x-4=0\]

I.e. the highest power of the unknown variable — \(x\) in this case — is \(x^2\). A general quadratic has the form

\[ ax^2+bx+c=0\qquad a \ne 0 \tag{4.1}\]

where \(a\),\(b\) and \(c\) are constants, and \(b\) or \(c\) could be equal to zero and so not appear. \(x\) is the unknown whose value (or values) need to be found.

In general there are two possible solutions to such equations, as can be seen by plotting

\[y=ax^2+bx+c\] and seeing where \(y=0\). E.g.

where we can see that \(y=x^2-x-2\) crosses the \(x\) axis at \(x=-1\) and \(x=2\) so these are solutions to \(x^2-x-2=0\). (Once you’ve worked through this chapter, you can explore how changing \(a\), \(b\) and \(c\) moves the graph in Section 4.6.)

Solving the equation graphically isn’t really a good option, and there are three methods which are generally used to solve it analytically.

4.1 Factorisation

Note that there are several methods of factorising quadratics, so the method I describe below may be slightly different from the one you know. There is no “one right way” — if you have a method which works for you, use it.

Before moving on to factorisation, it is worth examining expanding double brackets to form quadratic expressions.

You will have been taught at least one method to expand double brackets, e.g. “FOIL” (First Outer Inner Last) or the other method which goes by many names, such as “crab claws.” These are very useful in practice, however I would like to go back to basics for the purposes of this section.

Suppose I want to expand \((2x+3)(4x-5)\) without using FOIL or crab claws. I could expand either bracket, e.g.

\[2x(4x-5) + 3(4x-5)\]

and then expand it again to get

\[ 8x^2 -10x +12x -15 \tag{4.2}\]

finally giving

\[8x^2+2x-15\]

I could have expanded it the other way, giving

\[4x(2x+3) -5(2x+3)\]

then

\[ 8x^2 + 12x -10x -15 \tag{4.3}\]

again giving

\[8x^2+2x-15\]

If you examine equation 4.2 and equation 4.3 you will see that they only differ in the order of the two middle terms. Many methods of factorisation hinge upon trying to find these two middle terms, and then factorising from there — basically doing the above expansion in reverse.

Let’s start with a simple example, where the coefficient of \(x^2\) is \(1\).

E.g. To factorise \(x^2+5x+6\) I need to split the middle term \(5x\) into two terms. I look for two numbers which add to give \(5\) and multiply to give \(6\), which are \(2\) and \(3\):

  • Split the middle term to give \(x^2+2x+3x+6\)
  • Factorise the first two terms to give \(x(x+2)\)
  • Factorise the last two terms to give \(3(x+2)\)
  • I now have \(x(x+2)+3(x+2)\), which has a common factor of \((x+2)\), giving \((x+2)(x+3)\)

When the coefficient of \(x^2\) is \(1\), the two numbers you find (\(2\) and \(3\) here) go straight into the brackets, so with practice you can write down \((x+2)(x+3)\) directly. You can always check your answer by expanding the brackets again.

When the coefficient of \(x^2\) isn’t \(1\) there is a little more work to do.

E.g. If I start with \(8x^2+2x-15\) my steps are:

  • Split the middle term up so I have \(8x^2+12x-10x-15\)
  • Examine the first two terms \(8x^2+12x\)
    • Identify \(4x\) as a common factor
    • Factorise to give \(4x(2x+3)\)
  • Examine the last two terms \(-10x-15\)
    • Identify \(-5\) as a common factor
    • Factorise to give \(-5(2x+3)\)
  • I now have \(4x(2x+3) - 5(2x+3)\) which has a common factor of \((2x+3)\)
    • I can now factorise that out to give me \((2x+3)(4x-5)\)

The first step is the hardest — finding the way to split up the middle term (the term in \(x\)). The trick is to look for two numbers that

  1. Add to give the coefficient of \(x\) (\(b\) in the general equation, \(+2\) in this example)
  2. Multiply together to give the product of the coefficient of \(x^2\) (\(a\) in the general equation, \(+8\) in this example), with the constant term (\(c\) in the general equation, \(-15\) in this example).

E.g. we were looking for two numbers which add to give \(+2\) and multiply to give \(8 \times (-15) = -120\)

  • We know that one is positive and one negative, otherwise the product would be positive
  • We can use (educated) guesswork, or do it systematically by looking at factors of \(-120\)
    • 1 and -120 add to give -119
    • 2 and -60 add to give -58
    • 3 and -40 add to give -37
    • 4 and -30 add to give -26
    • 5 and -24 add to give -19
    • 6 and -20 add to give -14
    • 8 and -15 add to give -7
    • 10 and -12 add to give -2
  • Since 10 and -12 add to give -2, -10 and 12 add to give 2 which is what we are looking for, hence the middle term \(2x\) can be split into \(12x-10x\).

4.1.1 Special case: the difference of two squares

A quadratic with no \(x\) term, made of one square subtracted from another, is called a difference of two squares, and always factorises in the same way:

\[p^2 - q^2 = (p-q)(p+q)\]

E.g.

\[x^2 - 9 = (x-3)(x+3)\] \[4x^2 - 25 = (2x-5)(2x+5)\]

You can see why this works using the method above: the middle term is \(0x\), which splits into, e.g., \(-3x+3x\), so

\[\begin{align} x^2 - 9 &= x^2 - 3x + 3x - 9\\ &= x(x-3) + 3(x-3)\\ &= (x-3)(x+3) \end{align}\]

Note that a sum of two squares, such as \(x^2 + 9\), doesn’t factorise like this.

4.2 Roots

Often factorisation is the goal — for instance when quadratics appear in the denominators of fractions.

However, we often want to find the solutions to \(ax^2+bx+c=0\), which are also called the roots of the quadratic, and are the \(x\)-coordinates of the points where \(y=ax^2+bx+c\) crosses (or touches) the \(x\) axis.

Once we have factorised it, we get something of the form

\[ (px+q)(rx+s)=0 \tag{4.4}\]

It is a general rule that if two (or more) numbers multiply to give 0 then at least one of them must be equal to 0 itself. This means that we can make equation 4.4 true by setting either of the two bracketed expressions equal to zero, giving us the two equations:

\[\begin{align} px+q &=0 \\ \mathrm{or} \qquad rx+s &=0 \end{align}\]

which lead to the two possible solutions:

\[\begin{align} x &= -{q \over p} \\ \mathrm{and} \qquad x &= -{s \over r} \end{align}\]

So in our example of \(8x^2+2x-15\) we factorised to get \((2x+3)(4x-5)\). Thus the solution to \(8x^2+2x-15 = 0\) is the same as the solution of \((2x+3)(4x-5) = 0\) and is given by the two possibilities:

\[\begin{align} 2x+3 &=0 \\ \mathrm{or} \qquad 4x-5 &=0 \end{align}\]

which gives us:

\[\begin{align} x &= -{3 \over 2} \\ \mathrm{and} \qquad x &= {5 \over 4} \end{align}\]

4.2.1 Easy case 1: \(b = 0\)

There are a couple of cases where the general quadratic in Equation 4.1 can be solved quickly without having to worry about factorisation, or the techniques described later. This is when either \(b=0\) or \(c=0\).

When \(b=0\) the equation looks like

\[ax^2 + c = 0\] This can easily be rearranged to give \[ax^2 = -c\] and hence \[ x = \pm \sqrt{- c\over a}\]

For example, if \(3x^2 - 2 = 0\), \(x = \sqrt{2 \over 3}\) or \(x = -\sqrt{2 \over 3}\).

4.2.2 Easy case 2: \(c = 0\)

The other easy case is when \(c = 0\), i.e. we have an equation like

\[ax^2 + bx = 0\] Since both terms have a common factor of \(x\) this can be factorised to give

\[x(ax + b) = 0\] and, as we have two numbers multiplying to give zero, we get the two possibilities:

\[\begin{align} x &=0 \\ \mathrm{or} \qquad ax+b &=0 \end{align}\]

which gives us:

\[\begin{align} x &= 0 \\ \mathrm{and} \qquad x &= -{b \over a} \end{align}\]

as solutions.

For example, if \(2x^2 + 3x = 0\), we get \(x=0\) and \(x = -{3\over 2}\)

4.3 Completing the square

The next technique for dealing with quadratics is based around turning the expression into a perfect square with something left over. In arithmetic a perfect square is a number made up of squaring a whole number, e.g. 4,9,16,25,… In algebra we can do a similar thing:

\[(a+b)^2 = a^2 + 2ab + b^2\]

so we can think of \(a^2 + 2ab + b^2\) as a perfect square, as it is the square of \((a+b)\).

When dealing with quadratics, we are interested in terms like \((x+p)^2\)

\[ (x+p)^2 = x^2 + 2px + p^2 \tag{4.5}\]

E.g.

\[(x+3)^2 = x^2 + 6x + 9\]

\[(x+5)^2 = x^2 + 10x + 25\] \[(x-5)^2 = x^2 - 10x + 25\]

The important thing to notice here is that the coefficient of \(x\) is always twice \(p\) in a perfect square. This means that if I see an expression like \(x^2+10x\) I know that \(p = 5\), so it must be related to the perfect square \((x+5)^2\):

\[\begin{align} x^2 + 10x &= x^2 + 10x + 25 - 25\\ &= (x+5)^2 - 25 \end{align}\]

The first step is allowed as \(25-25=0\) so hasn’t changed the equation. By adding and subtracting 25 from this equation we have been able to “complete the square.” The 25 was chosen as it is \(5^2\), or \(p^2\) in the general case — see equation 4.5.

E.g. If we want to complete the square on \(x^2+8x\) we:

  • Look at the coefficient of \(x\), which is 8
  • Halve it to get \(p = 4\)
  • Square \(p\) to get 16
  • Then add and subtract the 16 from the equation \[ x^2 + 8x = x^2 + 8x + 16 - 16\]
  • Then rewrite the first three terms as a perfect square; giving us \[ x^2 + 8x = (x+4)^2 - 16\]

So far we have looked at completing the square where the coefficient of \(x\) is an even number, so that \(p\) in equation 4.5 is a whole number. This is rarely the case, but the same principle applies:

E.g. If we want to complete the square on \(x^2+7x\) we:

  • Look at the coefficient of \(x\), which is 7
  • Halve it to get \(p = \frac{7}{2}\)
  • Square \(p\) to get \(\frac{49}{4}\)
  • Then add and subtract the \(\frac{49}{4}\) from the equation \[ x^2 + 7x = x^2 + 7x + \frac{49}{4} - \frac{49}{4}\]
  • Then rewrite the first three terms as a perfect square; giving us \[ x^2 + 7x = \left(x+\frac{7}{2}\right)^2 - \frac{49}{4}\]

This is the basic technique of completing the square, however you won’t often see \(x^2 + bx\) by itself. You will often see \(x^2 + bx + c\), e.g. \(x^2 + 4x + 5\). The trick here is to ignore the last number and just concentrate on the \(x^2 + 4x\) term, which you know how to complete the square on.

E.g.

\[\begin{align} x^2 + 4x + 5 &= (x^2 + 4x) + 5\\ &= (x^2 + 4x + 4 - 4) + 5\\ &= [(x+2)^2 -4] +5\\ &= (x+2)^2 - 4 + 5\\ &= (x+2)^2 + 1 \end{align}\]

Where only the last step involved the \(c\) term.

You will remember that the general quadratic is given by \(ax^2 + bx + c\). So far we have only looked at cases where \(a=1\). Just as when \(c \ne 0\) we can easily reduce the general case to what we have studied before, by factorising out the \(a\), then continuing as before:

E.g. If we want to complete the square on \(2x^2 + 8x + 5\), we:

  • Ignore the last term as before \[2x^2 + 8x + 5 = [2x^2 + 8x] + 5\]
  • Factorise out the coefficient of \(x^2\) (the \(a\) term) \[2x^2 + 8x + 5 = 2[x^2 + 4x] + 5\]
  • Complete the square inside the brackets \[2x^2 + 8x + 5 = 2[(x+2)^2 -4] + 5\]
  • Multiply out the outer bracket \[2x^2 + 8x + 5 = 2(x+2)^2 - 8 + 5\]
  • Combine the last two terms \[2x^2 + 8x + 5 = 2(x+2)^2 -3\]

4.3.1 Using completing the square to solve quadratic equations

If we are given \(ax^2+bx+c=0\) we can use completing the square to find the solutions (also called roots).

E.g. If we have \(x^2 + 6x + 5 = 0\), we can:

  1. Complete the square on the left hand side, giving us: \[(x+3)^2 - 4 = 0\]
  2. Add 4 to both sides to get: \[(x+3)^2= 4\]
  3. Square root both sides: \[(x+3) = \pm 2\]
  4. Subtract 3 from both sides: \[ x = -3 \pm 2\]
  5. Which gives us \(x = -3 + 2\) and \(x = -3 - 2\)
  6. So \(x=-1\) and \(x=-5\) are the solutions.

The same steps work when the coefficient of \(x^2\) isn’t \(1\). E.g. to solve \(2x^2 + 8x + 5 = 0\):

  1. Complete the square on the left hand side, as we did earlier, giving us: \[2(x+2)^2 - 3 = 0\]
  2. Add 3 to both sides: \[2(x+2)^2 = 3\]
  3. Divide both sides by 2: \[(x+2)^2 = \frac{3}{2}\]
  4. Square root both sides: \[x+2 = \pm\sqrt{\frac{3}{2}}\]
  5. Subtract 2 from both sides: \[x = -2 \pm \sqrt{\frac{3}{2}}\]
  6. So \(x = -2 + \sqrt{\frac{3}{2}} \approx -0.78\) and \(x = -2 - \sqrt{\frac{3}{2}} \approx -3.22\) are the solutions.

Note that if, in the last example, the right hand side on step 2 had been negative, there wouldn’t be a real solution, as you can’t take the square root of a negative number.

4.4 The quadratic formula

If you are just interested in solving equation 4.1

\[ ax^2+bx+c=0\qquad a \ne 0 \]

then factorisation or completing the square may be more work than you’d like to do. In this case there is a simple formula for the roots (solutions to the equation)

\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \tag{4.6}\]

You don’t need this to use the formula, but if you’re curious: the quadratic formula is what you get by completing the square on the general quadratic \(ax^2 + bx + c = 0\), following exactly the same steps as in the \(2x^2 + 8x + 5 = 0\) example above.

  1. Factorise out the \(a\) from the first two terms: \[a\left[x^2 + \frac{b}{a}x\right] + c = 0\]
  2. Complete the square inside the brackets. Half the coefficient of \(x\) is \(\frac{b}{2a}\), so \[a\left[\left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a^2}\right] + c = 0\]
  3. Multiply out the outer bracket: \[a\left(x + \frac{b}{2a}\right)^2 - \frac{b^2}{4a} + c = 0\]
  4. Move the other terms to the right hand side and divide both sides by \(a\): \[\left(x + \frac{b}{2a}\right)^2 = \frac{b^2}{4a^2} - \frac{c}{a} = \frac{b^2 - 4ac}{4a^2}\]
  5. Square root both sides. Since \(\sqrt{4a^2} = 2a\) (or \(-2a\), which the \(\pm\) already covers): \[x + \frac{b}{2a} = \pm\frac{\sqrt{b^2 - 4ac}}{2a}\]
  6. Subtract \(\frac{b}{2a}\) from both sides: \[x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}\]

Step 5 also shows why the discriminant \(b^2 - 4ac\) matters: if it’s negative, there’s no real square root to take, and so no real solutions.

E.g. If I want to solve \(3x^2 + 9x + 4 = 0\), I would:

  • Identify \(a=3\), \(b=9\), \(c=4\)
  • Use the formula: \[\begin{align} x &= \frac{-9 \pm \sqrt{9^2 - 4 \times 3 \times 4}}{2 \times 3}\\ &= \frac{-9 \pm \sqrt{81 - 48}}{6}\\ &= \frac{-9 \pm \sqrt{33}}{6} \end{align}\]
  • Giving the roots as: \(x=\frac{-9 + \sqrt{33}}{6}\) and \(x=\frac{-9 - \sqrt{33}}{6}\).

Where people generally get into trouble is when one or more of the coefficients (\(a\), \(b\) or \(c\)) are negative. The trick, as ever with negative numbers, is to use brackets.

E.g. If I want to solve \(3x^2 - 9x - 4 = 0\), I would:

  • Identify \(a=3\), \(b=-9\), \(c=-4\)
  • Note that \(b\) and \(c\) are negative
  • Use the formula, making sure I bracket all cases of \(b\) and \(c\): \[\begin{align} x &= \frac{-(-9) \pm \sqrt{(-9)^2 - 4 \times 3 \times (-4)}}{2 \times 3}\\ &= \frac{9 \pm \sqrt{81 + 48}}{6}\\ &= \frac{9 \pm \sqrt{129}}{6} \end{align}\]
  • Giving the roots as: \(x=\frac{9 + \sqrt{129}}{6}\) and \(x=\frac{9 - \sqrt{129}}{6}\).

4.4.1 Number of roots and the discriminant

Look back at the quadratic formula

\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]

The expression in the square root \(b^2 - 4ac\) is very important, and is called the discriminant.

  • If it is negative, there are no real solutions to the equation (no real roots).
  • If it is zero, the two roots are the same.
  • If it is greater than zero, there are two distinct solutions.

E.g. How many solutions are there to \(3x^2+2x+5 = 0\)?

  • \(a=3\), \(b=2\), \(c=5\)
  • The discriminant is \(b^2 - 4ac = 2^2-4\times 3 \times 5\) so the discriminant is -56.
  • This is negative, so there are no real solutions.

E.g. How many solutions are there to \(3x^2+2x-5 = 0\)?

  • \(a=3\), \(b=2\), \(c=-5\)
  • The discriminant is \(b^2 - 4ac = 2^2-4\times 3 \times (-5)\) so the discriminant is 64.
  • This is positive, so there are two solutions.

4.5 Which method should I use?

All three methods give the same answers, so use whichever is quickest for the equation in front of you:

  • If \(b\) or \(c\) is zero, use the easy cases: rearrange and square root when \(b = 0\), or take out the common factor \(x\) when \(c = 0\).
  • If it factorises easily, factorisation is usually quickest. A useful check, when \(a\), \(b\) and \(c\) are whole numbers: if the discriminant \(b^2 - 4ac\) is a perfect square (0, 1, 4, 9, 16, …), the quadratic factorises with whole numbers.
  • If you need the turning point, e.g. to sketch the graph, complete the square: the vertex of \(a(x+p)^2 + q\) is at \((-p, q)\).
  • Otherwise, use the quadratic formula. It always works, and working out the discriminant first tells you how many solutions to expect.

4.6 Exploring the graph of a quadratic

Use the sliders to change \(a\), \(b\) and \(c\) in \(y = ax^2 + bx + c\) and watch how the graph moves. The roots (where the graph crosses the \(x\) axis) are marked with orange circles, and the turning point (the vertex) with a green diamond. Below the graph you can see the equation in completed-square form, the discriminant and the roots.

Things to try:

  • Make \(a\) negative. What happens to the shape of the graph?
  • Change only \(c\). How does the graph move, and what happens to the roots?
  • Find values where the discriminant is exactly zero. What does the graph look like then?
  • Compare the completed-square form \(a(x+p)^2 + q\) with the position of the vertex.

4.7 Further Resources