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

[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.

### Modelling

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?

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 and adding it to the line before gives

*a* = 1.5 and with that, we easily 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

*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.

18 May 2011 at 12:08 am [Comment permalink]

Thanks, once again, for emphasizing “real” math (for both utility and understanding). I agree that this is the kind of thing that schools and texts need to concentrate more on.

Another approach to the parabola problem, which may be of particular interest to calculus students, is that for a parabola to be the graph of y=ax^2+bx+c:

c is the y-intercept (ie the height at the point where x=0)

b is the slope of the tangent line at that point, and

a is the height of the graph above that line at x=1

One of the activities in my “Blue Meanies” game (at http://qpr.ca/math/applets/meanies/ )asks students to “guess” the equation of a parabola through three points by imagining the curve and using its geometry (in various ways) to determine the equation.

18 May 2011 at 1:27 pm [Comment permalink]

Thanks for the calculus-based approach, Alan. And thanks for sharing “Meanies”!

18 May 2011 at 10:53 pm [Comment permalink]

I love maths and as a maths student here in DWU university,this lesson send to me is a great help in my learning.

Thank you.

19 May 2011 at 4:22 am [Comment permalink]

[...] Bourne of squareCircleZ has posted on ‘How to find the equation of a quadratic function from its graph‘. This is indeed the type of discussion and exercise that we need to see more of. Not only [...]

19 May 2011 at 2:58 pm [Comment permalink]

Thanks. Its well understood.

19 May 2011 at 11:56 pm [Comment permalink]

Thanks!!! This helps a lot!!! I agree, as an engineering student this should be a main discussion in all math classes. I am so glad I found this site.

29 May 2011 at 6:09 am [Comment permalink]

I am a physics and Maths student, and with this lesson sent to me is really a great help in doing quadratics and projectile motion.

Thank you…

17 Jun 2011 at 7:33 pm [Comment permalink]

[...] Murray Bourne explains step by step How to find the equation of a quadratic function from its graph. [...]

19 Jun 2011 at 1:05 am [Comment permalink]

GeoGebra can be used very easily to find the equation of a parabola: given three points, A, B, C input the command FitPoly[{A, B, C}, 2].

There is also a spreadsheet, which can be used as easily as Excel.

19 Jun 2011 at 8:16 am [Comment permalink]

Hi Kathryn and thanks for your input. I was not aware of the FitPoly command in GeoGebra – it’s a shame it is not included in one of the menus.

27 Jun 2011 at 6:28 pm [Comment permalink]

I am a 41 year old who is about to study maths and physics at uni for the first time; stuff like this is fantastic.

Keep up the good work.

27 Jun 2011 at 8:08 pm [Comment permalink]

@Mick: Thanks for the positive feedback. Good luck with your studies!

29 Feb 2012 at 5:01 am [Comment permalink]

I am confused about one thing….If the y-intercept is (4.2), would we replace the 4 in place if the x instead of zero….just making sure the 0 is not used every time.

1 Mar 2012 at 2:14 pm [Comment permalink]

@Carolyn: I’m not quite sure what your question means (don’t want to lead you astray!).

If we have a y-intercept, the we find it by substituting x = 0. Nothing magic about it – when x does equal zero, we are on the y-axis.

11 Jul 2012 at 11:24 pm [Comment permalink]

Very disappointing.

I have no way of calculating x from your final equation without using maths software.

What a cop-out.

12 Jul 2012 at 9:09 am [Comment permalink]

@John: I don’t understand your comment.

This is the final equation in the article: f(x) = 0.25x^2 + x + 2. It is an equation for the parabola shown higher up. Which “x” are you trying to calculate? If you are trying to find the zeros for the function (that is find x when f(x) = 0), then that is simply done using quadratic equation – no need for math software.

The last portion showing how to do it on Wolfram|Alpha, Excel and GeoGebra give us the same answer as on paper. That is, we can do it with software or without. But once again, we are not even trying to find an “x”. we are trying to find the equation of the parabola.

31 Jul 2012 at 4:55 am [Comment permalink]

Two questions:

Is there a way to find the formula for a Quartic equation?

Can I use excel and choose polynomial and order 4?

31 Jul 2012 at 11:33 am [Comment permalink]

@John: Yes, that would do it. The more data points you give Excel (especially near extremes like maxima, minima and x- and y-intercepts), the closer the resulting polynomial will be to your given graph.

20 Sep 2012 at 3:30 am [Comment permalink]

Hi, I found your explanation lucid and helpful. I want to know for a set of paired x and y values how do I find vortex points (using f(x)=a(x-h)^2+k formula)? Thanks.

Jaahnavi

21 Sep 2012 at 6:02 pm [Comment permalink]

@Jaahnavi I think you mean “vertex points”, right? The vertex occurs where x = h, and that occurs at the lowest (or highest) y-value for your data. Hope it helps!

30 Sep 2012 at 12:17 pm [Comment permalink]

Whoa, this was really helpful! Thanks!!

30 Oct 2012 at 6:43 pm [Comment permalink]

hi,

Thanks for such a useful information. I am transport planning student and have lot of data where i have to fit parabola. For convenience let us assume that we have 3 points (1,5), (3,2) & (5,3). if we fit these points generally they fit on parabola with axis of symmetry on Y axis but i want to fit these points in parabola with axis of symmetry on X Axis and 2 points of the parabola intersecting on Y Axis.(parabola Legs towards West direction)

More advanced: I want to fit parabola equation at any axis of symmetry.

thanks

1 Nov 2012 at 12:12 pm [Comment permalink]

@Tarun: A very useful tool for you would be GeoGebra.

I did some digging and found a GeoGebra applet (no longer available) which draws a parabola through 3 points. I modified it to give a parabola with horizontal axis through your given 3 points.

You won’t be able to fit a parabola with x-axis as the parabola of symmetry through those 3 points – only one parallel to x-axis.

If you are going to try to do it algebraically for many different parabolas it’s going to be quite troublesome. GeoGebra is the way to go, I believe. Hope it helps.

3 Nov 2012 at 8:14 pm [Comment permalink]

i have a question where the curve is a parabola passing through the origin a point is given its neither the max nor min it’s on the curve the point is (1,2) and then the curve again cuts through the x axis at (6,0)

and i need to form a quadratic equation based on that could you pls help me out with it………..

4 Nov 2012 at 9:49 am [Comment permalink]

Hello Abhishek. I’m assuming your parabola must have a vertical axis (since you talk about forming a quadratic equation, and this must be in

x, since it cannot be inyfor your points).Just go about it the same as I did int he article: start with y = ax^2 + bx + c and substitute in your 3 points, then solve.

Edit: I meant y = ax^2 + bx + c

26 Nov 2012 at 4:18 am [Comment permalink]

Its really a great job to post about quadratic equation and its curves..i ll recommend it to my colleagues.

24 Mar 2013 at 12:41 am [Comment permalink]

i find just a little problem solving a problem. I am to find a equation of a parablo given the vertex (7,-2) and one x-intercept (4,0). Can you help me with the problem please.

24 Mar 2013 at 11:45 am [Comment permalink]

@Simon: You’ll need to use the “Vertex Method” as detailed in the article. Substitute your known values and you’ll end up with a system of equations, similar to the one in the article.

25 Aug 2013 at 9:00 am [Comment permalink]

Thanks a lot! I felt sick in Pre-Calc yesterday while they were reviewing this and wasn’t up to asking the teacher to repeat everything cuz it didn’t make sense at that moment but this really helps ! We already have a quiz Mnday!

25 Aug 2013 at 2:57 pm [Comment permalink]

@Maheera: Glad it helped! All the best in your exam.

20 Mar 2014 at 10:48 am [Comment permalink]

This really helped; you made me feel better now that I finally know how to do this, so I hope that letting you know you helped another person would make you feel better as well.

20 Mar 2014 at 8:48 pm [Comment permalink]

@Ethan: You’re very welcome. I’m glad your found it useful!