# How to find 4th degree polynomial equation from given points?

I am trying to find 4th degree polynomial equation from given points. I do not own a graphing calculator so this task is very difficult for me to solve. So far I would out what points I need. The points are $$(-2, 3), (-8, -5), (-11.5, -1), (3, -5), (9.5, 2), (-10, -3), (-5, -3), (1, -3), (5.5, -3)$$ I know that the format of the equation should be $P(x)=ax^4+bx^3+cx^2+dx+e$. I tried to find the way to get the equation but so far all of them require a calculator. I really need help with this problem. Any help would be appreciated.

• Excel will give you the best fit quartic. Plot the points, add a trendline, and do a polynomial fit of degree $4$. It won't go through any of the points unless you are very lucky. If you choose the option show equation on chart you can get the coefficients. Any numerical analysis text will have a section on linear least squares which will let you find the coefficients with a matrix inversion – Ross Millikan Oct 2 '16 at 3:58
• is tag functional equation good here ? – Adam Oct 2 '16 at 6:43

Lagrange Interpolation is the technique most commonly used for this purpose. Just take 5 points and plug them into Lagrange's formula (which I think is best articulated in the Examples section of the Wiki page). Assuming all of your points do indeed lie on a polynomial of degree 4, you will get that polynomial via Lagrange interpolation.

• On a computer, Lagrange interpolation should never be used except for very low degree polynomials, because of floating point precision issues. Additionally, polynomial interpolation (i.e. selecting a polynomial that actually passes through all the given points) will not generally answer the question of fitting a polynomial of degree $k$ to a data set of more than $k+1$ points, because typically no such polynomial exists. – Ian Oct 2 '16 at 4:00
• @Ian. 1. Could you show example of such precision issues ? – Adam Oct 2 '16 at 6:47
• @Adam It's a bit tedious to explicitly write down an example; this is generally covered in some detail in undergrad numerical analysis texts, e.g. the one by Tim Sauer. But the gist of it is just subtracting of nearly equal numbers. It is also slow to evaluate a polynomial interpolant in the Lagrange form, and it is slow and numerically unstable to convert it to a standard form. The Newton form turns out to be quite a bit more stable, and its form is immediately conducive to the use of a faster method like Horner's method for the evaluation. – Ian Oct 2 '16 at 11:50

Before doing anything, I felt that there is a serious problem with the data for which you want to find a fourth degree polynomial supposed to fit them. $$\left( \begin{array}{cc} x & y & \text{note} \\ -2. & +3. \\ -8. & -5. & * \\ -11.5 & -1. \\ 3. & -5. & *\\ 9.5 & +2. \\ -10. & -3. & **\\ -5. & -3. & **\\ 1. & -3. & **\\ 5.5 & -3. & ** \end{array} \right)$$

In order to go (more or less) through the data points, you would need a much higher degree.

For sure, since there are $9$ data points, a polynomial of degree $8$ will make a perfect fit but any lower degree will do a quite poor job.

In any manner, the problem has to be treated using multilinear regression.

Using a fourth degree polynomial, the predicted values would be $$\left( \begin{array}{cc} x & y & y_{calc} \\ -2. & +3. & -0.25\\ -8. & -5. & -4.20 \\ -11.5 & -1. & -0.85\\ 3. & -5. & -3.16\\ 9.5 & +2. & +2.31\\ -10. & -3. & -3.75\\ -5. & -3. & -1.88\\ 1. & -3. & -1.33\\ 5.5 & -3. & -4.90 \end{array} \right)$$

• What means the asterices in your first matix ? – Adam Oct 2 '16 at 6:49
• @Adam. Just trying to underline points where you have the same value of $y$. Just looking at the last four data points reveal the serious problem. – Claude Leibovici Oct 2 '16 at 6:55
• I like your exposition very much! :-) – Gottfried Helms Oct 4 '16 at 6:48
• @GottfriedHelms. Be sure I appreciate your comment. Cheers :-) – Claude Leibovici Oct 4 '16 at 7:59

@Alex : There is no need for a calculator to draw 9 points on a graph.

You wrote : I know that the format of the equation should be $P(x)=ax^4+bx^3+cx^2+dx+e$.

Well, from what do you know this ? Is it in the wording of your exercise ? You should have given more information. Without one cannot show you the better way to solve your problem.

If it is asked for finding a good but approximate fit of the fourth degree polynomial curve to the points, the regression method is recommended. It can be computed without calculator, but this would be very tiresome. I will not discuss more about the methods to apply because several answers were already given on this subject.

If it is asked for finding a fourth polynomial curve passing exactly on the 9 points, it is impossible. It is obvious just looking at the graph. Nevertheless, a proof is shown below :

We see that four points have the same value $y=-3$. Changing of function $Y(x)=y(x)+3$ shows that the four points are at the four roots of the function $Y(x)=c(x+10)(x+5)(x-1)(x-5.5)$.

So, the four points are exactly on the curve
$$y(x)=-3+c(x+10)(x+5)(x-1)(x-5.5)$$
To make a fifth point $(x_5\:,\:y_5)$ exactly on the curve : $$c=\frac{y_5+3}{(x_5+10)(x_5+5)(x_5-1)(x_5-5.5)}$$ The equation of the fourth degree polynomial is : $$y(x)=-3+(y_5+3)\frac{(x+10)(x+5)(x-1)(x-5.5)}{(x_5+10)(x_5+5)(x_5-1)(x_5-5.5)}$$ The figure below shows the five cases : On each one, they are five points exactly on the curve and of course four remaining points far from the curve.

What you need is a linear least-squares fit. Don't be deceived by the name, "linear" means linearity in the polynomial coefficients $a,b,c,d,e$, not linearity in $x$. If you insist on solving it by hand, you'll need to solve a $5\times 5$ set of equations, which is time-consuming but not impossible.