# Math: How to Find the Roots of a Quadratic Function

*I studied applied mathematics, in which I did both a bachelor's and a master's degree.*

## Quadratic Functions

A quadratic function is a polynomial of degree two. That means it is of the form ax^2 + bx +c. Here, a, b and c can be any number. When you draw a quadratic function, you get a parabola as you can see in the picture above. When a is negative, this parabola will be upside down.

### What Are Roots?

The roots of a function are the points on which the value of the function is equal to zero. These correspond to the points where the graph crosses the x-axis. So when you want to find the roots of a function you have to set the function equal to zero. For a simple linear function, this is very easy. For example:

f(x) = x +3

Then the root is x = -3, since -3 + 3 = 0. Linear functions only have one root. Quadratic functions may have zero, one or two roots. An easy example is the following:

f(x) = x^2 - 1

When setting x^2-1 = 0, we see that x^2 = 1. This is the case for both x = 1 and x = -1.

An example of a quadratic function with only one root is the function x^2. This is only equal to zero when x is equal to zero. It might also happen that here are no roots. This is, for example, the case for the function x^2+3. Then, to find the root we have to have an x for which x^2 = -3. This is not possible, unless you use complex numbers. In most practical situations, the use of complex numbers does make sense, so we say there is no solution.

Strictly speaking, any quadratic function has two roots, but you might need to use complex numbers to find them all. In this article we will not focus on complex numbers, since for most practical purposes they are not useful. There are however some field where they come in very handy. If you want to know more about complex numbers you should read my article about them.

## Ways to Find the Roots of a Quadratic Function

### Factorization

The most common way people learn how to determine the the roots of a quadratic function is by factorizing. For a lot of quadratic functions this is the easiest way, but it also might be very difficult to see what to do. We have a quadratic function ax^2 + bx + c, but since we are going to set it equal to zero, we can divide all terms by a if a is not equal to zero. Then we have an equation of the form:

x^2 + px + q = 0.

Now we try to find factors s and t such that:

(x-s)(x-t) = x^2 + px + q

If we succeed we know that x^2 + px + q = 0 is true if and only if (x-s)(x-t) = 0 is true. (x-s)(x-t) = 0 means that either (x-s) = 0 or (x-t)=0. This means that x = s and x = t are both solutions, and hence they are the roots.

If (x-s)(x-t) = x^2 + px + q, then it holds that s*t = q and - s - t = p.

**Numerical Example**

x^2 + 8x + 15

Then we have to find s and t such that s*t = 15 and - s - t = 8. So if we choose s = -3 and t = -5 we get:

x^2 + 8x + 15 = (x+3)(x+5) = 0.

Hence, x = -3 or x = -5. Let's check these values: (-3)^2 +8*-3 +15 = 9 - 24 + 15 = 0 and (-5)^2 + 8*-5 +15 = 25 - 40 + 15 = 0. So indeed these are the roots.

It might however be very difficult to find such a factorization. For example:

x^2 -6x + 7

Then the roots are 3 - sqrt 2 and 3 + sqrt 2. These are not so easy to find.

**The ABC Formula**

Another way to find the roots of a quadratic function. This is an easy method that anyone can use. It is just a formula you can fill in that gives you roots. The formula is as follows for a quadratic function ax^2 + bx + c:

(-b + sqrt(b^2 -4ac))/2a and (-b - sqrt(b^2 -4ac))/2a

This formulas give both roots. When only one root exists both formulas will give the same answer. If no roots exist, then b^2 -4ac will be smaller than zero. Therefore the square root does not exist and there is no answer to the formula. The number b^2 -4ac is called the discriminant.

**Numeric example**

Let's try the formula on the same function we used for the example on factorizing:

x^2 + 8x + 15

Then a = 1, b = 8 and c = 15. Therefore:

(-b + sqrt(b^2 -4ac))/2a = (-8+sqrt(64-4*1*15))/2*1 = (-8+sqrt(4))/2 = -6/2 = -3

(-b - sqrt(b^2 -4ac))/2a = (-8-sqrt(64-4*1*15))/2*1 = (-8-sqrt(4))/2 = -10/2 = -5

So indeed, the formula gives the same roots.

### Completing the Square

The ABC Formula is made by using the completing the square method. The idea of completing the square is as follows. We have ax^2 + bx + c. We assume a = 1. If this would not be the case, we could divide by a and we get new values for b and c. The other side of the equation is zero, so if we divide that by a, it stays zero. Then we do the following:

x^2 + bx + c = (x+b/2)^2 -(b^2/4) + c = 0.

Then (x+b/2)^2 = (b^2/4) - c.

Therefore x+b/2 = sqrt((b^2/4) - c) or x+b/2 = - sqrt((b^2/4) - c).

This implies x = b/2+sqrt((b^2/4) - c) or x = b/2 - sqrt((b^2/4) - c).

This is equal to the ABC-Formula for a = 1. However, this is easier to calculate.

**Numerical Example**

We take again x^2 + 8x + 15. Then:

x^2 + 8x + 15 = (x+4)^2 -16+15 = (x+4)^2 -1 = 0.

Then x = -4 + sqrt 1 = -3 or x = -4 - sqrt 1 = -5.

So indeed, this gives the same solution as the other methods.

## Summary

We have seen three different methods to find the roots of a quadratic function of the form ax^2 + bx + c. The first was factorizing where we try to write the function as (x-s)(x-t). Then we know the solutions are s and t. The second method we saw was the ABC Formula. Here you just have to fill in a, b and c to get the solutions. Lastly, we had the completing the squares method where we try to write the function as (x-p)^2 + q.

## Quadratic Inequalities

Finding the roots of a quadratic function can come up in a lot of situations. One example is solving quadratic inequalities. Here you must find the roots of a quadratic function to determine the boundaries of the solution space. If you want to find out exactly how to solve quadratic inequalities I suggest reading my article on that topic.

## Higher Degree Functions

Determining the roots of a function of a degree higher than two is a more difficult task. For third-degree functions—functions of the form ax^3+bx^2+cx+d—there is a formula, just like the ABC Formula. This formula is pretty long and not so easy to use. For functions of degree four and higher, there is a proof that such a formula doesn't exist.

This means that finding the roots of a function of degree three is doable, but not easy by hand. For functions of degree four and higher, it becomes very difficult and therefore it can better be done by a computer.

## Comments

**Santosh Sahu** from Bangalore on April 25, 2020:

A nice article.