# How to find the equation of a quadratic function from its graph

By Murray Bourne, 17 May 2011

A reader recently asked:

I would like to know how to find the equation of a quadratic function from its graph, including when it does not cut the

x-axis. Thanks.

## Modeling

This is a good question because it goes to the heart of a lot of "real" math. Often we have a set of data points from observations in an experiment, say, but we don't know the function that passes through our data points. (Most "text book" math is the wrong way round - it gives you the function first and asks you to plug values into that function.)

## A quadratic function's graph is a parabola

The graph of a quadratic function is a parabola. The parabola can either be in "legs up" or "legs down" orientation.

We know that a quadratic equation will be in the form:

*y = ax*^{2} + *bx* + *c*

Our job is to find the values of *a*, *b* and * c* after first observing the graph*.* Sometimes it is easy to spot the points where the curve passes through, but often we need to estimate the points.

Let's start with the simplest case. (We'll assume the axis of the given parabola is vertical.)

## Parabola cuts the graph in 2 places

We can see on the graph that the roots of the quadratic are:

*x* = β2 (since the graph cuts the *x*-axis at *x* = β 2); and

*x* = 1 (since the graph cuts the *x*-axis at *x* = 1.)

Now, we can write our function for the quadratic as follows (since if we solve the following for 0, we'll get our 2 intersection points):

*f*(*x*) = (*x* + 2)(*x* β 1)

We can expand this to give:

*f*(*x*) = *x*^{2} +* x* β 2

This is a quadratic function which passes through the *x*-axis at the required points.

But is this the correct answer?

Observe my graph passes through β3 on the *y*-axis. Let's substitute *x* = 0 into the equation I just got to check if it's correct.

*f*(0) = 0^{2} + 0 β 2 = β2

It's not correct!

It turns out there are an **infinite** number of parabolas passing through the points (β2,0) and (1,0).

Here are some of them (in green):

And don't forget the parabolas in the "legs down" orientation:

So how do we find the correct quadratic function for our original question (the one in blue)?

## System of Equations method

To find the **unique** quadratic function for our blue parabola, we need to use 3 points on the curve. We can then form 3 equations in 3 unknowns and solve them to get the required result.

On the original blue curve, we can see that it passes through the point (0, β3) on the *y*-axis. We'll use that as our 3rd known point.

Using our general form of the quadratic, *y = ax*^{2} + *bx + c*, we substitute the known values for *x* and *y* to obtain:

**Substituting (β2,0):**

0* = a*(β2)^{2} + *b*(β2)* + c = *4*a* β 2*b* + *c*

**Substituting (1,0):**

0* = a*(1)^{2} + *b*(1)* + c = **a* + *b* + *c*

**Substituting (0,β3):**

**β**3* = a*(0)^{2} + *b*(0)* + c = * *c*

So we get *c* = **β**3.

Substituting *c* = **β**3 in the first line gives:

4*a* β 2*b = *3; and substituting into the second line gives:

*a* + *b* = 3

Multiplying the last line by 2 gives:

2*a* + 2*b* = 6

Adding this to 4*a* β 2*b = *3 gives:

6*a* = 9

This gives *a* = 1.5.

Substituting *a* = 1.5 into *a* + *b* = 3, we get *b* = 1.5.

So the correct quadratic function for the blue graph is

*f*(*x*) = 1.5*x*^{2} + 1.5*x* β 3

We note that the "*a*" value is positive, resulting in a "legs up" orientation, as expected.

## Vertex method

Another way of going about this is to observe the vertex (the "pointy end") of the parabola.

We can write a parabola in "vertex form" as follows:

*y* = *a*(*x* β *h*)^{2} + *k*

For this parabola, the vertex is at (*h, k*).

In our example above, we can't really tell where the vertex is. It's near (β0.5, β3.4), but "near" will not give us a correct answer. (If there are no other "nice" points where we can see the graph passing through, then we would have to use our estimate.)

The next example shows how we can use the Vertex Method to find our quadratic function.

## One point touching the *x*-axis

This parabola touches the *x*-axis at (1, 0) only.

If we use *y* = *a*(*x* β *h*)^{2} + *k*, we can see from the graph that *h* = 1 and *k = *0.

This gives us *y* = *a*(*x* β 1)^{2}. What is the value of "*a*"?

But as in the previous case, we have an infinite number of parabolas passing through (1, 0). Here are some of them:

In this example, the blue curve passes through (0, 1) on the *y*-axis, so we can simply substitute *x* = 0, *y* = 1 into *y* = *a*(*x* β 1)^{2} as follows:

1 = *a*(β 1)^{2}

This gives us *a* = 1.

So our quadratic function for this example is

*f*(*x*) = (*x* β 1)^{2} = *x*^{2} β 2*x* + 1

**Note: **We could also make use of the fact that the *x*-value of the vertex of the parabola *y = ax*^{2} + *bx + c* is given by:

## No points touching the *x*-axis

Here's an example where there is no *x*-intercept.

We can see the vertex is at (-2, 1) and the *y*-intercept is at (0, 2).

We just substitute as before into the vertex form of our quadratic function.

We have (*h*, *k*) = (-2, 1) and at *x* = 0, *y* = 2.

So

*y* = *a*(*x* β *h*)^{2} + *k*

becomes

2 = *a*(0 β (β2))^{2} + 1

2 = 4*a* +1

*a* = 0.25

So our quadratic function is:

*f*(*x*) = 0.25(*x* β(β2))^{2} + 1 = 0.25(*x* + 2)^{2} + 1 = 0.25(*x*^{2} + 4*x* + 4) + 1

*f*(*x*) = 0.25*x*^{2} + *x *+ 2

## Using math software to find the function

**a. Wolfram|Alpha**

This Wolfram|Alpha search gives the answer to my last example.

**b. Excel**

You could use MS Excel to find the equation. Enter the points in cells as shown, and get Excel to graph it using "X-Y scatter plot". This gives the black curve shown. Then right click on the curve and choose "Add trendline" Choose "Polynomial" and "Order 2". (This gives the blue parabola as shown below).

In the "Options" tab, choose "Display equation on chart".

We get the following result.

**c. GeoGebra**

GeoGebra was not so useful for this task. GeoGebra will give us the equation of a parabola, but you need to know the focus and directrix first. This is not so straightforward from observations of a graph.

## Conclusion

Finding the equation of a parabola given certain data points is a worthwhile skill in mathematics. Parabolas are very useful for mathematical modelling because of their simplicity.

See the 82 Comments below.