How to find the equation of a quintic polynomial from its graph
By Murray Bourne, 26 Mar 2016
My earlier article on How to find the equation of a quadratic function from its graph has generated a lot of interest and many visits.
In a recent comment on that article, reader Mike asked:
"How could we go about figuring out the equation of other types of graphs?
Say I have the following quintic graph. How would I figure out the function?"
The graph has several key points marked:
- There are 5 x-intercepts (black dots)
- There are 2 local maxima and 2 local minima (red dots)
- There are 3 points of inflection (green dots)
[For some background on what these terms mean, see Curve Sketching Using Differentiation].
That should be plenty for us to find a good approximation for the equation of the function.
I'm going to assume it's a quintic (that is, a polynomial function of degree 5), not only because Mike said it was, but also the curve gets very steep at the far left and far right, suggesting it's a quintic. Of course, it is possible it has other curves beyond the domain shown, but we can only work with what we've been given.
General form of a quintic
A polynomial function of degree 5 (a quintic) has the general form:
y = px5 + qx4 + rx3 + sx2 + tx + u
We'll find the easiest value first, the constant u.
Finding the constant
From the graph we see that when x = 0, y = −1. Substituting these values in our quintic gives u = −1
So our quintic becomes:
y = px5 + qx4 + rx3 + sx2 + tx − 1
Finding the x-intercepts
Our aim is to set up a system of 5 equations with 5 unknonws.
Next, we'll substitute in the x-intercepts (where y = 0). It's too hard to estimate the places where the curve cuts the x-axis, so we construct a grid, as follows:
Using this grid, we can estimate where the black dots are on the x-axis:
x = −0.96, −0.15, 1.28, 1.8, 3.05
We substitute those 5 points one at a time into our general quintic equation and obtain the following 5 equations (Of course, I'm using software to do these steps):
− 0.8154p + 0.8493q − 0.8847r + 0.9216s − 0.96t − 1 = 0 ... 
− 0.00008p + 0.0005q − 0.003r + 0.0225s − 0.15t − 1 = 0 ... 
3.4360p + 2.6844q + 2.0972r +1.6384s + 1.28t − 1 = 0 ... 
18.8957p + 10.4976q + 5.832r + 3.24s + 1.8t − 1 = 0 ... 
263.9363p + 86 5365q + 28.3726r + 9.3025s + 3.05t − 1 = 0 ... 
Next, we solve those 5 simultaneous equations (using a computer algebra system) and obtain:
p = 0.9882235373
q = −4.960882158
r = 4.978373717
s = 5.015096102
t = −6.043658926
This means our quintic equation is approximately:
y = 0.988x5 − 4.96x4 + 4.978x3 + 5.015x2 − 6.043x − 1
(Of course, I've used full available accuracy throughout, but have rounded my answers for clarity.)
Is the equation correct?
In the earlier article about finding the equation of a quadratic curve, we learned that there are an infinite number of possibilities if we only use the x-intercepts.
However, how good is the solution we just found?
We'll check it graphically, then analytically.
The above derived graph is certainly close to the original curve given.
Now let's analytically examine if the other key points on the graph make sense.
Local maxima and minima
The local maxima and local minima (the "tops of the hills" and "bottoms of the valleys") are found by finding the first derivative, setting it equal to 0, then solving for x.
This equals 0 when x = −0.648, 0.458, 1.551 or 2.655.
Substituting these back into the equation for the quintic gives us the two local maxima:
(−0.648, 2.680) and (1.551, 0.427),
and the two local minima:
(0.458, −2.436) and (2.655, −4.653).
A check on the graph above shows these are very close to the red dots on the curve.
Points of inflection
There are three points of infleciton shown on the graph. Let's find the points of inflection using the quintic equation I found.
We find the second derivative and set it equal to zero.
This second derivative equals zero when x = −0.226, 1.004, or 2.234.
Substituting these back into the equation for the quintic gives the points of inflection:
(−0.226, 0.552), (1.004, −1.005) and (2.234, −2.540).
These are very close to the green dots on the curve.
So we can be confident we have a very good approximation for the equation of the quintic.
The original equation
The astute amongst you would have noticed the equation I obtained is actually very close to the following equation with integer values for the coefficients:
y = x5 − 5x4 + 5x3 + 5x2 − 6x − 1
In fact, this was the original curve, as given in the page from where the graph came.
See the 7 Comments below.
30 Mar 2016 at 6:13 am [Comment permalink]
You could just multiply over (x-v[k])
>v&:=[-0.96, -0.15, 1.28, 1.8, 3.05]
[-0.96, -0.15, 1.28, 1.8, 3.05]
>function p(x) &= product(x-float(v[k]),k,1,5)
(x - 3.05) (x - 1.8) (x - 1.28) (x + 0.15) (x + 0.96)
0.9882235377453956 x - 4.960882159481885 x
+ 4.978373716099981 x + 5.015096102762597 x - 6.043658925318761 x
30 Mar 2016 at 2:50 pm [Comment permalink]
Great! Thanks a lot for the explanations provided here. It is really giving us a clear picture on how to find equations given their curves.
31 Mar 2016 at 10:53 am [Comment permalink]
@Rene: Thanks for the alternate method!
1 Apr 2016 at 4:12 am [Comment permalink]
Thanks for this post!
how to find the equation, manually.
Q1: What is the software tool
you say was used for this calculation?
Q2: in Rene Grothmann's comment:
looks like program code...what is the programming language used?
How can we try out ourselves?
Q3: Any online calculator
to (easily) input the available points
and obtain the final equation as a result?
(not being lazy...just trying to see if there's an existing automated solution
to make it easy! 🙂
1 Apr 2016 at 4:31 am [Comment permalink]
quick follow up question...
can you supply a list of the 10 points
in (x , y) format?
Would make it easier to test out
other tools and compare results
to that of this article...
Thanks again, Murray! 🙂
1 Apr 2016 at 10:40 am [Comment permalink]
@SF: (1) You can use Wolfram|Alpha for solving simultaneous equations. This example shows how: https://www.wolframalpha.com/input/?i=x%2By%2Bz%3D10,+x-y-3z%3D4,+x-5y-3z%3D40
(2) Rene's code looks like Matlab.
(3) You can always use MS Excel to construct a polynomial through your given points, like I did in the earlier article: https://www.intmath.com/blog/mathematics/how-to-find-the-equation-of-a-quadratic-function-from-its-graph-6070
1 Apr 2016 at 10:42 am [Comment permalink]
@SF: The easiest way to do that would be to set it up in Excel and use the actual equation I give right at the end. But you would need to include negative values for x as well - not a good idea to start at x = 1.