Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can define a curve that passes through 3 points using a quadratic equation:

ax2 + bx + c = 0

I would like to know is it possible to define a curve that passes through 4 points using:

ax3 + bx2 + cx + d = 0


share|cite|improve this question

migrated from Feb 12 '12 at 8:10

This question came from our site for professional and enthusiast programmers.

Yes, it is possible. In general, for any n points in a plane, you can find an (n-1)th degree (or higher) polynomial that passes through all of them. Finding these polynomial involves solving matrix equations and can sometimes get a bit messy. – jpm Feb 10 '12 at 23:37
You can also use a Lagrange interpolating polynomial. – Anne Nonimus Feb 10 '12 at 23:40
@jpm is correct. For an easy formula (that works in most cases), see Lagrange polynomial - Wikipedia, the free encyclopedia. – Dennis Feb 10 '12 at 23:41

The answer was already in the comments upon migration: Use a Lagrange polynomial. The restriction "in most cases" is unnecessary; the Lagrange polynomial is completely general and yields a polynomial which interpolates the points as long as no two of them have the same $x$ coordinate; if they do, there can be no univariate function, polynomial or otherwise, that interpolates them.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.