2
$\begingroup$

I'm looking for a method to solve for $A$, $B$, and $C$ in the equation for a parabola given three points $(x_i, y_i), i = 1, 2, 3$. To start, I thought I should try to solve the system of equations:

$$ \left[ \begin{array}{ccc|c} x_1^2 & x_1 & 1 & y_1 \\ x_2^2 & x_2 & 1 & y_2 \\ x_3^2 & x_3 & 1 & y_3 \end{array} \right] $$ As I guessed, this got really messy really quickly, so I just plugged it into Wolfram Alpha and it spit out some of the ugliest things I've seen in a while:

$$ A = \frac{x_3(y_2 - y_1) + x_2(y_1 - y_3) + x_1(y_3 - y_2)}{(x_1 - x_2)(x_1 - x_3)(x_2 - x_3)}\\ B = \frac{x_1^2(y_2 - y_3) + x_3^2(y_1 - y_2) + x_2^2(y_3 - y_1)}{(x_1 - x_2)(x_1 - x_3)(x_2 - x_3)}\\ C = \frac{x_2^2(x_3y_1 - x_1y_3) + x_2(x_1^2y_3 - x_3^2y_1) + x_1x_3(x_3 - x_1)y_2}{(x_1 - x_2)(x_1 - x_3)(x_2 - x_3)} $$

These are horrible! I feel like I'm overcomplicating it. Is there any nicer way of doing it?

$\endgroup$
  • $\begingroup$ Is there any nicer way of doing it ? - If there would be, there would have been no need for a sophisticated mathematical formula involving advanced algebraic concepts such as matrices and determinants in the first place. $\endgroup$ – Lucian Feb 26 '17 at 18:30
7
$\begingroup$

For "nicely picked" numbers $x_1,x_2,x_3,y_1,y_2,y_3$, the equations you listed can be solved to get "nice" solutions for $A,B,C$. However, as you experienced, the general formula can be messy.

Alternatively, you could try using the Lagrange Interpolation Formula:

$P(x) = \dfrac{y_1(x-x_2)(x-x_3)}{(x_1-x_2)(x_1-x_3)} + \dfrac{y_2(x-x_1)(x-x_3)}{(x_2-x_1)(x_2-x_3)} + \dfrac{y_3(x-x_1)(x-x_2)}{(x_3-x_1)(x_3-x_2)}$.

This generalizes nicely to higher order polynomials.

$\endgroup$
  • $\begingroup$ Well if that's the best that can be done, I'll take it! Thanks for the help, and for introducing me to the Lagrange Interpolation Formula, I'd never heard of it before and it's really neat! $\endgroup$ – user3002473 Aug 7 '14 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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