Navigation   Home   Search   Site map

# document.write (document.title)

 Contact Graeme   Home   Email   Twitter

## Find the equation of an order n polynomial that passes through n points

On 6/1/01 6:31:47 PM, Garrett Mckinnon wrote:

 Does anyone know how to determine the equation of a curved line given several points. If so, could you please send me the answer or post it?

I think you want to fit an order n polynomial to n points. Here's the method. I'll illustrate with a fourth-degree polynomial, although it can be used for any nth-degree polynomial.

Suppose you know the following points (x,f(x)):

(-2,85)
(-1,-8)
(1,-20)
(3,40)
(4,307)

There is some polynomial,

f(x) = ax4 + bx3 + cx2 + dx + e

that satisfies these five points. Since that's true, you can take any point -- I'll use the first one -- and set x equal to -2, and f(x) is 85. So you have

85 = a(-2)4 + b(-2)3 + c(-2)2 + d(-2) + e

Simplifying, we have

85 = 16a - 8b + 4c - 2d + e

Using the same procedure with the second point, we get

-8 = a - b + c - d + e

Doing the same calculations on the remaining three points, we get

-20 = a + b + c + d + e
40 = 81a + 27b + 9c + 3d + e
307 = 256a + 64b + 16c + 4d + e

Now here's something unexpected: we have five linear equations with five unknowns. The surprise is that the unknown isn't x, but rather a, b, c, d, and e. These five letters normally represent constant coefficients, but in this case, we don't know what they are. So to us, they're unknowns. x, on the other hand, is perfectly well known, at least for the five points we were given.

Make sure you have gotten past the shock of the knowns and unknowns switching places before you go on.

Are you OK? Let's continue.

So we have five equations with five unknowns:

16a - 8b + 4c - 2d + e = 85
a - b + c - d + e = -8
a + b + c + d + e = -20
81a + 27b + 9c + 3d + e = 40
256a + 64b + 16c + 4d + e = 307

Cramer's method works well for solving these (especially if you have a darned good method for finding determinants of large matrices!)

The coefficient matrix has a determinant of 21600.

When the first column of the coefficient matrix is replaced by the constants, the determinant becomes 64800, so

a=64800/21600=3.

By replacing each column of the coefficient matrix in turn by the constants, we find the values of b, c, d, and e the same way.

b=-7, c=0, d=1, and e=-17.

This is a good method for finding all sorts of curves given a number of points. For example, you can use a similar method to find the equation of a circle that passes through any three points. The only difference is the general form of the equation should be the one for a circle instead of the one for a polynomial.

### Related pages in this website

Finding Coefficients of formula for Sum of Squares - A method to find the sum of n³, or any higher power of n for that matter, as well as any other series that can be exactly fit by a polynomial of finite order.

Method of Successive Differences to find the coefficients of a polynomial f(k), given a few values of f(k) for successive integers, k.

Cramer's Rule

Academic Decathlon State Competition Question 06 -- How many squares are on a checkerboard?

The webmaster and author of this Math Help site is Graeme McRae.